TExcelTAD
Home › Coordinate Geometry: 2D & 3D Cartesian Systems › Distance from a Point to a Line and Distance Between Parallel Lines in R²

Distance from a Point to a Line and Distance Between Parallel Lines in R2\mathbb{R}^2

In geometry, the distance from a point to a line is defined as the shortest path connecting them—which is always the length of the perpendicular line segment dropped from the point onto the line.

In this lesson, we derive the exact formula for the perpendicular distance from any point P(x0,y0)P(x_0, y_0) to a general line Ax+By+C=0Ax + By + C = 0, and extend it to determine the separation between two parallel lines.


1. Perpendicular Distance Formula

For any point P(x0,y0)P(x_0, y_0) and any straight line LL defined by the general linear equation:

Ax+By+C=0(A2+B2≠0)Ax + By + C = 0 \quad (A^2 + B^2 \neq 0)

The perpendicular distance dd from point PP to line LL is:

d=∣Ax0+By0+C∣A2+B2d = \frac{|A x_0 + B y_0 + C|}{\sqrt{A^2 + B^2}}
x y L: Ax + By + C = 0 P(x_0, y_0) Q (foot) d

2. Derivation on Paper

A vector normal (perpendicular) to the line Ax+By+C=0Ax + By + C = 0 is:

n⃗=(AB)\vec{n} = \begin{pmatrix} A \\ B \end{pmatrix}

The line passing through P(x0,y0)P(x_0, y_0) perpendicular to LL has parametric equation:

{x=x0+Aty=y0+Bt\begin{cases} x = x_0 + A t \\ y = y_0 + B t \end{cases}

Let the foot of the perpendicular on LL be Q(x0+At,y0+Bt)Q(x_0 + At, y_0 + Bt). Because QQ lies on LL, its coordinates satisfy Ax+By+C=0Ax + By + C = 0:

A(x0+At)+B(y0+Bt)+C=0(Ax0+By0+C)+(A2+B2)t=0t=−Ax0+By0+CA2+B2\begin{aligned} A(x_0 + At) + B(y_0 + Bt) + C &= 0 \\ (A x_0 + B y_0 + C) + (A^2 + B^2)t &= 0 \\ t &= -\frac{A x_0 + B y_0 + C}{A^2 + B^2} \end{aligned}

The distance dd is the length of segment PQPQ:

d=∥PQ⃗∥=(At)2+(Bt)2=(A2+B2)t2=∣t∣A2+B2=∣−Ax0+By0+CA2+B2∣A2+B2=∣Ax0+By0+C∣A2+B2\begin{aligned} d = \|\vec{PQ}\| &= \sqrt{(At)^2 + (Bt)^2} \\ &= \sqrt{(A^2 + B^2)t^2} \\ &= |t| \sqrt{A^2 + B^2} \\ &= \left| -\frac{A x_0 + B y_0 + C}{A^2 + B^2} \right| \sqrt{A^2 + B^2} \\ &= \frac{|A x_0 + B y_0 + C|}{\sqrt{A^2 + B^2}} \end{aligned}

3. Distance Between Two Parallel Lines

Two parallel lines share identical slopes and therefore can be written with matching coefficients AA and BB:

L1:Ax+By+C1=0L2:Ax+By+C2=0\begin{aligned} L_1: &\quad A x + B y + C_1 = 0 \\ L_2: &\quad A x + B y + C_2 = 0 \end{aligned}
L_1: Ax + By + C_1 = 0 L_2: Ax + By + C_2 = 0 d = |C_1 − C_2| / √(A^2 + B^2)

Pick any arbitrary point P(x1,y1)P(x_1, y_1) on line L1L_1. Because PP lies on L1L_1:

Ax1+By1+C1=0  ⟹  Ax1+By1=−C1A x_1 + B y_1 + C_1 = 0 \implies A x_1 + B y_1 = -C_1

The perpendicular distance from PP to line L2L_2 is:

d=∣Ax1+By1+C2∣A2+B2=∣−C1+C2∣A2+B2=∣C1−C2∣A2+B2d = \frac{|A x_1 + B y_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}}
d=∣C1−C2∣A2+B2d = \frac{|C_1 - C_2|}{\sqrt{A^2 + B^2}}

Crucial Prerequisite: Before applying this formula, you MUST ensure that the coefficients of xx and yy are completely identical in both equations. If one line has 2x+4y2x + 4y and the other has x+2yx + 2y, scale one of the equations first!


4. Step-by-Step Paper Notebook Method

Point-to-Line Distance:1. Write line in general form: Ax+By+C=0.2. Substitute point (x0,y0) into LHS: evaluate N=Ax0+By0+C.3. Calculate denominator D=A2+B2.4. The distance is d=∣N∣D. Simplify the radical.Parallel Lines Distance:1. Scale equations so A1=A2=A and B1=B2=B.2. Subtract constants: ∣C1−C2∣.3. Divide by A2+B2.\begin{aligned} \text{\bf Point-to-Line Distance:} &\quad \text{1. Write line in general form: } Ax + By + C = 0. \\ &\quad \text{2. Substitute point } (x_0, y_0) \text{ into LHS: evaluate } N = Ax_0 + By_0 + C. \\ &\quad \text{3. Calculate denominator } D = \sqrt{A^2 + B^2}. \\ &\quad \text{4. The distance is } d = \frac{|N|}{D}. \text{ Simplify the radical.} \\ \text{\bf Parallel Lines Distance:} &\quad \text{1. Scale equations so } A_1 = A_2 = A \text{ and } B_1 = B_2 = B. \\ &\quad \text{2. Subtract constants: } |C_1 - C_2|. \\ &\quad \text{3. Divide by } \sqrt{A^2 + B^2}. \end{aligned}

5. Comprehensive Worked Examples

Example 1: Perpendicular Distance from a Point

Problem Statement: Find the perpendicular distance from point P(2,−3)P(2, -3) to the line 3x−4y+7=03x - 4y + 7 = 0.

Step-by-Step Solution:

  • Step 1: Identify coefficients and coordinates

    A=3,B=−4,C=7,x0=2,y0=−3A = 3, \quad B = -4, \quad C = 7, \quad x_0 = 2, \quad y_0 = -3
  • Step 2: Evaluate the numerator

    Ax0+By0+C=3(2)+(−4)(−3)+7=6+12+7=25\begin{aligned} A x_0 + B y_0 + C &= 3(2) + (-4)(-3) + 7 \\ &= 6 + 12 + 7 = 25 \end{aligned}
  • Step 3: Evaluate 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: Compute the distance

    d=∣25∣5=5 unitsd = \frac{|25|}{5} = 5\text{ units}

The perpendicular distance is 5 units5\text{ units}.


Example 2: Distance Between Parallel Lines Requiring Rescaling

Problem Statement: Calculate the perpendicular distance between the parallel lines:

L1:3x−4y+9=0andL2:6x−8y−7=0L_1: 3x - 4y + 9 = 0 \quad \text{and} \quad L_2: 6x - 8y - 7 = 0

Step-by-Step Solution:

  • Step 1: Inspect coefficients Line L1L_1 has (A,B)=(3,−4)(A, B) = (3, -4), while line L2L_2 has (A,B)=(6,−8)(A, B) = (6, -8). We must scale line L1L_1 by multiplying all terms by 22:

    2×(3x−4y+9=0)  ⟹  6x−8y+18=02 \times (3x - 4y + 9 = 0) \implies 6x - 8y + 18 = 0
  • Step 2: Identify matching parameters Now both lines have A=6A = 6 and B=−8B = -8:

    C1=18andC2=−7C_1 = 18 \quad \text{and} \quad C_2 = -7
  • Step 3: Apply the parallel lines formula

    d=∣C1−C2∣A2+B2=∣18−(−7)∣62+(−8)2=∣18+7∣36+64=25100=2510=52=2.5 units\begin{aligned} d &= \frac{|C_1 - C_2|}{\sqrt{A^2 + B^2}} \\ &= \frac{|18 - (-7)|}{\sqrt{6^2 + (-8)^2}} \\ &= \frac{|18 + 7|}{\sqrt{36 + 64}} \\ &= \frac{25}{\sqrt{100}} = \frac{25}{10} = \frac{5}{2} = 2.5\text{ units} \end{aligned}

The distance between the parallel lines is 2.5 units2.5\text{ units} (or 52 units\frac{5}{2}\text{ units}).


Example 3: Finding Points on an Axis at a Given Distance

Problem Statement: Find the coordinates of the points on the xx-axis whose perpendicular distance from the line x3+y4=1\frac{x}{3} + \frac{y}{4} = 1 is 4 units4\text{ units}.

Step-by-Step Solution:

  • Step 1: Convert line equation to general form Multiply by 1212:

    12(x3)+12(y4)=12(1)  ⟹  4x+3y−12=012\left(\frac{x}{3}\right) + 12\left(\frac{y}{4}\right) = 12(1) \implies 4x + 3y - 12 = 0

    Here A=4A = 4, B=3B = 3, C=−12C = -12.

  • Step 2: Set up equation with a point on the xx-axis Any point on the xx-axis has coordinates P(x0,0)P(x_0, 0).

    d=∣4(x0)+3(0)−12∣42+32=∣4x0−12∣25=∣4x0−12∣5d = \frac{|4(x_0) + 3(0) - 12|}{\sqrt{4^2 + 3^2}} = \frac{|4x_0 - 12|}{\sqrt{25}} = \frac{|4x_0 - 12|}{5}
  • Step 3: Equate to distance 44 and solve

    ∣4x0−12∣5=4∣4x0−12∣=20\begin{aligned} \frac{|4x_0 - 12|}{5} &= 4 \\ |4x_0 - 12| &= 20 \end{aligned}

    This yields two cases:

    • Case 1:
      4x0−12=20  ⟹  4x0=32  ⟹  x0=84x_0 - 12 = 20 \implies 4x_0 = 32 \implies x_0 = 8
    • Case 2:
      4x0−12=−20  ⟹  4x0=−8  ⟹  x0=−24x_0 - 12 = -20 \implies 4x_0 = -8 \implies x_0 = -2

The two points on the xx-axis are (8,0)(8, 0) and (−2,0)(-2, 0).


6. Common Mistakes & Paper Traps

  1. Forgetting Absolute Value in Numerator: Calculating Ax0+By0+C=−15Ax_0 + By_0 + C = -15 and reporting a distance of −3-3. Distance is strictly a non-negative geometric measure: ∣−15∣=15|-15| = 15.
  2. Applying Parallel Line Formula Without Matching Coefficients: Directly computing ∣9−(−7)∣32+42\frac{|9 - (-7)|}{\sqrt{3^2 + 4^2}} without multiplying L1L_1 by 22 produces a completely false result.
  3. Not Converting to General Form First: Using the formula on y=mx+cy = mx + c without moving everything to one side (mx−y+c=0mx - y + c = 0) causes sign errors in the constant term.
  4. Distance to Origin Simplification: The distance from the origin (0,0)(0, 0) to Ax+By+C=0Ax + By + C = 0 simplifies directly to:
    dO=∣C∣A2+B2d_O = \frac{|C|}{\sqrt{A^2 + B^2}}

7. Pencil & Paper Practice

  1. Problem 1: Find the distance from the origin O(0,0)O(0, 0) to the line 5x+12y−26=05x + 12y - 26 = 0.
  2. Problem 2: Find the distance between the parallel lines 4x+3y−11=04x + 3y - 11 = 0 and 4x+3y+14=04x + 3y + 14 = 0.
  3. Problem 3: Show that the point (1,−2)(1, -2) lies on the line 3x+4y+5=03x + 4y + 5 = 0 by computing its perpendicular distance.

Worked Solutions

  • Solution 1:

    d=∣5(0)+12(0)−26∣52+122=∣−26∣25+144=26169=2613=2 unitsd = \frac{|5(0) + 12(0) - 26|}{\sqrt{5^2 + 12^2}} = \frac{|-26|}{\sqrt{25 + 144}} = \frac{26}{\sqrt{169}} = \frac{26}{13} = 2\text{ units}
  • Solution 2: Coefficients are already matched: A=4,B=3,C1=−11,C2=14A = 4, B = 3, C_1 = -11, C_2 = 14.

    d=∣−11−14∣42+32=∣−25∣25=255=5 unitsd = \frac{|-11 - 14|}{\sqrt{4^2 + 3^2}} = \frac{|-25|}{\sqrt{25}} = \frac{25}{5} = 5\text{ units}
  • Solution 3: Substitute (1,−2)(1, -2) into the distance formula:

    d=∣3(1)+4(−2)+5∣32+42=∣3−8+5∣5=∣0∣5=0 unitsd = \frac{|3(1) + 4(-2) + 5|}{\sqrt{3^2 + 4^2}} = \frac{|3 - 8 + 5|}{5} = \frac{|0|}{5} = 0\text{ units}

    Since the perpendicular distance from the point to the line is 00, the point lies directly on the line.


Test yourself

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

  1. 3 units
  2. 5 units
  3. 15 units
  4. 157\frac{15}{7} units

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

  1. 2 units
  2. 5\sqrt{5} units
  3. 252\sqrt{5} units
  4. 10 units

Before applying the formula d=∣C1−C2∣A2+B2d = \frac{|C_1 - C_2|}{\sqrt{A^2 + B^2}} to find the distance between two parallel lines, what condition must be met?

  1. Both lines must pass through the origin
  2. The constants C1C_1 and C2C_2 must be positive
  3. The coefficients AA and BB must be identical in both equations
  4. The slopes must multiply to −1-1