The distance between a point and the origin is . But since , both and have the same critical points, so we can consider instead the squared distance, .
We're looking for the extrema of subject to and . The Lagrangian is
with critical points where the partial derivatives vanish:
From the first two equations, it follows that .
Then in the last two equations,
If , then ; if , then .
So there are two critical points, and .
Let . We have a minimum distance of and maximum distance of .