<s>[INST] A stupid question about constrained optimization This is taken from an example in Boas, Mathematical Methods for Physicists. The problem is to minimize the distance, $d=\sqrt{x^2+y^2}$, from the origin to the curve $y=1-x^2$. That is minimize $d$ to the constraint $y=1-x^2$. that Figure 1, shows the correct solutions. When I try to solve the problem using Langrange multipliers or other methods, I get the solutions $x=0,y=1$ or $x=\pm\sqrt{\frac{1}{2}},y=\frac{1}{2}$. 
 
However, from the figure it is seems that there is also a solution at $x=\pm1,y=0$. The distance $d=\sqrt{x^2+y^2}=1$ as for the point $(0,1)$ and it follows the constraint.  Why do none of the methods return that?
 [/INST] You are trying to minimize the distance from the graph of $y(x)=1-x^2$ to the origin. Recall that distance between two points is 
$$
d=\sqrt{(x-x_0)^2+(y-y_0)^2}
$$
In our case, we want the origin, $(x_0,y_0)=(0,0)$. So we have 
$$
d=\sqrt{(x-x_0)^2+(y-y_0)^2}=\sqrt{x^2+y^2}
$$
But $d$ is minimal if and only if $d^2$ is minimal. It is computationally easier to minimize $d^2$, that is
$$
d^2=x^2+y^2
$$
So we minimize this instead.
$$
d^2=x^2+y^2=x^2+(1-x^2)^2=x^2+1-2x^2+x^4=x^4-x^2+1
$$
Now we take the derivative, 
$$
\frac{Dd^2}{Dx}=4x^3-2x=x(4x^2-2)
$$
Now set this equal to zero, 
$$
x(4x^2-2)=0
$$
So that $x=0$ or $x=\pm \frac{1}{\sqrt{2}}$. Now we need to find which one of these are mins. Using the orginary first derivative test for max or mins, we find that $x=0$ is a max and $x=\pm \frac{1}{\sqrt{2}}$ are minimums. From symmetry, we would expect if we get one that we should get $2$. This doesn't require Lagrange multiplies at all.
</s>