Calculus · real student question

Evaluate the integral of x^2 * sin(x) from x = 0 to x = pi.

Question

Evaluate

0πx2sinxdx\int_{0}^{\pi}x^{2}\sin x\,dx

Step-by-step solution

  1. Choose uu so the polynomial gets smaller. With a polynomial times a trigonometric function, always let uu be the polynomial: differentiating lowers its degree while sinx\sin x integrates to cosx-\cos x without growing. Take

    u=x2,dv=sinxdx  du=2xdx,v=cosxu=x^{2},\quad dv=\sin x\,dx\ \Longrightarrow\ du=2x\,dx,\quad v=-\cos x

    Choosing the other way round would raise the degree and never terminate.

  2. Apply integration by parts once.

    x2sinxdx=x2cosx+2xcosxdx\int x^{2}\sin x\,dx=-x^{2}\cos x+\int 2x\cos x\,dx

    The remaining integral has degree 11 instead of 22, so one more pass will finish it.

  3. Apply it a second time to xcosxdx\int x\cos x\,dx. Now u=xu=x, dv=cosxdxdv=\cos x\,dx, so du=dxdu=dx and v=sinxv=\sin x:

    xcosxdx=xsinxsinxdx=xsinx+cosx\int x\cos x\,dx=x\sin x-\int\sin x\,dx=x\sin x+\cos x

    Hence 2xcosxdx=2xsinx+2cosx\int 2x\cos x\,dx=2x\sin x+2\cos x.

  4. Write the full antiderivative.

    x2sinxdx=x2cosx+2xsinx+2cosx+C\int x^{2}\sin x\,dx=-x^{2}\cos x+2x\sin x+2\cos x+C

    (Degree 2 needed exactly two passes; a degree-nn polynomial needs nn.)

  5. Substitute the limits. At x=πx=\pi, using cosπ=1\cos\pi=-1 and sinπ=0\sin\pi=0:

    π2(1)+0+2(1)=π22-\pi^{2}(-1)+0+2(-1)=\pi^{2}-2

    At x=0x=0, using cos0=1\cos 0=1 and sin0=0\sin 0=0:

    0+0+2=20+0+2=2

  6. Subtract and check.

    0πx2sinxdx=(π22)2=π245.8696\int_{0}^{\pi}x^{2}\sin x\,dx=\left(\pi^{2}-2\right)-2=\pi^{2}-4\approx 5.8696

    A numerical Simpson estimate gives 5.86960440115.8696044011, matching π24=5.8696044011\pi^{2}-4=5.8696044011 ✓. The answer is positive, as it must be: sinx0\sin x\ge 0 throughout [0,π][0,\pi].

Answer

π245.8696\pi^{2}-4\approx 5.8696

Need to solve a different problem like this? Open the solver →