[Math] By creating a reduction formula for $I_n=\int_0 ^\pi x^n \sin x \,dx$ Show that $I_4=\pi^4 -12\pi^2 + 48$

definite integralsintegrationreduction-formula

By creating a reduction formula for
$$I_n=\int_0 ^\pi x^n \sin x \,dx$$ Show that $I_4=\pi^4 -12\pi^2 + 48$

So by using integration by parts I wrote $I_n$ as $$I_n=\int_0 ^\pi x^n \sin x \,dx = \left[-x^n\cos x \right]_0 ^\pi -\int_0 ^\pi nx^{n-1}\times -\cos x\, dx$$ and after messing about with this I got $$I_n = \pi^n +nI_{n-1}$$ However, the answer shows that this is wrong and I don't get the correct answer for $I_4$. The correct answer is $I_n = \pi^n -n(n-1)I_{n-2}$. Can someone help explain how you get this reduction formula as I can't seem to get it and why my one doesn't work.

Best Answer

$I_n=\pi^n +\int_0 ^\pi nx^{n-1}\cos x\, dx \ne \pi^n + nI_{n-1}$

As $I$ is an integral with a sine factor and not a cosine factor.

You need to do integration by parts a second time.

$n\int_0 ^\pi nx^{n-1}\cos x\, dx = n(n-1)\sin x|_0^{\pi} - n(n-1)\int_0^\pi x^{n-2}\sin x\ dx$

$I_n=\pi^n - n(n-1)I_{n-2}$

And $I_0 = 2$