Find closest Point to Another Point

72 Views Asked by At

How do I find the closest point to $(2,2)$ on the line CD, if C is $(3,2)$ and D is $(5, 3)$? How would I solve using linear algebra? Does it involve cross product and distance? Not sure how to solve

2

There are 2 best solutions below

0
On

If I solve this, I would use dot product.

Let $X = (2,2)$, $X' = X$ projected to line $CD$

Consider product $\vec{CD} \cdot\vec{CX}$. It it equal to the length of $\vec{CD}$ times the length of the $\vec{CX'}$.

So the (signed with relative to D) length of $\vec{CX'}$ is $$\vec{CD} \cdot\vec{CX} \over \left|\vec{CD}\right|$$

From that, you can calculate the point $X' = {\vec{CD} \times (\vec{CD} \cdot\vec{CX}) \over \left|\vec{CD}\right|^2}$ where $\times$ is the scalar product.

0
On

One way (fill in details):

The slope of line $\;CD\;$ is $\;\frac12\;$ , so any perpendicular line to it has a slope $\;-2\;$ .

Thus you want the intersection of the line $\;\ell\;$ through $\;(2,2)\;$ and slope $\;-2\;$ with the line $\;CD\;$ :

$$\begin{cases}CD\;:\;\;y-2=\frac12(x-3)\\{}\\\ell: y-2=-2(x-2)\end{cases}$$

The intersection of the lines above is:

$$\frac12x-\frac32=-2x+4\implies\frac52x=\frac{11}2\implies x=\frac{11}5\;,\;\;y=-\frac{22}5+6=\frac85$$

and thus the distance is from $\;(2,2)\;$ to $\;\left(\frac{11}5\,,\,\frac85\right)\;$ :

$$\sqrt{\frac1{25}+\frac4{25}}=\frac{\sqrt5}5=\frac1{\sqrt5}$$

Another way : the line $\;CD\;$ is, as above $\;x-2y+1=0\;$ , so the distacne between this line and the point $\;(2,2)\;$ is given by the formula

$$\frac{|2-4+1|}{\sqrt5}=\frac1{\sqrt5}$$