Distance from a Point to a Line
In coordinate geometry, one of the most practical measurements we can make is finding the shortest distance between a point and a line. This shortest path is always along the perpendicular from the point to the line — which is why the formula is called the perpendicular distance formula. Whether you are working in architecture, computer graphics, physics, or pure mathematics, knowing how far a point lies from a given line is an essential skill. The formula allows us to compute this distance algebraically, without having to draw the perpendicular, find its foot, and then calculate a length the long way. Given a line in the standard form ax + by + c = 0 and a point (x₁, y₁), the distance can be evaluated in a single expression involving the coefficients a, b, and c. The result is always a non-negative number, measured in the same units as the coordinate system. Understanding this formula deepens your appreciation of analytic geometry: it shows how algebraic manipulation can replace geometric construction. It also connects several ideas you already know — the equation of a line, the dot product concept behind projections, and the Pythagorean theorem — into one elegant result.
- Write the Line in Standard Form
- Identify the Point
- Set Up the Geometry
- Derive Using the Projection Formula
- State the Final Formula
- Special Case: Distance from the Origin
Write the Line in Standard Form
Any straight line can be written as ax + by + c = 0, where a, b, c are real constants and a and b are not both zero. For example, 3x - 4y + 5 = 0 is already in this form. If you are given y = mx + k, rearrange to mx - y + k = 0, identifying a = m, b = -1, c = k.
Identify the Point
Let the point whose distance from the line we want be P = (x₁, y₁). We want the length of the perpendicular segment from P to the line. Note that if P actually lies on the line, then ax₁ + by₁ + c = 0, and the distance will be zero — a nice sanity check.
Set Up the Geometry
The direction vector of the line ax + by + c = 0 is (b, -a), and the normal (perpendicular) vector to the line is (a, b). The perpendicular from P to the line goes in the direction of (a, b). We drop a perpendicular from P and call its foot F. The distance d = |PF|.
Derive Using the Projection Formula
Take any point Q on the line. The vector QP has component along the normal (a, b) of magnitude |QP · n̂|, where n̂ = (a, b)/√(a² + b²) is the unit normal. Choose Q = (x₀, y₀) on the line so ax₀ + by₀ + c = 0. Then QP = (x₁ - x₀, y₁ - y₀). The projection onto n̂ is [(a(x₁ - x₀) + b(y₁ - y₀))] / √(a² + b²) = [ax₁ + by₁ - (ax₀ + by₀)] / √(a² + b²) = [ax₁ + by₁ + c] / √(a² + b²), since ax₀ + by₀ = -c. Taking the absolute value gives the perpendicular distance.
State the Final Formula
The perpendicular distance from point (x₁, y₁) to the line ax + by + c = 0 is: d = |ax₁ + by₁ + c| / √(a² + b²). The absolute value ensures d ≥ 0 regardless of which side of the line the point lies on. The denominator √(a² + b²) is the magnitude of the normal vector and acts as a normalising factor.
Special Case: Distance from the Origin
If the point is the origin O = (0, 0), substitute x₁ = 0 and y₁ = 0 into the formula: d = |c| / √(a² + b²). This is a frequently used shortcut. For the line 3x - 4y + 10 = 0, the distance from the origin is |10| / √(9 + 16) = 10 / 5 = 2.
The Key Equation
- d — Perpendicular distance (same as coordinate units): The shortest (perpendicular) distance from point P to the line.
- a,\, b — Coefficients of x and y (dimensionless): Constants in the standard form ax + by + c = 0; not both zero.
- c — Constant term (dimensionless): The constant in the line equation ax + by + c = 0.
- (x_1,\, y_1) — Coordinates of the point (coordinate units): The point whose perpendicular distance from the line is being measured.
- \sqrt{a^2+b^2} — Magnitude of normal vector (dimensionless): The length of the normal vector (a, b) to the line; normalises the formula.
Worked Example
Problem. Find the perpendicular distance from the point P(3, -5) to the line 12x - 5y + 1 = 0.
Answer. The perpendicular distance is 62/13 ≈ 4.77 units.
Origins · 1 minRené Descartes and how this was discovered
Descartes invented the Cartesian coordinate system, published in his 1637 work La Géométrie as an appendix to his Discours de la méthode. By assigning numerical coordinates to points in the plane, he unified algebra and geometry, making it possible to express geometric relationships — including distances and line equations — as algebraic formulas. The perpendicular distance formula is a direct descendant of his vision. Descartes reportedly conceived the idea of coordinate geometry while lying in bed watching a fly on his ceiling, wondering how to describe its position mathematically using only numbers.
Related Concepts
- Equation of a Straight Line — You must be able to write a line in the form ax + by + c = 0 before applying the distance formula.
- Angle Between Two Lines — The concept of perpendicularity used in deriving the distance formula extends to finding angles between lines.
- Tangent to a Circle — A tangent line touches a circle at exactly one point; confirming this uses the perpendicular distance from the centre equalling the radius.
- Distance Between Parallel Lines — The distance between two parallel lines is found by picking any point on one line and applying the perpendicular distance formula to the other.