# Distance between Two Lines

The distance between two lines means that the parallel lines can be determined from one point to another on the opposite line. It is often referred to as the shortest distance between two parallel lines or the perpendicular distance between two lines. In coordinate geometry, we have several formulas, out of which distance formula is one of the most commonly used formulas. In this article, you will learn how to derive the formula for distance between two lines and the distance of a point from a line along with examples.

## Distance Between Two Lines in Coordinate geometry

The distance between any two parallel lines can be determined by the distance of a point from a line, and it is equivalent to the length of the vertical distance from any point on one of the lines to another line. So let’s understand how to derive the formula for the distance of a line from a point.

Distance Between Point and Line Derivation

The general equation of a line is given by Ax + By + C = 0.

Consider a line L : Ax + By + C = 0 whose distance from the point P (x1, y1) is d.

Draw a perpendicular PM from the point P to the line L, as shown in the figure below.

Let Q and R be the points where the line meets the x-and y-axes, respectively.

Coordinates of the points can be written as Q(-C/A, 0) and R(0, -C/B).

Let’s derive the formula using the formulas of the area of the triangle in different aspects.

In triangle PQR,

ar(ΔPQR) = (1/2) × Base × Height = (1/2) × PM × QR

⇒ PM = [2 ar(ΔPQR)]/2….(i)

In coordinate geometry, the area of triangle with vertices (x1, y1), (x2, y2) and (x3, y3) is

Δ = (1/2) |x1(y2 – y3) + x2(y3 – y1) + x3(y1 – y2)|

Here,

(x1, y1) = P(x1, y1)

(x2, y2) = Q(-C/A, 0)

(x3, y3) = R(0, -C/B)

Now, by substituting these values in area formula, we get;

ar(ΔPQR) = (1/2) |x1(0 + C/B) + (-C/A)(-C/B – y1) + 0(y1 – 0)|

ar(ΔPQR) = (1/2) |x1(C/B) + (C2/AB) + y1(C/A)|

⇒ 2 ar(ΔPQR) = |C/AB| . |Ax1 + By1 + C|….(ii)

Distance QR = √[(0 + C/A)2 + (C/B – 0)2]

= √[(C2/A2) + (C2/B2)]

Let’s find QR using the distance formula.

QR = |C/AB| √(A2 + B2)….(iii)

Substituting (ii) and (iii) in (i),

PM = [|C/AB| . |Ax1 + By1 + C|] / [|C/AB| √(A2 + B2)]

d = |Ax1 + By1 + C|]/ √(A2 + B2)

Therefore, the perpendicular distance (d) of a line Ax + By+ C = 0 from a point (x1, y1) is given by

d = |Ax1 + By1 + C|]/ √(A2 + B2)

Based on this formula, we can derive the formula for the distance between two parallel lines.

## 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:

yy = mx + c1….(1)

and yy = mx + c2….(2)

The point AA 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.

## Solved Examples

Example 1:

Find the distance between two lines 3x + 4y = 9 and 6x + 8y = 15.

Solution:

Given equations of lines are:

3x + 4y = 9….(i)

6x + 8y = 15 Or 3x + 4y = 15/2 ….(ii)

Let us check whether the given lines are parallel or not.

From (i),

4y  = -3x + 9

y = (-¾)x + (9/4)

Here, slope = m1 = -¾

From (ii),

8y = -6x + 15

y = (-6/8)x + (15/8)

y = (-¾)x + (15/8)

Here, slope = m2 = -¾

Thus, the slope of the given lines is equal so they are parallel to each other.

Now, by comparing with the standard form of parallel lines equations, we get:

A = 3, B = 4, C1 = -9, C2 = -15/2

d = |C1 – C2|/√(A2 + B2)

= |-9 + (15/2)|/√(9 + 16)

= |-18 + 15|/2√25

= |-3|/(2 × 5)

= 3/10

Therefore, the distance between the given lines is 3/10 units.

Example 2:

The distance between two parallel lines 5x – 12y + 2 = 0 and 5x – 12y + k = 0 is given by 5/13 units. Find the value of k.

Solution:

Given equations of lines are:

5x – 12y + 2 = 0….(i)

5x – 12y + k = 0 ….(ii)

Let us check whether the given lines are parallel or not.

From (i),

12y = 5x + 2

y = (5/12)x + (2/12)

Here, slope = m1 = 5/12

From (ii),

From (i),

12y = 5x + k

y = (5/12)x + (k/12)

Here, slope = m2 = 5/12

Thus, the slope of the given lines is equal so they are parallel to each other.

Now, by comparing with the standard form of parallel lines equations, we get:

A = 5, B = -12, C1 = 2, C2 = k

d = |C1 – C2|/√(A2 + B2)

5/13 = |2 – k|/√(25 + 144)

5/13 = |2-k|/√169

5/13 = |2 – k|/13

5 = 2 – k

k = 2 – 5 = -3