The distance from a point to a line always means the perpendicular distance — the length of the shortest segment from the point to the line. Any other segment from the point meets the line at an angle and is therefore longer.
For a line written in general form $Ax + By + C = 0$ and a point $(x_1, y_1)$, this shortest distance is:
The recipe is mechanical and reliable: substitute the point's coordinates into the left-hand side of the line's equation, take the absolute value of the result (distance is never negative), and divide by $\sqrt{A^2 + B^2}$, the magnitude of the coefficient pair. The line must be in the form $Ax + By + C = 0$ before you read off $A$, $B$, $C$ — a common slip is to forget to move all terms to one side first.
A neat special case: the distance from the origin $(0, 0)$ collapses to:
Distance between two parallel lines. Parallel lines never meet, so the gap between them is constant. If they are written with identical coefficients of $x$ and $y$:
then the perpendicular distance between them is:
The crucial precondition is highlighted in the table below — the $x$- and $y$-coefficients must be made identical before subtracting the constants.
| Situation | Formula | Watch out for |
|---|---|---|
| Point $(x_1, y_1)$ to line | $d = \dfrac{|Ax_1 + By_1 + C|}{\sqrt{A^2 + B^2}}$ | line must be $Ax + By + C = 0$ |
| Origin to line | $d = \dfrac{|C|}{\sqrt{A^2 + B^2}}$ | just set $x_1 = y_1 = 0$ |
| Two parallel lines | $d = \dfrac{|C_1 - C_2|}{\sqrt{A^2 + B^2}}$ | make $A, B$ identical first |
Deeper Insight — why the sign tells you which side: The absolute value in the distance formula hides a useful secret. Before you take the modulus, the signed quantity $\dfrac{Ax_1 + By_1 + C}{\sqrt{A^2 + B^2}}$ tells you not only how far the point is from the line but on which side of it the point lies — points on opposite sides give opposite signs, while points on the line give exactly zero. This is the foundation of how a line splits the plane into two half-planes, an idea you will rely on heavily in Linear Programming when shading feasible regions. The denominator $\sqrt{A^2 + B^2}$ is no accident either: it is the length of the normal vector $(A, B)$ to the line, and dividing by it converts the raw value $Ax_1 + By_1 + C$ into a true geometric distance measured along that perpendicular direction. The parallel-line formula is then just the same idea applied twice — both lines share the same normal direction, so their separation is simply the difference in their constant terms, scaled by that same length. Seen this way, all three formulas in this topic are really one formula wearing different hats.