Integral of $$$x \sin{\left(\frac{x}{2} \right)}$$$

The calculator will find the integral/antiderivative of $$$x \sin{\left(\frac{x}{2} \right)}$$$, with steps shown.

Related calculator: Definite and Improper Integral Calculator

Please write without any differentials such as $$$dx$$$, $$$dy$$$ etc.
Leave empty for autodetection.

If the calculator did not compute something or you have identified an error, or you have a suggestion/feedback, please contact us.

Your Input

Find $$$\int x \sin{\left(\frac{x}{2} \right)}\, dx$$$.

Solution

For the integral $$$\int{x \sin{\left(\frac{x}{2} \right)} d x}$$$, use integration by parts $$$\int \operatorname{u} \operatorname{dv} = \operatorname{u}\operatorname{v} - \int \operatorname{v} \operatorname{du}$$$.

Let $$$\operatorname{u}=x$$$ and $$$\operatorname{dv}=\sin{\left(\frac{x}{2} \right)} dx$$$.

Then $$$\operatorname{du}=\left(x\right)^{\prime }dx=1 dx$$$ (steps can be seen ») and $$$\operatorname{v}=\int{\sin{\left(\frac{x}{2} \right)} d x}=- 2 \cos{\left(\frac{x}{2} \right)}$$$ (steps can be seen »).

The integral can be rewritten as

$${\color{red}{\int{x \sin{\left(\frac{x}{2} \right)} d x}}}={\color{red}{\left(x \cdot \left(- 2 \cos{\left(\frac{x}{2} \right)}\right)-\int{\left(- 2 \cos{\left(\frac{x}{2} \right)}\right) \cdot 1 d x}\right)}}={\color{red}{\left(- 2 x \cos{\left(\frac{x}{2} \right)} - \int{\left(- 2 \cos{\left(\frac{x}{2} \right)}\right)d x}\right)}}$$

Apply the constant multiple rule $$$\int c f{\left(x \right)}\, dx = c \int f{\left(x \right)}\, dx$$$ with $$$c=-2$$$ and $$$f{\left(x \right)} = \cos{\left(\frac{x}{2} \right)}$$$:

$$- 2 x \cos{\left(\frac{x}{2} \right)} - {\color{red}{\int{\left(- 2 \cos{\left(\frac{x}{2} \right)}\right)d x}}} = - 2 x \cos{\left(\frac{x}{2} \right)} - {\color{red}{\left(- 2 \int{\cos{\left(\frac{x}{2} \right)} d x}\right)}}$$

Let $$$u=\frac{x}{2}$$$.

Then $$$du=\left(\frac{x}{2}\right)^{\prime }dx = \frac{dx}{2}$$$ (steps can be seen »), and we have that $$$dx = 2 du$$$.

The integral becomes

$$- 2 x \cos{\left(\frac{x}{2} \right)} + 2 {\color{red}{\int{\cos{\left(\frac{x}{2} \right)} d x}}} = - 2 x \cos{\left(\frac{x}{2} \right)} + 2 {\color{red}{\int{2 \cos{\left(u \right)} d u}}}$$

Apply the constant multiple rule $$$\int c f{\left(u \right)}\, du = c \int f{\left(u \right)}\, du$$$ with $$$c=2$$$ and $$$f{\left(u \right)} = \cos{\left(u \right)}$$$:

$$- 2 x \cos{\left(\frac{x}{2} \right)} + 2 {\color{red}{\int{2 \cos{\left(u \right)} d u}}} = - 2 x \cos{\left(\frac{x}{2} \right)} + 2 {\color{red}{\left(2 \int{\cos{\left(u \right)} d u}\right)}}$$

The integral of the cosine is $$$\int{\cos{\left(u \right)} d u} = \sin{\left(u \right)}$$$:

$$- 2 x \cos{\left(\frac{x}{2} \right)} + 4 {\color{red}{\int{\cos{\left(u \right)} d u}}} = - 2 x \cos{\left(\frac{x}{2} \right)} + 4 {\color{red}{\sin{\left(u \right)}}}$$

Recall that $$$u=\frac{x}{2}$$$:

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

Therefore,

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

Add the constant of integration:

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

Answer

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