Is there any standard solution or way to solve the following integration
$$I=\int_0^{\pi} \left(\cos(\theta)\right)^n \cos(p\theta) d\theta$$
where, $n=0, 1, 2,\dots$ and $p=0, 1, 2,\dots$ and $p> n$
Is there any standard solution or way to solve the following integration
$$I=\int_0^{\pi} \left(\cos(\theta)\right)^n \cos(p\theta) d\theta$$
where, $n=0, 1, 2,\dots$ and $p=0, 1, 2,\dots$ and $p> n$
On
$\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{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align} I_{np} &\equiv \int_{0}^{\pi}\cos^{n}\pars{\theta}\cos\pars{p\theta}\,\dd\theta = \half\int_{-\pi}^{\pi}\cos^{n}\pars{\theta}\cos\pars{p\theta}\,\dd\theta:\ ?. \quad \left\lbrace\begin{array}{l} \ds{n \in \braces{0,1,2\ldots}} \\ \ds{p \in \mathbb{Z}} \end{array}\right. \end{align}
\begin{align} \color{#f00}{I_{np}} & = \half\,\Re\int_{-\pi}^{\pi}\cos^{n}\pars{\theta}\expo{\ic p\theta}\,\dd\theta = \half\,\Re\oint_{\verts{z}\ =\ 1}\,\,\pars{z^{2} + 1 \over 2z}^{n}z^{p} \,{\dd z \over \ic z} \\[4mm] & = {1 \over 2^{n + 1}}\,\Im\oint_{\verts{z}\ =\ 1}\, {\pars{1 + z^{2}}^{n} \over z^{n - p + 1}}\,\dd z = {1 \over 2^{n + 1}}\,\Im\sum_{k = 0}^{n}{n \choose k} \oint_{\verts{z}\ =\ 1}\,\,\,{\dd z \over z^{n - p - 2k + 1}} \\[4mm] & = {1 \over 2^{n + 1}}\,\Im\sum_{k = 0}^{n}{n \choose k} 2\pi\ic\bracks{\vphantom{\large A} n -p - 2k + 1 = 1}\quad \mbox{where}\ \bracks{\cdots}\ \mbox{is an}\ \ul{Iverson\ Bracket}\,. \end{align}
Hint:
Using the complex representation with $z=e^{i\theta}$,
$$I=-i\int_1^{-1}\left(\frac{z+z^{-1}}2\right)^n\frac{z^p+z^{-p}}2\frac{dz}z\ =-\frac i{2^{n+1}}\int_1^{-1}\sum_{k=0}^n\binom nk\left(z^{2k-n+p-1}+z^{2k-n-p-1}\right)dz.$$
Then for $m\ne-1$,
$$\int_0^\pi z^mdz=\left.\frac{z^{m+1}}{m+1}\right|_1^{-1}=-\frac2{m+1}$$ for even $m$ and $0$ otherwise, and
$$\int_0^\pi z^{-1}dz=\left.\log z\right|_1^{-1}=i\pi.$$
Logically, all imaginary terms should vanish, leaving either $0$ or $$\binom n{(n+p)/2}\dfrac\pi{2^{n+1}}.$$