9.3 Distance of a Point from a Line
The shortest way from a point to a line is along the perpendicular. Its length is $d=\dfrac{|Ax_1+By_1+C|}{\sqrt{A^2+B^2}}$, and two parallel lines $Ax+By+C_1=0$, $Ax+By+C_2=0$ are $\dfrac{|C_1-C_2|}{\sqrt{A^2+B^2}}$ apart.
A village stands $10\ \text{km}$ from a district town, and a new straight highway is planned past it. The village wants an access road โ as short as possible โ down to the highway. Where should it join, and how long will it be? Or think of a ship steaming on a straight course past a lighthouse: how close will it come, and when? Both questions ask for the distance of a point from a line, and both have the same answer: walk off at right angles. Any other route to the line is the hypotenuse of a right triangle whose other side is the perpendicular, so it is longer.
In this section we turn that geometric fact into a formula you can use without drawing: the distance of a point $(x_1,y_1)$ from a line in terms of the coefficients of its equation. We also find the point where the perpendicular meets the line (the foot of the perpendicular), and the distance between two parallel lines โ the width of a straight road, a canal or a strip of land.
The Shortest Distance from a Point to a Line
Let $P$ be a point and $L$ a line. Draw the line through $P$ perpendicular to $L$, meeting $L$ at $N$. The point $N$ is the foot of the perpendicular from $P$ to $L$, and the length $PN$ is the (perpendicular) distance of $P$ from $L$. If $P$ lies on $L$, then $N=P$ and the distance is $0$.
Why the perpendicular is shortest. If $Q$ is any other point of $L$, the triangle $PNQ$ has a right angle at $N$, so by Pythagoras $PQ^2=PN^2+NQ^2\gt PN^2$. Every other path from $P$ to the line is longer.
For the formula we write the line with all its terms on one side, $$Ax+By+C=0\qquad(A,B\text{ not both }0).$$ Every equation in Section 9.2 can be rearranged like this: $y=mx+c$ becomes $mx-y+c=0$, and $x=x_1$ becomes $x-x_1=0$. When $B\ne0$ you can go back with $y=-\tfrac ABx-\tfrac CB$, so the slope is $-\tfrac AB$; when $B=0$ the line is vertical.
The distance of the point $P(x_1,y_1)$ from the line $Ax+By+C=0$, where $A$ and $B$ are not both $0$, is $$d=\dfrac{|Ax_1+By_1+C|}{\sqrt{A^2+B^2}}.$$
Proof. Case $B=0$. The line is the vertical line $x=-\tfrac CA$, and the perpendicular from $P$ is horizontal, so $d=\left|x_1+\tfrac CA\right|=\dfrac{|Ax_1+C|}{|A|}$, which is the formula with $B=0$.
Case $B\ne0$. Write the line as $y=mx+c$ with $m=-\tfrac AB$ and $c=-\tfrac CB$. The vertical line through $P$ meets $L$ at $Q(x_1,\,mx_1+c)$, so the vertical distance is $PQ=|y_1-mx_1-c|$. If $m=0$ the line is horizontal and $PN=PQ$. Otherwise the triangle $PNQ$ has a right angle at $N$. Let $\varphi$ be the acute angle between $L$ and the $x$-axis, so $\tan\varphi=|m|$. The side $PQ$ is vertical and $PN$ is perpendicular to $L$; turning both the $x$-axis and $L$ through $90^\circ$ turns them into $PQ$ and $PN$, so $\angle QPN=\varphi$. Hence $$PN=PQ\cos\varphi=\dfrac{PQ}{\sqrt{1+\tan^2\varphi}}=\dfrac{|y_1-mx_1-c|}{\sqrt{1+m^2}},$$ which also covers $m=0$. Now substitute $m=-\tfrac AB$, $c=-\tfrac CB$: $$d=\dfrac{\left|y_1+\tfrac ABx_1+\tfrac CB\right|}{\sqrt{1+\tfrac{A^2}{B^2}}}=\dfrac{|Ax_1+By_1+C|/|B|}{\sqrt{A^2+B^2}/|B|}=\dfrac{|Ax_1+By_1+C|}{\sqrt{A^2+B^2}}.\ \blacksquare$$
The middle line of the proof is worth remembering on its own: for $y=mx+c$, $$d=\dfrac{|y_1-mx_1-c|}{\sqrt{1+m^2}}=\dfrac{\text{vertical distance}}{\sqrt{1+m^2}}.$$ The steeper the line, the more the vertical distance overstates the true distance.
- Rewrite the line as $Ax+By+C=0$ โ everything on one side, "$=0$" on the other.
- Substitute the point into the left-hand side: $Ax_1+By_1+C$. Take the modulus.
- Divide by $\sqrt{A^2+B^2}$ โ the square root of the sum of the squares of the coefficients of $x$ and $y$ only (not $C$).
- If the distance is given and something is unknown, $|\ \cdot\ |=k$ means "$=k$ or $=-k$": expect two answers.
The Foot of the Perpendicular
To find the point $N$ itself, use Sections 9.1 and 9.2: write the line through $P$ perpendicular to $L$ (its slope is the negative reciprocal of the slope of $L$), and solve the two equations together. Then check that $PN$ agrees with the distance formula.
Distance between Parallel Lines
Two parallel lines are the same distance apart everywhere โ that is what makes them parallel โ so the distance between them is the distance of any point of one from the other. Choosing the point cleverly gives a formula.
The distance between the parallel lines $Ax+By+C_1=0$ and $Ax+By+C_2=0$ (same $A$ and $B$, not both $0$) is $$d=\dfrac{|C_1-C_2|}{\sqrt{A^2+B^2}}.$$ In slope-intercept form, the distance between $y=mx+c_1$ and $y=mx+c_2$ is $\dfrac{|c_1-c_2|}{\sqrt{1+m^2}}$.
Proof. Let $(x_0,y_0)$ be any point of the first line, so $Ax_0+By_0=-C_1$. By Theorem 9.10 its distance from the second line is $$\dfrac{|Ax_0+By_0+C_2|}{\sqrt{A^2+B^2}}=\dfrac{|-C_1+C_2|}{\sqrt{A^2+B^2}}=\dfrac{|C_1-C_2|}{\sqrt{A^2+B^2}}.$$ The second statement is the case $A=m$, $B=-1$, $C_1=c_1$, $C_2=c_2$ (the lines $mx-y+c_1=0$, $mx-y+c_2=0$). $\blacksquare$
(b) Find the lines parallel to $3x-4y+7=0$ at a distance $2$ from it.
1. Using the formula before rearranging. For $y=2x+5$, the expression to substitute into is $2x-y+5$, not $2x+5$. Get "$=0$" first.
2. Putting $C$ under the square root. The denominator is $\sqrt{A^2+B^2}$ โ the coefficients of $x$ and $y$ only.
3. Forgetting the modulus. Distances are never negative. Without $|\ |$, a point on the "other side" gives a negative answer.
4. Unmatched coefficients for parallel lines. $|C_1-C_2|/\sqrt{A^2+B^2}$ needs the same $A$ and $B$ in both equations. Scale one equation first, as in Example 6.
5. Confusing the vertical distance with the perpendicular distance. $|y_1-(mx_1+c)|$ is the vertical gap; the distance is that divided by $\sqrt{1+m^2}$. They agree only for horizontal lines.
In JEE Advanced 2026 (angle bisectors and the incentre); not in JEE Main 2026 or the CBSE year-end exam. JEE Advanced uses the distance formula to find angle bisectors and the incentre of a triangle.
Angle bisectors. A point lies on a bisector of an angle between two lines exactly when it is equidistant from them. So the two bisectors of the angles between $A_1x+B_1y+C_1=0$ and $A_2x+B_2y+C_2=0$ are $$\dfrac{A_1x+B_1y+C_1}{\sqrt{A_1^2+B_1^2}}=\pm\dfrac{A_2x+B_2y+C_2}{\sqrt{A_2^2+B_2^2}},$$ one for each sign; the two bisectors are always perpendicular to each other.
Worked example. Find the bisectors of the angles between $3x+4y-7=0$ and $4x-3y+1=0$.
Solution. Both denominators are $5$, so $3x+4y-7=\pm(4x-3y+1)$. With $+$: $-x+7y-8=0$, i.e. $x-7y+8=0$. With $-$: $7x+y-6=0$. Check: the given lines meet where $3x+4y=7$ and $4x-3y=-1$, i.e. at $(0.68,\ 1.24)$; both bisectors pass through it ($0.68-8.68+8=0$ and $4.76+1.24-6=0$ โ), and their slopes $\tfrac17$ and $-7$ multiply to $-1$ โ.
Exercises
- 1 $(0,0)$ from $3x+4y-10=0$.
- 2 $(1,2)$ from $4x-3y+7=0$.
- 3 $(-2,3)$ from $5x+12y+1=0$.
- 4 $(3,-1)$ from $x=-2$.
- 5 $(4,1)$ from $y=3x-1$.
- 6 $(2,5)$ from the line through $(0,1)$ and $(3,-3)$.
- 7 $(1,1)$ from $12x-5y+6=0$.
- 8 The origin from the line $\dfrac xa+\dfrac yb=1$ ($a,b\ne0$).
- 1 Find $k$ if the distance of $(2,k)$ from $3x-4y+4=0$ is $2$.
- 2 Find $c$ if the line $5x+12y+c=0$ is at distance $3$ from the origin.
- 3 Find the foot of the perpendicular from the origin to $3x+4y=25$.
- 4 Find the foot of the perpendicular from $(1,8)$ to $x-y+1=0$, and check the distance with the formula.
- 5 Find the image of $(1,8)$ in the line $x-y+1=0$.
- 6 Find the points on the $y$-axis at distance $3$ from the line $4x-3y+5=0$.
- 7 For the triangle $A(0,4)$, $B(-2,0)$, $C(4,1)$, find the altitude from $A$ and the area.
- 1 Find the distance between $3x+4y-7=0$ and $3x+4y+8=0$.
- 2 Find the distance between $5x-12y+2=0$ and $10x-24y-22=0$.
- 3 Find the distance between $y=2x+3$ and $y=2x-7$.
- 4 Find the distance between $x=4$ and $x=-1$.
- 5 Find the lines parallel to $8x-15y+1=0$ at a distance $2$ from it.
- 6 Find the line midway between $3x-4y+2=0$ and $3x-4y-8=0$.
- 7 The two edges of a straight road lie along $y=0.75x+2$ and $y=0.75x-5.5$ (in metres). How wide is the road?
- 1 A ship sails along the straight line $x+y=10$, with a lighthouse at the origin (distances in km). How close does the ship come to the lighthouse, and where is it then?
- 2 Show that the point $(3,2)$ is equidistant from the lines $3x-4y+9=0$ and $4x+3y-8=0$.
- 3 Two sides of a square lie along $2x-y+3=0$ and $2x-y-7=0$. Find the length of a side and the area of the square.
- 4 A rectangular park is bounded by the lines $x-2y+4=0$, $x-2y-6=0$, $2x+y-2=0$ and $2x+y+8=0$, with one unit representing $10\ \text{m}$. Find the area of the park in square metres.
- 5 Find the points on the line $y=x$ at distance $2$ from the line $3x+4y-2=0$.
- 6 Line $l_1$ passes through $(0,3)$ and line $l_2$ through $(4,0)$, both with slope $2$. Find the distance between them.
How this is examined: Board papers ask for the distance of a point from a line or between two parallel lines (1โ2 marks, often with a line that must first be rearranged or rescaled), and for the foot of the perpendicular or the image of a point (3 marks). JEE combines the distance formula with unknowns, gives two answers through the modulus, and uses equal distances for incentres and bisectors.
E1. Board ยท 1 mark The distance between the parallel lines $4x+3y=11$ and $8x+6y=15$ is (A) $\tfrac7{10}$ (B) $\tfrac45$ (C) $\tfrac75$ (D) $\tfrac{26}5$
E2. Board ยท 2 marks Find the distance of the point $(2,-3)$ from the line $4(x-1)=3(y+2)$.
E3. Board ยท 3 marks Find the coordinates of the foot of the perpendicular from $P(2,7)$ to the line $x+2y-6=0$, and the image of $P$ in this line.
E4. Board ยท Case study A lighthouse stands at the origin $O$ of a chart marked in kilometres. A cargo ship holds a straight course along the line $3x+4y=60$. (i) How close does the ship come to the lighthouse? (1 mark) (ii) At which point of its course is it closest? (1 mark) (iii) The lighthouse beam can be seen up to $13\ \text{km}$ away. For how many kilometres of its course can the ship see the beam? (2 marks)
E5. JEE Main The lines parallel to $3x+4y+5=0$ at a distance of $2$ units from the point $(1,1)$ are $3x+4y+C=0$. The product of the possible values of $C$ is (A) $-51$ (B) $51$ (C) $-14$ (D) $30$
E6. JEE Advanced Numerical answer. The circle inscribed in the triangle formed by the lines $x=0$, $y=0$ and $3x+4y=12$ has centre $(r,r)$, where $r$ is its radius. Find $r$.
Research question. How far is your school (or home) from the nearest straight stretch of a highway, railway line or canal โ and does the distance formula agree with a measurement on a map?
Why it matters. "Distance to the nearest line" is one of the most used calculations in planning: noise and pollution buffers along highways, safety zones beside railway tracks, the length of a pipeline to join a main line, flood zones beside rivers and the closest approach of a ship to a coast or of an aircraft to a mountain. Mapping software does exactly this calculation.
What to do.
- Open an online map (or a printed town map with a scale) and find a straight stretch of a road, railway line or canal near your school.
- Set up axes: put the origin at a convenient landmark, with $x$ east and $y$ north, and use the map scale (or the map's distance tool) to read the coordinates, in metres, of two points on the straight stretch and of your school.
- Find the equation of the line through the two points in the form $Ax+By+C=0$, and compute the distance of your school from it with Theorem 9.10. Find the foot of the perpendicular as well.
- Measure the shortest distance directly with the map's distance tool and compare.
- Repeat for a second landmark (a hospital, a park) and comment on the size and causes of any differences.
Tools: An online map with a distance tool (or a scaled paper map and ruler), a calculator or spreadsheet
Hand in: A sketch of your axes and points, the equation of the line, the computed distance and foot, the measured distance, and a short discussion of the errors.
Going further. Real roads are not perfectly straight. Split a curving road into three straight segments, find the distance of your school from each segment's line, and explain why the true shortest distance might be to an end point of a segment rather than to a foot of a perpendicular.
๐งช Self-check quiz
Q1. The distance of the origin from the line $3x-4y+15=0$ is
Q2. The distance between the lines $2x+y-4=0$ and $4x+2y+2=0$ is
Q3. The distance of the point $(3,4)$ from the $x$-axis is
Q4. To find the distance of $(2,-1)$ from the line $y=3x+2$ with the formula, you first write the line as
Q5. The foot of the perpendicular from $(4,0)$ to the line $y=x$ is