How to integrate $\int \frac{\cos^m x}{\cos nx} \,\mathrm{d}x$

Solution 1:

HINT

Let $y=\cos(x),$ then $$\frac{\cos^m x}{\cos nx} = \frac{(\cos x)^m}{T_n(\cos x)} = f(\cos x),$$ where $T_n(y)$ are the Chebyshev's polynomials of the first kind.

If $m\ge n$ it is necessary to single out an integer part of the ratio of polynomials.
Let $$g_{n-1}(y) = y^m\bmod T_n(y),\quad h(y) = f(y) - g_{n-1}(y),$$ then $$f(y) = r(y) + h(y),$$ where $$r(y) = \frac{g_{n-1}(y)}{T_n(y)},$$ $h(y)$ are polynomial of $y$ or zero, and $g_{n-1}(y)$ is polynomial of order $(n-1)$ or less.

Then, $$T_n(y) = 2^n\prod_{k=1}^n (y-y_{n,k}),$$ where $$y_{n,k} = \cos\left|\frac{2k-1}{2n}\right|.$$ So $$r(y) = \frac {g_{n-1}(y)}{2^n \prod_{k=1}^n (y-y_{n,k})} = \sum_\limits{k=1}^n \frac{a_k}{y-y_{n,k}},$$ and $$a_k = \lim_{y\to y_{n,k}}r(y)(y-y_{n,k}).$$ In this way, $$\int\frac{\cos^m(x)}{\cos nx}\,dx = \sum_{k=1}^n a_k\int\frac{dx}{\cos x - y_{n,k}} + \int h(\cos x)\,dx,$$ where $h(y)$ is the polynomial, and the integrals under the sum can be calculated using the universal trig substitution.