Welcome to our community

Be a part of something great, join today!

Commentary for "Finding the distance between a point and a line"


Well-known member
MHB Math Scholar
Mar 10, 2012
This topic is for comments/questions pertaining to this tutorial:

There is another nice way to do it.

Let $C$ be the circle $(x-x_0)^2+(y-y_0^2)=r^2$ centered at $P$ and having radius $r$. The line $y=mx+b$ can have two points in common or one point in common or no points on common with $C$. Assume $m\neq 0$ because if it is then the answer is easily found. The perpendicular distance from $P$ to $y=mx+b$ is equal to the radius $r$ corresponding to which there is exactly one point in common between $y=mx+b$ and $C$. For this we substitute $x=(y-b)/m$ in $C$ and find a quadratic in $y$. For having just one root of this we just need to set the discriminant to zero and find the desired result.


Well-known member
MHB Math Scholar
Jan 30, 2012
I suggest the following proof that deals with the general (or standard) form of the line equation rather than the slope–intercept form.

Suppose in a Cartesian coordinate system a line $l$ is given by the equation $L(x,y)=0$ where $L(x)=Ax+By+C$. Also, let $\vec{n}=(A,B)$.

Theorem. The distance $d(P_0,l)$ from any point $P_0(x_0,y_0)$ to $l$ is $L(x_0,y_0)/|\vec{n}|$.

Proof. Let $P_1(x_1,y_1)$ be any point on $l$ (thus, $L(x_1,y_1)=0$) and let $\varphi$ be the (smaller) angle between $\overrightarrow{P_1P_0}$ and $\vec{n}$. Since $\vec{n}$ is perpendicular to $l$ (Lemma 2 below), we have
d(P_0,l)&= |\overrightarrow{P_1P_0}|\cdot|\cos\varphi|\\
&=\frac{|\overrightarrow{P_1P_0}\cdot\vec{n}|} {|\vec{n}|}\\
&= \frac{|A(x_0-x_1)+B(y_0-y_1|)}{|\vec{n}|}\\

Since $|\vec{n}|=\sqrt{A^2+B^2}$, $d(P_0,l)$ can be expanded to

Lemma 1. Vector $(-B,A)$ is parallel to $l$. This holds in any affine coordinate system, not necessarily a Cartesian one.

Proof. Let $P_0(x_0,y_0)$, $P_1(x_1,y_1)$ be two different points on $l$. Then $\overrightarrow{P_0P_1}=(x_1-x_0,y_1-y_0)$ is parallel to $l$. Also,
If $A\ne0$ and $B\ne0$, then (*) is equivalent to
But even if $A=0$ or $B=0$ (but not $A=B=0$), (*) expresses the fact that $(x_1-x_0,y_1-y_0)$ is proportional to, and thus parallel to, $(-B,A)$.

Lemma 2. If the coordinate system is Cartesian, then $n$ is perpendicular to $l$.

Proof. By Lemma 1, vector $\vec{p}=(-B,A)$ is parallel to $l$, and $\vec{n}\cdot\vec{p}=-AB+BA=0$, so $n$ is perpendicular to $p$ and to $l$.
Last edited: