Reduction formula for $I_{n}=\int {\cos{nx} \over \cos{x}}\rm{d}x$

What would be a simple method to compute a reduction formula for the following?

$\displaystyle I_{n}=\int {\cos{nx} \over \cos{x}} \rm{d}x~$ where $n$ is a positive integer

I understand that it may involve splitting the numerator into $\cos(n-2+2)x~$ (or something similar to this form...), but how would one intuitively recognize that manipulating the expression into such a random arrangement is the way to proceed on this question? Moreover, are there alternative methods, and possibly even some way of directly computing this integral without the need for a reduction formula?

-
What intuition is necessary beyond "the angle addition formula exists"? – Qiaochu Yuan Jun 20 '11 at 14:26

The complex exponential approach described by Gerry Myerson is very nice, very natural. Here are a couple of first-year calculus approaches. The first is kind of complicated, but introduces some useful facts. The second one, given at the very end, is quick.

Instead of doing a reduction formula directly, we separate out a fact that is far more important than our integral.

Lemma: There is a polynomial $P_n(x)$ such that $$\cos(nx)=P_n(\cos x)$$ Moreover, $P_n$ contains only terms of odd degree if $n$ is odd, and only terms of even degree if $n$ is even.

Proof: The cases $n=1$ and $n=2$ are familiar. Suppose we know the result for $n$. We establish the result for $n+2$. Note that $$\cos((n+2)x)=\cos(2x)\cos(nx)-\sin(2x)\sin(nx)$$ The $\cos(2x)\cos(nx)$ part is expressible as a polynomial in $\cos x$, by the induction hypothesis.

But $\sin(nx)$ is the derivative of $(-1/n)\cos(nx)$, so it is $(-1/n)(2\sin x)P_n'(\cos x)$. Thus $$\sin(2x)\sin(nx)=(-1/n)(2\sin x\cos x)(\sin x)P_n'(\cos x)$$ and now we replace $\sin^2 x$ by $1-\cos^2 x$. As we do the induction, we can easily check that all degrees are even or all are odd as claimed. Or else we can obtain the degree information afterwards from symmetry considerations.

Now to the integral! If $n$ is odd, then $\cos(nx)=P_n(\cos x)$, where $P_n(x)$ has only terms of odd degree. Then $\frac{\cos(nx)}{\cos x}$ is a polynomial in $\cos x$, and can be integrated using the standard reduction procedure.

If $n$ is even, pretty much the same thing happens, except that $P_n(x)$ has a non-zero constant term. Divide as in the odd case. We end up with a polynomial in $\cos x$ plus a term of shape $k/(\cos x)$. The integral of $\sec x$, though mildly unpleasant, is standard.

Remark: If $n$ is odd, then $\sin(nx)$ is a polynomial in $\sin x$, with only terms of odd degree. If $n$ is even, then $\sin(nx)$ is $\cos x$ times a polynomial in $\sin x$, with all terms of odd degree.

Added: I should also give the simple reduction formula that was asked for, even at the risk people will not get interested in the polynomials.

Recall that $$\cos(a-b)+\cos(a+b)=2\cos a \cos b$$ Take $a=(n-1)x$ and $b=x$, and rearrange a bit. We get $$\cos(nx)=2\cos x\cos((n-1)x)-\cos((n-2)x)$$ Divide through by $\cos x$, and integrate. $$\int\frac{\cos(nx)}{\cos x}dx =2\int \cos((n-1)x)dx-\int\frac{\cos((n-2)x)}{\cos x}dx$$ The first integral on the right is easy to evaluate, and we get our recurrence, and after a while arrive at the case $n=0$ or $n=1$. Now working "forwards" we can even express our integral as a simple explicit sum.

-
@Jaydon Zhao: I added at the end a quick answer to your problem that does not take the detour through polynomials. – André Nicolas Jun 20 '11 at 18:13
+1 for the complete answer. For those who might be interested in here is a generalization $$\int \dfrac{\cos (px)}{\cos (qx)}dx=2\dfrac{\sin ((p-q)x)}{p-q}-\int \dfrac{\cos ((p-2q)x)}{\cos (qx)}dx\quad p\neq q.$$ – Américo Tavares Jun 21 '11 at 13:13
Thanks for the detailed answer. :) – amy Jun 26 '11 at 10:53

$\cos x=(e(x)+e(-x))/2$, where $e(x)$ abbreviates $e^{ix}$; $\cos nx=(e(nx)+e(-nx))/2$; $\cos nx/\cos x=(e(nx)+e(-nx))/(e(x)+e(-x))=e((1-n)x)(e(2nx)+1)/(e(2x)+1)$ $=e((1-n)x)(e((2n-2)x)-e((2n-4)x)+\cdots+1)$ if $n$ is odd, and now you can integrate term-by-term.

-
I do not think $\cos(x) = [e(x) + e(-x)]/2$ with your definition of $e(x)$... – Fabian Jun 20 '11 at 12:43
@Fabian, thanks - fixed. – Gerry Myerson Jun 20 '11 at 13:03