One way to do it is with calculus. The distance between any point

on the line to the origin is given by

Now, both

and

attain their respective extrema at the same critical points, so we can work with the latter and apply the derivative test to that.

Solving for

, you find a critical point of

.
Next, check the concavity of the squared distance to verify that a minimum occurs at this value. If the second derivative is positive, then the critical point is the site of a minimum.
You have

so indeed, a minimum occurs at

.
The minimum distance is then
