Skip to content

Mathematics · Ch 11 — Straight Lines

Distance of a Point from a Line

9

Distance of a Point from a Line

Given a line L:Ax+By+C=0L: Ax+By+C=0 and a point P(x1,y1)P(x_1,y_1) not on LL, this section finds the length of the perpendicular dropped from PP to LL — the shortest possible distance from the point to the line.

Setting up. Let MM be the foot of the perpendicular from PP to LL (Figure), so the required distance is d=PMd=PM. Assume, for the derivation, that neither AA nor BB is zero (the two axis-parallel cases were already covered directly in Section 4). Let LL meet the x-axis at Q(−CA,0)Q\left(-\dfrac{C}{A},0\right) and the y-axis at R(0,−CB)R\left(0,-\dfrac{C}{B}\right) — its intercepts, from Section 8.

Derivation (area method). Consider the triangle PQRPQR. Its area can be computed in two different ways, and equating them isolates dd.

First way — the coordinate area formula, applied to vertices P(x1,y1)P(x_1,y_1), Q(−CA,0)Q\left(-\frac{C}{A},0\right), R(0,−CB)R\left(0,-\frac{C}{B}\right); after simplifying the determinant expansion, this reduces to

Area=12⋅∣C∣∣AB∣⋅∣Ax1+By1+C∣.\text{Area} = \frac{1}{2}\cdot\frac{|C|}{|AB|}\cdot|Ax_1+By_1+C|.

Second way — as 12×base×height\frac12\times\text{base}\times\text{height}, using QRQR as the base and PM=dPM=d as the corresponding height (since PM⊥QRPM\perp QR by construction, QRQR being part of LL):

Area=12⋅QR⋅d,QR=(CA)2+(CB)2=∣C∣∣AB∣A2+B2\text{Area} = \frac{1}{2}\cdot QR\cdot d, \qquad QR = \sqrt{\left(\frac{C}{A}\right)^2+\left(\frac{C}{B}\right)^2} = \frac{|C|}{|AB|}\sqrt{A^2+B^2}

(by the distance formula of Section 1, applied to QQ and RR).

Equating the two areas and cancelling the common factor ∣C∣∣AB∣\dfrac{|C|}{|AB|} from both sides gives

d=∣Ax1+By1+C∣A2+B2\boxed{d = \frac{|Ax_1+By_1+C|}{\sqrt{A^2+B^2}}}

— the distance formula. Although derived here assuming A,B,CA,B,C all non-zero, the formula is checked to hold for every line (including x=ax=a and y=by=b) by direct substitution, and so may be used unconditionally.

Distance between two parallel lines. Two parallel lines share the same A,BA,B (up to a common scalar), differing only in the constant term: L1:Ax+By+C1=0L_1: Ax+By+C_1=0 and L2:Ax+By+C2=0L_2: Ax+By+C_2=0. Picking any point (x1,y1)(x_1,y_1) on L1L_1 (so Ax1+By1=−C1Ax_1+By_1=-C_1) and applying the distance formula to find its distance from L2L_2:

d=∣Ax1+By1+C2∣A2+B2=∣−C1+C2∣A2+B2=∣C1−C2∣A2+B2.d = \frac{|Ax_1+By_1+C_2|}{\sqrt{A^2+B^2}} = \frac{|-C_1+C_2|}{\sqrt{A^2+B^2}} = \boxed{\frac{|C_1-C_2|}{\sqrt{A^2+B^2}}}. …

Figure 9.1Perpendicular distance from a point to a line

What this figure shows. A straight line L drawn across a pair of coordinate axes, together with a single point P marked clearly off the line (not on it). A second line segment is drawn from P straight down to the line L, meeting it at a foot point M, such that this segment PM is perpendicular to L; a small square (right-angle marker) is drawn in the corner at M to indicate the 90-degree angle between PM and L. The length of the segment PM is labelled d, representing the required shortest distance from P to L. The line L is also shown extended to cross both axes, with its x-intercept point Q and y-intercept point R marked, and the straight segment QR drawn connect …