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.

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

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.