Mathwords logoReference LibraryMathwords

Distance from a Point to a Line

Distance from a Point to a Line

The length of the shortest segment from a given point to a given line. A formula is given below.

 

Diagram showing point P, line ℓ, and formula: distance = |Ax₀ + By₀ + C| / √(A² + B²)

 

 

See also

Standard form for the equation of a line

Key Formula

d=Ax0+By0+CA2+B2d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}
Where:
  • dd = The perpendicular distance from the point to the line
  • (x0,y0)(x_0, y_0) = The coordinates of the given point
  • AA = The coefficient of x in the line's standard form Ax + By + C = 0
  • BB = The coefficient of y in the line's standard form Ax + By + C = 0
  • CC = The constant term in the line's standard form Ax + By + C = 0

Worked Example

Problem: Find the distance from the point (2, 3) to the line 3x + 4y − 6 = 0.
Step 1: Identify A, B, C from the line equation and the point coordinates. The line is 3x + 4y − 6 = 0, so A = 3, B = 4, C = −6. The point is (x₀, y₀) = (2, 3).
A=3,B=4,C=6,(x0,y0)=(2,3)A = 3,\quad B = 4,\quad C = -6,\quad (x_0, y_0) = (2, 3)
Step 2: Substitute into the numerator of the formula: |Ax₀ + By₀ + C|.
3(2)+4(3)+(6)=6+126=12=12|3(2) + 4(3) + (-6)| = |6 + 12 - 6| = |12| = 12
Step 3: Compute the denominator: the square root of A² + B².
32+42=9+16=25=5\sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5
Step 4: Divide the numerator by the denominator to get the distance.
d=125=2.4d = \frac{12}{5} = 2.4
Answer: The distance from (2, 3) to the line 3x + 4y − 6 = 0 is 2.4 units.

Another Example

This example starts with the line in slope-intercept form (y = mx + b), so an extra conversion step to standard form is required before applying the formula.

Problem: Find the distance from the point (−1, 5) to the line y = 2x + 3.
Step 1: Convert the line equation from slope-intercept form to standard form Ax + By + C = 0. Rearrange y = 2x + 3 by subtracting y from both sides.
2xy+3=0A=2,  B=1,  C=32x - y + 3 = 0 \quad \Rightarrow \quad A = 2,\; B = -1,\; C = 3
Step 2: Substitute the point (−1, 5) into the numerator.
2(1)+(1)(5)+3=25+3=4=4|2(-1) + (-1)(5) + 3| = |-2 - 5 + 3| = |-4| = 4
Step 3: Compute the denominator.
22+(1)2=4+1=5\sqrt{2^2 + (-1)^2} = \sqrt{4 + 1} = \sqrt{5}
Step 4: Divide and rationalize the denominator if desired.
d=45=4551.789d = \frac{4}{\sqrt{5}} = \frac{4\sqrt{5}}{5} \approx 1.789
Answer: The distance is 4√5 / 5 ≈ 1.789 units.

Frequently Asked Questions

Why does the distance formula use absolute value in the numerator?
The expression Ax₀ + By₀ + C can be positive or negative depending on which side of the line the point lies. Distance is always non-negative, so the absolute value ensures you get a positive result regardless of the point's position relative to the line.
Why is the shortest distance from a point to a line always perpendicular?
Among all segments connecting a point to a line, the perpendicular segment is the shortest. This follows from the Pythagorean theorem: any non-perpendicular segment forms the hypotenuse of a right triangle with the perpendicular segment as one leg, making it necessarily longer.
How do you find the distance from a point to a line in 3D?
In three dimensions, you use a vector approach. If the line passes through a point Q with direction vector d, and your point is P, then the distance is |QP × d| / |d|, where × denotes the cross product. The standard-form formula only applies to lines in a 2D plane.

Distance from a Point to a Line vs. Distance Between Two Points

Distance from a Point to a LineDistance Between Two Points
DefinitionShortest (perpendicular) distance from a point to a lineStraight-line distance between two specific points
Formulad = |Ax₀ + By₀ + C| / √(A² + B²)d = √[(x₂−x₁)² + (y₂−y₁)²]
Inputs neededOne point and one line equationTwo points (four coordinates)
Result directionAlways perpendicular to the lineAlong the segment connecting the two points

Why It Matters

This formula appears frequently in coordinate geometry problems on standardized tests and in analytic geometry courses. It is essential for computing the height of a triangle when you know a vertex and the equation of the opposite side, which in turn lets you find area. Beyond the classroom, the concept is used in computer graphics, GPS systems, and engineering to measure how far an object is from a boundary or path.

Common Mistakes

Mistake: Forgetting to convert the line equation to standard form (Ax + By + C = 0) before applying the formula.
Correction: If the line is given as y = mx + b, first rewrite it as mx − y + b = 0 so you can correctly identify A, B, and C. Using the slope or intercept directly in the formula produces a wrong answer.
Mistake: Omitting the absolute value in the numerator and getting a negative distance.
Correction: Distance is always non-negative. The signed value Ax₀ + By₀ + C tells you which side of the line the point is on, but the distance requires taking its absolute value.

Related Terms