Give a recursive formula for calculating the value of $ \int_{0}^{\pi} \sin^n x \, \mathrm dx$ $ \int_{0}^{\pi} \sin^n x \, \mathrm dx$ 
I think that the Integration by parts can be a good idea, and I should check that the value of $n$ is odd or even.
$ \int_{0}^{\pi} 1 \cdot \sin^n x \,\mathrm dx$ and $f'=\sin\,x,g=\sin^{n-1}\,x$ 
 A: $I_n = \displaystyle \int_{0}^{\pi} \sin^n xdx = \displaystyle \int_{0}^{\pi} \sin^{n-1}x d(-\cos x)= 0 - \displaystyle \int_{0}^{\pi}(-\cos x)d(\sin^{n-1} x)=(n-1)\displaystyle \int_{0}^{\pi} \cos^2 x\sin^{n-2}xdx= (n-1)\displaystyle \int_{0}^{\pi} \sin^{n-2}xdx- (n-1)\displaystyle \int_{0}^{\pi} \sin^nxdx=(n-1)I_{n-2}- (n-1)I_n\implies I_n = \dfrac{(n-1)I_{n-2}}{n}$
A: The following is, apparently, the same as the other answer...but since I didn't understand what is done there I write this in more detail:
First:
$$\begin{align*}&I_1:=\int_0^\pi\sin x\,dx=\left.-\cos x\right|_0^\pi=2\\{}\\
&I_2:=\int_0^\pi\sin^2x\,dx=\left.\frac12\left(x-\cos x\sin x\right)\right|_0^\pi=\frac\pi2\end{align*}$$
So for $\;n>2\;$ :
$$I_n=\int_0^\pi\sin^nx\,dx=\int_0^\pi\sin^{n-2}x\,dx-\int_0^\pi\sin^{n-2}x\cos^2x\,dx=$$
$$=I_{n-2}-\int_0^\pi\sin^{n-2}x\cos^2x\,dx\;\;\color{red}{(**)}$$
Now by parts:
$$\begin{align*}&u=\cos x,&u'=-\sin x\\{}\\
&v'=\sin^{n-2}x\cos x,&v=\frac{\sin^{n-1}x}{n-1}\end{align*}$$
thus
$$\color{red}{(**)}=I_{n-2}-\left.\frac{\cos x\sin^{n-1}x}{n-1}\right|_0^\pi-\frac1{n-1}I_n\implies$$
$$\left(1+\frac1{n-1}\right)I_n=I_{n-2}\implies I_n=\frac{n-1}nI_{n-2}$$
