Nearest-point minimization outside a Euclidean ball (source code)

= Nearest-point minimization outside a Euclidean ball
{title2=$\operatorname*{arg\,min}_{\|x\|\geq R}\|x-a\|^2=Ra/\|a\|\quad(0<\|a\|<R)$}

Suppose $0<\|a\|<R$ in a <Euclidean space>. Among points outside or on the radius-$R$ ball centred at zero, the unique closest point to $a$ is $x_*=Ra/\|a\|$. Its squared distance is $(R-\|a\|)^2$.

Indeed, the <reverse triangle inequality> gives $\|x-a\|\geq\|x\|-\|a\|\geq R-\|a\|$. Equality requires $\|x\|=R$ and $x$ pointing in the same direction as $a$, giving the stated unique point. If $a=0$, every point on the sphere is a minimizer. If $\|a\|\geq R$, the point $a$ itself is feasible and the minimum distance is zero.

The exterior is not a <convex set>, so a direct geometric argument is useful: it certifies the global answer without treating every candidate satisfying the <Karush-Kuhn-Tucker conditions> as a minimum.