Perpendicular distance from point (x₁, y₁) to the line ax + by + c = 0.
Derivation
Given point P(x1,y1) and line L:ax+by+c=0.
Write L in normal form by dividing by a2+b2:
a2+b2ax+a2+b2by+a2+b2c=0
In normal form xcosα+ysinα=p, the signed distance from any point (x1,y1) to the line is (x1cosα+y1sinα−p). Substituting:
signed distance=a2+b2ax1+by1+c
The sign indicates which side of the line P lies on. The perpendicular distance is:
d=a2+b2∣ax1+by1+c∣
Key Idea
Vector form. Let $A$ be any point on $L$, and $\vec{d} = (b, -a)$ a direction vector along $L$ (perpendicular to the normal $(a,b)$). Then the distance from $P$ to $L$ is the magnitude of the component of $\overrightarrow{AP}$ perpendicular to $\vec{d}$:
>
> $$
> d = \frac{|\overrightarrow{AP} \times \vec{d}|}{|\vec{d}|}
> $$
>
> where $\times$ denotes the 2D cross product (z-component of the 3D cross product). Taking $A$ as any point satisfying $ax + by + c = 0$ and computing recovers the same formula. This is the form used in 3D for distance from a point to a line in space.