What is the integral of powers of sines and cosines over one period? I am looking for an expression for the integral
\begin{equation*}
I_{n,m}=\int_0^{2\pi} \cos^n(x)\sin^m(x) \, dx
\end{equation*}
where $n,m$ are arbitrary positive integers. Thanks
 A: HINT
The problem is how to reduce the cosine and sine with degrees to cosine and sine of multiple arguments, since $\cos(nx)$ and $\sin(mx)$ are orthogonal on the interval $(0,2\pi):$
$$\int_0^{2\pi}\cos(nx)\sin(mx)=0,$$
$$\int_0^{2\pi}\cos(nx)\cos(mx)=\int_0^{2\pi}\sin(nx)\sin(mx)=
\begin{cases}
2\pi\text{ for }n=m=1\\
\pi\text{ for }n=m\not=1\\
0\text{ for }n\not=m.
\end{cases}$$
To reduce, it's possible to use the formula
$$2\cos(nx)=z^n+\bar z^n,\quad 2i\sin(mx)=z^m-\bar z^m,\quad z=e^{ix},\quad \bar z=e^{-ix},$$
then 
$$2^n\cos^n(x)=(z+\bar z)^n = \sum_{k=0}^h
\genfrac{(}{)}{0}{}{n}{k}\left(z^{n-2k}+\bar z^{n-2k}\right)+(n-2h-1)\genfrac{(}{)}{0}{}{n}{h}$$
$$=2\sum_{k=0}^h
\genfrac{(}{)}{0}{}{n}{k}\cos(n-2k)x + (n-2h-1)\genfrac{(}{)}{0}{}{n}{h},$$
where $h=\left[\dfrac{n}2\right]$;
$$(2i)^m\sin^m(x)=(z-\bar z)^n$$
$$
=\sum_{k=0}^{h'}(-1)^k\genfrac{(}{)}{0}{}{m}{k}\left(z^{m-2k}+(-1)^m\bar z^{m-2k}\right) + (-1)^{h'}(m-2h'-1)\genfrac{(}{)}{0}{}{n}{h'}$$
$$=
\begin{cases}
2\sum_{k=0}^l(-1)^k\genfrac{(}{)}{0}{}{m}{k}\cos(m-2k)x + (-1)^l\genfrac{(}{)}{0}{}{n}{l}\text{ for }m=2l\\
2i\sum_{k=0}^l(-1)^k\genfrac{(}{)}{0}{}{m}{k}\sin(m-2k)x\text{ for }m=2l+1
\end{cases}$$
A: $\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
I_{nm} & \equiv \int_{0}^{2\pi}\cos^{n}\pars{x}\sin^{m}\pars{x}\,\dd x =
\pars{-1}^{m + n}\int_{-\pi}^{\pi}\cos^{n}\pars{x}\sin^{m}\pars{x}\,\dd x
\\[5mm] & =
\pars{-1}^{m + n}\,\bracks{1 + \pars{-1}^{m}}
\int_{0}^{\pi}\cos^{n}\pars{x}\sin^{m}\pars{x}\,\dd x =
\\[5mm] & =
\bracks{\pars{-1}^{m + n} + \pars{-1}^{n}}\bracks{
\pars{-1}^{n}\int_{-\pi/2}^{\pi/2}\sin^{n}\pars{x}\cos^{m}\pars{x}\,\dd x}
\\[5mm] & =
\bracks{\pars{-1}^{m} + 1}\braces{\bracks{1 + \pars{-1}^{n}}
\int_{0}^{\pi/2}\sin^{n}\pars{x}\cos^{m}\pars{x}\,\dd x}
\\[5mm] & =
\bracks{\pars{-1}^{m} + 1}\bracks{\pars{-1}^{n} + 1}
\int_{0}^{\pi/2}\sin^{n}\pars{x}\cos^{m}\pars{x}\,\dd x
\label{1}\tag{1}
\end{align}

$$
\fbox{$\ds{\quad I_{nm} = \bracks{\pars{-1}^{m} + 1}\bracks{\pars{-1}^{n} + 1}I_{mn}\quad}$}
$$

With $\ds{t \equiv \sin\pars{x}}$, the last integral in \eqref{1} is given by:
\begin{align}
&\int_{0}^{\pi/2}\sin^{n}\pars{x}\cos^{m}\pars{x}\,\dd x =
\int_{0}^{1}t^{n}\pars{1 - t^{2}}^{m/2 - 1/2}\,\,\,\dd t =
\half\int_{0}^{1}t^{n/2 - 1/2}\,\,\,\pars{1 - t}^{m/2 - 1/2}\,\,\,\dd t
\\[5mm] = &\
\half\,
{\Gamma\pars{n/2 + 1/2}\Gamma\pars{m/2 + 1/2} \over \Gamma\pars{n/2 + m/2 + 1}}
\end{align}
where we used the Beta Function expression in terms of the Gamma Function $\ds{\Gamma}$.

\begin{align}
\color{#f00}{I_{nm}} & \equiv \int_{0}^{2\pi}\cos^{n}\pars{x}\sin^{m}\pars{x}\,\dd x =
\color{#f00}{\half\bracks{\pars{-1}^{m} + 1}\bracks{\pars{-1}^{n} + 1}
{\Gamma\pars{n/2 + 1/2}\Gamma\pars{m/2 + 1/2} \over \Gamma\pars{n/2 + m/2 + 1}}}
\end{align}
A: These are dealt with in pretty much any Calculus text.
  If either sine or cosine is to an odd power, a simple substitution reduces it to an algebraic integral:
1) $\int \sin^n(x)\cos^{2k+1}(x)\, dx= \int \sin^n(x) \cos^{2k}(x) (\cos(x)\,dx)$
  Let $u= \sin(x)$ so that $du= \cos(x)\,dx$, $\cos^2(x)= 1- \sin^2(x)= 1- u^2$ and $\cos^{2k}(x)= (1- u^2)^k$.  The integral becomes $\int u^n(1- u^2)^k \,du$.
2) $\int \sin^{2k+ 1}(x)\cos^m(x)\,dx= \int \sin^{2k}(x)\cos^m(x)(\sin(x) \, dx)$
  Let $u= cos(x)$ so that $du= -\sin(x)\,dx$, $\sin^2(x)= 1- \cos^2(x)= 1- u^2$, and $\sin^{2k}(x)= (1- u^2)^k$.  The integral becomes $\int (1- u^2)^ku^m \,du$.
If both sine and cosine are to an even power use $\sin^2(x)= (1- \cos(2x))/2$ and $\cos^2(x)= (1+ \cos(2x))/2$, repeatedly if necessary, to reduce to a form in which either sine or cosine has an odd power.
