# How do you integrate int xcos(1/2)x from 0 to pi by integration by parts method?

Dec 30, 2016

$\int x \cos \left(\frac{1}{2} x\right) \mathrm{dx} = 2 \pi - 4$

#### Explanation:

If this was meant to be:

$\int x \cos \left(\frac{1}{2}\right) \mathrm{dx}$

Integration by parts is not necessary, as $\cos \left(\frac{1}{2}\right)$ is a constant. You could bring it outside of the integral:

$\cos \left(\frac{1}{2}\right) \cdot \int x \mathrm{dx}$

$\implies \cos \left(\frac{1}{2}\right) \cdot \frac{{x}^{2}}{2}$

Evaluating from $0 \to \pi$:

$\implies \cos \left(\frac{1}{2}\right) \cdot \left({\pi}^{2} / 2 - 0\right)$

$\implies \frac{{\pi}^{2} \cos \left(\frac{1}{2}\right)}{2}$

If this was meant to be (I assume):

$\int x \cos \left(\frac{1}{2} x\right) \mathrm{dx}$

The integration by parts method can be summarized as:

$u v - \int v \mathrm{du}$

We pick one of the terms and set it equal to $u$. This term we will derive. The other term we set equal to $\mathrm{dv}$, and this we will "anti-derive." Figuring out which variable to derive and which to anti-derive is usually the more challenging part. With practice it becomes a much quicker process.

In this case, I would set $u = x$ and $\mathrm{dv} = \cos \left(\frac{1}{2} x\right)$. This will give $\mathrm{du} = \mathrm{dx}$ and makes one less term for us to have to worry about.

$u = x , \mathrm{du} = \mathrm{dx}$

$\mathrm{dv} = \cos \left(\frac{1}{2} x\right) , v = 2 \sin \left(\frac{1}{2} x\right)$

$\implies 2 x \sin \left(\frac{x}{2}\right) - 2 \int \sin \left(\frac{1}{2} x\right) \mathrm{dx}$

Now we can use substitution to evaluate the integral:

$u = \frac{1}{2} x , \mathrm{du} = \frac{1}{2} \mathrm{dx} \implies 2 \mathrm{du} = \mathrm{dx}$

$\implies 2 x \sin \left(\frac{x}{2}\right) - 2 \left(2\right) \int \sin \left(u\right) \mathrm{du}$

Evaluating:

$2 x \sin \left(\frac{x}{2}\right) - 4 \left(- \cos \left(u\right)\right)$

$\implies 2 x \sin \left(\frac{x}{2}\right) + 4 \cos \left(u\right)$

Substituting back in for $u$:

$\implies 2 x \sin \left(\frac{x}{2}\right) + 4 \cos \left(\frac{x}{2}\right)$

Now we can evaluate from $0 \to \pi$:

$\left[2 \left(\pi\right) \sin \left(\frac{\pi}{2}\right) + 4 \cos \left(\frac{\pi}{2}\right)\right] - \left[2 \left(0\right) \sin \left(\frac{0}{2}\right) + 4 \cos \left(\frac{0}{2}\right)\right]$

$\implies \left[2 \left(\pi\right) \sin \left(\frac{\pi}{2}\right) + 4 \cos \left(\frac{\pi}{2}\right)\right] - 4 \cos \left(0\right)$

$\implies 2 \pi \left(1\right) + 0 - 4 \left(1\right)$

$\implies 2 \pi - 4$

Hope this helps!