Associated Topics || Dr. Math Home || Search Dr. Math

### Distance from a Point to a Line

```
Date: 08/20/99 at 11:35:31
From: Carolyn Gallagher
Subject: Deriving the formula for distance from a point to a line

I am a math teacher in Ontario, Canada looking for a straightforward
way to derive the formula for the distance from a point to a line

abs(Ax + By + C)/sqrt(A^2+B^2) = D

Sorry about the form, but you probably get the general idea.

This topic is in the new curriculum for tenth grade mathematics as
part of the analytic geometry strand.

I know that it is easy enough to show specific cases given the point
and the equation of the line, but how do I explain the equation to
such a young audience?

Carolyn
```

```
Date: 08/20/99 at 14:15:47
From: Doctor Anthony
Subject: Re: Deriving the formula for distance from a point to a line

If the equation of the straight line is ax + by + c = 0, and (h,k) is
the point from which we require the perpendicular distance, we can
prove the result as follows.

Assume the line has positive slope and lies in the first quadrant in a
convenient position.  Let (h,k) be a point in the first quadrant below
the given line but with k greater than the y coordinate where the
given line cuts the y axis. This diagram will avoid unnecessary
complications in explaining the geometry.

Draw the perpendicular from P(h,k) to the line.  Let the foot of this
perpendicular be point N. Draw a horizontal line from P to meet the
given line at M. If theta is the angle of slope of the given line then
the perpendicular PN is given by PM*sin(theta).

The x coordinate of M is found by putting y = k in the equation

ax + by + c = 0

ax + bk + c = 0   so   ax = -(bk+c)    x = -(bk+c)/a

Therefore PM =  h - [-(bk+c)/a]

=  [ah + bk + c]/a

Now tan(theta) = -(a/b) from equation of line.

Then from Pythagoras

/|
/ |
/  | a         hypotenuse = sqrt(a^2+b^2)
/   |
/    |           sin(theta) = a/sqrt(a^2+b^2)
/_____|
b

and so   PM.sin(theta) = [ah+bk+c]/a * a/sqrt(a^2+b^2)

PN = [ak+bk+c]/sqrt(a^2+b^2)

So the perpendicular distance from (h,k) to the line ax + by + c = 0
is given by

ah + by + c
-------------
sqrt(a^2+b^2)

If this result is positive the point (h,k) is on the same side of the
given line as the origin. If the answer is negative then (h,k) is on
the opposite side of the line from the origin. This can be used as a
check to see on which side of a line a given point lies.

- Doctor Anthony, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Euclidean/Plane Geometry
High School Geometry

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search