# Decompose a vector in a part parallel to a plane and other to a line

I have the problem:

Decompose the vector $\vec v = (1,2,4)$ in two parts, one parallel to the plane $X = (1,1,0) + \lambda(1,0,1) + \gamma(0,1,-1)$ and other parallel to the line $X = (0,0,0) + h(2,1,0)$

What i've done:

I tried to project the vector $\vec v$ in the direction of $(1,0,1)$ and decompose it in the direction of $(0,1,-1)$, then the sum of its two projections is parallel to the plane. I, then, decomposed $\vec v$ in the direction of $(2,1,0)$. But my answer is wrong. Does it has something to do with projections or I'm doing the wrong way? i checked my projections in wolfram alpha and they seemed good.

We can write $(1,2,4) = (a,b,c) + (1-a, 2-b, 4-c)$, where, for example, $(a,b,c)$ is parallel to $(2,1,0)$. Then, exists $k \in \mathbb{R}$ such that $a = 2k$, $b = k$ and $c = 0\cdot k = 0$. We want the other part to be parallel to the plane, that is equivalent to the part $(1-a, 2-b, 4-c)$, which is the same as $(1-2k, 2 - k, 4)$ being orthogonal to the vector $\vec{n}$ normal to the plane, which we can calculate using the cross product. Then $$\vec{n} = (1,0,1) \times (0,1,-1) = \left|\begin{array}{c c c}\vec{i} & \vec{j} & \vec{k} \\ 1 & 0 & 1 \\ 0 & 1 & -1\end{array}\right|= (-1,1,1)$$ Going on: $$\langle (1-2k, 2-k,4), \vec{n}\rangle = 0 \\\langle (1-2k, 2 - k, 4), (-1,1,1)\rangle = 0 \\ 2k-1 + 2 - k + 4 = 0 \\ k = -5$$ So, the vectors are $(11, 7,4)$ and $(-10, -5, 0)$. Notice that really we have: $$(1,2,4) = (11,7,4) + (-10,-5,0)$$ Also, $(-10,-5,0)$ is parallel to the given line, and $(11,7,4)$ is a linear combination of the plane vectors (in detail, $(11,7,4) = 11\cdot (1,0,1) + 7 \cdot(0,1,-1)$).
Express your vector $v=[\lambda(1,0,1) + \gamma(0,1,-1)] + h(2,1,0)$ and find the values of $\lambda, \gamma$ and $h$. The parenthesized portion is the component parallel to the plane and the remaining is parallel to the line.