# How do you integrate int x^2sinx by integration by parts method?

Oct 27, 2016

$\int {x}^{2} \sin x \mathrm{dx} = 2 \cos x + 2 x \sin x - {x}^{2} \cos x + C$

#### Explanation:

The formula for integration by parts is:
$\int u \frac{\mathrm{dv}}{\mathrm{dx}} \mathrm{dx} = u v - \int v \frac{\mathrm{du}}{\mathrm{dx}} \mathrm{dx}$

Essentially we would like to find one function that simplifies when differentiated, and one that simplifies when integrated (or is at least integrable).

In this case a trig function stays as a trig function but ${x}^{2}$ simplifies if differentiated.

Let $\left\{\begin{matrix}u = {x}^{2} & \implies & \frac{\mathrm{du}}{\mathrm{dx}} = 2 x \\ \frac{\mathrm{dv}}{\mathrm{dx}} = \sin x & \implies & v = - \cos x\end{matrix}\right.$

So IBP gives:

$\int \left({x}^{2}\right) \left(\sin x\right) \mathrm{dx} = \left({x}^{2}\right) \left(- \cos x\right) - \int \left(- \cos x\right) \left(2 x\right) \mathrm{dx}$
$\therefore \int {x}^{2} \sin x \mathrm{dx} = - {x}^{2} \cos x + 2 \int x \cos x \mathrm{dx}$ ..... 

Ok, well that is better, but for the second interval we have to use IBP again;

Let $\left\{\begin{matrix}u = x & \implies & \frac{\mathrm{du}}{\mathrm{dx}} = 1 \\ \frac{\mathrm{dv}}{\mathrm{dx}} = \cos x & \implies & v = \sin x\end{matrix}\right.$

So IBP gives:

$\int \left(x\right) \left(\cos x\right) \mathrm{dx} = \left(x\right) \left(\sin x\right) - \int \left(\sin x\right) \left(1\right) \mathrm{dx}$
$\therefore \int x \cos x \mathrm{dx} = x \sin x - \int \sin x \mathrm{dx}$
$\therefore \int x \cos x \mathrm{dx} = x \sin x + \cos x$ ..... 

Substituting  into  we have;

$\int {x}^{2} \sin x \mathrm{dx} = - {x}^{2} \cos x + 2 \left\{x \sin x + \cos x\right\} + C$
$\therefore \int {x}^{2} \sin x \mathrm{dx} = - {x}^{2} \cos x + 2 x \sin x + 2 \cos x + C$
$\therefore \int {x}^{2} \sin x \mathrm{dx} = 2 \cos x + 2 x \sin x - {x}^{2} \cos x + C$