[Math] Describing y as the sum of two orthogonal vectors

linear algebra

$y=\begin{bmatrix}-6 \\ 3 \\ 7 \end{bmatrix}$ and $u=\begin{bmatrix}-3 \\ 6 \\ 4 \end{bmatrix}$

Describe $y$ as the sum of two orthogonal vectors, $x_1$ in span{$u$} and $x_2$ orthogonal to $u$.

My attempt:

Calculating the projection of $y$ onto $u$ is simple:
$y_{proj-u}=\frac{y\dot{}u}{u\dot{}u}u=\begin{bmatrix}-192/31 \\ 384/61 \\ 256/61 \end{bmatrix}$

Here is the part I am not so sure about:

I need to find a vector orthogonal to $u$. Since $u$ is in $R^3$ I calculated the cross product of the unit vector $z=\begin{bmatrix}0 \\ 0 \\ 1 \end{bmatrix}$ and $u$. I am assuming any vector orthogonal to $u$ will give me what I am looking for.

$w=u\times{}z=\begin{bmatrix}0 \\ 0 \\ 1 \end{bmatrix}\times{}\begin{bmatrix}-3 \\ 6 \\ 4 \end{bmatrix}=\begin{bmatrix}6 \\ 3 \\ 0 \end{bmatrix}$

Now I should have a vector orthogonal to $u$, and I can get the projection of $y$ on $w$.

$y_{proj-{w}}=\frac{y\dot{}w}{w\dot{}w}w=\begin{bmatrix}-18/5 \\ -9/5 \\ 0 \end{bmatrix}$

Now, $u\dot{}w=0$ and $y_{proj-{u}}\dot{}y_{proj-{w}}=0$, which should mean both are orthogonal and meet the requirements of the answer.

According to the program I am entering these online to, $y_{proj-{w}}$ is incorrect. What am I doing wrong?

Best Answer

$x_2$ needs to be in the plane spanned by $u$ and $y$. To get the needed vector use the following:

$$x_2 = (y\times u) \times u$$

This will guarantee that is is in the plane and perpendicular to $u$.