Distance between two straight lines

This article considers two lines in a plane. For two lines not in the same plane, see Skew lines#Distance.

The distance between two straight lines in the plane is the minimum distance between any two points lying on the lines. In case of intersecting lines, the distance between them is zero, because the minimum distance between them is zero (at the point of intersection); whereas in case of two parallel lines, it is the perpendicular distance from a point on one line to the other line.

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+b_1\,
y = mx+b_2\,,

the distance between the two lines is the distance between the two intercepts 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+b_1 \\
y = -x/m \, ,
\end{cases}

and

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

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

\left( x_1,y_1 \right)\ = \left( \frac{-b_1m}{m^2+1},\frac{b_1}{m^2+1} \right)\, ,

and

\left( x_2,y_2 \right)\ = \left( \frac{-b_2m}{m^2+1},\frac{b_2}{m^2+1} \right)\, .

The distance between the points is

d = \sqrt{\left(\frac{b_1m-b_2m}{m^2+1}\right)^2 + \left(\frac{b_2-b_1}{m^2+1}\right)^2}\,,

which reduces to

d = \frac{|b_2-b_1|}{\sqrt{m^2+1}}\,.

When the lines are given by

ax+by+c_1=0\,
ax+by+c_2=0,\,

the distance between them can be expressed as

d = \frac{|c_2-c_1|}{\sqrt {a^2+b^2}}.

See also

This article is issued from Wikipedia - version of the Monday, December 21, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.