## Proof of Formula for Least Distance Between a Point and a Plane

The normal
$\vec{n}$
to the plane
$ax+by+cz=d$
is
$\begin{pmatrix}a\\b\\c\end{pmatrix}$

. The line
$r(t)= \begin{pmatrix}x_0\\y_0\\z_0\end{pmatrix}+ \begin{pmatrix}a\\b\\c\end{pmatrix} t$
is perpendicular to the plane and passes through the point
$(x_0,y_0,z_0)$
. For this line, the
$x, \; y, \; z$
coordinates are
$x_0+at, \; y_0+bt, \; z_0+ct$
respectively. Substitute these into the equation of the plane.
$a(x_0+at)+b(y_0+bt)+c(z_0+ct)=d \rightarrow t=\frac{d-ax_0-by_0-cz_0}{a^2+b^2+c^2}$
.
Substitute this value of
$t$
into the equation of the line to get the coordinate of the intersection of the line with the plane.
\begin{aligned} (x_0,y_0,z_0)+ \begin{pmatrix}a\\b\\c\end{pmatrix}^T \frac{d-ax_0-by_0-cz_0}{a^2+b^2+c^2} &= (x_0+ \frac{a(d-ax_0-by_0-cz_0)}{a^2+b^2+c^2},y_0 + \frac{b(d-ax_0-by_0-cz_0)}{a^2+b^2+c^2},z_0 \\ &+ \frac{c(d-ax_0-by_0-cz_0)}{a^2+b^2+c^2} ) \end{aligned}
.
The distance between this point and the origin
$(x_0,y_0,z_0)$
is
\begin{aligned} d &=\sqrt{(\frac{a(d-ax_0-by_0-cz_0)}{a^2+b^2+c^2})^2+(\frac{b(d-ax_0-by_0-cz_0)}{a^2+b^2+c^2})^2+(\frac{c(d-ax_0-by_0-cz_0)}{a^2+b^2+c^2})^2} \\ &= \sqrt{\frac{(d-ax_0-by_0-cz_0)^2(a^2+b^2+c^2)}{(a^2+b^2+c^2)^2}} \\ &= \frac{(d-ax_0-by_0-cz_0)}{\sqrt{a^2+b^2+c^2}}\end{aligned}