Prove formula for $\int \frac{dx}{(1+x^2)^n}$ I was reading a calculus book and I saw this reduction formula:
$$\int \frac{dx}{(1+x^2)^n} = \frac{1}{2n-2}\frac{x}{(x^2+1)^{n-1}}+\frac{2n-3}{2n-2}\int\frac{1}{(x^2+1)^{n-1}}dx$$
Out of curiosity I attempted to prove it, but I got stuck near the end of it.
My attempt:
Let $x=\tan(t),  dx=\sec^2(t)dt$
Substituting in the original integral we get:
$$\int\frac{\sec^2(t)}{(1+\tan^2(t))^n}{dt}$$
By trig identities the integral becomes something like this:
$\int\frac{1}{[\sec^2(t)]^{n-1}}{dt}$, which is equal to $\int{\cos^{2n-2}(t)}{dt}$, then applying the reduction formula for cosine we get this thing:
$$\int{\cos^{2n-2}(t)}{dt}= \frac{1}{2n-2}·\cos^{2n-3}(t)\sin(t) + \frac{2n-3}{2n-2}·\int{{\cos}^{2n-4}(t)}{dt}$$
Then after some algebraic and trigonometric manipulations the expression looks like this:
$$\frac{1}{2n-2}·\frac{\tan(t)}{[1+\tan^{2}(t)]^{n-1}} + \frac{2n-3}{2n-2}\int{\cos}^{2n-4}(t){dt}$$
I only need to substitute $x=\tan(t)$ to get the first part of the formula, but I don't know how to manipulate $\int{{\cos}^{2n-4}(t){dt}}$ to get an expression that I can use to finish this problem.
How do I proceed, did I make a mistake, will there ever be a proof for the Riemman Hypothesis?
P.s
I tried breaking down $\int{{\cos}^{2n-4}(t){dt}}$ into $$\int{{\cos}^{2n-2}(t)\cos^{-2}(t){dt}}$$
But after playing around with that expression I get $\int\frac{1+x^{2}}{[1+x^{2}]^{n-1}}{dx}$, which doesn't match the formula
 A: Use integration by parts, 
$$I=\int\frac{dx}{(1+x^2)^n}=\int\frac{1}{(1+x^2)^n}\cdot 1\ dx $$
$$I=\frac{1}{(1+x^2)^n}\int 1 \ dx-\int \left((-n)\frac{2x}{(1+x^2)^{n+1}}\cdot x\right)dx$$
$$I=\frac{x}{(1+x^2)^n}+2n\int \left(\frac{(1+x^2)-1}{(1+x^2)^{n+1}}x\right)dx$$
$$I=\frac{x}{(1+x^2)^n}+2n\int \left(\frac{1}{(1+x^2)^{n}}-\frac{1}{(1+x^2)^{n+1}}\right)dx$$
$$I=\frac{x}{(1+x^2)^n}+2n\int \frac{dx}{(1+x^2)^{n}}-2n\int \frac{1}{(1+x^2)^{n+1}}dx$$
$$I=\frac{x}{(1+x^2)^n}+2nI-2n\int \frac{1}{(1+x^2)^{n+1}}dx$$
$$0=\frac{x}{(1+x^2)^n}+(2n-1)I-2n\int \frac{1}{(1+x^2)^{n+1}}dx$$
$$2n\int \frac{1}{(1+x^2)^{n+1}}dx=\frac{x}{(1+x^2)^n}+(2n-1)I$$
$$\int \frac{dx}{(1+x^2)^{n+1}}=\frac{x}{2n(1+x^2)^n}+\frac{(2n-1)}{2n}\int \frac{dx}{(1+x^2)^{n}}$$
setting $n=n-1$
$$\int \frac{dx}{(1+x^2)^{n}}=\frac{x}{(2n-2)(1+x^2)^{n-1}}+\frac{(2n-3)}{2n-2}\int \frac{dx}{(1+x^2)^{n-1}}$$
A: Note 
$$\left( \frac{x}{(x^2+1)^{n-1}}\right)’ =\frac{3-2n}{(x^2+1)^{n-1}}+ 
\frac{2n-2}{(x^2+1)^{n}}
$$
Then, integrate both sides to obtain
$$\int \frac{dx}{(1+x^2)^n} = \frac{1}{2n-2}\frac{x}{(x^2+1)^{n-1}}+\frac{2n-3}{2n-2}\int\frac{1}{(x^2+1)^{n-1}}dx
$$
A: This doesn't prove the formula so you can take it as a comment but it gives the anti-derivative explicitly. It is just a different way to approach this integral in general. I will use the following identities: 
$$\cos^{2\left(n-1\right)}\left(t\right)=\frac{\left(2\left(n-1\right)\right)!}{4^{\left(n-1\right)}\left(\left(n-1\right)!\right)^{2}}+\frac{1}{2^{\left(2n-3\right)}}\sum_{k=0}^{n-2}\binom{2\left(n-1\right)}{k}\cos\left(2t\left(n-k-1\right)\right) \tag{1}$$
$$\sin\left(2\left(n-k-1\right)\arctan\left(x\right)\right)=\frac{1}{x\left(1+x^{2}\right)^{\left(n-k-1\right)}}\sum_{j=1}^{n-k-1}\left(-1\right)^{\left(j-1\right)}\binom{2\left(n-k-1\right)}{2j-1}x^{2j} \tag{2}$$
$$\sin\left(2nx\right)=\sum_{k=1}^{n}\left(-1\right)^{\left(k-1\right)}\binom{2n}{2k-1}\sin^{\left(2k-1\right)}\left(x\right)\cos^{\left(2\left(n-k\right)+1\right)}\left(x\right) \tag{3}$$
$(1)$ can be proved by combining $\cos(x)=\frac{e^{ix}+e^{-ix}}{2}$ with the binomial theorem and exploiting the symmetry of the binomial coefficient. 
$(3)$ follows by combining $(\cos(x)+i\sin(x))^n=\cos(nx)+i\sin(nx)$ with the binomial theorem and equating imaginary parts (note that the LHS is $(e^{ix})^n$ and the RHS is $e^{inx}$ so the formula is immediate).
$(2)$ can be proved by combining $(3)$ with $\sin\left(\arctan\left(x\right)\right)=\frac{x}{\sqrt{1+x^{2}}}$ and $\cos\left(\arctan\left(x\right)\right)=\frac{1}{\sqrt{1+x^{2}}}$.
Now and in a straight forward manner,
$$ I = \int \frac{1}{\left(1+x^{2}\right)^{n}}dx = \int \cos^{2\left(n-1\right)}\left(t\right)dt \\ = \frac{\left(2\left(n-1\right)\right)!}{4^{\left(n-1\right)}\left(\left(n-1\right)!\right)^{2}}t+\frac{1}{2^{\left(2n-3\right)}}\sum_{k=0}^{n-2}\binom{2\left(n-1\right)}{k}\frac{1}{2\left(n-k-1\right)}\sin\left(2\left(n-k-1\right)t\right) =\frac{\left(2\left(n-1\right)\right)!}{4^{\left(n-1\right)}\left(\left(n-1\right)!\right)^{2}}\arctan\left(x\right)+\frac{1}{4^{\left(n-1\right)}x\left(1+x^{2}\right)^{\left(n-1\right)}}\\\\\\\\\\\\\\\sum_{k=0}^{n-2}\sum_{j=1}^{n-k-1}\left(-1\right)^{\left(j-1\right)}\binom{2\left(n-1\right)}{k}\binom{2\left(n-k-1\right)}{2j-1}\ \frac{x^{2j}\left(x^{2}+1\right)^{k}}{n-k-1} $$
To get the second line from the first, I used $(1)$. To get from the second to the third, I used $t=\arctan(x)$ along with $(2)$ and $(3)$. So, 

$$\int
\frac{1}{\left(1+x^{2}\right)^{n}}dx=\frac{\left(2\left(n-1\right)\right)!}{4^{\left(n-1\right)}\left(\left(n-1\right)!\right)^{2}}\arctan(x)+
\begin{aligned}\frac{1}{4^{\left(n-1\right)}x\left(1+x^{2}\right)^{\left(n-1\right)}}\sum_{k=0}^{n-2}\sum_{j=1}^{n-k-1}\left(-1\right)^{\left(j-1\right)}\binom{2\left(n-1\right)}{k}\binom{2\left(n-k-1\right)}{2j-1}\
\frac{x^{2j}\left(x^{2}+1\right)^{k}}{n-k-1} +C \end{aligned}$$.

It is delightful to watch this formula work for small $n$. It is also interesting (provided I didn't do any miscalculation) that although this integral is relatively simple, wolframalpha doesn't give the anti-derivative in terms of elementary functions.
