# Distance between Two Lines

The distance between any two parallel lines can be determined by the distance of a point from a line. It is equivalent to the length of the vertical distance from any point on one of the lines to another line. In this article, let us discuss the derivation of the distance between the point from the line as well as the distance between the two lines formulas and derivation in detail.

## Distance Between Point and Line Derivation

The general equation of a line is given by Ax + By + C = 0. Consider a point P in the Cartesian plane having the coordinates (x1,y1). The distance from the point to the line, in the Cartesian system, is given by calculating the length of the perpendicular between the point and line.

In the figure given below, the distance between the point P and the line LL can be calculated by figuring out the length of the perpendicular.

Draw PQ from P to the line L.

The coordinate points for different points are as follows:

Point P (x1, y1), Point N (x2, y2), Point R (x3,y3)

The line L makes intercepts on both the x – axis and y – axis at the points N and M respectively. The co-ordinates of these points are $M (0,-\frac{C}{B})$ and $N~ (-\frac{C}{A},0)$.

Area of Δ MPN can be given as:

Area of Δ MPN = $\frac{1}{2}~×~Base~×~Height$

$\Rightarrow Area~ of~ Δ~MPN$ = $\frac{1}{2}~×~PQ~×~MN$

$\Rightarrow PQ$ = $\frac{2~×~Area~ of~ Δ~MPN}{MN}$   ………………………(i)

In terms of Co-ordinate Geometry, the area of the triangle is given as:

Area of Δ MPN = $\frac{1}{2} \left [ x_{1} (y_{2}-y_{3}) + x_{2} (y_{3}-y_{1}) + x_{3} (y_{1}-y_{2})\right ]$

Therefore, the area of the triangle can be given as:

Area of Δ MPN $= \frac{1}{2} \left [ x_{1} (0 + \frac{C}{B}) + (-\frac{C}{A}) ( -\frac{C}{B} -y_{1}) + 0( y_{1}-0 )\right ]$

$\Rightarrow Area ~of~ Δ~MPN$  $= \frac{1}{2} \left [\frac{C}{B} \times x_{1} + \frac{C}{A} \times y_{1} + (\frac{c^{2}}{AB}))\right ]$

Solving this expression we get;

$2~×~Area~ of~ Δ~MPN$ $= \left ( \frac{C}{AB} \right ) (Ax_{1} + B y_{1} + C)$   …………………………(ii)

Using the distance formula, we can find out the length of the side MN of ΔMPN.

$MN = \sqrt{\left ( 0 + \frac{C}{A} \right )^{2} + \left ( \frac{C}{B}- 0 \right )^{2}}$

$\Rightarrow MN = \frac{C}{AB} \sqrt{A^{2} + B^{2}}$   …………………………………..(iii)

Equating equation (ii) and (iii) in (i), the value of perpendicular comes out to be:

$PQ$ $= \frac{\left | Ax_{1} + By_{1} + C \right |}{\sqrt{A^{2} + B^{2}}}$

This length is generally represented by $d$.

### Distance Between Two Parallel Lines

The distance between two parallel lines is equal to the perpendicular distance between the two lines. We know that the slopes of two parallel lines are the same; therefore the equation of two parallel lines can be given as:

$y$ = $mx~ + ~c_1$ and $y$ = $mx ~+ ~c_2$

The point $A$ is the intersection point of the second line on the $x$ – axis.

The perpendicular distance would be the required distance between two lines

The distance between the point $A$ and the line $y$ = $mx ~+ ~c_2$ can be given by using the formula:

$d$ = $\frac{\left | Ax_{1} + By_{1} + C \right |}{\sqrt{A^{2} + B^{2}}}$

$\Rightarrow d$ $= \frac{\left | (-m)(\frac{-c_{1}}{m}) – c_{2} \right |}{\sqrt{1 + m^{2}}}$

$\Rightarrow d$ $= \frac{\left | c_{1} – c_{2} \right |}{\sqrt{1 + m^{2}}}$

Thus, we can conclude that the distance between two parallel lines is given by:

$d$ = $\frac{|c_1 ~- ~c_2|}{√1 + m^2}$

If we consider the general form of the equation of straight line, and the lines are given by:

$L_1 ~: ~Ax~ + ~By ~+ ~C_1$ = $0$

$L_2 ~: ~Ax ~+ ~By ~+ ~C_2$ = $0$

Then, the distance between them is given by:

$d$ = $\frac{|C_1 ~- ~C_2|}{√A^2~ +~ B^2}$

### Shortest Distance Between Two parallel Lines

The shortest distance between the two parallel lines can be determined using the length of the perpendicular segment between the lines. It does not matter which perpendicular line you are choosing, as long as two points are on the line.

Thus, we can now easily calculate the distance between two parallel lines and the distance between a point and a line.