# Math Help - (x^2)cosx

1. ## (x^2)cosx

Calculate the integral from 0 to pi of (x^2)cosxdx

2. Originally Posted by TexasGirl
Calculate the integral from 0 to pi of (x^2)cosxdx
I will find the anti-derivative then you can complete the problem.
---
$\int x^2\cos x dx$.
Let $u=x^2$ and $v'=\cos x$
Then,
$u'=2x$ and $v=\sin x$
Thus, by parts,
$x^2\sin x-2\int x \sin xdx$
Now, you do it again,
Let $u=x$ and $v'=\sin x$
Then,
$u'=1$ and $v=-\cos x$
Thus, by parts,
$x^2\sin x-2\left( -x\cos x-\int -\cos xdx \right)$
Simplify,
$x^2\sin x+2x\cos x-2\int \cos xdx$
Thus,
$x^2\sin x+2x\cos x-2\sin x+C$

3. Hello, TexasGirl!

You need to integrate by parts . . . twice!

$I \;= \;\int_0^{\pi} x^2\cos x\,dx$

Let: $u = x^2\qquad dv = \cos x\,dx$

Then: $du = 2x\,dx\quad v = \sin x$

And we have: . $I\;=\;x^2\sin x - 2\int x\sin x\,dx$

Let: $u = x\qquad dv = \sin x\,dx$

Then: $du = dx\quad v = -\cos x$

And we have: . $I \;= \;x^2\sin x - 2\left[-x\cos x - \int(-\cos x)\,dx\right]$
. . . . . . . . . . $I \;= \;x^2\sin x + 2x\cos x - 2\int\cos x\,dx$

Therefore:. . . $\boxed{I \;= \;x^2\sin x + 2x\cos x - 2\sin x + C}$

Edit: Too fast for me, TPHacker!