Proving a reduction formula for $I_n = \int \:e^{ax}\cos^n x\;dx$ (Further Maths: F3) 
Given $$
I_n = \int \:e^{ax}\cos^n x\;dx
$$
I have to prove that
  $$
\left(a^2+n^2\right)I_n\:=\:e^{ax}\cos^{n-1}x\left(a\cos x+n\sin x\right)+n(n-1)I_{n-2}
$$

I just cannot get it to reduce. I keep ending up with too many species in the next integral to use parts again.
I have an important Further Pure F3 exam in a month and reduction is proving the hardest of the topics. Help is greatly appreciated.
 A: Recall the integration by parts formula:-
$$\int uv'dx=uv-\int vu'dx$$
where $v'=\frac{dv}{dx}$ and $u'=\frac{du}{dx}$
Applying integration by parts by setting $v'=e^{ax}$ and $u=\cos^nx$ we obtain
$$\int \color{red}{e^{ax}}\color{blue}{\cos ^n\left(x\right)}dx=\color{red}{\frac{1}{a}e^{ax}}\color{blue}{\cos^nx}+\frac{\color{blue}{n}}{\color{red}{a}}\int \color{red}{e^{ax}}\color{blue}{\cos^{n-1}x\sin x}\text{ }dx$$
Apply integration by parts to the integral on the right hand side of the above equation setting $v'=e^{ax}$ and $u=\cos^{n-1}x\sin x$. This results in the following expression (note the use of the product rule for differentiation in the integral on the RHS):-
$$\int \color{red}{e^{ax}}\color{blue}{\cos^{n-1}x\sin x}\text{ }dx=\color{red}{\frac{1}{a}e^{ax}}\color{blue}{\cos^{n-1}x\sin x}-\color{red}{\frac{1}{a}}\int \color{red}{e^{ax}}\color{blue}{[-(n-1)\cos^{n-2}x\sin^2x+\cos^n x]}\text{ }dx\\=\frac{1}{a}e^{ax}\cos^{n-1}x\sin x+\frac{1}{a}\int e^{ax}(n-1)\cos^{n-2}x\color{magenta}{\sin^2x}\text{ }dx-\frac{1}{a}\int e^{ax}\cos^n x\text{ }dx\\=\frac{1}{a}e^{ax}\cos^{n-1}x\sin x+\frac{1}{a}\int e^{ax}(n-1)\cos^{n-2}x\color{magenta}{(1-\cos^2x)}\text{ }dx-\frac{1}{a}\int e^{ax}\cos^n x\text{ }dx\\=\frac{1}{a}e^{ax}\cos^{n-1}x\sin x+\frac{n-1}{a}\int e^{ax}\cos^{n-2}x\text{ }dx+\frac{1-n}{a}\int e^{ax}\cos^{n}x\text{ }dx-\frac{1}{a}\int e^{ax}\cos^n x\text{ }dx\\=\frac{1}{a}e^{ax}\cos^{n-1}x\sin x+\frac{n-1}{a}I_{n-2}-\frac{n}{a}I_n$$
If we substitute this expression into what we obtained after the we integrated by parts for the first time, we obtain:-
$$I_n=\frac{1}{a}e^{ax}\cos^nx+\frac{n}{a^2}\left[e^{ax}\cos^{n-1}x\sin x+(n-1)I_{n-2}-nI_n\right]\\\Rightarrow a^2I_n=ae^{ax}\cos^nx+ne^{ax}\cos^{n-1}x\sin x+n(n-1)I_{n-2}-n^2I_n\\\Rightarrow (a^2+n^2)I_n=e^{ax}\cos^{n-1}x(a\cos x+n\sin x)+n(n-1)I_{n-2}$$ 
A: Outline: Suppose that $n\ge 2$. We use integration by parts, as in your attempt, letting $u=\cos^n x$ and $dv=e^{ax}\,dx$. Then we get $du =-n\sin x\cos^{n-1}x\,dx$ and $v=\frac{1}{a}e^{ax}$.  
So it remains to compute $\int \frac{n}{a}e^{ax}\sin x\cos^{n-1} x\,dx$. 
Do it again, letting $u=\cos^{n-1} x\sin x$ and $dv=\frac{n}{a}e^{ax}\,dx$.  Then $du=\left(\cos^n x -(n-1)\sin^2 x\cos^{n-2} x\right)\,dx$.
Now comes a key step: Replace $\sin^2 x$ by $1-\cos^2 x$. Thus 
$$du=\left(n\cos^{n} x -(n-1)\cos^{n-2}x\right)\,dx.$$
