letx=

Coordinate geometry

Distance from a point to a line

The shortest distance from a point (x0,y0) to the line ax+by+c=0, measured along the perpendicular.

d=|ax0+by0+c|a2+b2

Calculator

The live calculator needs JavaScript. The worked example below shows the same steps it would.

See it move

−12−10−8−6−4−224681012−6−4−2246P
  • Line: 3x + 4y − 10 = 0
  • Shortest distance d ≈ 5.8, along the perpendicular to the foot (1.52, 1.36)

What the symbols mean

d
the shortest (perpendicular) distance
a
the coefficient of x in the line's equation
b
the coefficient of y
c
the constant term (with the equation arranged to equal 0)
x0
the x-coordinate of the point
y0
the y-coordinate of the point

When to use it

Use it for the gap between a point and a line, the height of a triangle drawn on a grid, the distance between two parallel lines (pick a point on one), and to test whether a line is tangent to a circle: it is when the distance from the centre to the line equals the radius. Rearrange the line to ax+by+c=0 first, so y=2x+3 becomes 2x−y+3=0.

Worked example

How far is the point (5, 6) from the line 3x + 4y − 10 = 0? Here a = 3, b = 4 and c = −10.

  1. Start from the formula.

    d=|a⁢x0+b⁢y0+c|a2+b2
  2. Substitute a = 3, b = 4, c = −10, x0 = 5, y0 = 6 and work it out.

    d=|3·5+4·6+(−10)|32+42
    =|15+24+(−10)|9+16
    =|39+(−10)|25
    =|29|5
    =295
    =5.8
  3. The closest point on the line (the foot of the perpendicular) is (1.52,1.36).

Answer d = 5.8

Why it works

The vector (a, b) is perpendicular to the line. Putting the point into ax+by+c measures how far along that direction the point is from the line, scaled by the length a2+b2; dividing removes the scale, and the absolute value makes the distance positive on either side.

Common mistakes

  • Using the line in the form y=mx+b without rearranging to ax+by+c=0.
  • Dropping the absolute value and reporting a negative distance.
  • Dividing by a2+b2 instead of its square root.