Sub topic 8
Distance from a Point to a Line
Assume you know fractions, square roots, linear equations, slopes, and the Pythagorean theorem. In coordinate geometry, the shortest distance from a point to a line is always measured along the perpendicular to that line.
The point-to-line distance formula
Write the line in general form:
\[ ax+by+c=0 \]
For a point \(P(x0,y0)\), the perpendicular distance from \(P\) to the line is
\[ d=\frac{|ax0+by0+c|}{\sqrt{a^2+b^2}}. \]
The absolute value is necessary because distance cannot be negative.
| Part | Meaning |
|---|---|
| \(a,b,c\) | Coefficients from the line \(ax+by+c=0\) |
| \(x_0,y_0\) | Coordinates of the given point |
| Numerator | How far the point lies from the line algebraically |
| Denominator | A scale factor that makes the result an actual distance |
Worked example
Find the distance from \(P(1,2)\) to
\[ 3x+4y-10=0. \]
Here, \(a=3\), \(b=4\), and \(c=-10\). Substitute the point:
\[ d=\frac{|3(1)+4(2)-10|}{\sqrt{3^2+4^2}} =\frac{|3+8-10|}{5} =\frac{1}{5}. \]
Therefore, the distance is \(0.2\) units.
A quick check is useful. The point \((1,2)\) does not lie on the line because \(3(1)+4(2)-10=1\), not \(0\).
Why the formula works
The line \(ax+by+c=0\) has a normal vector, or perpendicular direction, \((a,b)\). The denominator \(\sqrt{a^2+b^2}\) is the length of this vector. Dividing by its length removes the scale introduced by the coefficients.
The numerator measures the point's signed position relative to the line. Taking its absolute value gives the perpendicular distance.
Distance between parallel lines
For parallel lines
\[ ax+by+c1=0 \quad\text{and}\quad ax+by+c2=0, \]
the distance between them is
\[ d=\frac{|c1-c2|}{\sqrt{a^2+b^2}}. \]
The coefficients of \(x\) and \(y\) must match. If they do not, multiply one equation by a suitable constant first.
For example, the distance between
\[ 3x+4y-10=0 \quad\text{and}\quad 3x+4y+5=0 \]
is
\[ \frac{|-10-5|}{\sqrt{3^2+4^2}} =\frac{15}{5}=3. \]
Common errors and CAT strategy
- Do not use the vertical difference \(|y_0-y|\) unless the line is horizontal.
- Convert the line to general form before applying the formula.
- Substitute both coordinates carefully, including negative signs.
- Use the shortest method. If the question asks only for distance, finding the foot of the perpendicular is usually unnecessary.
- If the point makes the numerator zero, the point lies on the line.
def point_line_distance(x0, y0, a, b, c):
return abs(a * x0 + b * y0 + c) / (a ** 2 + b ** 2) ** 0.5
print(point_line_distance(1, 2, 3, 4, -10))Exercise
Find the distance from the point (2, -1) to the line 6x - 8y + 3 = 0.
Show answer
Substitute: d = |6(2) - 8(-1) + 3| / √(6² + (-8)²) = 23/10 units.