projection of a vector onto a vector space

supppose that we have a vector space $$A=\left(\left[ \begin{array}{} x\\ y\\ w\\ z\\ \end{array} \right] : x-y+w=0 \right)$$ and we wanted to find the closest point to a vector $$x= \left[\begin{array}{} a\\ b\\ c\\ d\\ \end{array}\right]$$ I solved the problem by finding the basis of the vector space A and orthonormalizing it, then taking the projection of x onto the orthonormal basis of A which returned a vector. However I would like a second method to verify that this is in fact the closest point. Is there a way to verify whether or not my solution is correct?

• Once you have an orthonormal basis of $A$, say $e_1,e_2,e_3$ you can express an arbitrary point of $A$ as $te_1+ue_2+ve_3$ and compute $(x-(te_1+ue_2+ve_3))^2$, then take it to the minimum. – Alexey Burdin May 30 '20 at 20:48
• working the real space would the minimization occur when the interior portion is equal to zero. Also its squared because you are projecting the distance between x and an arbitrary point on itself right? – lambdaepsilon May 30 '20 at 21:06
• You could’ve saved yourself a lot of work by projecting orthogonally onto $A^\perp$ instead, which is only one-dimensional, and then subtracting that from $x$. You can read a vector that spans $A^\perp$ directly from the equation that defines $A$. – amd May 30 '20 at 21:32

1 Answer

Yes: if $$p\in A$$, then $$p$$ is the point of $$A$$ closest to $$x$$ if and only if $$x-p$$ is orthogonal to every element of $$A$$.

For instance, the solution of your problem is$$p=\begin{bmatrix}\frac13(2a+b-c)\\\frac13(a+2b+c)\\\frac13(-a+b+2c)\\d\end{bmatrix}$$and$$x-p=\begin{bmatrix}\frac13(a-b+c)\\\frac13(-a+b-c)\\\frac13(a-b+c)\\0\end{bmatrix}.$$And, indeed, if $$x$$, $$y$$, $$w$$, and $$z$$ are such that $$x-y+w=0$$, then$$\begin{bmatrix}x\\y\\w\\z\end{bmatrix}.(x-p)=0.$$

• interesting I know that the shortest point from a plane to a point is always when there exists an orthogonal relationship, but what is the intuition behind this? – lambdaepsilon May 30 '20 at 21:02
• and thanks alot!! – lambdaepsilon May 30 '20 at 21:02
• Imagine a point $(x,y,z)\in\Bbb R^3$. It's projection into the $z=0$ plane is $(x,y,0)$. And $(x,y,z)-(x,y,0)=(0,0,z)$, which is orthogonal to every element of the plane $z=0$. – José Carlos Santos May 30 '20 at 21:13