Distance Between Two Lines
A line is a figure that is formed when two points are connected with minimum distance between them, and both the ends of a line are extended to infinity. The distance between two lines means how far is two lines are located from each other. The distance between two lines can be calculated by measuring the perpendicular distance between them. Generally, we find the distance between two parallel lines. Also, for two nonintersecting lines which are lying in the same plane, the shortest distance between them is the distance that is the shortest of all the distances between two points lying on both lines. Let us learn more about the distance between two lines along with a few solved examples and practice questions.
Distance Between Two Lines
In a plane, the distance between two straight lines is the minimum distance between any two points lying on the lines. For the distance between two lines, we often deal with different sets of lines such as parallel lines, intersecting lines, or skew lines. So, the distance between two parallel lines is the perpendicular distance from any point on one line to the other line. For two intersecting lines, the shortest distance between such lines eventually comes to zero and the distance between two skew lines is equal to the length of the perpendicular between the lines.
Steps to Calculate The Distance Between Two Lines
 Check whether the given equations of parallel lines are in slopeintercept form (i.e. y= mx + c) or not.
 Also, if the equations of lines are given in the slopeintercept form the slope value should be common for both lines.
 Now find the value of interception point (c_{1} and c_{2}) and find the value of slope for both the lines.
 Substitute the values in the slopeintercept equation to calculate the value of y.
 In the last, Put all the values in the distance formula discussed below to find the distance between two lines.
Distance Between Two Lines Formula
The formula for distance between two parallel lines is given below:
If we have the slopeintercept form of the two lines as \(y = mx + c _1 \) and \(y = mx + c_2\), then formua for the distance is:
\(d = \frac {c_2  c_1} {\sqrt{1 + m^2}}\)
Here, c_{1} is the constant of line l_{1} and c_{2} is the constant for line l_{2}. Also, m represents the slope of the line.
If the equations of the parallel lines are given in the \(ax + by + c_1 = 0 \) and \( ax + by + c_2 = 0\), then the formula for the distance is:
\(d = \dfrac {c_2  c_1} {\sqrt{a^2 + b^2}}\)
Shortest Distance Between Two Skew Lines
Before finding the formula to calculate the shortest distance between skew lines, let us recall what are skew lines. Skew lines exist in the multidimensional system, where two lines are nonparallel but never intersects with each other. This is possible only in 3dimensions or more.
Let us see the formula to calculate the shortest distance between two skew lines whose equations are \( \vec{r_1} = \vec{a_1} + t \vec{b_1} \) and \(\vec{r_2} = \vec{a_2} + t \vec{b_2}\), is:
\(d = \dfrac{ (\vec{a_2}  \vec{a_1}).(\vec{b_1}\times \vec{b_2})}{(\vec{b_1}\times \vec{b_2})}\)
The distance between two skew lines, if the equation of the lines is given in cartesian form as \(( x – x_1 ) / a_1 = ( y – y_1 ) / b_1 = ( z – z_1) / c_1 \\ ( x – x_2 ) / a_2 = ( y – y_2 ) / b_2 = ( z – z_2 ) / c_2 \), is:
\(d = \dfrac{\begin{vmatrix} x_2 – x_1 & y_2 – y_1 & z_2 – z_1\\ a_1 & b_1 & c_1\\ a_2 & b_2 & c_2 \end{vmatrix} }{ {[(b_1c_2 – b_2c_1)^2 + ( c_1a_2 – a_2c_1)^2 + (a_1b_2– b_2a_1)^2}]^{1/2}}\)
Let us see a few solved examples on the distance between two lines.
Related topics:
Solved Examples

Example 1
What will be the distance between two lines 5x + 3y + 6 = 0 and 5x + 3y – 6 = 0? Find this by using the distance between two lines formula.
Solution:
To find: distance between two lines
Given parameters are,
a = 5, b = 3, \(c_1 = 6, \) and \(c_2 = 6\)
Using distance between two lines formula,
\(d = \dfrac {c_2  c_1} {\sqrt{a^2 + b^2}}\)
\(d = \dfrac{66}{\sqrt{5^2 + 3^2}}\)
d = 12/√34
Answer: The distance between the two lines is 12/√34.

Example 2
Determine the shortest distance between two skew lines, if the equations of the lines are \(\vec{r}_1 = \vec{i} + \vec{j} + \lambda (2 \vec{i} – \vec{j} + \vec{k} ) \) and \(\vec{r}_2 = 2 \vec{i} + \vec{j} – \vec{k}+ \mu (3\vec{i} – 5 \vec{j} + 2 \vec{k})\).
Solution:
To find: distance between two lines
Comparing with the standard form of the equation of a line, i.e., \( \vec{r_1} = \vec{a_1} + t \vec{b_1} \) and \(\vec{r_2} = \vec{a_2} + t \vec{b_2}\), we get,
\(a_1 = \vec{i} + \vec{j} , \ \ a_2 = 2 \vec{i} + \vec{j} – \vec{k} \\ b_1 = 2 \vec{i} – \vec{j} + \vec{k} , \ \ b_2 = 3\vec{i} – 5 \vec{j} + 2 \vec{k} \)
Now, on putting the values in the formula to calculate the distance between two skew lines, we get:
\(d =  [(2 \vec{i} – \vec{j} + \vec{k}) \times (3\vec{i} – 5 \vec{j} + 2 \vec{k} )] . (\vec{i} – \vec{k})  /  (2 \vec{i} – \vec{j} + \vec{k}) \times (3 \vec{i} – 5 \vec{j} + 2 \vec{k}) \)
On solving we get:
=  3 – 0 + 7  / (59)^{1/2}
= 10 / (59)^{1/2} = 10/7.68
= 1.30 units.
Answer: The shortest distance between the two lines is 1.30 units
FAQs on Distance Between Two Lines
What is the Formula for Distance Between Two Lines?
The formula for the distance between two lines is: \(d = \frac {c_2  c_1} {\sqrt{1 + m^2}}\), and \(d = \dfrac {c_2  c_1} {\sqrt{a^2 + b^2}}\)
Here,
 c_{1} is the constant of line l_{1} and
 c_{2} is the constant for line l_{2}
What Happens if Two Lines are Parallel?
If the two lines are parallel, the distance between the two lines will never change. For two parallel lines, the slope of both the lines will be the same but the yintercept of each line will vary. The shortest distance between the two lines can be calculated if we have the equation of the two lines.
What is the Shortest Distance Between 2 Points?
The shortest distance between the two points is the length of the straight line drawn from one point to the other. The formula for the shortest distance between two points whose coordinate are \((x_A, y_A), \) and \( (x_B, y_B)\) is: \(\sqrt{(x_Bx_A)^2+(y_By_A)^2}\). This formula is also known as the distance formula.
How Do You Know Two Lines are Parallel?
To know whether the two lines are parallel or not, we can check the slope of the two lines. If the slope of the two lines is equal then the two lines are parallel. To find out the slope, we convert the given equation of the line into slopeintercept form and compare the two equations to find the value of the slope of the lines.
Do Parallel Lines Mean no Solution?
As the property of parallel lines is that they never intersect each other, other than at infinity, they can not have any solutions. Solutions of parallel lines do not exist, hence it is known that the parallel lines have no solution. And the equations of the parallel lines are known as the inconsistent set of equations.
What are Parallel Lines? Give 2 Examples.
Parallel lines are the lines with the same slope. The distance between the two lines will never change. Some examples of the parallel lines are: 5x + 3y + 6 = 0 and 5x + 3y – 6 = 0 are parallel lines, and y = 5x + 5, and y = 5x  7 are the parallel lines. We can confirm that the slope of parallel lines given here is the same. i.e., m1 = m2 = 5.