Geometry · Grades 10, 11

The Distance from a Point to a Line

Quick answer

The distance from a point to a line is the length of the shortest path, which meets the line at a right angle. For the line ax + by + c = 0 and the point (x₀, y₀), it is |ax₀ + by₀ + c| / √(a² + b²). So the point (1, 2) is |3 + 8 − 1| / 5 = 2 units from 3x + 4y − 1 = 0. The same formula gives the distance between two parallel lines, and the height of a triangle drawn on a grid.

What you'll learn

  • Explain why the shortest distance is perpendicular
  • Write a line in the form ax + by + c = 0
  • Apply the point-to-line distance formula
  • Find the distance between parallel lines

The shortest path is perpendicular

From a point to a line there are many paths, but the shortest one meets the line at a right angle. Its length is the distance from the point to the line. For a line written as ax+by+c=0ax + by + c = 0 and a point (x0,y0)(x_0, y_0):

d=∣ax0+by0+c∣a2+b2d = \frac{|ax_0 + by_0 + c|}{\sqrt{a^2 + b^2}}
The distance from (1, 2) to 3x + 4y − 1 = 0 The line 3x + 4y − 1 = 0, falling from upper left to lower right, and the point (1, 2) above it. A dashed segment runs from the point to the line at a right angle, meeting it at (−0.2, 0.4). Its length is 2. −3−2−11234−2−11234xy (1, 2) (−0.2, 0.4)
  • 3x + 4y − 1 = 0
The distance from (1, 2) to 3x + 4y − 1 = 0

Why any other path is longer

Drop the perpendicular from the point PP to the line, meeting it at FF. Any other point QQ on the line makes a right triangle PFQPFQ with the right angle at FF. The path PQPQ is the hypotenuse of that triangle, and a hypotenuse is always longer than a leg, so PFPF is the shortest. The formula computes PFPF: the vector (a,b)(a, b) points straight across the line, and the expression ax0+by0+cax_0 + by_0 + c measures how far PP is from the line in that direction, in units of a2+b2\sqrt{a^2 + b^2}.

Worked examples

Common mistakes

Practice problems

  1. Find the distance from (3,4)(3, 4) to the xx-axis.

    Answer

    44

    Full solution

    The xx-axis is y=0y = 0, so d=∣4∣1d = \tfrac{|4|}{1}.

  2. Find the distance from (5,0)(5, 0) to 5x+12y=05x + 12y = 0.

    Answer

    2513\tfrac{25}{13}

    Full solution

    ∣25+0∣25+144=2513\tfrac{|25 + 0|}{\sqrt{25 + 144}} = \tfrac{25}{13}.

  3. Find the distance from (2,−1)(2, -1) to x−y+1=0x - y + 1 = 0.

    Answer

    222\sqrt{2}

    Full solution

    ∣2+1+1∣2=42\tfrac{|2 + 1 + 1|}{\sqrt{2}} = \tfrac{4}{\sqrt{2}}.

  4. Find the distance from (6,8)(6, 8) to 3x+4y=03x + 4y = 0.

    Answer

    1010

    Full solution

    ∣18+32∣5=10\tfrac{|18 + 32|}{5} = 10.

  5. Find the distance between y=x+1y = x + 1 and y=x−3y = x - 3.

    Answer

    222\sqrt{2}

    Full solution

    As x−y+1=0x - y + 1 = 0 and x−y−3=0x - y - 3 = 0: ∣1+3∣2\tfrac{|1 + 3|}{\sqrt{2}}.

  6. Find the distance from (4,1)(4, 1) to the line x=7x = 7.

    Answer

    33

    Full solution

    x−7=0x - 7 = 0 gives ∣4−7∣1\tfrac{|4 - 7|}{1}.

  7. A triangle has vertices (0,0)(0, 0), (6,0)(6, 0) and (2,5)(2, 5). Use the distance from (2,5)(2, 5) to the base to find its area.

    Answer

    1515

    Full solution

    The base lies on y=0y = 0, so the height is 55 and the area is 12⋅6⋅5\tfrac{1}{2} \cdot 6 \cdot 5.

  8. A student finds the distance from (0,0)(0, 0) to y=2x+5y = 2x + 5 as 55, the vertical distance. What is the true distance?

    Answer

    5\sqrt{5}

    Full solution

    The vertical path is not perpendicular to the line. The formula gives 55=5\tfrac{5}{\sqrt{5}} = \sqrt{5}.

Frequently asked questions

What is the distance from a point to a line?

The length of the shortest segment from the point to the line. That segment is perpendicular to the line.

What is the formula?

For the line ax + by + c = 0 and the point (x₀, y₀): d = |ax₀ + by₀ + c| / √(a² + b²).

What if the line is given as y = mx + b?

Rewrite it as mx − y + b = 0, so a = m, the y-coefficient is −1, and c = b.

How do I find the distance between two parallel lines?

Pick any point on one line and find its distance to the other. For ax + by + c₁ = 0 and ax + by + c₂ = 0, it is |c₁ − c₂| / √(a² + b²).

What does it mean if the numerator is 0?

The point lies on the line, so the distance is 0.

Standards alignment

This lesson covers the following Common Core State Standards for Mathematics.

  • CCSS.MATH.CONTENT.HSG.GPE.B.5Expressing Geometric Properties with EquationsProve the slope criteria for parallel and perpendicular lines and use them to solve geometric problems (e.g., find the equation of a line parallel or perpendicular to a given line that passes through a given point).