Solution (source code)

= Solution

Decompose the position <vector> into its components parallel and perpendicular to the <unit vector> $\mathbf u$:
$$
\mathbf r=s\mathbf u+\mathbf v,\qquad s=\mathbf r\cdot\mathbf u,\qquad\mathbf v\cdot\mathbf u=0.
$$
This is an <orthogonal projection>, and the <Pythagorean theorem> gives $|\mathbf r|^2=s^2+|\mathbf v|^2$. The two surfaces are distinguished by fixing an angle in part (a), and fixing distance from an axis in part (b).