TITLE: Ramanujan's 'well known' integral, $\int\limits_{-\pi/2}^{\pi/2} (\cos x)^m e^{in x}dx$.
QUESTION [12 upvotes]: $$\int_{-\pi/2}^{\pi/2} (\cos x)^m e^{in x}dx=\frac{\pi}{2^m} \frac{\Gamma(1+m)}{\Gamma \left(1+ \frac{m+n}{2}\right)\Gamma \left(1+ \frac{m-n}{2}\right)}$$
Appearing at the start of Ramanujan's paper 'A Class of Definite Integrals', the above is, cited as 'well known', particularly dispiriting as I can't prove it. Anyone know of a nice proof? 
$\Re(m)>-1$ and I assume that $m \in \mathbb{C}, n \in \mathbb{R}$.

REPLY [5 votes]: $\newcommand{\+}{^{\dagger}}
 \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{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{\int_{-\pi/2}^{\pi/2}\cos^{m}\pars{x}\expo{\ic nx}\,\dd x
={\pi \over 2^{m}}\,
{\Gamma\pars{1 + m}
 \over \Gamma\pars{1 + \bracks{m + n}/2}\,\Gamma\pars{1 + \bracks{m - n}/2}}:\
 {\large ?}}$

\begin{align}
&\color{#c00000}{\int_{-\pi/2}^{\pi/2}\cos^{m}\pars{x}\expo{\ic nx}\,\dd x}
=\int_{-\pi/2}^{\pi/2}\bracks{1 + \cos\pars{2x} \over 2}^{m/2}\expo{\ic nx}\,\dd x
\\[3mm]&=2^{-m/2 - 1}\int_{-\pi}^{\pi}\bracks{1 + \cos\pars{x}}^{m/2}
\expo{\ic nx/2}\,\dd x
\\[3mm]&=2^{-m/2 - 1}
\int_{\verts{z} = 1 \atop {\vphantom{\Huge A}\verts{{\rm Arg}\pars{z}}\ <\ \pi}}
\pars{1 + {z^{2} + 1 \over 2z}}^{m/2}z^{n/2}\,{\dd z \over \ic z}
\\[3mm]&=-2^{-m - 1}\,\ic
\int_{\verts{z} = 1 \atop {\vphantom{\Huge A}\verts{{\rm Arg}\pars{z}}\ <\ \pi}}
\pars{2z + z^{2} + 1}^{m/2}z^{\pars{n - m}/2 - 1}\,\dd z
\\[3mm]&=-2^{-m - 1}\,\ic
\int_{\verts{z} = 1 \atop {\vphantom{\Huge A}\verts{{\rm Arg}\pars{z}}\ <\ \pi}}
\pars{z + 1}^{m}z^{\pars{n - m}/2 - 1}\,\dd z
\\[3mm]&=2^{-m - 1}\,\ic
\int_{-1}^{0}\pars{x + 1}^{m}\pars{-x}^{\pars{n - m}/2 - 1}
\exp\pars{\ic\pi\bracks{{n - m \over 2} - 1}}\,\dd x
\\[3mm]&\mbox{}+
2^{-m - 1}\,\ic
\int_{0}^{-1}\pars{x + 1}^{m}\pars{-x}^{\pars{n - m}/2 - 1}
\exp\pars{-\ic\pi\bracks{{n - m \over 2} - 1}}\,\dd x
\\[3mm]&=2^{-m - 1}\,\ic
\int_{0}^{1}\pars{1 - x}^{m}x^{\pars{n - m}/2 - 1}
\exp\pars{\ic\pi\bracks{{n - m \over 2} - 1}}\,\dd x
\\[3mm]&\mbox{}-
2^{-m - 1}\,\ic
\int_{0}^{1}\pars{1 - x}^{m}x^{\pars{n - m}/2 - 1}
\exp\pars{-\ic\pi\bracks{{n - m \over 2} - 1}}\,\dd x
\\[3mm]&=2^{-m - 1}\ic\braces{2\ic\sin\pars{\pi\bracks{{n - m \over 2} - 1}}}
\int_{0}^{1}x^{\pars{n - m}/2 - 1}\pars{1 - x}^{m}\,\dd x
\end{align}

$$
\color{#c00000}{\int_{-\pi/2}^{\pi/2}\cos^{m}\pars{x}\expo{\ic nx}\,\dd x}
=2^{-m}\sin\pars{{n - m \over 2}\,\pi}{\rm B}\pars{{n - m \over 2},m + 1}\,,\qquad
\Re\pars{n} > \Re\pars{m} > -1
$$
where
$\ds{{\rm B}\pars{x,y} \equiv \int_{0}^{1}t^{x - 1}\pars{1 - t}^{y - 1}\,\dd t}$ is the Beta Function
$\pars{~\mbox{with}\ \Re\pars{x}, \Re\pars{y} > 0~}$ which has the property
$\ds{{\rm B}\pars{x,y} = {\Gamma\pars{x}\Gamma\pars{y} \over \Gamma\pars{x + y}}}$.
$\ds{\Gamma\pars{z}}$ is the
Gamma Function.

Then
  \begin{align}
&\color{#c00000}{\int_{-\pi/2}^{\pi/2}\cos^{m}\pars{x}\expo{\ic nx}\,\dd x}
=2^{-m}\sin\pars{{n - m \over 2}\,\pi}\,
{\Gamma\pars{\bracks{n - m}/2}\Gamma\pars{m + 1} \over
\Gamma\pars{\bracks{n + m}/2 + 1}}\tag{1}
\end{align}
  By using the Gamma function
  Euler Reflection Formula
  $\ds{\Gamma\pars{z}\Gamma\pars{1 - z} = {\pi \over \sin\pars{\pi z}}}$ we find:
  $$
\sin\pars{{n - m \over 2}\,\pi}\Gamma\pars{n - m \over 2}
={\pi \over \Gamma\pars{1 + \bracks{m - n}/2}}
$$
  such that $\pars{1}$ is reduced to
  $$\color{#00f}{\large%
\int_{-\pi/2}^{\pi/2}\cos^{m}\pars{x}\expo{\ic nx}\,\dd x
={\pi \over 2^{m}}\,
{\Gamma\pars{1 + m}
 \over \Gamma\pars{1 + \bracks{m + n}/2}\,\Gamma\pars{1 + \bracks{m - n}/2}}}
$$