Solution (source code)

= Solution

Let $s=|\mathbf r'|>0$ and $\mathbf p=\mathbf r'/s^2$. For $|\mathbf r|=1$, expanding both squared <Euclidean distances> gives
$$
\begin{aligned}
s^2|\mathbf r-\mathbf p|^2
&=s^2-2\mathbf r\cdot\mathbf r'+1\\
&=|\mathbf r-\mathbf r'|^2.
\end{aligned}
$$
Taking nonnegative square roots proves
$$
\boxed{|\mathbf r-\mathbf r'|=|\mathbf r'|\,|\mathbf r-\mathbf p|.}
$$
This is the distance identity behind <inversion in a circle> and the <method of images> for a circular boundary.