Linear Algebra – Closest Point on a Line to Another Point

linear algebra

The problem asks to find the nearest to $P(2,2)$, on the line:

$$-x -2y +3 =0$$

This is what I've tried,

  • the normal vector,

    $$n = (-1,-2)$$

  • found an arbitrary point on the given line by setting $y = 0$, which results in

    $$P_1 = (3,0)$$

  • calculated distance from $P$ to $P_1$ (call it the vector u):

$$u = (-1,2)$$

then finally I simply applied the projection formula and got that the point on the line should be (3/5,6/5) which unfortunately is the wrong answer.

any ideas where I've gone wrong?

Best Answer

Here is another way to look at this, using the normal vector you've found. Call the closest point to $ \ (2,2) \ $ on the given line $ \ (x,y) \ . $ The vector from $ \ (2,2) \ $ to this point is $ \ \langle x-2 , y-2 \rangle \ . $ Since the shortest distance from an external point to a line is along a perpendicular to the line, this vector must have the same direction as the normal vector, so we may write

$$ \langle x-2 \ , \ y-2 \rangle \ = \ k \cdot \langle -1 \ , \ -2 \rangle \ . $$

From this, we can establish the relation $ \ 2 \ (x-2) = y - 2 \ . $ This is satisfied by the external point $ \ (2,2) \ $ and must also be satisfied by the point on the given line, $ \ x + 2y = 3 \ . $ Inserting our relation into this linear equation allows us to solve for one of the coordinates; the equation of the line will then also give us the other coordinate of the sought-after closest point.

In view of your comment, you can also use the direction vector of the line, $ \ \langle 2 , -1 \rangle \ $ and look for where its dot product with $ \ \langle x-2 \ , \ y-2 \rangle \ $ is zero, again under the constraint that $ \ (x,y) \ $ is on the given line.

[Incidentally, the perpendicularity requirement ("dot product equals zero") is equivalent to the condition for minimum distance given by setting the derivative of the function for the distance between the points equal to zero.]

Related Question