Integrating $\int_0^{\pi/2} \cos^a(x) \cos(bx) \ dx$ Please help me in this integral :
$$\int_0^{\pi/2} \cos^a(x) \cos(bx) \ dx \quad \text{if}\; b>a>-1$$
Please help me I used everything and can't evaluate it.
 A: $$
\begin{align}
&\int_0^{\frac\pi2}\cos^a(x)\cos(bx)\,\mathrm{d}x\\
&=\mathrm{Re}\left(2^{-a}\int_0^{\frac\pi2}\left(e^{ix}+e^{-ix}\right)^ae^{ibx}\,\mathrm{d}x\right)\tag{1}\\
&=\mathrm{Re}\left(2^{-a}\int_0^{\frac\pi2}\left(1+e^{-2ix}\right)^ae^{i(a+b)x}\,\mathrm{d}x\right)\tag{2}\\
&=\mathrm{Re}\left(2^{-a}\int_0^{\frac\pi2}\left(1+e^{-2ix}\right)^ae^{i(a+b+2)x}\,\frac{i}{2}\mathrm{d}e^{-2ix}\right)\tag{3}\\
&=\mathrm{Re}\left(2^{-a}\int_1^{-1}\left(1+u\right)^au^{-(a+b)/2-1}\,\frac{i}{2}\mathrm{d}u\right)\tag{4}\\
&=\mathrm{Re}\left(2^{-a}\int_0^{-1}\left(1+u\right)^au^{-(a+b)/2-1}\,\frac{i}{2}\mathrm{d}u\right)\tag{5}\\
&=\mathrm{Re}\left(2^{-a}\int_0^1\left(1-u\right)^au^{-(a+b)/2-1}e^{i\pi((a+b)/2+1)}\,\frac1{2i}\mathrm{d}u\right)\tag{6}\\
&=\mathrm{Re}\left(2^{-a-1}e^{i\pi((a+b+1)/2)}\int_0^1\left(1-u\right)^au^{-(a+b)/2-1}\,\mathrm{d}u\right)\tag{7}\\
&=2^{-a-1}\cos(\pi(a+b+1)/2)\int_0^1\left(1-u\right)^au^{-(a+b)/2-1}\,\mathrm{d}u\tag{8}\\
&=2^{-a-1}\sin(-\pi(a+b)/2)\frac{\Gamma(a+1)\Gamma(-(a+b)/2)}{\Gamma(1+(a-b)/2)}\tag{9}\\
&=\frac{\pi\,2^{-a-1}\,\Gamma(a+1)}{\Gamma(1+(a-b)/2)\,\Gamma(1+(a+b)/2)}\tag{10}
\end{align}
$$
Explanation:
$(1)$ write trigonometric functions as exponentials
$(2)$ pull $e^{iax}$ out of the parentheses
$(3)$ $\mathrm{d}x=e^{i2x}\frac i2\,\mathrm{d}e^{-2ix}$
$(4)$ $u=e^{-2ix}$ ($u$ travels clockwise along the unit circle from $1$ to $-i$ to $-1$
$\hphantom{(4)\ u=e^{-2ix}(}$ then Cauchy's theorem lets us deform the countour to
$\hphantom{(4)\ u=e^{-2ix}(}$ just under the real axis from $1$ to $0$ to $-1$)
$(5)$ the integral from $1$ to $0$ is pure imaginary, so we can drop it
$(6)$ $u\mapsto-u$ and since $u$ passed below $0$ we use $e^{-i\pi}$ for $-1$
$(7)$ pull the imaginary character out front
$(8)$ take the real part
$(9)$ use the integral for the Beta function
$(10)$ use the reflection formula $\Gamma(x)\Gamma(1-x)=\frac\pi{\sin(\pi x)}$ with $x=-(a+b)/2$
