Here's an analogous example that might help you understand what's going on. Suppose we want to find the point on the line $y = 2 - x$ that is closest to the origin in $\Bbb R^2$. We can parameterize this line as $$ \mathbf x(t) = (2 - t, t). $$ The value that we are trying to minimize is $$ d(t) = \|\mathbf x(t) - 0\| = \sqrt{(2 - t)^2 + t^2}. $$ The $t$ that minimizes this function corresponds to the point on the line that is closest to $(0,0)$. That said, the $t$ that minimizes $d(t)$ will also minimize $[d(t)]^2$. So, we can make the calculus simpler by minimizing the function $$ f(t) = [d(t)]^2 = (2 - t)^2 + t^2 = 2t^2 - 4t + 4. $$ From here, straightforward calculus gives us the answer: $$ f'(t) = 4t - 4 = 0 \implies t = 1 $$ So, the closest point to $(0,0)$ will be $\mathbf x(1,1) = (2 - 1, 1) = (1,1)$.