TExcelTAD
Home › School Analytical Trigonometry & Conic Sections › Distance from a Point to a Line

Distance from a Point to a Line

In Euclidean geometry, the distance from an external point to a straight line is defined as the length of the shortest segment connecting the point to the line. This shortest path always meets the line at a right angle (90∘90^\circ).

In coordinate geometry, the perpendicular distance from any point M(x0,y0)M(x_0, y_0) to a straight line Δ:Ax+By+C=0\Delta: Ax + By + C = 0 can be evaluated directly through a single, elegant algebraic formula:

d(M,Δ)=∣Ax0+By0+C∣A2+B2d(M, \Delta) = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}

This formula is one of the most powerful tools in analytical geometry, forming the cornerstone for finding circle tangents, computing triangle altitudes, and determining the distance between parallel lines.


1. Concepts & Geometric Proof

Geometric Setup and Projection

Let Δ\Delta be a line with general equation Ax+By+C=0Ax + By + C = 0, having normal vector n⃗=(A,B)≠0⃗\vec{n} = (A, B) \neq \vec{0}. Let M(x0,y0)M(x_0, y_0) be any given point in the plane, and let HH be the orthogonal projection (the foot of the perpendicular) of MM onto Δ\Delta.

The distance d(M,Δ)d(M, \Delta) is the length of segment MHMH:

M(x0, y0) H (Foot) Line d: Ax + By + C = 0 Distance d(M, d) = |Ax0 + By0 + C| / sqrt(A^2 + B^2)

Take any arbitrary point P(x1,y1)P(x_1, y_1) on line Δ\Delta. Because PP lies on Δ\Delta, its coordinates satisfy:

Ax1+By1+C=0  ⟹  C=−(Ax1+By1)Ax_1 + By_1 + C = 0 \implies C = -(Ax_1 + By_1)

Consider the displacement vector from PP to MM:

PM⃗=(x0−x1, y0−y1)\vec{PM} = (x_0 - x_1, \, y_0 - y_1)

The length of the projection of PM⃗\vec{PM} onto the normal vector n⃗\vec{n} equals the perpendicular height MHMH:

d(M,Δ)=∥proj⁡n⃗PM⃗∥=∣n⃗⋅PM⃗∣∥n⃗∥d(M, \Delta) = \|\operatorname{proj}_{\vec{n}} \vec{PM}\| = \frac{|\vec{n} \cdot \vec{PM}|}{\|\vec{n}\|}

Expanding the dot product in Cartesian coordinates:

n⃗⋅PM⃗=A(x0−x1)+B(y0−y1)=Ax0+By0−(Ax1+By1)\begin{aligned} \vec{n} \cdot \vec{PM} &= A(x_0 - x_1) + B(y_0 - y_1) \\ &= Ax_0 + By_0 - (Ax_1 + By_1) \end{aligned}

Since −(Ax1+By1)=C-(Ax_1 + By_1) = C, this simplifies directly to:

n⃗⋅PM⃗=Ax0+By0+C\vec{n} \cdot \vec{PM} = Ax_0 + By_0 + C

Dividing by the magnitude ∥n⃗∥=A2+B2\|\vec{n}\| = \sqrt{A^2 + B^2}, we establish the formula:

d(M,Δ)=∣Ax0+By0+C∣A2+B2d(M, \Delta) = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}

Distance Between Two Parallel Lines

Consider two parallel lines with identical normal coefficients AA and BB:

Δ1:Ax+By+C1=0Δ2:Ax+By+C2=0\begin{aligned} \Delta_1 &: Ax + By + C_1 = 0 \\ \Delta_2 &: Ax + By + C_2 = 0 \end{aligned}

Picking any point P(x1,y1)P(x_1, y_1) on Δ1\Delta_1, we have Ax1+By1=−C1Ax_1 + By_1 = -C_1. The distance from PP to Δ2\Delta_2 is:

d(Δ1,Δ2)=∣Ax1+By1+C2∣A2+B2=∣−C1+C2∣A2+B2=∣C1−C2∣A2+B2d(\Delta_1, \Delta_2) = \frac{|Ax_1 + By_1 + C_2|}{\sqrt{A^2 + B^2}} = \frac{|-C_1 + C_2|}{\sqrt{A^2 + B^2}} = \frac{|C_1 - C_2|}{\sqrt{A^2 + B^2}}

Formula Box

Distance Formulas Toolkit

  1. Point-to-Line Distance:

    d(M,Δ)=∣Ax0+By0+C∣A2+B2d(M, \Delta) = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}

    where M(x0,y0)M(x_0, y_0) is the point and Δ:Ax+By+C=0\Delta: Ax + By + C = 0 is the line in general form.

  2. Distance from Origin O(0,0)O(0, 0):

    d(O,Δ)=∣C∣A2+B2d(O, \Delta) = \frac{|C|}{\sqrt{A^2 + B^2}}
  3. Distance Between Parallel Lines:

    d(Δ1,Δ2)=∣C1−C2∣A2+B2d(\Delta_1, \Delta_2) = \frac{|C_1 - C_2|}{\sqrt{A^2 + B^2}}

    (Crucial: coefficients AA and BB must be made strictly identical before applying this shortcut).


2. Step-by-Step Paper Notebook Method

M(x0, y0) H (Foot) Line d: Ax + By + C = 0 Distance d(M, d) = |Ax0 + By0 + C| / sqrt(A^2 + B^2)

3. Worked Notebook Examples

Example 1: Classic Distance Calculation

Problem: Calculate the distance from point P(2,−3)P(2, -3) to the line Δ:3x−4y+7=0\Delta: 3x - 4y + 7 = 0.

Step 1: Identify coefficients and coordinates

  • x0=2x_0 = 2, y0=−3y_0 = -3
  • A=3A = 3, B=−4B = -4, C=7C = 7

Step 2: Compute the numerator

Ax0+By0+C=3(2)+(−4)(−3)+7=6+12+7=25\begin{aligned} Ax_0 + By_0 + C &= 3(2) + (-4)(-3) + 7 \\ &= 6 + 12 + 7 = 25 \end{aligned}

Taking absolute value:

∣25∣=25|25| = 25

Step 3: Compute the denominator

A2+B2=32+(−4)2=9+16=25=5\sqrt{A^2 + B^2} = \sqrt{3^2 + (-4)^2} = \sqrt{9 + 16} = \sqrt{25} = 5

Step 4: Divide numerator by denominator

d(P,Δ)=255=5d(P, \Delta) = \frac{25}{5} = 5

Final Answer:

d(P,Δ)=5d(P, \Delta) = 5

Example 2: Distance from Origin and Line in Slope Form

Problem: Find the distance from the origin O(0,0)O(0, 0) to the line y=−512x+2612y = -\frac{5}{12}x + \frac{26}{12}.

Step 1: Convert to general form Multiply by 1212:

12y=−5x+26  ⟹  5x+12y−26=012y = -5x + 26 \implies 5x + 12y - 26 = 0

Here A=5A = 5, B=12B = 12, C=−26C = -26.

Step 2: Apply the origin distance formula

d(O,Δ)=∣C∣A2+B2=∣−26∣52+122d(O, \Delta) = \frac{|C|}{\sqrt{A^2 + B^2}} = \frac{|-26|}{\sqrt{5^2 + 12^2}}

Step 3: Simplify

d(O,Δ)=2625+144=26169=2613=2d(O, \Delta) = \frac{26}{\sqrt{25 + 144}} = \frac{26}{\sqrt{169}} = \frac{26}{13} = 2

Final Answer:

d(O,Δ)=2d(O, \Delta) = 2

Example 3: Distance Between Parallel Lines

Problem: Find the distance between the two parallel lines:

Δ1:4x−3y+15=0andΔ2:8x−6y−20=0\Delta_1: 4x - 3y + 15 = 0 \quad \text{and} \quad \Delta_2: 8x - 6y - 20 = 0

Step 1: Normalize coefficients to match Notice the coefficients of Δ2\Delta_2 are twice those of Δ1\Delta_1:

8x−6y−20=0→÷24x−3y−10=08x - 6y - 20 = 0 \xrightarrow{\div 2} 4x - 3y - 10 = 0

Now both lines share A=4A = 4 and B=−3B = -3:

  • For Δ1\Delta_1: C1=15C_1 = 15
  • For Δ2\Delta_2: C2=−10C_2 = -10

Step 2: Apply parallel line distance formula

d(Δ1,Δ2)=∣C1−C2∣A2+B2=∣15−(−10)∣42+(−3)2d(\Delta_1, \Delta_2) = \frac{|C_1 - C_2|}{\sqrt{A^2 + B^2}} = \frac{|15 - (-10)|}{\sqrt{4^2 + (-3)^2}}

Step 3: Evaluate

d(Δ1,Δ2)=∣15+10∣16+9=2525=255=5d(\Delta_1, \Delta_2) = \frac{|15 + 10|}{\sqrt{16 + 9}} = \frac{25}{\sqrt{25}} = \frac{25}{5} = 5

Final Answer:

d(Δ1,Δ2)=5d(\Delta_1, \Delta_2) = 5

4. Common Mistakes & Paper Traps

[!WARNING]

  1. Dropping the Absolute Value Bars: Evaluating Ax0+By0+C=−15Ax_0 + By_0 + C = -15 and reporting d=−155=−3d = -\frac{15}{5} = -3. Distance is a geometric length and is strictly non-negative (d≥0d \ge 0).
  2. Using Slope-Intercept Directly: Plugging mm and bb into the formula without rearranging into Ax+By+C=0Ax + By + C = 0.
    • For y=2x+1y = 2x + 1, you must first write 2x−y+1=02x - y + 1 = 0, giving A=2,B=−1,C=1A = 2, B = -1, C = 1.
  3. Unmatched Parallel Coefficients: Computing ∣15−(−20)∣|15 - (-20)| between 4x−3y+15=04x - 3y + 15 = 0 and 8x−6y−20=08x - 6y - 20 = 0 directly. You must divide the second equation by 22 first so that AA and BB are identical!

5. Pencil & Paper Practice

Try these problems in your notebook:

Practice 1

Find the distance from point M(−1,4)M(-1, 4) to line Δ:5x+12y+9=0\Delta: 5x + 12y + 9 = 0.

Practice 2

Find the distance from point Q(3,2)Q(3, 2) to the vertical line x=−2x = -2.

Practice 3

Calculate the distance between parallel lines d1:3x+4y−8=0d_1: 3x + 4y - 8 = 0 and d2:3x+4y+12=0d_2: 3x + 4y + 12 = 0.


Worked Solutions

Solution to Practice 1:

  • Point (x0,y0)=(−1,4)(x_0, y_0) = (-1, 4).
  • Line 5x+12y+9=0  ⟹  A=5,B=12,C=95x + 12y + 9 = 0 \implies A = 5, B = 12, C = 9.
d=∣5(−1)+12(4)+9∣52+122=∣−5+48+9∣25+144=∣52∣169=5213=4d = \frac{|5(-1) + 12(4) + 9|}{\sqrt{5^2 + 12^2}} = \frac{|-5 + 48 + 9|}{\sqrt{25 + 144}} = \frac{|52|}{\sqrt{169}} = \frac{52}{13} = 4

Answer: d=4d = 4.


Solution to Practice 2:

  • Convert x=−2x = -2 to general form: 1x+0y+2=01x + 0y + 2 = 0.
d=∣1(3)+0(2)+2∣12+02=∣3+2∣1=5d = \frac{|1(3) + 0(2) + 2|}{\sqrt{1^2 + 0^2}} = \frac{|3 + 2|}{1} = 5

(Notice this matches the simple 1D horizontal difference: 3−(−2)=53 - (-2) = 5.) Answer: d=5d = 5.


Solution to Practice 3:

  • Both lines have A=3A = 3 and B=4B = 4.
  • Constants are C1=−8C_1 = -8 and C2=12C_2 = 12.
d=∣C1−C2∣A2+B2=∣−8−12∣32+42=∣−20∣9+16=2025=205=4d = \frac{|C_1 - C_2|}{\sqrt{A^2 + B^2}} = \frac{|-8 - 12|}{\sqrt{3^2 + 4^2}} = \frac{|-20|}{\sqrt{9 + 16}} = \frac{20}{\sqrt{25}} = \frac{20}{5} = 4

Answer: d=4d = 4.


Test yourself

What is the distance from point M(0,0)M(0, 0) to the line 3x−4y+15=03x - 4y + 15 = 0?

  1. 33
  2. 55
  3. −3-3
  4. 157\frac{15}{7}

What happens when you calculate d(M,Δ)d(M, \Delta) and the numerator Ax0+By0+C=0Ax_0 + By_0 + C = 0?

  1. The distance is undefined.
  2. The line is vertical.
  3. The point MM lies directly on the line Δ\Delta.
  4. The point MM is at the origin.

What is the distance between the parallel lines x−2y+4=0x - 2y + 4 = 0 and x−2y−6=0x - 2y - 6 = 0?

  1. 5\sqrt{5}
  2. 252\sqrt{5}
  3. 103\frac{10}{3}
  4. 1010