Distance between Point and Line
The distance between a point \(P\) and a line \(L\) is the shortest distance between \(P\) and \(L\); it is the minimum length required to move from point \( P \) to a point on \( L \). In fact, this path of minimum length can be shown to be a line segment perpendicular to \( L \).
The distance \(d\) can then be defined as the length of the line segment that has \(P\) as an endpoint and is perpendicular to \(L\).
Definition
For a point and a line (or in the third dimension, a plane), you could technically draw an infinite number of lines between the point and line or point and plane. So, which one gives you the "correct" distance between the point/line or point/plane? When we say distance, we mean the shortest possible distance from the point to the line/plane, which happens to be when the distance line through the point is also perpendicular to the line/plane.
But why is the shortest line segment perpendicular?
This is because the longest side in a right triangle is the hypotenuse. If we draw the foot of the perpendicular from the point to the line, and draw any other segment joining the point to the line, this segment will always be the hypotenuse of the right triangle formed.
What is the distance between point \(P\) and line \(L\) in the diagram?
The length of each line segment connecting the point and the line differs, but by definition the distance between point and line is the length of the line segment that is perpendicular to \(L\). In other words, it is the shortest distance between them, and hence the answer is \(5\). \(_\square\)
Formula
The distance between point \(P=(x_0,y_0)\) and line \(L:ax+by+c=0\) is
\[d = \frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}.\]
Let's have a generic line \(ax + by + c = 0\) named \(L\). This line has slope \(-\frac{a}{b}\). Let's also have a generic point \(P=(x_0, y_0)\). The distance between line \(L\) and point \(P\) can be represented by another line perpendicular to \(L;\) let's call it \(T\). \(T\) will have slope \(\frac{b}{a}\) since it's perpendicular to \(L\). Now, to find the distance between point \(P\) and line \(L,\) we can use a little geometry trick and have another line, parallel to \(L\), that passes through \(P\); let's call it \(S\). Likewise, we can have another line, this time parallel to \(T\), that passes through the origin \((0,0)\); let's call it \(R\).
Now that drawing time's over, it's time to work.
First off, since \(S\) passes through \(P\) and has the same slope as \(L\), its equation is
\[y − y_0 = -\dfrac{a}{b}(x − x_0) \implies y = \dfrac{-ax + ax_0 + by_0}{b}.\]
Line \(R\) has equation
\[ y = \dfrac{b}{a}x.\]
So, line \(S\) intersects with line \(R\) when
\[ \frac{b}{a}x = \dfrac{-ax + ax_0 + by_0}{b} \implies x = \dfrac{a(ax_0 + by_0)}{a^2 + b^2}. \]
Substituting back into \(R\)'s equation, we find that the intersection point between \(S\) and \(R\) is
\[ P_1 \left( \dfrac{a(ax_0 + by_0)}{a^2 + b^2} , \dfrac{b(ax_0 + by_0)}{a^2 + b^2} \right). \]
Now let's put that aside for a moment and look when lines \(L\) and \(R\) intersect. This occurs when both \( y = \frac{b}{a}x \) and \( ax + by + c = 0 \implies y = -\frac{ax + c}{b} \) are true. Solving this system of two equations for \(x\),
\[-\dfrac{ax + c}{b} = \dfrac{b}{a}x \implies x = -\dfrac{ac}{a^2+b^2}.\]
Using \(x\) to solve for \(y\),
\[y = \dfrac{b}{a}\left(-\dfrac{ac}{a^2 + b^2}\right) = -\dfrac{bc}{a^2 + b^2}. \]
So the point of intersection of \(L\) and \(R\) is
\[P_2 \left( -\dfrac{ac}{a^2 + b^2}, - \dfrac{bc}{a^2 + b^2} \right). \]
Now, using the distance formula \(d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2},\) we can tell the distance between \(P_1\) and \(P_2\):
\[\begin{align} d &= \sqrt{ \left( - \ \dfrac{ac}{a^2 + b^2} - \dfrac{a(ax_0 + by_0)}{a^2 + b^2} \right)^2 + \left( - \ \dfrac{bc}{a^2 + b^2} - \dfrac{b(ax_0 + by_0)}{a^2 + b^2} \right)^2 } \\\\ &= \sqrt{ \dfrac{\big[-a(ax_0 + by_0 + c)\big]^2 + \big[-b(ax_0 + by_0 + c)v\big]^2}{\big(a^2+b^2\big)^2} } \\\\ &= \sqrt{ \dfrac{\big(a^2+b^2\big)(ax_0 + by_0 + c)^2}{\big(a^2+b^2\big)^2} } \\\\ &= \sqrt{ \dfrac{(ax_0 + by_0 + c)^2}{a^2+b^2} } \\\\ &= \dfrac{|ax_0 + by_0 + c|}{\sqrt{a^2+b^2}}. \end{align} \]
The absolute value sign is necessary as the distance must be a positive value. \(_\square\)
Here, we present a geometric proof.
First, we draw a line parallel to \(L\) that passes through \(P\), which has the equation \(ax+by-(ax_0+by_0)=0\). Then, we construct a right triangle which has height \(d\). Both legs of the right triangle can be obtained by the differences between the interception of \(x\)- and \(y\)-axes of the two lines. The hypotenuse, by the Pythagorean theorem, is
\[|ax_0+by_0+c|\frac{\sqrt{a^2+b^2}}{ab}.\]
Finally, by the area of triangle,
\[\begin{aligned} \frac{1}{2} |ax_0+by_0+c|\frac{\sqrt{a^2+b^2}}{ab}\times d &= \frac{1}{2} |ax_0+by_0+c|^2 \frac{1}{ab} \\ \\ \Rightarrow d &= \dfrac{|ax_0 + by_0 + c|}{\sqrt{a^2+b^2}}.\ _\square \end{aligned}\]
Vectorial Approach
Consider a line given by the points \(\vec{r} = \vec{a} + \lambda \vec{b}\) and the point \(\vec{x}\). Then, the distance of the line from the point is
\[ \left \| {\vec{x} - \big(\vec{a} + \lambda ' \vec{b}\big)} \right \|, \]
where
\[ \lambda ' = \frac{\vec{x} \cdot \vec{b} - \vec{a} \cdot \vec{b}}{ \left \| \vec{b} \right \| ^2}.\]
Consider the foot of the perpendicular on the line from \(\vec{x}\). Let us call this \(\vec{r}\). We want to get the value of \( \left \| \vec{x} - \vec{r} \right \| \). By definition, this is the distance from the point to the line.
Since \(\vec{r}\) lies on the line, it satisfies \(\vec{r} = \vec{a} + \lambda ' \vec{b} \) for some \(\lambda '\). Since it is perpendicular to the line, we have
\[\begin{align} (\vec{x} - \vec{r}) \cdot \vec{b} &= 0 \\ \big(\vec{x} - \vec{a} - \lambda ' \vec{b} \big) \cdot \vec{b} &= 0 \\ \vec{x} \cdot \vec{b} - \vec{a} \cdot \vec{b} - \lambda ' \left \| \vec{b} \right \| ^2 &= 0 \\ \lambda ' &= \frac{\vec{x} \cdot \vec{b} - \vec{a} \cdot \vec{b}}{ \left \| \vec{b} \right \| ^2}.\ _\square \end{align} \]
The nice thing about this approach is that it is going to work for any number of dimensions.
Example Problems
Find the distance between the point \( (5, 1) \) and the line \( y = 3x + 1 \).
We have
\[ d = \dfrac{\big| ax_0 + by_0 + c\big| }{\sqrt{a^2 + b^2}}. \]
Given \( (x_0, y_0) = (5, 1) \) and \( 0 = 3x - y + 1, \)
\[d = \dfrac{\big| 3 \cdot 5 - 1 \cdot 1 + 1 \big| }{\sqrt{3^2 + (-1)^2}}= \dfrac{15}{\sqrt{10}}.\ _\square\]
Find the distance between the lines \( y = 2x + 5 \) and \( y = 2x + 2016 \).
Notice that these two lines are parallel (same slope), so we can just choose a point on one of the lines, and then apply the formula.
But wait, wouldn't you get a different result if you try different points? Let's try two different points on the line \( y = 2x + 5 \).
If \( (x_0, y_0) = (1, 7) \) and \( 2x - y + 2016 = 0 \), then applying the formula, we get
\[ d = \dfrac{\left| 2 \cdot 1 - 1 \cdot 7 + 2016 \right| }{\sqrt{2^2 + (-1)^2}}= \dfrac{2011}{\sqrt{5} }. \]
If \( (x_0, y_0) = (2, 9 ) \) and \( 2x - y + 2016 = 0 \), then applying the formula, we get
\[ d = \dfrac{\left| 2 \cdot 2 - 1 \cdot 9 + 2016 \right| }{\sqrt{2^2 + (-1)^2}} = \dfrac{2011}{\sqrt{5}}.\ _\square\]
For the reader...
- How do you prove that any point on \( y = 2x + 5 \) can be used in the above formula and still get the same distance between \( y = 2x + 5 \) and \( y = 2x + 2016?\)
- Also, how do you prove that you'll still get the same distance if you use any point on \( y = 2x + 2016 \) and the line \( y = 2x + 5?\)
Find the distance between the point \( (1,2 , 3 ) \) and the plane \( x+2y-3z = 44 \).
The formula for this one is an extension of the formula used for finding distance between line and point:
\[ d = \dfrac{\left| ax_0 + by_0 + cz_0 +d \right| }{\sqrt{a^2 + b^2 + c^2}} .\]
Using the information we have,
\[ d= \dfrac{\left| 1 \cdot 1 + 2 \cdot 2 - 3 \cdot 3 + 44 \right| }{1^2 + 2^2 + (-3)^2} =\dfrac{40}{\sqrt{14}}.\ _\square \]
Find the distance between the lines \( \vec{a}(t) = \left \langle 1, 2, 3 \right \rangle + \left \langle 4, 5, 6 \right \rangle t \) and \( \vec{b}(t) = \left \langle 8, 9, 4 \right \rangle - \left \langle -3, -2, 4 \right \rangle t \).
Find the distance between the line \( \vec{a}(t) = \left \langle 0, 0, 6 \right \rangle + \left \langle 1, 2, -2 \right \rangle t \) and the plane \( 2 x + y +2z = 10 \).
Applications
Find the equation of the angle bisectors between the two distinct lines
\[\begin{align} a_1x + b_1y + c_1 &= 0 \\ a_2x + b_2y + c_2 &= 0. \end{align}\]
Notice that there are two angle bisectors between a pair of lines--one bisects the acute angle, and the other bisects the obtuse angle between the lines (if the lines are perpendicular, then there are two right angles formed, anyways).
One of the properties of the angle bisector of two lines is that every point on it is equidistant from both lines.
This can be proved by dropping the perpendiculars on the two lines from the point and using congruence of the resulting triangles.If \((x_0, y_0)\) is a point on the angle bisector, we can equate the distances to the lines as
\[ \left|\frac{a_1x_0 + b_1y_0 + c_1}{\sqrt{a_1^2 + b_1^2}}\right| = \left|\frac{a_2x_0 + b_2y_0 + c_2}{\sqrt{a_2^2 + b_2^2}}\right|. \]
Removing the absolute value signs,
\[ \frac{a_1x_0 + b_1y_0 + c_1}{\sqrt{a_1^2 + b_1^2}} = \pm \frac{a_2x_0 + b_2y_0 + c_2}{\sqrt{a_2^2 + b_2^2}} .\]
Now, shift like terms on either side, to make the resulting equation of this form:
\[ a_3x_0 + b_3y_0 + c_3 = 0. \]
Here,
\[\begin{align} a_3 &= \frac{a_1}{\sqrt{a_1^2 + b_1^2}} \pm \frac{a_2}{\sqrt{a_2^2 + b_2^2}} \\ b_3 &= \frac{b_1}{\sqrt{a_1^2 + b_1^2}} \pm \frac{b_2}{\sqrt{a_2^2 + b_2^2}} \\ c_3 &= \frac{c_1}{\sqrt{a_1^2 + b_1^2}} \pm \frac{c_2}{\sqrt{a_2^2 + b_2^2}}. \end{align}\]
So, the equation of the angle bisectors will then be
\[ a_3x + b_3y + c_3 = 0. \]
The \( \pm \) tells us that there are two possible values of \(a_3, b_3, c_3, \) hence two angle bisectors, as we discussed above. \(_\square\)