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.
Not really different, but all fully formatted and pretty :) $$S(n)=\int_0^\pi x^n\sin x\,\mathrm dx$$ IBP: $$\mathrm dv=\sin x\,\mathrm dx\Rightarrow v=-\cos x\\ u=x^n\Rightarrow \mathrm du=nx^{n-1}\mathrm dx$$ Thus $$S(n)=-x^n\cos x\big|_0^\pi+n\int_0^\pi x^{n-1}\cos x\,\mathrm dx$$ $$S(n)=\pi^n+n\int_0^\pi x^{n-1}\cos x\,\mathrm dx$$ IBP: $$\mathrm dv=\cos x\,\mathrm dx\Rightarrow v=\sin x\\ u=x^{n-1}\Rightarrow \mathrm du=(n-1)x^{n-2}\mathrm dx$$ Thus $$S(n)=\pi^n+n\left[x^{n-1}\sin x\big|_{0}^{\pi}-(n-1)\int_0^\pi x^{n-2}\sin x\,\mathrm dx\right]$$ $$S(n)=\pi^n-n(n-1)S(n-2)$$ QED