Distance between two parallel lines explained

The distance between two parallel lines in the plane is the minimum distance between any two points.

Formula and proof

Because the lines are parallel, the perpendicular distance between them is a constant, so it does not matter which point is chosen to measure the distance. Given the equations of two non-vertical parallel lines

y=mx+b1

y=mx+b2,

the distance between the two lines is the distance between the two intersection points of these lines with the perpendicular line

y=-x/m.

This distance can be found by first solving the linear systems

\begin{cases} y=mx+b1\\ y=-x/m, \end{cases}

and

\begin{cases} y=mx+b2\\ y=-x/m, \end{cases}

to get the coordinates of the intersection points. The solutions to the linear systems are the points

\left(x1,y1\right) =\left(

-b1m,
m2+1
b1
m2+1

\right),

and

\left(x2,y2\right) =\left(

-b2m,
m2+1
b2
m2+1

\right).

The distance between the points is

d=\sqrt{\left(

b1m-b2m
m2+1

\right)2+\left(

b2-b1
m2+1

\right)2},

which reduces to

d=

|b2-b1|
\sqrt{m2+1
}\,.

When the lines are given by

ax+by+c1=0

ax+by+c2=0,

the distance between them can be expressed as

d=

|c2-c1|
\sqrt{a2+b2
}.

See also

References

External links