Correct substitution for simplifying derivative The stationary points of
$$
f(x,y) = (x^2 + y^2)e^{-(x^2 + y^2)}
$$
can be seen to be at $(0,0)$ and on the unit circle, specifically the point at $(0,0)$ is a local minimum and points on the unit circle maximums. This is easy to verify by partial differentiation.
I tried another approach via the substitution $r = x^2 + y^2$, which gives a simpler differential with respect to $r$,
$$
\frac{d}{dr} (re^{-r}) = (1 - r)e^{-r}
$$
which clearly gives the stationary points on the unit circle. However, this differential implies the point $r = 0$ has derivative $1$, not $0$ as expected.
If instead the substitution $r^2 = x^2 + y^2$ is made, we find the derivative with respect to $r$ is
$$
\frac{d}{dr} (r^2e^{-r^2}) = e^{-r^2} (2r-2 r^3)
$$
which has roots $r = \pm 1$ and $r = 0$, giving all the stationary points expected.
My question is why does the second substitution give all the correct stationary points where as the first does not? And why does the first substitution imply the point $(0,0)$ has a non-zero derivative?
 A: The change to polar coordinates is $$\left\{\begin{array}{}x=r\cos\theta \\y=r\sin\theta \end{array} \right., \quad \theta\in(0,2\pi], \ r\ge0$$
Of course it follows, like you say, that $x^2+y^2=r^2$ (the only difference is that you hadn't done a complete change of coordinates, there always has to be two). Notice we'd lose injectivity on $(1,0)$, which is why we dont include $\theta=0$. So, $$f(r,\theta)=re^{-r}$$ And everything else follows as the second part of your work (except that $r\not =-1$ !!!). To see what happens with the first part, we could try to work backwards, sort of. Say instead we do the substitution to these coordinates: $$\left\{\begin{array}{}x=\sqrt r\cos\theta \\y=\sqrt r\sin\theta \end{array} \right., \quad \theta\in(0,2\pi], \ r\ge0$$
And we'd have, like you say, that $x^2+y^2=r$. But wait! This isn't a valid change of coordinates! Both partial derivatives with respect to $r$ are not defined at $r=0$ (I'll leave the verification to you). This is why, at $r=0$ the results aren't valid, because this change of variables isn't a diffeomorfism (differentiable with differentiable inverse).
