= Closest point on a plane
{title2=$\mathbf q=\mathbf p-(\mathbf n\cdot\mathbf p-d)\mathbf n/\|\mathbf n\|^2$}
= Orthogonal projection onto a plane
{synonym}
For a nonzero <normal vector> $\mathbf n$ and the <plane equation> $\mathbf n\cdot\mathbf x=d$, the <closest point on a plane> to $\mathbf p$ is
$$
\boxed{\mathbf q=\mathbf p-\frac{\mathbf n\cdot\mathbf p-d}{\mathbf n\cdot\mathbf n}\mathbf n.}
$$
It subtracts only the normal displacement. Substituting gives $\mathbf n\cdot\mathbf q=d$, so $\mathbf q$ lies on the <plane>; the difference $\mathbf p-\mathbf q$ is a <scalar multiple> of its <normal vector>. These two checks identify the <orthogonal projection onto a plane> without solving a three-variable minimization problem.
For $\mathbf n=(2,-1,2)$, $d=3$, and $\mathbf p=(4,1,2)$, the residual $8$ gives
$$
\boxed{\mathbf q=(4,1,2)-\frac89(2,-1,2)
=\left(\frac{20}9,\frac{17}9,\frac29\right).}
$$
Indeed, $(40-17+4)/9=3$, and $\|\mathbf p-\mathbf q\|=(8/9)\cdot3=8/3$. Choosing the <plane> point $(1,1,1)$ instead gives distance $\sqrt{10}>8/3$: being on the <plane> does not make a point the nearest one.
\Image[/plane-point-normal-orthogonal-projection.png]
{title=The <closest point on a plane> is reached along its <normal vector>}
{description=Original three-dimensional example $2x-y+2z=3$, with $\mathbf p=(4,1,2)$ and $\mathbf q=(20/9,17/9,2/9)$. The finite mesh is only a displayed patch of the infinite <plane>; it is not a physical measurement.}
As a <function> of $\mathbf p$, this projection is
$$
\mathbf p\longmapsto\left(I-\frac{\mathbf n\mathbf n^{\mathsf T}}{\mathbf n^{\mathsf T}\mathbf n}\right)\mathbf p
+\frac{d}{\mathbf n^{\mathsf T}\mathbf n}\mathbf n.
$$
It is an <affine map>, becoming a <linear map> when $d=0$. Projecting a second time changes nothing. It preserves displacements along the <plane> and removes the normal displacement, so it is a concrete example of an <idempotent map>.
Back to article page