Perpendicular Distance from Straight Line in Plane to Point/General Form

Theorem
Let $\mathcal L$ be a straight line embedded in a cartesian plane, given by the equation:
 * $a x + b y = c$

Let $P$ be a point in the cartesian plane whose coordinates are given by:
 * $P = \tuple {x_0, y_0}$

Then the perpendicular distance $d$ from $P$ to $\mathcal L$ is given by:


 * $d = \dfrac {\size {a x_0 + b y_0 + c} } {\sqrt {a^2 + b^2} }$

Proof
We have that $\mathcal L$ has the equation:


 * $(1): \quad a x + b y + c$



Let a perpendicular be dropped from $P$ to $\mathcal L$ at $Q$.

The perpendicular distance $d$ that we are to find is then $PQ$.

In order to simplify the algebra that will inevitably follow, we are to make a transformation as follows.

Let $\mathcal M$ be constructed parallel to $\mathcal L$.

Construct a perpendicular from $\mathcal M$ to pass through the origin.

Let this perpendicular intersect $\mathcal M$ at $R$ and $\mathcal L$ at $S$.

We have that $PQSR$ is a rectangle, and so $RS = PQ$.

It remains to establish the length of $RS$.

We can manipulate $(1)$ into slope-intercept form as:
 * $y = -\dfrac a b x + \dfrac c b$

Thus the slope of $\mathcal L$ is $-\dfrac a b$.

From Slope of Orthogonal Curves, the slope of $RS$ is then $\dfrac b a$.

The next step is to find the coordinates of $R$ and $S$.

From Equation of Straight Line in Plane: Point-Slope Form, the equation of $\mathcal M$ can be given as:
 * $y - y_0 = -\dfrac a b \paren {x - x_0}$

or:
 * $(2): \quad y = \dfrac {-a x + a x_0 + b y_0} b$

From Equation of Straight Line in Plane: Slope-Intercept Form, the equation of $RS$ can be given as:
 * $(3): \quad y = \dfrac b a x$

$\mathcal M$ and $RS$ intersect where these are equal:


 * $\dfrac b a x = \dfrac {-a x + a x_0 + b y_0} b$

which gives us:


 * $x = \dfrac {a \paren {a x_0 + b y_0} } {a^2 + b^2}$

Substituting back for $y$ in $3$, we find that:
 * $R = \tuple {\dfrac {a \paren {a x_0 + b y_0} } {a^2 + b^2}, \dfrac {b \paren {a x_0 + b y_0} } {a^2 + b^2} }$

Now to find the coordinates of $S$, which is the intersection of $\mathcal L$ and $RS$.

We can express $\mathcal L$ as:
 * $y = -\dfrac {a x + c} b$

and so:
 * $\dfrac b a x = -\dfrac {a x + c} b$

which leads to:
 * $x = -\dfrac {a c} {a^2 + b^2}$

Substituting back for $y$ in $3$, we get (after algebra):
 * $S = \tuple {\dfrac {-a c} {a^2 + b^2}, \dfrac {-b c} {a^2 + b^2} }$

It remains to find the length $d$ of $RS$.

From the Distance Formula: