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?

$$
\begin{align}
\arctan(x) &= y\\
x &= \tan(y)\\
\frac{\mathrm d}{\mathrm dx} x &= \frac{\mathrm d}{\mathrm dx} \tan(y)\\
1 &= y' \sec^2(y)\\
y'&=\dfrac{1}{\sec^2(y)}\\
y'&=\dfrac{1}{\tan^2(y)+1}\\
y'&=\dfrac{1}{x^2 + 1}
\end{align}
$$
Because $x = \tan(y)$
