<s>[INST] Why is the antiderivative of $\frac{1}{1+x^2}=\tan^{-1}(x)$? My textbook says the antiderivative of $\frac{1}{1+x^2}$ is $\tan^{-1}(x)$. 
To confirm this to myself I took the derivative of $\tan^{-1}(x)$ expecting to get $\frac{1}{1+x^2}$ , but instead I ended up with $-\frac{1}{\sin^2(x)}$. So why is $\tan^{-1}(x)$ the antiderivative of $\frac{1}{1+x^2}$ if the  derivative of $\tan^{-1}(x)$ is not $\frac{1}{1+x^2}$? Shouldn't the derivative of the antiderivative of a function give you the original function?
 [/INST] Using the formula for geometric series,
$${1\over 1+x^2}=1-x^2+x^4-x^6+\cdots+(-x^2)^n+\cdots
$$
Integrating,
$$
\begin{align}
\int 1-x^2+x^4-x^6+\cdots+(-x^2)^n+\cdots dx&=x-{x^3\over3}+{x^5\over5}-{x^7\over7}+\cdots\\
&=\arctan x\\
\end{align}
$$
</s>