Why these point are not global max and min?

I was studying the function $$z=2x\exp(-x^2-y^2)$$ and I found out that (with the hessian matrix) $$(\frac{\sqrt2}{2},0)$$ and $$(-\frac{\sqrt2}{2},0)$$ are respectively local max and min point for the function z which is correct, but when plotting the graph looks like these two point are global max and min I don't understand why they're just local. Thanks for your help!

In this case, $$\left|2x e^{-x^2-y^2}\right| = 2e^{-y^2}\left| xe^{-x^2}\right|$$. As $$y\to\pm\infty$$, $$e^{-y^2}\to 0$$. As $$x\to\pm\infty$$, $$xe^{-x^2}\to 0$$. No matter what direction we go to $$\infty$$ in, $$z\to 0$$. Those two points you found, at which $$z$$ takes values $$\pm\sqrt{2}e^{-\frac12}$$, are in fact global maxima and minima for this function.
The catch? We can't prove that just by looking at the Hessian at the critical points. The second derivatives that go into the Hessian are strictly local information, and they don't tell us anything about what the function does far away from those points. Think back to how you worked single-variable optimization problems - in addition to the critical points, we always had to look at the boundary (endpoints) of the domain. In two dimensions, we still do - but the boundary is a lot larger. Here, with all of $$\mathbb{R}^2$$ as a domain, we have to look at what happens if we approach $$\infty$$ in any direction.