The distance between a point and a line is defined to be the length of the perpendicular line segment connecting the point to the given line.
Let (x1,y1) be the point not on the line and let (x2,y2) be the point on the line.
To find the distance between the point (x1,y1) and the line with equation ax + bx + c = 0, you can use the formula below.
Example #1
Find the distance between a point and a line using the point (5,1) and the line y = 3x + 2.
Rewrite y = 3x + 2 as ax + by + c = 0
Using y = 3x + 2, subtract y from both sides.
y - y = 3x - y + 2
0 = 3x - y + 2
3x - y + 2 = 0
a = 3, b = -1, and c = 2
x1 = 5 and y1 = 1
Example #2
Find the distance between a point and a line using the point (-4,2) and the line y = -2x + 5.
Rewrite y = -2x + 5 as ax + by + c = 0
Using y = -2x + 5, subtract y from both sides.
y - y = -2x - y + 5
0 = -2x - y + 5
-2x - y + 5 = 0
a = -2, b = -1, and c = 5
x1 = -4 and y1 = 2
We can redo example #1 using the distance formula. To use the distance formula, we need two points. We already have (5,1) that is not located on the line y = 3x + 2.
We can just look for the point of intersection between y = 3x + 2 and the line that is perpendicular to y = 3x + 2 and passing through (5, 1)
The line that is perpendicular to y = 3x + 2 is given by y = (-1/3)x + b.
Use the point (5, 1) to find b by letting x = 5 and y = 1.
1 = (-1/3) × 5 + b
1 = -5/3 + b
b = 1 + 5/3 = 8/3
y = (-1/3)x + 8/3
Now, set the two equations equal to themselves
(-1/3)x + 8/3 = 3x + 2
3x + (1/3)x = 8/3 - 2
(10/3)x = (8 - 6)/3
(10/3)x = 2/3
x = (2/3) × 3/10 = 2/10 = 1/5
y = 3x + 2 = 3 × 1/5 + 2 = 3/5 + 2 = 13/5
The point of intersection between y = 3x + 2 and y = (-1/3)x + 8/3 is
(1/5, 13/5) or (0.25, 2.6)
Find the distance using the points (5,1) and (0.25, 2.6).
To derive the formula at the beginning of the lesson that helps us to find the distance between a point and a line, we can use the distance formula and follow a procedure similar to the one we followed in the last section when the answer for d was 5.01.
Hang in there tight. Deriving the distance between a point and a line is among of the toughest things you have ever done in life.
The steps to take to find the formula are outlined below.
1) Write the equation ax + by + c = 0 in slope-intercept form.
2) Use (x1, y1) to find the equation that is perpendicular to ax + by + c = 0
3) Set the two equations equal to each other to find expressions for the points of intersection (x2, y2)
4) Use the distance formula, (x1, y1), and the expressions found in step 3 for (x2, y2) to derive the formula.
1)
ax + by + c = 0
ax - ax + by + c = -ax
by + c = -ax
by + c - c = -ax - c
by = -ax - c
y = -ax/b - c/b
y = (-a/b)x - c/b
2) The line that is perpendicular to y = (-a/b)x - c/b can be written as
y = (b/a)x + y-intercept
Use (x1, y1) to find y-intercept
y1 = (b/a)x1 + y-intercept
y-intercept = y1- (b/a)x1
y = (b/a)x + y1- (b/a)x1
3) Set the two equations equal to each other to find expressions for the points of intersection (x2, y2)
Set y = (-a/b)x - c/b and y = (b/a)x + y1- (b/a)x1 equal to each other
(-a/b)x - c/b = (b/a)x + y1- (b/a)x1
(b/a)x + (a/b)x = -c/b + (b/a)x1 - y1
(b/a)x + (a/b)x = (ba/ba) × [(-c/b + (b/a)x1 - y1]
(b/a + a/b)x = (-ca + b2x1 - y1ba) / ba
[ (a2 + b2)/ab ] / x = (-ca + b2x1 - y1ba) / ba
x = (-ca + b2x1 - y1ba) / a2 + b2 ( this is x2 )
Now, let us find y2 using the equation y = (-a/b)x - c/b
(-a/b)x = -a/b[ (-ca + b2x1 - bay1) / (a2 + b2) ]
(-a/b)x = (ca2 - ab2x1 + ba2y1) / b(a2 + b2)
(-a/b)x - c/b = [(ca2 - ab2x1 + ba2y1) / b(a2 + b2)] - c/b
(-a/b)x - c/b = (ca2 - ab2x1 + ba2y1 - ca2 - b2c) / b(a2 + b2)
(-a/b)x - c/b = (- ab2x1 + ba2y1 - b2c) / b(a2 + b2)
(-a/b)x - c/b = b[(- abx1 + a2y1 - bc)] / b(a2 + b2)
(-a/b)x - c/b = (- abx1 + a2y1 - bc) / (a2 + b2)
y = (- abx1 + a2y1 - bc) / (a2 + b2) (this is y2)
To summarize,
x2 = (-ca + b2x1 - y1ba) / a2 + b2
y2 = (- abx1 + a2y1 - bc) / (a2 + b2)
Now, find the distance between a point and a line using (x1,y1) and (x2,y2)