Integrating $\int \sin^n{x} \ dx$

First let us denote

$$I_n = \int \sin^n{x} \ dx $$

$$ \int u(x) v'(x) dx = u(x) v(x) - \int v(x) u' (x) dx $$

Here $u(x) = \sin^{n-1}{x} \hspace{3pt}$ and $\hspace{3pt} v'(x) = \sin x $

$ \Rightarrow v(x) = -\cos x$

Therefo‌‌‌‌‌‌‌‌re‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌ $$ \begin{align*} I_n &= -\cos x \hspace{3pt} \sin^{n-1}x + \int \cos^2 x \hspace{4pt} (n-1) \sin^{n-2} x \hspace{4pt} dx \\ &= -\cos x \hspace{3pt} \sin^{n-1}x + (n-1) \int \sin^{n-2} x \hspace{4pt} dx - (n-1) \int \sin^{n} dx\\ &= -\cos x \hspace{3pt} \sin^{n-1}x + (n-1) \int \sin^{n-2} x \hspace{4pt} dx - (n-1) I_n \end{align*} $$

$$ \Rightarrow (1+n-1)I_n = -\cos x \hspace{3pt} \sin^{n-1}x + (n-1) \int \sin^{n-2} x dx $$

$$ \Rightarrow I_n = \frac{-\cos x \hspace{3pt} \sin^{n-1}x}{n} + \frac{(n-1)}{n} \int \sin^{n-2} x dx $$