Integrate squared trigonometric function I'm trying to integrate $\int_a^b \left( \frac{1}{1+x^2}  \right)^2 dx$
I know that $\frac{d}{dx} \arctan(x) = \frac{1}{1+x^2}$, but how can I integrate with the squared part?
I've tried substitution with no success.

Consider the integral 
$$I_n=\int\frac{\mathrm{d}x}{(ax^2+b)^n}$$
Integration by parts: $$\mathrm{d}v=\mathrm{d}x\Rightarrow v=x\\u=\frac1{(ax^2+b)^n}\Rightarrow \mathrm{d}u=-2an(ax^2+b)^{-n-1}x\mathrm{d}x$$
$$I_n=\frac{x^2}{(ax^2+b)^n}+2n\int\frac{ax^2\mathrm{d}x}{(ax^2+b)^{n+1}}$$
$$I_n=\frac{x^2}{(ax^2+b)^n}+2n\int\frac{ax^2+b-b}{(ax^2+b)^{n+1}}\mathrm{d}x$$
$$I_n=\frac{x^2}{(ax^2+b)^n}+2n\int\frac{ax^2+b}{(ax^2+b)^{n+1}}\mathrm{d}x-2nb\int\frac{\mathrm{d}x}{(ax^2+b)^{n+1}}$$
$$I_n=\frac{x^2}{(ax^2+b)^n}+2n\int\frac{\mathrm{d}x}{(ax^2+b)^n}-2nb\int\frac{\mathrm{d}x}{(ax^2+b)^{n+1}}$$
$$I_n=\frac{x^2}{(ax^2+b)^n}+2nI_n-2nbI_{n+1}$$
Now we solve for $I_{n+1}$ in terms of $I_n$:
$$I_n=\frac{x^2}{(ax^2+b)^n}+2nI_n-2nbI_{n+1}$$
$$2bI_{n+1}=\frac{x^2}{(ax^2+b)^n}+2nI_n-I_n$$
$$I_{n+1}=\frac{x^2}{2b(ax^2+b)^n}+\frac{2n-1}{2b}I_n$$
Cleverly replacing $n$ with $n-1$ gives
$$I_{n-1+1}=\frac{x^2}{2b(ax^2+b)^{n-1}}+\frac{2(n-1)-1}{2b}I_{n-1}$$
$$I_{n}=\frac{x^2}{2b(ax^2+b)^{n-1}}+\frac{2n-3}{2b}I_{n-1}$$
And there's your reduction formula. Plugging in $a=1,\quad b=1,\quad n=2$ will give your integral without the bounds plugged in. Note that this formula only works when $b\neq0$, $n$ is an integer, and $n\geq2$.
