Distance from a point to a line (Coordinate Geometry)

The distance from a point to a line is the shortest distance between them - the length of a perpendicular line segment from the line to the point.
Try this Adjust the sliders to change the line equation and drag the point C. Note the distance from the point to the line. You can also drag the origin point at (0,0).

When we talk about the distance from a point to a line, we mean the shortest distance. If you draw a line segment that is perpendicular to the line and ends at the point, the length of that line segment is the distance we want. In the figure above, this is the distance from C to the line.

There are many ways to calculate this distance. In this volume, four methods are described:

Method 1. When the line is horizontal or vertical

If you are lucky and the line is either exactly horizontal or vertical (parallel to the x or y axis), then the distance is very easy to calculate.

Method 2. Using two line equations

From the equation of the given line we find the equation of the line perpendicular to it that passes through the given point. (Does not work for vertical lines.)

Method 3. Using trigonometry

The distance is found using trigonometry on the angles formed.

Method 4. By formula

Given the equation of the line in slope - intercept form, and the coordinates of the point, a formula yields the distance between them. (Does not work for vertical lines.)


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