Distance Between a Point and a Line
The distance from a point to a line is the length of the shortest segment connecting them, which is always perpendicular to the line. This distance is given by a compact formula involving the line's equation and the point's coordinates.
Quick Reference
| Formula | Description |
|---|---|
| d = \dfrac{\lvert ax_0 + by_0 + c \rvert}{\sqrt{a^2 + b^2}} | Distance from (x_0, y_0) to the line ax + by + c = 0 |
The Distance Formula
Point-to-Line Distance Theorem
The perpendicular distance from the point P(x_0, y_0) to the line L with equation ax + by + c = 0 is:
d = \frac{|ax_0 + by_0 + c|}{\sqrt{a^2 + b^2}}The absolute value in the numerator ensures the distance is always non-negative, regardless of which side of the line the point lies on. The denominator \sqrt{a^2 + b^2} is the length of the normal vector (a, b) to the line.

Proof (click to expand)
Drop a perpendicular from P(x_0, y_0) to L and call the foot Q(x_1, y_1). Since the slope of L is -\dfrac{a}{b}, the perpendicular L_1 through P has slope \dfrac{b}{a}, giving:
y - y_0 = \frac{b}{a}(x - x_0).Since Q(x_1, y_1) lies on L_1:
y_1 - y_0 = \frac{b}{a}(x_1 - x_0) \implies \frac{y_1 - y_0}{b} = \frac{x_1 - x_0}{a}.Let r denote this common ratio. Then x_1 - x_0 = ar and y_1 - y_0 = br. The distance is:
d = |PQ| = \sqrt{(ar)^2 + (br)^2} = \sqrt{a^2 + b^2}\,|r|.To find r, use the fact that Q(x_1, y_1) satisfies ax_1 + by_1 + c = 0. Substituting x_1 = ar + x_0 and y_1 = br + y_0:
a(ar + x_0) + b(br + y_0) + c = 0 \implies (a^2 + b^2)r = -(ax_0 + by_0 + c),so r = -\dfrac{ax_0 + by_0 + c}{a^2 + b^2}. Therefore:
d = \sqrt{a^2+b^2}\cdot\frac{|ax_0+by_0+c|}{a^2+b^2} = \frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}. \quad \squareNote: The proof above assumes a \neq 0 and b \neq 0, but the formula remains valid when either a = 0 or b = 0.
How to Apply the Formula
Step-by-Step Procedure
- Rewrite the line equation in the form ax + by + c = 0 (move all terms to one side).
- Identify a, b, c, and the point (x_0, y_0).
- Substitute into d = \dfrac{|ax_0 + by_0 + c|}{\sqrt{a^2 + b^2}}.
- Simplify. Rationalize the denominator if needed.
Worked Examples
Example 1. Find the distance between the point (3, -1) and the line y = 2x - 1.
Solution. Rewrite the line equation:
y = 2x - 1 \implies 2x - y - 1 = 0.Here a = 2, b = -1, c = -1, x_0 = 3, y_0 = -1:
d = \frac{|2(3) + (-1)(-1) + (-1)|}{\sqrt{2^2 + (-1)^2}} = \frac{|6 + 1 - 1|}{\sqrt{5}} = \frac{6}{\sqrt{5}} = \frac{6\sqrt{5}}{5}.Example 2. Find the distance between the parallel lines 3x - 4y + 10 = 0 and 3x - 4y - 5 = 0.
Solution. Since the two lines have equal slopes, the distance between them is constant. Choose any convenient point on the second line. Setting x = 3:
3(3) - 4y - 5 = 0 \implies 4 = 4y \implies y = 1.So $(3, 1)$ lies on the second line. Now apply the formula with the first line 3x - 4y + 10 = 0, where a = 3, b = -4, c = 10, x_0 = 3, y_0 = 1:
d = \frac{|3(3) - 4(1) + 10|}{\sqrt{3^2 + (-4)^2}} = \frac{|9 - 4 + 10|}{\sqrt{9 + 16}} = \frac{15}{5} = 3.The distance between the two parallel lines is $3$.
Frequently Asked Questions
Why is the distance formula measured perpendicularly?
The perpendicular distance is the shortest distance from a point to a line. Any other path from the point to the line is longer than the perpendicular segment. This makes the perpendicular distance the natural and most meaningful measure of how far the point is from the line.
How do I rewrite a line equation in the form ax + by + c = 0?
Move all terms to one side of the equation. For example:- y = 3x - 5 becomes 3x - y - 5 = 0 (so a = 3, b = -1, c = -5).
- 2x + 3y = 7 becomes 2x + 3y - 7 = 0 (so a = 2, b = 3, c = -7).