The distance from a point to an infinite straight line is the length of the perpendicular segment from the point to the line. A horizontal or vertical gap gives that distance only when it happens to be perpendicular.
There are two useful methods. You can find the perpendicular foot and apply the point-to-point distance formula, or use a direct formula involving the line’s coefficients. Both describe the same geometric length.
On this page
Why the shortest segment is perpendicular
Let be the point and let be its perpendicular foot on the line. For any other point on the line, triangle is right-angled at , so
Equality occurs at . Therefore is the shortest distance. If already lies on the line, the distance is zero.
The perpendicular foot gives the shortest distance
Diagram explanation and exact data
H satisfies both y = x + 2 and the perpendicular y = −x + 5. The dashed P-to-Q segment is not perpendicular and is longer.
| Point or segment | Exact data |
|---|---|
| P | |
| H | |
| Q | |
| PH | |
| PQ |
Worked example by finding the foot
Find the distance from to the line . The line has slope 1, so the perpendicular through has slope :
At the intersection,
Then , giving .
Apply the distance formula:
The point is also on the line, but its vertical distance of 3 from is longer. The perpendicular distance is approximately 2.121 units.
Direct point-to-line formula
Write the line as
For , the distance is
The absolute value makes the result non-negative. The denominator accounts for the size of the normal vector . A derivation using the normal direction is given in Wolfram MathWorld’s point-line distance reference.
For , use . Hence , and :
This agrees with the foot method. Be careful about signs: when a line is initially written , move to the left, so the formula’s constant is .
Why rescaling the line equation changes nothing
Multiplying the entire line equation by a non-zero constant gives the same line. In the distance formula, the numerator is multiplied by , and so is the denominator:
The factors cancel. This is why and give the same distance. Multiplying only some terms would not preserve the line.
Another example and the perpendicular foot formula
Find the distance from the origin to :
The foot can also be obtained without solving a second line equation. Define
Then the foot is
In this example , so . It lies on the line because , and its distance from the origin is 4.
Vertical lines, horizontal lines and parallel lines
For a vertical line , the distance from is . For a horizontal line , it is . Both follow directly from the general formula.
For parallel lines written with identical coefficients,
the distance between them is . Normalize the coefficients first; subtracting the constants of differently scaled equations is not valid.
A segment is not an infinite line
If the perpendicular foot lies outside a specified segment, the nearest point on that segment is an endpoint, not the foot on its infinite extension.
For example, consider and the horizontal segment from to . The distance to the infinite line is 2, but the foot is outside the segment. The nearest endpoint is , at distance .
Always identify whether the target is a line, ray or segment before choosing a distance method.
Practice questions
- Find the distance from to .
- Find the distance from to .
- Find the distance from to the vertical line .
Check your answers
- Write . The distance is units.
- Write . The distance is units.
- The perpendicular direction is horizontal, so the distance is units.
Related topics
Circles in Coordinate Geometry compares the distance of a line from a centre with a radius. Parabolas uses equality of point-to-point and point-to-line distances to define a curve.
