Proving the distance between a point and a line formula using vectors

2.4k Views Asked by At

In coordinate geometry, I've often used the following result to obtain the perpendicular distance from a point to a line.

The perpendicular distance of the line $\ell:ax+by+c=0$ from the point $(h,k)$ is given by $$\left|\frac{ah+bk+c}{\sqrt{a^2+b^2}}\right|$$

Now I have never seen a proof of this result, but using vectors, I've also solved this same problem for specific situations, so I attempted to prove the result using the following generalised method:

  1. Convert the equation $\ell:ax+by+c=0$ to vector form; which I did, giving $$\boldsymbol{\mathrm r}(\lambda)=\lambda\,(b\,\boldsymbol{\mathrm i}-a\,\boldsymbol{\mathrm j})-\frac{c}{a}\,\boldsymbol{\mathrm i}$$ substituting $\boldsymbol{\mathrm r}={x\choose y}$ and simplifying easily verifies this to be correct.
  2. Now suppose the position vector of $(h,k)$ is $\boldsymbol{\mathrm p}$, and let $\boldsymbol{\mathrm s}$ be the vector from the point $(h,k)$ to the line $\ell$. Clearly we have $$\boldsymbol{\mathrm s}=\boldsymbol{\mathrm r}(\lambda)-\boldsymbol{\mathrm p}$$ and using this, we obtain a vector-valued function $\boldsymbol{\mathrm s}(\lambda)=\left(\lambda b-\frac{c}{a}-h\right)\boldsymbol{\mathrm i}-(\lambda a+k)\boldsymbol{\mathrm j}$ which for different values of $\lambda$ traces the line $\ell$, starting from the point $(h,k)$.
  3. Now to obtain the perpendicular distance from $(h,k)$, to $\ell$, we want the direction of $\ell$ to be parallel to $\boldsymbol{\mathrm s}(\lambda)$. Thus we solve $$\boldsymbol{\mathrm s}(\lambda)\cdot(b\,\boldsymbol{\mathrm i}-a\,\boldsymbol{\mathrm j})=0$$ for $\lambda$. Say the solution is $\lambda=\lambda_1$. Then the distance is therefore given by $\|\boldsymbol{\mathrm s}(\lambda_1)\|$.

At step 3, I started running into complicated algebra, where I obtained $$\lambda = \frac{cb+hab-a^3-a^2h}{ab^2}$$ and attempts to evaluate $\|\boldsymbol{\mathrm s}(\lambda_1)\|$ seemed to be getting me nowhere.

But I've used this method countless times to find the distance between a point and a line, why is it not working in the general case? I'd appreciate any feedback.

1

There are 1 best solutions below

2
On BEST ANSWER

Consider vector normal to your target line

$(a,b)$ is the normal vector. Now find a point on your line. $(p,q)$ the vector from $(h,k)$ to $(p,q)$ = $(p-h,q-k)$

The distance we seek is$\|(p-h,q-k)\|\cos\theta$ where $\theta$ is the angle between $(p-h,q-k)$ and $(p-h,q-k)$

Note that: $|\mathbf u\cdot \mathbf v | = \|\mathbf u|\|\mathbf v\|\cos\theta$

So our formula is: $\frac {|(a,b)\cdot(p-h,q-h)|}{\|(a,b)\|} = \frac{|(a,b)\cdot(p,q)-(a,b)\cdot(h,k)|}{\|(a,b)\|} = \frac{|c-(a,b)\cdot(h,k)|}{\|(a,b)\|}$

I am not following step 3. above, but it looks like this is the direction you are going.

$r(\lambda) = (-b,a)\lambda + (\frac ca,0)$ is the our line in vector form.

$s(\mu) = (a,b)\mu + (h,k)$ is the line perpendicular to $r(t)$ through $(h,k)$

Find $\lambda, \mu$ for the point of intersection.

The distance between the two lines will be $|\mu|\|(a,b)\|$

$a\mu + h = -b\lambda+ \frac ca\\ b\mu + k = a\lambda $

$a\mu + b\lambda = - h+\frac ca\\ b\mu - a\lambda = -k $

$a^2\mu + ab\lambda = - ha + c\\ b^2\mu - ab\lambda = -kb $

$(a^2+b^2)\mu = -ha -kb + c$

$d= \sqrt{a^2+b^2}|\mu| = \frac {|-ha -kb + c|}{\sqrt{a^2+b^2}}$