2.3.10Coordinate Geometry

Distance from a point to a line

2,117 words10 min readdifficulty · medium5 backlinks

Core Understanding: What ARE We Finding?

We want the perpendicular distance from a point P(x1,y1)P(x_1, y_1) to a line L:ax+by+c=0L: ax + by + c = 0.

Key insight: Among all possible paths from PP to any point on line LL, the perpendicular path is the shortest. Why? Because any slanted path forms the hypotenuse of a right triangle, which is always longer than the perpendicular leg.

Figure — Distance from a point to a line

Deriving the Formula from First Principles

Method 1: Area of Triangle Approach

Let's take a line ax+by+c=0ax + by + c = 0 and a point P(x1,y1)P(x_1, y_1) not on the line.

Step 1: Find TWO points on the line.

  • Set x=0x = 0: we get by+c=0y=cbby + c = 0 \Rightarrow y = -\frac{c}{b} (if b0b \neq 0), giving point A(0,cb)A(0, -\frac{c}{b})
  • Set y=0y = 0: we get ax+c=0x=caax + c = 0 \Rightarrow x = -\frac{c}{a} (if a0a \neq 0), giving point B(ca,0)B(-\frac{c}{a}, 0)

Step 2: Calculate the distance ABAB (base of our triangle). AB=(ca)2+(cb)2=c2a2+c2b2=c1a2+1b2=ca2+b2a2+b2a2b2a2+b2AB = \sqrt{\left(-\frac{c}{a}\right)^2 + \left(-\frac{c}{b}\right)^2} = \sqrt{\frac{c^2}{a^2} + \frac{c^2}{b^2}} = |c|\sqrt{\frac{1}{a^2} + \frac{1}{b^2}} = \frac{|c|}{\sqrt{a^2 + b^2}} \cdot \frac{\sqrt{a^2+b^2}}{\sqrt{a^2b^2}} \cdot \sqrt{a^2+b^2}

Wait, let me recalculate: AB=c2a2+c2b2=cb2+a2a2b2=ca2+b2abAB = \sqrt{\frac{c^2}{a^2} + \frac{c^2}{b^2}} = |c|\sqrt{\frac{b^2 + a^2}{a^2b^2}} = \frac{|c|\sqrt{a^2+b^2}}{|ab|}

Step 3: Calculate area of triangle PABPAB using the coordinate formula: Area=12x1(yAyB)+xA(yBy1)+xB(y1yA)\text{Area} = \frac{1}{2}|x_1(y_A - y_B) + x_A(y_B - y_1) + x_B(y_1 - y_A)| =12x1(cb0)+0(0y1)+(ca)(y1+cb)= \frac{1}{2}\left|x_1\left(-\frac{c}{b} - 0\right) + 0\left(0 - y_1\right) + \left(-\frac{c}{a}\right)\left(y_1 + \frac{c}{b}\right)\right| =12cx1bcy1ac2ab=c2abax1+by1+c= \frac{1}{2}\left|-\frac{cx_1}{b} - \frac{cy_1}{a} - \frac{c^2}{ab}\right| = \frac{|c|}{2|ab|}\left|ax_1 + by_1 + c\right|

Step 4: Use the relationship Area = 12×base×height\frac{1}{2} \times \text{base} \times \text{height}.

If dd is the perpendicular distance (height), then: c2abax1+by1+c=12×ca2+b2ab×d\frac{|c|}{2|ab|}|ax_1 + by_1 + c| = \frac{1}{2} \times \frac{|c|\sqrt{a^2+b^2}}{|ab|} \times d

Simplifying: ax1+by1+c=a2+b2d|ax_1 + by_1 + c| = \sqrt{a^2+b^2} \cdot d

Method 2: Perpendicular from Point (Vector Approach)

Why this works: The perpendicular distance is the component of any position vector in the direction of the normal to the line.

The line ax+by+c=0ax + by + c = 0 has a normal vector n=(a,b)\vec{n} = (a, b).

Take any point Q(x0,y0)Q(x_0, y_0) on the line (so ax0+by0+c=0ax_0 + by_0 + c = 0).

The vector from QQ to PP is QP=(x1x0,y1y0)\vec{QP} = (x_1 - x_0, y_1 - y_0).

The perpendicular distance is the projection of QP\vec{QP} onto the unit normal: d=QPnn=a(x1x0)+b(y1y0)a2+b2d = \left|\vec{QP} \cdot \frac{\vec{n}}{|\vec{n}|}\right| = \frac{|a(x_1-x_0) + b(y_1-y_0)|}{\sqrt{a^2+b^2}}

Since ax0+by0=cax_0 + by_0 = -c: d=ax1+by1(ax0+by0)a2+b2=ax1+by1+ca2+b2d = \frac{|ax_1 + by_1 - (ax_0 + by_0)|}{\sqrt{a^2+b^2}} = \frac{|ax_1 + by_1 + c|}{\sqrt{a^2+b^2}}

Worked Examples

Solution: Here a=3,b=4,c=10a = 3, b = 4, c = -10, and (x1,y1)=(3,4)(x_1, y_1) = (3, 4).

d=3(3)+4(4)+(10)32+42=9+16109+16=1525=155=3d = \frac{|3(3) + 4(4) + (-10)|}{\sqrt{3^2 + 4^2}} = \frac{|9 + 16 - 10|}{\sqrt{9 + 16}} = \frac{|15|}{\sqrt{25}} = \frac{15}{5} = 3

Why each step?

  • We substitute directly into the formula.
  • 32+42=5\sqrt{3^2 + 4^2} = 5 is a3-45 Pythagorean triple—recognize these for speed!
  • The distance is 3 units.

Solution: Here a=1,b=2,c=4a = 1, b = -2, c = 4, and (x1,y1)=(1,2)(x_1, y_1) = (-1, 2).

d=1(1)+(2)(2)+412+(2)2=14+41+4=15=15=55d = \frac{|1(-1) + (-2)(2) + 4|}{\sqrt{1^2 + (-2)^2}} = \frac{|-1 - 4 + 4|}{\sqrt{1 + 4}} = \frac{|-1|}{\sqrt{5}} = \frac{1}{\sqrt{5}} = \frac{\sqrt{5}}{5}

Why each step?

  • The numerator becomes negative (1-1), but the absolute value makes it positive.
  • We rationalize 15\frac{1}{\sqrt{5}} by multiplying by 55\frac{\sqrt{5}}{\sqrt{5}}.
  • Distance is 550.447\frac{\sqrt{5}}{5} \approx 0.447 units.

Solution: Step 1: Find the equation of the line. Slope m=5141=43m = \frac{5-1}{4-1} = \frac{4}{3}.

Using point-slope form: y1=43(x1)y - 1 = \frac{4}{3}(x - 1) 3(y1)=4(x1)3(y - 1) = 4(x - 1) 3y3=4x43y - 3 = 4x - 4 4x3y1=04x - 3y - 1 = 0

Step 2: Apply the distance formula. Here a=4,b=3,c=1a = 4, b = -3, c = -1, and (x1,y1)=(2,3)(x_1, y_1) = (2, -3).

d=4(2)+(3)(3)+(1)42+(3)2=8+9116+9=1625=165d = \frac{|4(2) + (-3)(-3) + (-1)|}{\sqrt{4^2 + (-3)^2}} = \frac{|8 + 9 - 1|}{\sqrt{16 + 9}} = \frac{16}{\sqrt{25}} = \frac{16}{5}

Why each step?

  • We must convert to ax+by+c=0ax + by + c = 0 form first—slope-intercept won't work directly.
  • The distance is 165=3.2\frac{16}{5} = 3.2 units.

Common Mistakes

Why it feels right: You might think distance can be negative (like a "signed distance"), but distance is always non-negative.

Steel-man: In some contexts (like determining which side of a line a point is on), the signed distance is useful. But when asked for "the distance," we want the magnitude.

Fix: Always include |\cdots| around the numerator.

Why it feels right: y=mx+cy = mx + c is the most familiar form.

The issue: The formula requires the form ax+by+c=0ax + by + c = 0. If you use y=2x+3y = 2x + 3, you must rewrite it as 2x+y3=0-2x + y - 3 = 0 (or 2xy+3=02x - y + 3 = 0).

Fix: Always convert to ax+by+c=0ax + by + c = 0 first. Remember: y=mx+kmxy+k=0y = mx + k \Rightarrow mx - y + k = 0.

Why it feels right: You might forget the square root, thinking it's just a2+b2a^2 + b^2.

Fix: The denominator is a2+b2\sqrt{a^2 + b^2}, not a2+b2a^2 + b^2. This comes from the magnitude of the normal vector (a,b)(a, b).

Special Cases

When the point lies ON the line: ax1+by1+c=0ax_1 + by_1 + c = 0, so d=0d = 0. ✓

Parallel lines: To find the distance between two parallel lines ax+by+c1=0ax + by + c_1 = 0 and ax+by+c2=0ax + by + c_2 = 0, pick ANY point on one line and find its distance to the other: d=c1c2a2+b2d = \frac{|c_1 - c_2|}{\sqrt{a^2 + b^2}}

Deep Connections

Or think: "Plug point into line equation, divide by length of normal vector (a,b)(a,b), take absolute value."

The denominator a2+b2\sqrt{a^2+b^2} is just the magnitude of the normal vector—easy to remember if you know vectors!

Recall Explain to a 12-year-old

Imagine you're at a park (that's your point), and there's a straight path (that's the line). You want to get to the path as quickly as possible. Would you walk at an angle? No way! You'd walk straight toward it, making a90-degree angle with the path—that's the shortest route.

To find how far you need to walk, we have a magic formula. You take the equation of the path (which looks like ax+by+c=0ax + by + c = 0), plug in where you're standing (x1,y1)(x_1, y_1), and divide by a number that depends on the path's stepness (a2+b2\sqrt{a^2+b^2}). The answer tells you the shortest distance!

The absolute value bars |\cdots| are like saying "ignore whether the number is positive or negative—just tell me how big it is," because distance can't be negative!


#flashcards/maths

What is the formula for the distance from a point (x1,y1)(x_1, y_1) to a line ax+by+c=0ax + by + c = 0? :: d=ax1+by1+ca2+b2d = \frac{|ax_1 + by_1 + c|}{\sqrt{a^2 + b^2}}

Why must we use the absolute value in the distance formula?
Because distance is always non-negative; the absolute value ensures we get a positive result regardless of which side of the line the point is on.
What form must the line equation be in to use the distance formula?
The line must be in the form ax+by+c=0ax + by + c = 0 (standard/general form), not slope-intercept form.
What does the denominator a2+b2\sqrt{a^2 + b^2} represent geometrically?
It represents the magnitude (length) of the normal vector (a,b)(a, b) to the line.
If a point lies ON the line, what is the distance from point to the line?
Zero, because ax1+by1+c=0ax_1 + by_1 + c = 0 when the point is on the line.
How do you find the distance between two parallel lines ax+by+c1=0ax+by+c_1=0 and ax+by+c2=0ax+by+c_2=0?
d=c1c2a2+b2d = \frac{|c_1 - c_2|}{\sqrt{a^2+b^2}} (pick any point on one line and find its distance to the other).
Why is the perpendicular distance the SHORTEST distance from a point to a line?
Any other path forms the hypotenuse of a right triangle, which is always longer than the perpendicular leg.
If the line is y=mx+ky = mx + k, how do you convert it to use in the distance formula?
Rewrite as mxy+k=0mx - y + k = 0, so a=m,b=1,c=ka = m, b = -1, c = k.

Concept Map

shortest path to

perpendicular gives

any slanted path is

so shortest is

derives

derives

uses points A and B

Area = half base times height

normal vector n = a,b

project QP onto unit normal

equals

Point P x1 y1

Line ax+by+c=0

Perpendicular distance d

Hypotenuse longer

Method 1 Triangle Area

Formula d

Method 2 Vector Projection

d = ax1+by1+c / sqrt a2+b2

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, agar tumhe ek point diya hai aur ek straight line di hai, toh tumhe sabse chhoti dori nikalni hai point se line tak. Ab yeh dori kaise nikalte hain? Simple hai—jab tum point se line tak perpendicular (90 degree ka angle banate hue) chalo, toh woh sabse short path hota hai. Agar tum tircha (slanted) chaloge, toh zyada dori cover karni padegi, kyunki perpendicular wala path hypotenuse nahi hai, seedha leg hai right triangle ka.

Formula yad rakho: d=ax1+by1+ca2+b2d = \frac{|ax_1 + by_1 + c|}{\sqrt{a^2 + b^2}}. Yahan line ka equation ax+by+c=0ax + by + c = 0 hona chahiye (standard form mein), aur point ka coordinate (x1,y1)(x_1, y_1) hai. Numerator mein point ko line ki equation mein plug karo, absolute value lo (kyunki distance kabhi negative nahi hota), aur denominator mein normal vector (a,b)(a, b) ki length a2+b2\sqrt{a^2+b^2} se divide kar do. Bas!

Yeh formula bahut important hai—geometry mein, coordinate problems mein, aur real-life scenarios mein jaise highway se city ki dori nikalna. Ekbaar samajh gaye toh kafi useful hai, aur derivation bhi straight-forward hai area of triangle ya vector projection se. Practice karo different examples pe, aur dhyan do ki line ka form sahi ho aur absolute value mat bholo!

Go deeper — visual, from zero

Test yourself — Coordinate Geometry

Connections