Distance of a Point From a Line - Formula & Examples

#Geometry
TL;DR
The distance of a point from a line is the shortest length between them, measured along the perpendicular dropped from the point to the line. For a point (x0,y0)(x_0, y_0) and a line Ax+By+C=0Ax + By + C = 0, that distance is d=∣Ax0+By0+C∣A2+B2d = \dfrac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}; this article derives the formula and works six examples.
MV
Madhukar VLast updated on July 21, 20269 min read

What Is the Distance of a Point From A Line?

The distance of a point from a line is the length of the perpendicular segment drawn from the point to the line. It is the shortest possible distance between the fixed point and any point on the line.

Why the perpendicular, and not some other segment? Drop the perpendicular from point PP to the line, meeting it at foot MM. Now pick any other point QQ on the line and join PP to QQ. The triangle PMQPMQ has a right angle at MM, so PQPQ is its hypotenuse - and the hypotenuse is always the longest side. So PMPM (the perpendicular) is shorter than PQPQ for every other choice of QQ. The perpendicular wins, always.

This lives in coordinate geometry: we describe the point with coordinates (x0,y0)(x_0, y_0) on the coordinate plane and the line with an equation of a straight line, then compute the gap without ever drawing it.

Let's take an example: A pilot flying a straight course wants to know: how close will I actually pass to that mountain peak?

The peak is a single point. The flight path is a straight line. The answer the pilot needs is not any old distance to the line - it is the shortest one, the near-miss distance. That single number is what "distance of a point from a line" means, and coordinate geometry gives it a clean formula.

What Is The Formula?

For a point P(x0,y0)P(x_0, y_0) and a line written in standard form Ax+By+C=0Ax + By + C = 0, the perpendicular distance is:

d=∣Ax0+By0+C∣A2+B2d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}

The pieces mean:

  • AA, BB, CC are the coefficients of the line once it is written as Ax+By+C=0Ax + By + C = 0 (everything on one side, equal to zero).

  • x0x_0, y0y_0 are the coordinates of the point.

  • The absolute value bars ∣;∣|;| keep the answer positive, since a distance can never be negative.

  • A2+B2\sqrt{A^2 + B^2} normalises by the "steepness" of the line.

The formula needs the line in standard form first. If the line is given as y=mx+cy = mx + c, rewrite it as mx−y+c=0mx - y + c = 0, so A=mA = m, B=−1B = -1, C=cC = c.

Where does the formula come from?

A short derivation, one step per line. Take line L:Ax+By+C=0L: Ax + By + C = 0 and point P(x0,y0)P(x_0, y_0).

The line crosses the axes at intercepts (−CA,0)\left(-\tfrac{C}{A}, 0\right) and (0,−CB)\left(0, -\tfrac{C}{B}\right).

Form triangle PABPAB using PP and those two intercepts.

Compute its area two ways. First, using the coordinate area formula, the area works out to 12⋅∣C∣⋅∣Ax0+By0+C∣∣AB∣\tfrac{1}{2}\cdot\dfrac{|C|\cdot|Ax_0 + By_0 + C|}{|AB|}.

Second, area =12⋅(base AB)⋅(height d)= \tfrac{1}{2}\cdot(\text{base } AB)\cdot(\text{height } d), where dd is the perpendicular distance we want and the base AB=∣C∣A2+B2∣AB∣AB = \dfrac{|C|\sqrt{A^2+B^2}}{|AB|}.

Setting the two area expressions equal and cancelling gives:

d=∣Ax0+By0+C∣A2+B2d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}

The numerator is just the line's expression evaluated at the point; the denominator rescales it into a true length.

Examples Of Distance Of A Point From A Line

Six worked examples, easier to harder. The problem statement is bold; the steps are not. We use ⋅\cdot for every product.

Example 1

Find the distance from the point (0,0)(0, 0) to the line 3x+4y−10=03x + 4y - 10 = 0.

Here A=3A = 3, B=4B = 4, C=−10C = -10, and (x0,y0)=(0,0)(x_0, y_0) = (0, 0).

d=∣3⋅0+4⋅0−10∣32+42d = \frac{|3\cdot 0 + 4\cdot 0 - 10|}{\sqrt{3^2 + 4^2}} d=∣−10∣9+16d = \frac{|-10|}{\sqrt{9 + 16}} d=1025=105=2d = \frac{10}{\sqrt{25}} = \frac{10}{5} = 2

Final answer: the distance is 2 units.

Example 2

Find the distance from (2,3)(2, 3) to the line y=2x+1y = 2x + 1. A student plugs the point straight into the slope-intercept form. Watch how that goes.

The tempting move is to use y=mx+cy = mx + c directly with m=2m = 2, c=1c = 1, and just compute ∣y0−(mx0+c)∣=∣3−(2⋅2+1)∣=∣3−5∣=2|y_0 - (m x_0 + c)| = |3 - (2\cdot 2 + 1)| = |3 - 5| = 2, then call the distance 2.

That number 2 is the vertical gap, not the perpendicular gap — and the two are only equal for a horizontal line. Here the line is slanted, so the true distance is shorter.

Rewrite in standard form: 2x−y+1=02x - y + 1 = 0, so A=2A = 2, B=−1B = -1, C=1C = 1.

d=∣2⋅2+(−1)⋅3+1∣22+(−1)2d = \frac{|2\cdot 2 + (-1)\cdot 3 + 1|}{\sqrt{2^2 + (-1)^2}} d=∣4−3+1∣4+1=25≈0.894d = \frac{|4 - 3 + 1|}{\sqrt{4 + 1}} = \frac{2}{\sqrt{5}} \approx 0.894

Final answer: about 0.894 units, not 2. The fix is always the same: convert to Ax+By+C=0Ax + By + C = 0 first, then apply the formula, so the A2+B2\sqrt{A^2+B^2} can do its rescaling job.

Example 3

Find the distance from (1,1)(1, 1) to the line x+y−4=0x + y - 4 = 0.

A=1A = 1, B=1B = 1, C=−4C = -4.

d=∣1⋅1+1⋅1−4∣12+12=∣−2∣2=22=2≈1.414d = \frac{|1\cdot 1 + 1\cdot 1 - 4|}{\sqrt{1^2 + 1^2}} = \frac{|-2|}{\sqrt{2}} = \frac{2}{\sqrt{2}} = \sqrt{2} \approx 1.414

Final answer: 2\sqrt{2}, about 1.414 units.

Example 4

Find the distance from the origin to the line 5x−12y+26=05x - 12y + 26 = 0.

A=5A = 5, B=−12B = -12, C=26C = 26, point (0,0)(0, 0).

d=∣5⋅0−12⋅0+26∣52+(−12)2=2625+144=26169=2613=2d = \frac{|5\cdot 0 - 12\cdot 0 + 26|}{\sqrt{5^2 + (-12)^2}} = \frac{26}{\sqrt{25 + 144}} = \frac{26}{\sqrt{169}} = \frac{26}{13} = 2

Final answer: 2 units. The 5,12,135, 12, 13 Pythagorean pattern in the denominator makes this one land cleanly.

Example 5

A point lies on the line 2x+3y−6=02x + 3y - 6 = 0. Find its distance from that line.

Take any point on the line, say (3,0)(3, 0) (it satisfies 2⋅3+3⋅0−6=02\cdot 3 + 3\cdot 0 - 6 = 0).

d=∣2⋅3+3⋅0−6∣22+32=∣0∣13=0d = \frac{|2\cdot 3 + 3\cdot 0 - 6|}{\sqrt{2^2 + 3^2}} = \frac{|0|}{\sqrt{13}} = 0

Final answer: 0. Any point on the line has zero distance from it — a useful check that the formula behaves sensibly.

Example 6

Find the distance between the two parallel lines 3x+4y−7=03x + 4y - 7 = 0 and 3x+4y+3=03x + 4y + 3 = 0.

Parallel lines are a constant distance apart, so pick any point on the first line and measure its distance to the second. On the first line, x=1,y=1x = 1, y = 1 works: 3⋅1+4⋅1−7=03\cdot 1 + 4\cdot 1 - 7 = 0.

Now measure (1,1)(1, 1) against the second line, 3x+4y+3=03x + 4y + 3 = 0:

d=∣3⋅1+4⋅1+3∣32+42=∣10∣25=105=2d = \frac{|3\cdot 1 + 4\cdot 1 + 3|}{\sqrt{3^2 + 4^2}} = \frac{|10|}{\sqrt{25}} = \frac{10}{5} = 2

Final answer: the parallel lines are 2 units apart.

Why This Formula Matters

The perpendicular-distance formula answers a question that comes up far more often than its textbook home suggests.

The real problem it solves is "how close does a straight path come to a fixed spot?" - and that shows up everywhere:

  • Clearance and safety. Air-traffic separation, a robot arm avoiding an obstacle, a road planned to skirt a protected building - all ask for the shortest gap between a point and a line of travel.

  • Best-fit lines in data. When statistics fits a trend line to a cloud of points, "how good is the fit" is measured by how far each point sits from the line. The perpendicular distance is the honest version of that error.

  • Computer graphics. Deciding whether a click landed on a drawn line, or how thick a rendered line should look, uses exactly this distance.

The intuition worth carrying is the one from the Quora threads students keep asking: why perpendicular? Because any slanted segment from the point to the line is the hypotenuse of a right triangle whose short leg is the perpendicular - and the hypotenuse always loses the length race. The shortest way to a line is to meet it head-on, at 90°.

The Mistakes Students Make Most Often

Three errors account for most wrong answers here.

Mistake 1: Using slope-intercept form instead of standard form

Where it slips in: the line is handed over as y=mx+cy = mx + c and the student plugs straight in (the rusher who skips the setup step).

Don't do this: apply the formula to y=2x+1y = 2x + 1 as though A,B,CA, B, C are already sitting there.

The correct way: rewrite as Ax+By+C=0Ax + By + C = 0 first - here 2x−y+1=02x - y + 1 = 0 - then read off A=2A = 2, B=−1B = -1, C=1C = 1. Skipping the standard-form conversion is the single most common source of a wrong distance.

Mistake 2: Dropping the absolute value

Where it slips in: when Ax0+By0+CAx_0 + By_0 + C comes out negative (the second-guesser who trusts the raw sign).

Don't do this: report a negative distance like −2-2.

The correct way: the bars ∣;∣|;| are part of the formula - a distance is always positive. If the numerator is negative, take its magnitude.

Mistake 3: Confusing it with the distance between two points

Where it slips in: problems that mention two coordinate pairs (the memorizer who reaches for (x2−x1)2+(y2−y1)2\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2} automatically).

Don't do this: use the two-point distance formula when one object is a whole line, not a point.

The correct way: if you are measuring to a line, use the perpendicular formula. The two-point formula measures between two specific spots; the perpendicular formula measures to the nearest spot on an infinite line.

Conclusion

  • The distance of a point from a line is the perpendicular (shortest) distance between them.

  • The formula is d=∣Ax0+By0+C∣A2+B2d = \dfrac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}, with the line in standard form.

  • Always convert y=mx+cy = mx + c into Ax+By+C=0Ax + By + C = 0 before applying it.

  • The absolute value keeps the distance positive; a point on the line gives distance 0.

  • The perpendicular is shortest because every other segment is a longer hypotenuse.

To take this topic further with a teacher, explore Bhanzu's geometry tutor, a high school math tutor for coordinate-geometry chapters, or math tutoring for guided practice.

Practice these problems to solidify your understanding: (1) point (1,2)(1, 2), line 4x+3y−5=04x + 3y - 5 = 0; (2) point (0,0)(0, 0), line x−y+4=0x - y + 4 = 0; (3) distance between x+y−1=0x + y - 1 = 0 and x+y+5=0x + y + 5 = 0. Answer to Question 1: 1. Answer to Question 2: 22≈2.832\sqrt{2} \approx 2.83. Answer to Question 3: 32≈4.243\sqrt{2} \approx 4.24. If you get stuck on the parallel-lines problem, come back to Example 6. Want a live trainer to walk through coordinate geometry? Book a free demo class.

Read More

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

How do you find the distance from a point to a line?
Write the line as Ax+By+C=0Ax + By + C = 0, then compute ∣Ax0+By0+C∣A2+B2\dfrac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}} using the point's coordinates.
Why is the shortest distance always the perpendicular?
Because any non-perpendicular segment is the hypotenuse of a right triangle whose leg is the perpendicular, and the hypotenuse is always longer.
What is the distance from a point to a line in 3D?
The idea is the same — the perpendicular distance — but the formula uses vectors and a cross product rather than the 2D coefficient formula above
What is the distance if the point lies on the line?
Zero. Substituting a point that satisfies the equation makes the numerator zero.
Can this formula find the distance between two parallel lines?
Yes. Pick any point on one line and measure its distance to the other, as in Example 6.
✍️ Written By
Madhukar V
Madhukar V
Math Columnist & Analyst
I see mathematics as more than just numbers and formulas—it is a way of thinking, questioning, and understanding the world around us. I work at the intersection of mathematics, EdTech, technology, and AI-powered learning, I enjoy exploring how mathematical ideas can be made simple, meaningful, and relatable. Through my articles, I aim to present mathematics with curiosity and a practical perspective, helping readers see the beauty and relevance behind every concept in a Bhanzu way.
LinkedIn
Related Articles
Book a FREE Demo ClassBook Now →