Worked examples — Distance from a point to a line
Before anything, let me re-anchor every symbol so no notation is borrowed silently:
The picture below shows exactly what these words mean — this is the mental image behind every example on the page.

Look at the red arrow: that is the normal , poking straight across the blue line. The yellow segment is itself — the perpendicular drop from . Every formula below is just measuring the length of that yellow segment.
See Equation of a Line for the forms a line can take, Normal Vector to a Line for why points across it, and Projection of Vectors for why we divide by its length.
The scenario matrix
Every distance problem falls into one of these cells. The examples below are labelled with the cell they cover, and together they hit all of them.
| Cell | What makes it different | Example |
|---|---|---|
| A — clean substitution | all numbers positive, Pythagorean triple denominator | Ex 1 |
| B — signed-value cancellation | plugging in gives a negative inside the bars | Ex 2 |
| C — disguised line | given as or two points, must convert first | Ex 3 |
| D — degenerate: point ON the line | numerator , distance | Ex 4 |
| E — axis-parallel line ( or ) | one coordinate "disappears" — both sub-cases | Ex 5a, 5b |
| F — two parallel lines | no single point, use the shortcut | Ex 6 |
| G — real-world word problem | must build the model, carry units | Ex 7 |
| H — exam twist: unknown parameter | distance is given, solve backwards for a letter | Ex 8 |
Cell A — clean substitution
Forecast: Guess before reading — is it bigger or smaller than 5? Write your guess down.
- Read off the numbers. ; point . Why this step? The formula only works once every letter is matched to a number — mismatching 's sign is the #1 slip.
- Numerator: plug the point into the left side of the line. Why this step? measures "how far off zero" the point is when fed into the line's equation — that mismatch is exactly what distance is built from.
- Denominator: length of the normal. Why this step? We divide by the normal's length so the answer is a true distance, not a scaled copy (see Projection of Vectors).
- Divide. Why this step? Numerator over the normal's length turns the raw mismatch into the actual length of the yellow perpendicular segment .
Verify: The point satisfies ; the line is . The two parallel lines and are apart — matches. ✓ Units: same as the grid, so units.
Cell B — signed-value cancellation
Forecast: The point sits close to the line here — will the answer be a whole number or something irrational? Guess.
- Match numbers. ; point . Note is negative — keep it. Why this step? Dropping the sign of silently changes the line; the sign lives inside the formula, not just in front of it.
- Numerator. Why this step? Here the inside comes out negative — that is perfectly normal. It only tells us which side of the line is on.
- Absolute value. . Why this step? Distance can't be negative, so we discard the side-information and keep size.
- Denominator & divide. Why this step? Dividing the size- mismatch by the normal length gives the true perpendicular length; then rationalizing to is just the tidy exam form (multiply top and bottom by ).
Verify: , and squared is also . Same number. ✓
Cell C — disguised line
Forecast: You can't plug in until the line is in form. Guess whether the answer exceeds 3.
- Slope from two points. Why this step? Two points fix a line; slope is the first thing we can extract (see Equation of a Line).
- Point–slope, then clear fractions. Why this step? The formula demands the standard form; can't be fed in directly.
- Match & plug the point into the left side. ; point . Why this step? Now that the line is standardised we compute the numerator mismatch, exactly as in Cell A — the disguise is gone.
- Denominator & divide. Why this step? Dividing the mismatch by the normal length converts it into the real perpendicular distance .
Verify: Do both given points satisfy ? ✓, ✓. So the line is correct, hence the distance is trustworthy.
Cell D — degenerate: the point lies ON the line
Forecast: Where does sit relative to the line? Test it in your head first.
- Numerator. Why this step? If plugging the point into the line gives exactly , the point satisfies the line's equation — it lies on the line.
- Divide. Why this step? We still run the full formula rather than "just declaring" the answer — it shows the perpendicular segment has shrunk to nothing, so falls out with no special rule needed.
Verify: Zero divided by any positive number is ; distance means "you're already there." The formula degrades gracefully — no special case needed. ✓

The figure shows (red) sitting right on the blue line: there is no yellow segment to measure, which is the geometric meaning of .
Cell E — axis-parallel line (both sub-cases)
An axis-parallel line makes one of zero. There are two flavours — vertical () and horizontal () — so we work both.
Forecast: A vertical line has no slope — will the formula still cope? Guess the answer from the picture below.
- Write it in standard form. , i.e. . So . Why this step? "" hides the ; the normal is , a purely horizontal arrow — it points straight across a vertical line, exactly as it should.
- Numerator. Why this step? The -coordinate drops out because — distance to a vertical line depends only on how far your is from .
- Denominator & divide. , so Why this step? The normal has length , so dividing changes nothing — the perpendicular is purely horizontal and is just the horizontal gap.
Verify: By eye, from to is steps horizontally — the formula agrees. ✓

The yellow segment in the figure is horizontal because the normal is horizontal — that is the whole reason the -coordinate never entered the arithmetic.
Forecast: Now it's the -coordinate that should vanish. Predict the answer.
- Standard form. , so . Why this step? A horizontal line has normal — a purely vertical arrow, pointing straight across it.
- Numerator. Why this step? Now the -coordinate drops out because — distance to a horizontal line depends only on how far your is from .
- Denominator & divide. , so Why this step? Same reason as 5a with roles swapped: the perpendicular is vertical, so is just the vertical gap .
Verify: From down to is — matches. ✓
Recall Why doesn't a zero coefficient break the formula?
Setting or only kills a term; the denominator stays as long as at least one of is non-zero. Only (no line at all) would break it. A vertical line gives distance ::: . A horizontal line gives distance ::: .
Cell F — two parallel lines
Forecast: There's no single point given. What do you do? Guess before step 1.
- Check they're parallel. Both have the same , so same normal ⇒ parallel. Why this step? The shortcut only works when the two lines share and ; otherwise they cross and the distance is .
- Match to the shortcut. . Why this step? Any point on line 1 sits the same distance from line 2 (parallel = constant gap), so we can skip picking a point and just use the difference of the constant terms.
Verify (the long way): Pick a point on line 1. Set : , point . Distance to line 2: Same answer — the shortcut is honest. ✓
Cell G — real-world word problem
Forecast: Guess the distance to the nearest km before computing.
- Standardise. . So . Why this step? Move everything to one side so the formula's form is met.
- Numerator. Why this step? This is the raw mismatch of the town's coordinates against the highway equation.
- Denominator. Why this step? is a Pythagorean triple — spotting it avoids a messy root.
- Divide with units. Why this step? Dividing the mismatch by the normal length converts it into a genuine perpendicular distance; the "per number" division leaves the km unit untouched.
- Answer the actual question. , so a km warning zone would not reach the town. Why this step? The word problem asked a yes/no coverage question, not just a number — we must compare to the radius to answer it.
Verify: Multiply back: ✓. Units: the distance formula divides km by a pure number, so the result is in km — dimensionally consistent.
Cell H — exam twist: solve backwards for a parameter
Forecast: How many answers do you expect — one or two? Guess and give a reason.
- Write the distance with unknown. Why this step? We set up the same formula, but now the numerator carries the unknown letter, because is what we're solving for.
- Set equal to the given distance and clear the fraction. Why this step? Undoing the division (multiply both sides by ) isolates the absolute-value expression so we can attack it directly.
- Split the absolute value into two cases. Why two cases? means or — the two parallel lines lying units on either side of . Missing this loses half the answer.
- Solve each. or . Why this step? Each case is a one-line linear equation; subtract from both sides to get the two values of that place the line exactly units from .
Verify: For : ✓. For : ✓. Both work — geometrically, two parallel lines flank the point.

The green and red lines are the two answers: each sits exactly units from the yellow point , one on each side — the picture reason there are two values of , not one.
Choosing the right route — a decision map
The next flowchart is a decision map: start at the top with any distance problem, and follow the yes/no branches until you land on the cell (and hence the example) that matches. Read it as "ask this question, then go where the arrow with your answer points." It compresses all eight cells into one route-finder so that, mid-problem, you always know your next move.
Recall Self-test
Distance from to ::: Distance between and ::: Values of if is from ::: or Distance from to ::: Distance from to :::
Back to the parent: Distance from a point to a line. Related: Distance Formula, Area of Triangle Using Coordinates, Linear Programming, Least Squares Regression.