# What is int xsin(x/2-pi) ?

Apr 20, 2016

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

#### Explanation:

First, we can simplify $\sin \left(\frac{x}{2} - \pi\right)$ using the sine angle subtraction formula:

$\sin \left(A - B\right) = \sin A \cos B - \cos A \sin B$

Thus,

$\sin \left(\frac{x}{2} - \pi\right) = \sin \left(\frac{x}{2}\right) \cos \left(\pi\right) - \cos \left(\frac{x}{2}\right) \sin \left(\pi\right)$

$= \sin \left(\frac{x}{2}\right) \left(- 1\right) - \cos \left(\frac{x}{2}\right) \left(0\right)$

$= - \sin \left(\frac{x}{2}\right)$

Thus the integral is slightly simplified to become

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

First, set $t = \frac{x}{2}$. This implies that $\mathrm{dt} = \frac{1}{2} \mathrm{dx}$ and $x = 2 t$. We will want to multiply the interior of the integral by $\frac{1}{2}$ so that we have $\frac{1}{2} \mathrm{dx} = t$ and balance this by multiplying the exterior by $2$.

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

Substitute in $x = 2 t$, $\frac{x}{2} = t$, and $\frac{1}{2} \mathrm{dx} = \mathrm{dt}$.

$= - 2 \int 2 t \sin \left(t\right) \mathrm{dt} = - 4 \int t \sin \left(t\right) \mathrm{dt}$

Here, use integration by parts, which takes the form

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

For $\int t \sin \left(t\right) \mathrm{dt}$, set $u = t$ and $\mathrm{dv} = \sin \left(t\right) \mathrm{dt}$, which imply that $\mathrm{du} = \mathrm{dt}$ and $v = - \cos \left(t\right)$.

Hence,

$\int t \sin \left(t\right) \mathrm{dt} = t \left(- \cos \left(t\right)\right) - \int \left(- \cos \left(t\right)\right) \mathrm{dt}$

$= - t \cos \left(t\right) + \sin \left(t\right) + C$

Multiply these both by $- 4$ to see that:

$- 4 \int t \sin \left(t\right) \mathrm{dt} = 4 t \cos \left(t\right) - 4 \sin \left(t\right) + C$

Now, recall that $t = \frac{x}{2}$:

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

$= 2 x \cos \left(\frac{x}{2}\right) - 4 \sin \left(\frac{x}{2}\right) + C$