Derivative when $(\sqrt{x})^2$ is involved? Problem: If $f(x)=\frac{1}{x^2+1}$ and $g(x)=\sqrt{x}$, then what is the derivative of $f(g(x))$?
My book says the answer is $-(x+1)^{-2}$. This answer seems flawed because $(\sqrt{x})^2$ is being simplified to $x$ when it should really be simplified to $|x|$. If $(\sqrt{x})^2$ is simplified to $|x|$ then the answer I get is instead $-\frac{x}{|x|(|x|+1)^2}$. But the book is probably right so is there something I'm overlooking?

Ignoring the sign issue, the formal differentiation yields
$$\left(\frac1{(\sqrt x)^2+1}\right)'=-\frac{2\sqrt x(\sqrt x)'}{((\sqrt x)^2+1)^2}=-\frac{2\sqrt x}{2\sqrt x}\frac1{((\sqrt x)^2+1)^2}=-\frac1{((\sqrt x)^2+1)^2},$$
which is not exactly what you found and is not exactly equivalent to
$$-\frac1{(|x|+1)^2}$$ nor to
$$-\frac1{(x+1)^2}$$ unless you restrict the domain.
