The distance between some point and the origin is given by
so this is the function we're trying to minimize. But notice that and attain their critical points at the same , so we can solve the same problem by minimizing instead.
So let's take the Lagrangian to be
with partial derivatives (set equal to 0)
Now, notice that
and we can use this to solve for . We get
At this critical point, we get a minimum distance of