# Proving formula for distance between 2 parallel lines

I am given the equation $|\frac{c_1-c_2}{\sqrt{a^2+b^2}}|$ to find the distance between 2 parallel lines, $ax+by+c_1=0$ and $ax+by+c_2=0$. I would like to know how this formula was derived. Normally, when finding the distance between 2 parallel lines, I would use Pythagoras' theorem, I have no idea how this equation was derived.

• Suppose I give you two parallel lines; how would you go about finding the distance between them? what would you physically do? – uniquesolution Jan 17 '18 at 14:49
• I would use pythagoras' theorem – QuIcKmAtHs Jan 17 '18 at 14:54
• For which triangle? – uniquesolution Jan 17 '18 at 14:54
• I have the gradient, I can draw a vertical and horizontal line connecting both lines, forming a triangle – QuIcKmAtHs Jan 17 '18 at 14:58
• Good. Can you write down expressions for the points on the two lines connected by your lines? – uniquesolution Jan 17 '18 at 15:00

A vector perpendicular to the lines is $(a,b)$, so the unit vector perpendicular to the lines is $\mathbf u = (a, b)/\sqrt{a^2 + b^2}$. Your two lines are given by $(x,y) \cdot \mathbf u = -c_i/\sqrt{a^2 + b^2}$ for $i = 1, 2$. In particular the multiple of the unit vector $\mathbf u$ which lies on the $i$-th line is $\mathbf p_i = -c_i/\sqrt{a^2 + b^2} \mathbf u$. What you want is the length of $\mathbf p_1 - \mathbf p_2$, which is given by your formula.
Addendum: given the discussion in the comments, you may be happier with a slightly different solution, also using the unit vector $\mathbf u$. Find one point $\mathbf q_i$ ($i = 1, 2$) on each line. For example, if $a \ne 0$, you can find the unique point with zero $y$ coordinate. The distance is $\left | (\mathbf q_1 - \mathbf q_2)\cdot \mathbf u \right |$. The case $a = 0$ has to be handled separately.