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 $(x_0, y_0)$ and a line $Ax + By + C = 0$, that distance is $d = \dfrac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}$; this article derives the formula and works six examples.
BT
Bhanzu TeamLast 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 $P$ to the line, meeting it at foot $M$. Now pick any other point $Q$ on the line and join $P$ to $Q$. The triangle $PMQ$ has a right angle at $M$, so $PQ$ is its hypotenuse - and the hypotenuse is always the longest side. So $PM$ (the perpendicular) is shorter than $PQ$ for every other choice of $Q$. The perpendicular wins, always.

This lives in coordinate geometry: we describe the point with coordinates $(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(x_0, y_0)$ and a line written in standard form $Ax + By + C = 0$, the perpendicular distance is:

$$d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}$$

The pieces mean:

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

  • $x_0$, $y_0$ are the coordinates of the point.

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

  • $\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 + c$, rewrite it as $mx - y + c = 0$, so $A = m$, $B = -1$, $C = c$.

Where does the formula come from?

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

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

Form triangle $PAB$ using $P$ and those two intercepts.

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

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

Setting the two area expressions equal and cancelling gives:

$$d = \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)$ to the line $3x + 4y - 10 = 0$.

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

$$d = \frac{|3\cdot 0 + 4\cdot 0 - 10|}{\sqrt{3^2 + 4^2}}$$ $$d = \frac{|-10|}{\sqrt{9 + 16}}$$ $$d = \frac{10}{\sqrt{25}} = \frac{10}{5} = 2$$

Final answer: the distance is 2 units.

Example 2

Find the distance from $(2, 3)$ to the line $y = 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 + c$ directly with $m = 2$, $c = 1$, and just compute $|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 = 0$, so $A = 2$, $B = -1$, $C = 1$.

$$d = \frac{|2\cdot 2 + (-1)\cdot 3 + 1|}{\sqrt{2^2 + (-1)^2}}$$ $$d = \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 = 0$ first, then apply the formula, so the $\sqrt{A^2+B^2}$ can do its rescaling job.

Example 3

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

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

$$d = \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: $\sqrt{2}$, about 1.414 units.

Example 4

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

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

$$d = \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, 13$ Pythagorean pattern in the denominator makes this one land cleanly.

Example 5

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

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

$$d = \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 = 0$ and $3x + 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 = 1$ works: $3\cdot 1 + 4\cdot 1 - 7 = 0$.

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

$$d = \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 + c$ and the student plugs straight in (the rusher who skips the setup step).

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

The correct way: rewrite as $Ax + By + C = 0$ first - here $2x - y + 1 = 0$ - then read off $A = 2$, $B = -1$, $C = 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 $Ax_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$.

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 $\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 = \dfrac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}$, with the line in standard form.

  • Always convert $y = mx + c$ into $Ax + 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)$, line $4x + 3y - 5 = 0$; (2) point $(0, 0)$, line $x - y + 4 = 0$; (3) distance between $x + y - 1 = 0$ and $x + y + 5 = 0$. Answer to Question 1: 1. Answer to Question 2: $2\sqrt{2} \approx 2.83$. Answer to Question 3: $3\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 = 0$, then compute $\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
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →