# Find the closest point p in S to the point w, given

NOTE: Nobody showed me how to do this before. I AM DESPERATE for a step by step solution. Please help!!

Let $S$ be the subspace of $\mathbb R^3$ spanned by vectors $u$ and $v$. Find the closest point $p$ in $S$ to the point $w$, given:

$$u^T = [1,−2,2]$$

$$v^T = [−4,−7,−5]$$

$$w^T = [3,3,1].$$

Does anyone know how to do it? Step by step would be helpful as I have a ton of these questions. Thanks a lot!

-
– Dietrich Burde Apr 2 '14 at 17:31

recall that the projection matrix is given by $P = A(A^TA)^{-1}A^T$

Where the matrix $A$ has the vectors $u$ and $v$ in the columns. $$A = \begin{bmatrix}1&-4\\-2&-7\\2&-5\end{bmatrix}$$ We need to compute $P$ but, let's start with $A^TA$.

$$(A^TA) = \begin{bmatrix}1&-2&2\\-4&-7&-5\end{bmatrix}\begin{bmatrix}1&-4\\-2&-7\\2&-5\end{bmatrix} = \begin{bmatrix}9&0\\0&90\end{bmatrix}$$

$$(A^TA)^{-1} = \frac{1}{90}\begin{bmatrix}10&0\\0&1\end{bmatrix}$$

$$P = A(A^TA)^{-1}A^T = \frac{1}{90}\begin{bmatrix}1&-4\\-2&-7\\2&-5\end{bmatrix} \begin{bmatrix}10&0\\0&1\end{bmatrix}\begin{bmatrix}1&-2&2\\-4&-7&-5\end{bmatrix}$$

$$P = A(A^TA)^{-1}A^T = \frac{1}{90}\begin{bmatrix}1&-4\\-2&-7\\2&-5\end{bmatrix} \begin{bmatrix}10&-20&20\\-4&-7&-5\end{bmatrix}$$

$$P = A(A^TA)^{-1}A^T = \frac{1}{90}\begin{bmatrix}26&8&40\\8&89&-5\\40&-5&65\end{bmatrix}$$

Ok, Great, now we have the projection matrix. All we need to do is multiply $Pw$ to find the projection of $w$ onto the space spanned by the columns of $A$.

$$Pw = \frac{1}{90}\begin{bmatrix}26&8&40\\8&89&-5\\40&-5&65\end{bmatrix}\begin{bmatrix}3\\3\\1\end{bmatrix} = \frac{1}{90}\begin{bmatrix}142\\286\\170\end{bmatrix}$$

Please check my arithmetic. I did this in a hurry.

-

Here is a step by step stretch:

1. First you want to find the normal vector $\mathbf{n}$ of the plane $S$ spanned by $\mathbf{u}$ and $\mathbf{v}$. The normal vector $\mathbf{n}$ is perpendicular to every vectors on $S$ so $$\mathbf{n} = \mathbf{u} \times \mathbf{v}$$

2. The points on the that line passes through $\mathbf{w}$ and is parallel to $\mathbf{n}$ have the form $$l = \{\mathbf{x}~:~\mathbf{x}=t\cdot \mathbf{n} + \mathbf{w}\}$$ where $t$ is a scalar in the underlying field of the vector space

3. Our goal is the find the intersection between line $l$ and plane $S$ containing points of the form $a\cdot \mathbf{u} + b \cdot \mathbf{v}$. To do so, simply equate the equation of the line to the equation of the plane and solve the equation: $$t\cdot \mathbf{n} + \mathbf{w} = a\cdot \mathbf{u} + b \cdot \mathbf{v}$$ Observe that this is essentially a system of 3 equations with 3 unknowns scalars $(t,a,$and $b)$.

4. The closest point $\mathbf{p}$ in $S$ to $\mathbf{w}$ is $$\mathbf{p}=t\cdot \mathbf{n} + \mathbf{w}$$

-