I'm working on a code at the moment that calculates the closest point to a circle from a point inside it. Let's say we have the point ($x_0, x_1$) to calculate the closest point to the unit circle it first calculates $\rho = \sqrt{x_0^2 + x_1^2}$ and then the closest point to the unit circle is $(x_0 / \rho, x_1 / \rho)$.
I don't know much about geometry and I don't understand how this works. I'd really appreciate it if someone could explain me why and how this works.