Calculus · real student question

Evaluate the integral from 0 to pi of x times (sin 2x - sin x) dx.

Question

Evaluate

0πx(sin2xsinx)dx\int_{0}^{\pi}x\left(\sin2x-\sin x\right)dx

Step-by-step solution

  1. Split by linearity. Each piece is a polynomial times a trigonometric function, the standard shape for integration by parts:

    0πxsin2xdx0πxsinxdx\int_{0}^{\pi}x\sin2x\,dx-\int_{0}^{\pi}x\sin x\,dx

    In both, choose u=xu=x (which differentiates away to 11) and dvdv the sine part.

  2. First integral: xsin2xdx\displaystyle\int x\sin2x\,dx. With u=xu=x, dv=sin2xdxdv=\sin2x\,dx, so du=dxdu=dx and v=12cos2xv=-\tfrac12\cos2x:

    xsin2xdx=x2cos2x+12cos2xdx=x2cos2x+14sin2x\int x\sin2x\,dx=-\frac{x}{2}\cos2x+\frac12\int\cos2x\,dx=-\frac{x}{2}\cos2x+\frac14\sin2x

    The inner factors of 12\tfrac12 come from the chain rule on 2x2x and are the easiest thing to lose here.

  3. Evaluate the first integral on [0,π][0,\pi]. At x=πx=\pi: cos2π=1\cos2\pi=1 and sin2π=0\sin2\pi=0, giving π2-\tfrac{\pi}{2}. At x=0x=0: both terms vanish. So

    0πxsin2xdx=π2\int_{0}^{\pi}x\sin2x\,dx=-\frac{\pi}{2}

    Simpson quadrature returns 1.5707963-1.5707963 ✓, matching π2-\tfrac\pi2.

  4. Second integral: xsinxdx\displaystyle\int x\sin x\,dx. With u=xu=x, dv=sinxdxdv=\sin x\,dx, so v=cosxv=-\cos x:

    xsinxdx=xcosx+cosxdx=xcosx+sinx\int x\sin x\,dx=-x\cos x+\int\cos x\,dx=-x\cos x+\sin x

    At x=πx=\pi: π(1)+0=π-\pi(-1)+0=\pi. At x=0x=0: 00. So 0πxsinxdx=π\displaystyle\int_{0}^{\pi}x\sin x\,dx=\pi, confirmed numerically as 3.14159273.1415927 ✓.

  5. Subtract to finish.

    π2π=3π24.712389-\frac{\pi}{2}-\pi=-\frac{3\pi}{2}\approx-4.712389

    Direct Simpson quadrature of the original integrand gives 4.71238898-4.71238898 ✓, agreeing to eight decimals.

  6. Sanity-check the sign. On (0,π)(0,\pi) the term xsinx-x\sin x is negative throughout, while xsin2xx\sin2x contributes a positive hump on (0,π2)\left(0,\tfrac\pi2\right) and a larger negative one on (π2,π)\left(\tfrac\pi2,\pi\right) — larger because the weight xx is bigger there. Both parts therefore pull the total negative, consistent with 3π2-\tfrac{3\pi}{2}.

Answer

0πx(sin2xsinx)dx=3π2\int_{0}^{\pi}x\left(\sin2x-\sin x\right)dx=-\frac{3\pi}{2}

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