Another integral (when cosine turns bad !) I encountered a problem which was like this :- let $ I (m,n) $ be the indefinite integral of  $ \int cos^{m}(x) cos(nx)  dx $  . Then find  $ I(5,7) $ in terms of  $ I(4,6) $ and some function of sine and cosines of the involved angles . Now usually one would think about using the reduction formulae in this case  as the reduction formulae establish a recursion between the various $ I(m,n) $ but not  it is handy to use integration by parts again and again to find these reduction formulae so i thought of changing the problem by using complex numbers by defining  $ C(m,n)+iS(m,n) $ as $  \int e^{mix}cos^{n}(x)  dx $  and then finding its real part so as to solve the problem but it turned out to be even more tedious . So i would like to get some innovative and short method or hints  to solve the problem! ( PS: I have been stuck with it and now need some help and guidance ) . Thanks in advance ☺️
 A: $$\Re\int\frac{(e^{ix}+e^{-ix})^m}{2^m}e^{inx}dx=\Re\int\sum_{k=0}^m\frac{\binom mk}{2^m}e^{i(2k-m+n)x}dx
\\=\Re\sum_{k=0}^m\frac{\binom mk}{i(2k-m+n)2^m}e^{i(2k-m+n)x}
\\=\sum_{k=0}^m\frac{\binom mk}{(2k-m+n)2^m}\sin((2k-m+n)x).$$
If $2k-m+n$ turns out to be zero, the corresponding term is linear ($\dfrac{\binom{m}{(m-n)/2}}{2^m}x$).
A: You need to use trig identities and integration by parts. Start with cosine addition
$$
\cos[(n-1)x]   = \cos(nx)\cos(x) + \sin(nx)\sin(x)
$$
which gives
\begin{multline}
I(m,n) = \int\cos^m(x)\cos(nx)= \int\cos^{m-1}(x)\cos[(n-1)x]dx - \int\cos^{m-1}(x)\sin(nx)\sin(x)dx
\\ = I(m-1,n-1) - \int\cos^{m-1}(x)\sin(nx)\sin(x)dx
\end{multline}
Now integrate by parts on the second term
\begin{multline}
\int\cos^{m-1}(x)\sin(nx)\sin(x)dx = \left[-\frac{\cos^m(x)}{m}\right]\sin(nx) - \int\left[-\frac{\cos^m(x)}{m}\right][n\cos(nx)]dx
\\ = -\frac{\cos^m(x)\sin(nx)}{m}+\frac{n}{m}I(m,n)
\end{multline}
Put this together and you have
$$
I(m,n) = \frac{m\,I(m-1,n-1)+\cos^m(x)\sin(nx)}{m+n}
$$
