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
-
use the Hessian Normalform – Dr. Sonnhard Graubner Jan 17 '18 at 15:04
-
@uniquesolution I see where you are getting now! Thanks for your help! – QuIcKmAtHs Jan 17 '18 at 15:17
-
Do you know how to find the distance from a point to a line? There is a very similar-looking formula for that. The formula in your question is just the difference between the signed distances of the origin from the two lines. – amd Jan 17 '18 at 21:18
-
For reference, there is a WP page: https://en.wikipedia.org/wiki/Distance_between_two_parallel_lines – kebs Jun 30 '21 at 07:46
1 Answers
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.
Exercise: find and prove a similar formula for the distance between parallel planes.
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.

- 4,253