## Derivation of Formula For Distance Between Parallel Lines

Suppose we want to find the distance between the parallel lines

\[ax+by=d_1\]

(1)\[ax+by=d_1\]

(2)Suppose a normal connects points

\[(x_1,y_1)\]

in line (1) to point \[(x_2,y_2)\]

in line (2). Then\[ax_1+by_1=d_1\]

(3)\[ax_2+by_2=d_2\]

(4)(4)-(3) gives

\[a(x_2-x_1)+b(y_2-y_1)=d_2-d_1\]

(5)Let the equation of the normal from line (1) to (2) be

\[\mathbf{r}(t)= \begin{pmatrix}x_1\\y_\\end{pmatrix} + \begin{pmatrix}a\\b\end{pmatrix} t\]

.Then

\[\begin{pmatrix}x_2\\y_2\end{pmatrix}= \begin{pmatrix}x_1\\y_1\end{pmatrix} + \begin{pmatrix}a\\b\end{pmatrix} t_0 \rightarrow \begin{pmatrix}x_2-x_1\\y_2-y_1\end{pmatrix}= \begin{pmatrix}a\\b\end{pmatrix} t_0\]

Substitution into (5) gives

\[a^2t_0+b^2t_0=d_2-d_1 \rightarrow t_0=\frac{d_2-d_1}{a^2+b^2}\]

\[\begin{pmatrix}x_2-x_1\\y_2-y_1-\end{pmatrix}-= \begin{pmatrix}a\\b\\c\end{pmatrix} \frac{d_2-d_1}{a^2+b^2}\]

The distance between the lines is then

\[\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}=\sqrt{a^2+b^2}\frac{d_2-d_1}{a^2+b^2+c^2}= \frac{d_2-d_1}{\sqrt{a^2+b^2}\]