data-ad-format="horizontal">



 
Distance from a point to a line (Coordinate Geometry)
Method 1: When the line is vertical or horizontal
 
The distance from a point to a vertical or horizontal line can be found by the simple difference of coordinates
Try this Drag the point C, or the line using the orange dot on it. Note the distance from the point to the line. You can also drag the origin point at (0,0).

Finding the distance from a point to a line is easy if the line is vertical or horizontal. We simply find the difference between the appropriate coordinates of the point and the line. In fact, for vertical lines, this is the only way to do it, since the other methods require the slope of the line, which is undefined for vertical lines. For more on this see Slope of a line (Coordinate Geometry)

Vertical lines

In the figure above, click on 'reset'. As you can see we have a vertical line whose equation is x=22. This means that all points of the line have an x-coordinate of 22. The given point C has coordinates of (42,7) which means it has a x-coordinate of 42. The distance between the point and line is therefore the difference between 22 and 42, or 20.

As a formula:

distance = | Px - Lx | Where:
Px is the x-coordinate of the given point P
Lx is the x-coordinate of any point on the given vertical line L.
| | the vertical bars mean "absolute value" - make it positive even if it calculates to a negative.

Example:

Here, we see how to use this method to calculate the distances in the figure above.
  • In the figure above click on 'reset'.
  • Drag the point C to left, past the y-axis, until is has the coordinates of (-10,15).
  • The line has an x-coordinate of 22.
  • The point C has a x-coordinate of -10.
  • The distance from C to the line is therefore
    |-10-22 | = 32


Horizontal lines

In the figure above, click on 'reset', then 'horizontal'. As you can see we have a horizontal line whose equation is y=25. This means that all points of the line have a y-coordinate of 25. The given point C has coordinates of (39,7) which means it has a y-coordinate of 7. The distance between the point and line is therefore the difference between 25 and 7, or 18.

As a formula:

distance = | Py - Ly | Where:
Py is the y-coordinate of the given point P
Ly is the y-coordinate of any point on the given vertical line L.
| | the vertical bars mean "absolute value" - make it positive even if it calculates to a negative.

Example:

Here, we see how to use this method to calculate the distances in the figure above.
  • In the figure above click on 'reset', then 'horizontal'
  • Drag the point C to down, past the x-axis, until is has the coordinates (40,-6).
  • The line has a y-coordinate of 25.
  • The point C has a y-coordinate of -6.
  • The distance from C to the line is therefore
    | -6-25 | = 31

Things to try

Test your understanding of this method by doing the following:
  1. In the figure above, click 'reset', and 'hide details'
  2. Drag the point C to any location and drag the orange dot on the line to any location.
  3. Calculate the distance from the point to the line.
  4. Click on 'show details' to see how you did.
  5. Click on 'horizontal' and repeat.

Other methods

This is one way to find the distance from a point to a line. Others are:

Limitations

In the interest of clarity in the applet above, the coordinates are rounded off to integers and the lengths rounded to one decimal place. This can cause calculatioons to be slightly off.

For more see Teaching Notes

Other Coordinate Geometry topics