# How to evaluate the following integral using hypergeometric function?

May I know how this integral was evaluated using hypergeometric function? $$\int \sin^n x\ dx$$

Wolframalpha showed this result but with no steps

-
You can prove using integration by parts that these integrals (as a sequence of functions) satisfy a recurrence relation. Similarly, hypergeometric series satisfy lots of similar relations (which is one of the main reasons they are special, actually). This is why they often pop up when doing integrals. –  Marek Jan 15 '13 at 20:28
@Marek, thanks for your highlights. –  Tariq Jan 16 '13 at 17:47

Assuming $n$ is a non-negative integer, you could use binomial theorem: $$\begin{eqnarray} \sin^n(x) &=& \left( \frac{\exp(i x) - \exp(-i x)}{2i}\right)^n = \frac{1}{2^n i^n} \sum_{m=0}^n \binom{n}{m} (-1)^m \exp\left( i \left(n-2m\right)x \right) \\ &=& \frac{1}{2^n i^n} \sum_{m=0}^n \binom{n}{m} (-1)^m \left(\cos\left(\left(n-2m\right)x \right) + i \sin\left( \left(n-2m\right)x \right) \right) \end{eqnarray}$$ Since the left-hand-side is real we only keep cosines for even $n$: $$\begin{eqnarray} \sin^{2n}(x) &=& \frac{1}{2^{2n}} \sum_{m=0}^{2n} \binom{2n}{m}\left(-1\right)^{n-m} \cos\left(\left(2n-2m\right)x\right) \\ &\stackrel{\text{symmetry}}{=}& \frac{1}{2^{2n}} \binom{2n}{n} + \frac{1}{2^{2n-1}} \sum_{m=0}^{n-1} \binom{2n}{m}\left(-1\right)^{n-m} \cos\left(2 \left(n-m\right)x\right) \\ &\stackrel{m\to n-m} =& \frac{1}{2^{2n}} \binom{2n}{n} + \frac{1}{2^{2n-1}} \sum_{m=1}^n \binom{2n}{n+m} (-1)^n \cos(2 m x) \tag{1} \end{eqnarray}$$ and, likewise, only sines for odd $n$: $$\sin^{2n+1}(x) = \frac{1}{2^{2n}} \sum_{m=0}^n \binom{2n+1}{n+1+m} (-1)^m \sin\left((2m+1)x\right) \tag{2}$$ We can now integrate element-wise: $$\int \sin^{2n}(x) \, \mathrm{d}x = \frac{1}{2^{2n}} \binom{2n}{n} x + \frac{1}{2^{2n-1}} \sum_{m=1}^n \binom{2n}{n+m} (-1)^n \frac{\sin(2 m x)}{2m} + \text{const.}$$ $$\int \sin^{2n+1}(x) \, \mathrm{d}x = -\frac{1}{2^{2n}} \sum_{m=0}^n \binom{2n+1}{n+1+m} (-1)^m \frac{\cos\left((2m+1)x\right)}{2m+1} + \text{const.}$$
To obtain a hypergeometric function, let $u = \sin(x)$. Then $$\int \sin^n(x)\, \mathrm{d}x = \int \frac{u^n}{\sqrt{1-u^2}} \mathrm{d}u$$ Now see this answer of mine on how to find the anti-derivative of $\int u^a (1-u)^b \mathrm{d} u$. Applying the same principles, we find: $$\int \frac{u^n}{\sqrt{1-u^2}} \mathrm{d}u =\int u^n \cdot {}_1F_0\left(\left.\begin{array}{c} \frac{1}{2} \\ - \end{array} \right| u^2 \right) \mathrm{d} u = \int \frac{\mathrm{d}}{\mathrm{d}u} \left( \frac{u^{n+1}}{n+1} \cdot {}_2F_1\left(\left.\begin{array}{cc} \frac{1}{2} & \frac{n+1}{2} \\ & \frac{n+3}{2} \end{array} \right| u^2 \right) \right) \mathrm{d} u$$ Thus, we have: $$\int \sin^n(x) \, \mathrm{d}x = \frac{\sin^{n+1}(x)}{n+1} \cdot {}_2F_1\left(\left.\begin{array}{cc} \frac{1}{2} & \frac{n+1}{2} \\ & \frac{n+3}{2} \end{array} \right| \sin^2(x) \right) + \text{const.} \tag{3}$$ This works where $u = \sin(x)$ is invertible. To extend validity of the answer, differentiate it. We would get $$\frac{\mathrm{d}}{\mathrm{d}x} \left( \frac{\sin^{n+1}(x)}{n+1} \cdot {}_2F_1\left(\left.\begin{array}{cc} \frac{1}{2} & \frac{n+1}{2} \\ & \frac{n+3}{2} \end{array} \right| \sin^2(x) \right) \right) = \frac{\sqrt{\cos^2(x)}}{\cos(x)} \sin^{n} (x)$$ and since the pre-factor $\frac{\sqrt{\cos^2(x)}}{\cos(x)}$ is a differential constant, i.e. its derivative is zero, we arrive at: $$\int \sin^n(x) \, \mathrm{d}x = \frac{\cos(x)}{\sqrt{\cos^2(x)}} \frac{\sin^{n+1}(x)}{n+1} \cdot {}_2F_1\left(\left.\begin{array}{cc} \frac{1}{2} & \frac{n+1}{2} \\ & \frac{n+3}{2} \end{array} \right| \sin^2(x) \right) + \text{const.} \tag{4}$$ This can be related to the answer provided by Wolfram|Alpha, and thus by Mathematica, using Kummer's relations.
@J.M. Thanks! $\ \$ –  Sasha Jan 16 '13 at 17:53