# int (x^2 + 2x) cos(x) dx Evaluate the integral

int (x^2+2x)cosx dx

To evaluate, apply integration by parts int udv = uv - int vdu .

So let

u = x^2+2x

and

dv = cosx dx

Then, differentiate u and integrate dv.

du = (2x + 2)dx

and

v = int cosx dx = sinx

Plug-in them to the formula of integration by parts. So the integral becomes:

int (x^2+2x)cosx dx

= (x^2+2x)sinx - int sinx * (2x + 2)dx

= (x^2 + 2x)sinx - int (2x + 2)sinx dx

To take the integral of (2x + 2sinx)dx, apply integration by parts again.

So let

u_2 = 2x + 2

and

dv_2 = sinx dx

Differentiate u_2 and integrate dv_2.

du_2 = 2dx

and

v_2 = -cosx

So the integral becomes:

= (x^2+2x)sinx - [ (2x + 2)*(-cosx) - int -cosx * 2dx]

=(x^2+2x)sinx - [-(2x + 2)cosx + 2int cosx dx]

=(x^2+2x)sinx - [-(2x + 2)cosx + 2sinx]

= (x^2+2x)sinx +(2x +2)cosx -2sinx

= (x^2+2x - 2)sinx + (2x + 2)cosx

Since the given is indefinite integral, add C.

= (x^2+2x - 2)sinx + (2x + 2)cosx + C

Therefore, int (x^2+2x)cosx dx = (x^2+2x-2)sinx= (x^2+2x - 2)sinx + (2x + 2)cosx + C .

Approved by eNotes Editorial Team