Help with integral I seem to be stuck trying to prove the following integral
$$
\int\frac{\cos^mx}{\sin^nx}dx = -\frac{\cos^{m+1}x}{(n-1)\sin^{n-1}x}-\frac{m-n+2}{n-1}\int\frac{\cos^mx}{\sin^{n-2}x} dx + C\,\,(n \neq 1)
$$
My thinking so far has been that if I take
$$
I = \int\frac{\cos^mx}{\sin^nx}dx
$$
I have been able to prove that
$$
I = -\frac{\cos^{m-1}x}{(n-1)\sin^{n-1}x}  - \frac{m-1}{n-1}\int\frac{\cos^{m-2}x}{\sin^{n-2}x}\,dx+C\,\,\,\,\,(1)
$$
and
$$
I = \frac{\cos^{m-1}x}{(m-n)\sin^{n-1}x} + \frac{m-1}{m-n}\int\frac{\cos^{m-2}x}{\sin^nx}\,dx+C\,\,\,\,\,(2)
$$
but showing that 
$$
I = -\frac{\cos^{m+1}x}{(n-1)\sin^{n-1}x}-\frac{m-n+2}{n-1}\int\frac{\cos^mx}{\sin^{n-2}x} dx + C
$$
seems to be eluding me. I attempted to apply a similar technique what I used on $(1)$ to get $(2)$ to try to obtain this integral, but it didn't seem to work.
I can also show that
$$
I = -\frac{\cos^{m+1}x}{(m+1)\sin^{n+1}x} - \frac{n+1}{m+1}\int\frac{\cos^{m+2}x}{\sin^{n+2}x}\, dx + C\,\,\,\,\,(3)
$$
but there's obviously more to it.
Any broad hints would be more than welcome.

After a little more thought (and a lot more sleep) I finally figured out the answer:
Let
$$
I_1 = \int\frac{\cos^mx}{\sin^{n-2}x}\, dx = \int\frac{\cos^mx}{\sin^{n-1}x}. \sin x\, dx
$$
Integrate $I_1$ by parts, choose $u=\frac{\cos^mx}{\sin^{n-1}x}$, $dv = \sin x\, dx$ so $v = -\cos x$
$$
du = \frac{\sin^{n-1}x(-m\cos^{m-1}x\sin x)-\cos^mx((n-1)\sin^{n-2}x\cos x)}{(\sin^{n-1}x)^2}
$$
$$
=\frac{sin^{n-1}x\cos^{m-1}x(-m\sin x)-\sin^{n-1}x\cos^{m-1}x((n-1)\sin^{-1}x\cos^2x)}{(\sin^{n-1}x)^2}
$$
$$
= \frac{\cos^{m-1}x}{\sin^{n-1}x}(-m\sin x - (n-1)\frac{\cos^2 x}{\sin x})
$$
So
$$
I_1 = -\frac{\cos^{m+1}x}{\sin^{n-1}x} - \int\frac{\cos^{m-1}x}{\sin^{n-1}x}(-m\sin x - (n-1)\frac{\cos^2 x}{\sin x})(-\cos x)\, dx
$$
$$
= -\frac{\cos^{m+1}x}{\sin^{n-1}x} - \int\frac{\cos^{m-1}x}{\sin^{n-1}x}(m\sin x\cos x + (n-1)\frac{\cos^3x}{\sin x})\, dx
$$
$$
= -\frac{\cos^{m+1}x}{\sin^{n-1}x} - m\int\frac{\cos^mx}{\sin^{n-2}x}\,dx - (n-1)\int\frac{\cos^{m+2}x}{\sin^nx}\, dx
$$
which implies
$$
(1+m)I_1 = -\frac{\cos^{m+1}x}{\sin^{n-1}x} - (n-1)\int\frac{\cos^{m+2}x}{\sin^nx}\, dx
$$
$$
= -\frac{\cos^{m+1}x}{\sin^{n-1}x} - (n-1)\int\frac{\cos^mx. \cos^2 x}{\sin^nx}\, dx
$$
$$
= -\frac{\cos^{m+1}x}{\sin^{n-1}x} - (n-1)\int\frac{\cos^mx.(1-\sin^2 x)}{\sin^nx}\, dx
$$
$$
= -\frac{\cos^{m+1}x}{\sin^{n-1}x} - (n-1)(\int\frac{\cos^mx}{\sin^nx}\,dx - \int\frac{\cos^mx}{\sin^{n-2}x}\,dx )
$$
Let 
$$
I = \int\frac{\cos^mx}{\sin^nx}\,dx 
$$
so we now have
$$
I_1 = \frac{-\cos^{m+1}x}{(1+m)\sin^{n-1}x} - \frac{n-1}{m+1}I + \frac{n-1}{m+1}\int\frac{\cos^mx}{\sin^{n-2}x}\,dx 
$$
$\implies$
$$
(1-\frac{n-1}{m+1})I_1 = \frac{-\cos^{m+1}x}{(1+m)\sin^{n-1}x} - \frac{n-1}{m+1}I
$$
$\implies$
$$
\frac{m-n+2}{m+1}I_1 = \frac{-\cos^{m+1}x}{(1+m)\sin^{n-1}x} - \frac{n-1}{m+1}I
$$
$\implies$
$$
\frac{n-1}{m+1}I = \frac{-\cos^{m+1}x}{(1+m)\sin^{n-1}x} - \frac{m-n+2}{m+1}I_1
$$
$\implies$
$$
I = \frac{m+1}{n-1}.\frac{-\cos^{m+1}x}{(1+m)\sin^{n-1}x} - \frac{m+1}{n-1}.\frac{m-n+2}{m+1}I_1
$$
$$
= \frac{-\cos^{m+1}x}{(n-1)\sin^{n-1}x} - \frac{m-n+2}{n-1}I_1
$$
All comments greatly appreciated!
