Find the recursive formula for indefinite integral I have to find the recursive formula for this expression : $\int\dfrac{dx}{(a+b\cos x)^n}$ . 
This is all what I've done :
$$\int\frac{dx}{(a+b\cos x)^n} = \frac{1}{a}\int\frac{adx}{(a+b\cos x)^n}=\frac{1}{a}\int\frac{a+b\cos x-b\cos x}{(a+b\cos x)^n}dx=\frac{1}{a}I_{n-1}-\frac{b}{a}\int\frac{\cos xdx}{(a+b\cos x)^n} .$$
Now I have to solve : 
$\int\dfrac{\cos xdx}{(a+b\cos x)^n}$
 A: $\int\dfrac{dx}{(a+b\cos x)^n}$
$=\dfrac{1}{a}\int\dfrac{a}{(a+b\cos x)^n}~dx$
$=\dfrac{1}{a}\int\dfrac{a+b\cos x-b\cos x}{(a+b\cos x)^n}~dx$
$=\dfrac{1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}-\dfrac{b}{a}\int\dfrac{\cos x}{(a+b\cos x)^n}~dx$
$=\dfrac{1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}-\dfrac{b}{a}\int\dfrac{d(\sin x)}{(a+b\cos x)^n}$
$=-\dfrac{b\sin x}{a(a+b\cos x)^n}+\dfrac{1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}+\dfrac{b}{a}\int\sin x~d\left(\dfrac{1}{(a+b\cos x)^n}\right)$
$=-\dfrac{b\sin x}{a(a+b\cos x)^n}+\dfrac{1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}+\dfrac{b^2n}{a}\int\dfrac{\sin^2x}{(a+b\cos x)^{n+1}}~dx$
$=-\dfrac{b\sin x}{a(a+b\cos x)^n}+\dfrac{1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}-\dfrac{b^2n}{a}\int\dfrac{\cos^2x-1}{(a+b\cos x)^{n+1}}~dx$
$=-\dfrac{b\sin x}{a(a+b\cos x)^n}+\dfrac{1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}-\dfrac{n}{a}\int\dfrac{b^2\cos^2x-b^2}{(a+b\cos x)^{n+1}}~dx$
$=-\dfrac{b\sin x}{a(a+b\cos x)^n}+\dfrac{1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}-\dfrac{n}{a}\int\dfrac{b^2\cos^2x+2ab\cos x+a^2-2ab\cos x-a^2-b^2}{(a+b\cos x)^{n+1}}~dx$
$=-\dfrac{b\sin x}{a(a+b\cos x)^n}+\dfrac{1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}-\dfrac{n}{a}\int\dfrac{(a+b\cos x)^2-2a(a+b\cos x)+a^2-b^2}{(a+b\cos x)^{n+1}}~dx$
$=-\dfrac{b\sin x}{a(a+b\cos x)^n}-\dfrac{n-1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}+2n\int\dfrac{dx}{(a+b\cos x)^n}-\dfrac{(a^2-b^2)n}{a}\int\dfrac{dx}{(a+b\cos x)^{n+1}}$
$\therefore\dfrac{(a^2-b^2)n}{a}\int\dfrac{dx}{(a+b\cos x)^{n+1}}=-\dfrac{b\sin x}{a(a+b\cos x)^n}+(2n-1)\int\dfrac{dx}{(a+b\cos x)^n}-\dfrac{n-1}{a}\int\dfrac{dx}{(a+b\cos x)^{n-1}}$
$\int\dfrac{dx}{(a+b\cos x)^{n+1}}=-\dfrac{b\sin x}{(a^2-b^2)n(a+b\cos x)^n}+\dfrac{a(2n-1)}{(a^2-b^2)n}\int\dfrac{dx}{(a+b\cos x)^n}-\dfrac{n-1}{(a^2-b^2)n}\int\dfrac{dx}{(a+b\cos x)^{n-1}}$
Hence $\int\dfrac{dx}{(a+b\cos x)^n}=-\dfrac{b\sin x}{(a^2-b^2)(n-1)(a+b\cos x)^{n-1}}+\dfrac{a(2n-3)}{(a^2-b^2)(n-1)}\int\dfrac{dx}{(a+b\cos x)^{n-1}}-\dfrac{n-2}{(a^2-b^2)(n-1)}\int\dfrac{dx}{(a+b\cos x)^{n-2}}$
