# Compute $\int x^2 \cos \frac{x}{2} \mathrm{d}x$

I am trying to compute the following integral:

$$\int x^2 \cos \frac{x}{2} \mathrm{d}x$$

I know this requires integration by parts multiple times but I am having trouble figuring out what to do once you have integrated twice. This is what I have done:

Let $u = \cos \frac{x}{2}$ and $\mathrm{d}u = \frac{-\sin\left(\dfrac{x}{2}\right)}{2} \mathrm{d}x$ and $\mathrm{d}v = x^2$ and $v= \frac{x^3}{3}$.

\begin{align} &\int x^2 \cos \frac{x}{2} \\ &\cos \frac{x}{2} \cdot \frac{x^3}{3} - \int \frac{x^3}{3} \cdot \frac{-\sin\left(\dfrac{x}{2}\right)}{2} \mathrm{d}x \end{align}

So now I integrate $\int \frac{x^3}{3} \cdot \frac{-\sin\left(\dfrac{x}{2}\right)}{2} \mathrm{d}x$ to get:

\begin{align} \frac{-\sin\left(\dfrac{x}{2}\right)}{2} \cdot \frac{x^4}{12} - \int \frac{x^4}{12} \cdot \frac{\cos x}{2} \end{align}

Now, this is where I get stuck. I know if I continue, I will end up with $\frac{-\sin\left(\dfrac{x}{2}\right)}{2}$ again when I integrate $\cos \frac{x}{2}$. So, where do I go from here?

Thanks!

$$\int x^2 \cos \frac{x}{2} \mathrm{d}x$$

Let $u = x^2$ and $\mathrm{d}u = 2x\,dx$ and let $dv = \cos\frac x2\,dx \implies v = 2 \sin \frac x2$.

$$2x^2 \sin \frac x2 - \int 2x\cdot 2\sin \frac x2\,dx$$

You'll only need to do integration by parts one additional time. Let me know if you get stuck after that.

• I am having trouble simplifying $2x^2 \sin (x/2) + 8x \cos (x/2) - 16 \sin (x/2)$. I factored out a $2$ but what then? – Jeel Shah Aug 16 '13 at 23:17
• You'll have $2x^2 \sin (x/2) + 8x \cos (x/2) - 16 \sin (x/2) + C = (2x^2 - 16)\sin(x/2) + 8x \cos(x/2) + C$. No need to simplify further. If you've access to the solution, and it differs, there may be a half-angle identity you can use. – amWhy Aug 16 '13 at 23:22
• Ahh! Got it! Thanks! – Jeel Shah Aug 16 '13 at 23:26
• You're welcome! – amWhy Aug 16 '13 at 23:27
• @amWhy: great feedback +1 – Amzoti Aug 17 '13 at 0:11

HINT

Go in the opposite direction. Let $u = x^2$, $dv = \cos \frac{x}{2}$.

• You are really fast in typing, I was writing this :-) – SomeOne Aug 16 '13 at 22:49
• You mean certainly $v'= \cos \frac{x}{2}$. – user63181 Aug 16 '13 at 22:59
• @Sami: I adopted the same notation the OP used in his OP. – davidlowryduda Aug 17 '13 at 4:13
• This is not a simple notation but a differentiation's operator so either we write $dv=\cos \frac{x}{2}dx$ or we write $v'=\cos \frac{x}{2}$ isn't it? – user63181 Aug 17 '13 at 8:43

Hint: Switch the functions you originally set equal to $u$ and $dv$.

General Strategy: Assume you're trying to compute $\int p(x) f(x) dx$ where $p(x) = a_0 + a_1 x + \ldots + a_nx^n$ is a polynomial and $f(x)$ is a function that you know how to integrate $n$ times. (For example, in your problem $p(x) = x^2$, $f(x) = \cos x$, and we note that it's easy to integrate $\cos x$ twice.) Then you can just keep integrating by parts ($n$ times), setting $u = p(x)$ (or $p^{(k)}(x)$) and $dv = \lbrack\text{whatever is leftover}\rbrack dx$ to eventually arrive at $$\int p(x) f(x) dx = \lbrack\text{a bunch of terms not involving integrals}\rbrack + \int F(x) dx$$ where $F(x)$ is a function such that $F^{(n)}(x) = f(x)$.

let S be the integrate... That is, S x"2cosx/2 dx........let u=x"2 and dv=cosx/2dx. so that, du=2x and v=2sinx/2 dx. Therefore, S x"2cosx/2 dx= x"2(2sinx/2)-S 2sinx/2(2x) =2x"2sinx/2-S 2x.2sinx/2 dx = 2x"2sinx/2-4 S xcosx/2 dx. Apply another integration. S xcosx/2 dx. let u=x and dv=cosx/2dx. so that du=(1)dx=dx and v=2sinx/2 dx. Hence, S xcosx/2 dx=x(2cosx/2)-S 2sinx/2 dx. combining all formulas we get. S x"2cosx/2dx=2x"2sin(x/2)-2(4xcos(x/2)-S 2sin(x/2) dx). That is, S x"2sin(x/2)+8xcos(x/2)-16sin(x/2) dx = 2x"2sin(x/2)+8xcos(x/2)-16sin(x/2)+C. SO, (2x"2-16)sin(x/2)+8xcos(x/2)+C. I hope this help. By O'john