

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 xcoordinate of 22.
The given point C has coordinates of (42,7) which means it has a xcoordinate of 42.
The distance between the point and line is therefore the difference between 22 and 42, or 20.
As a formula:
distance =  P_{x}  L_{x} 

Where:
P_{x} 
is the xcoordinate of the given point P 
L_{x} 
is the xcoordinate 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 yaxis, until is has the coordinates of (10,15).
 The line has an xcoordinate of 22.
 The point C has a xcoordinate of 10.
 The distance from C to the line is therefore
1022  = 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 ycoordinate of 25.
The given point C has coordinates of (39,7) which means it has a ycoordinate of 7.
The distance between the point and line is therefore the difference between 25 and 7, or 18.
As a formula:
distance =  P_{y}  L_{y} 

Where:
P_{y} 
is the ycoordinate of the given point P 
L_{y} 
is the ycoordinate 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 xaxis, until is has the coordinates (40,6).
 The line has a ycoordinate of 25.
 The point C has a ycoordinate of 6.
 The distance from C to the line is therefore
 625  = 31
Things to try
Test your understanding of this method by doing the following:
 In the figure above, click 'reset', and 'hide details'
 Drag the point C to any location and drag the orange dot on the line to any location.
 Calculate the distance from the point to the line.
 Click on 'show details' to see how you did.
 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
While you are here..
... I have a small favor to ask. Over the years we have used advertising to support the site so it can remain free for everyone.
However, advertising revenue is falling and I have always hated the ads. So, would you go to Patreon and become a patron of the site?
When we reach the goal I will remove all advertising from the site.
It only takes a minute and any amount would be greatly appreciated.
Thank you for considering it! – John Page
Become a patron of the site at patreon.com/mathopenref
Other Coordinate Geometry topics
(C) 2011 Copyright Math Open Reference. All rights reserved

