evaluate cosine power reduction formula in terms of Gamma function I ran across an identity I had not saw before, and am wondering how it can be derived.
$\displaystyle \int_{0}^{\frac{\pi}{2}}\cos^{m}(x)\cos(nx)dx=\frac{\pi\Gamma(m+1)}{2^{m+1}\Gamma(\frac{m+n}{2}+1)\Gamma(\frac{m-n}{2}+1)}$.
For the case, $m=n$, then the result is $\frac{\pi}{2^{m+1}}$.
I can easily use parts, but I do not know how to connect it to Gamma. It would appear the 
method must lie in generalizing somehow. It looks like the classic Beta/trig integral may 
be in there somewhere.
I used parts and got:
$\displaystyle\int_{0}^{\frac{\pi}{2}}\cos^{m}(x)\cos(nx)dx=\frac{m}{n}\int_{0}^{\frac{\pi}{2}}\cos^{m-1}(x)\cos(n-1)xdx-\frac{m}{n}\int_{0}^{\frac{\pi}{2}}\cos^{m}(x)\cos(nx)dx$
$\displaystyle \left(1+\frac{m}{n}\right)I_{m,n}=\frac{m}{n}I_{m-1,n-1}$
and so on.  Now, perhaps let $n=n-1, \;\ m=m-1$, then sub in and generalize?. 
I still do not see how to tie it to Gamma unless it comes from the product of the m and n terms 
Thanks to anyone who has a clever idea.
 A: First, we note that:    
$$z=e^{ix}$$
$$\cos x=\frac{e^{ix}+e^{-ix}}{2}=\frac{z+\frac{1}{z}}{2}$$  
$$dx=\frac{dz}{iz}$$  Based on the above, we consider an integral:  
$$I_1=\frac{1}{i2^m}\int_{0}^{i}(1+z^2)^mz^{n-m-1}dz$$ The original integral $I$ is the real part of $I_1$ because that $$z^n=\cos nx +i\sin nx$$  
Next step is the change of variable: $z^2=-y$   
$$I_1=\frac{i^{n-m-1}}{2^{m+1}}\int_{0}^{1}(1-y)^my^{\frac{n-m}{2}-1}dz=\frac{i^{n-m-1}}{2^{m+1}}B\left(m+1,\frac{n-m}{2}\right)$$  
where $B(x,y)$ is the beta function.   
From complex algebra we get:  
$$i^{n-m-1}=\sin\left(\pi\frac{n-m}{2}\right)-i\cos\left(\pi\frac{n-m}{2}\right)$$  
Remembering that we need a real part of $I_1$ we finally have:  
$$I=\mathfrak{Re}(I_1)= \frac{\sin\left(\pi\frac{n-m}{2}\right)}{2^{m+1}}B\left(m+1,\frac{n-m}{2}\right)$$  
To get the result in terms of gamma function as desired we use the common relations:  
$$B(x,y)=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}$$  
$$\Gamma(x)\Gamma(1-x)=\frac{\pi}{\sin\pi x}$$
