# Integral/Powers of sine/Recursion/Example

A primitive function for the sine function ${\displaystyle {}\sin x}$ is ${\displaystyle {}-\cos x}$. In order to find a primitive function for ${\displaystyle {}\sin ^{n}x}$, we use integration by parts to get a recursive relation to a power with a smaller exponent. To make this more precise, we work over an interval, the primitive function shall start at ${\displaystyle {}0}$ and have the value ${\displaystyle {}0}$ there. For ${\displaystyle {}n\geq 2}$, with integration by parts, we get
{\displaystyle {}{\begin{aligned}\int _{0}^{x}\sin ^{n}t\,dt&=\int _{0}^{x}\sin ^{n-2}t\cdot \sin ^{2}t\,dt\\&=\int _{0}^{x}\sin ^{n-2}t\cdot {\left(1-\cos ^{2}t\right)}\,dt\\&=\int _{0}^{x}\sin ^{n-2}t\,dt-\int _{0}^{x}{\left(\sin ^{n-2}t\cos t\right)}\cos t\,dt\\&=\int _{0}^{x}\sin ^{n-2}t\,dt-{\frac {\sin ^{n-1}t}{n-1}}\cos t|_{0}^{x}-{\frac {1}{n-1}}{\left(\int _{0}^{x}\sin ^{n}t\,dt\right)}.\end{aligned}}}
Multiplication with ${\displaystyle {}n-1}$ and rearranging yields
${\displaystyle {}n\int _{0}^{x}\sin ^{n}t\,dt=(n-1)\int _{0}^{x}\sin ^{n-2}t\,dt-\sin ^{n-1}x\cos x\,.}$
In particular, for ${\displaystyle {}n=2}$, we have
${\displaystyle {}\int _{0}^{x}\sin ^{2}t\,dt={\frac {1}{2}}{\left(x-\sin x\cos x\right)}\,.}$