Finding 2 vectors to express a vector as the sum of both

Write the vector $u = (5,1,5)$ as the sum of two vectors, $v$ and $w$, such that $v \| p = (1,1,0)$ and $v ⊥ w$.

So what I did was let $v=(1,1,0)$ and $w = (5-1,1-1,5-0)$ Which is obviously wrong because i'm not using the cross product what so ever. So my assumption of $v$ must be wrong. Why is this? Or am I reading the question wrong?

• Another hint: v∥p=(1,1,0) means v = k(1,1,0), where k is an arbitrary constant. – S. McGrew Apr 17 '18 at 14:24

Let $v$ be the orthogonal projection of $u$ on $p$, which, according to the projection theorem is given by $$v = \frac{p \cdot u}{p \cdot p}\,p = \frac{(1,1,0)\cdot(5,1,5)}{(1,1,0)\cdot(1,1,0)}(1,1,0) = \frac{5+1+0}{1+1+0}(1,1,0) = 3(1,1,0),$$ and let $w=u-v=(5,1,5)-(3,3,0)=(2,-2,5)$.
Sanity check: $v \cdot w = (3,3,0) \cdot (2,-2,5)=0$, so indeed $v \perp w$.
• How do we know that when using $w=u-v$ that $v \perp w$, I see that you proved it in the end, but how did we know that is was going to be the case? – Dan D'silva Apr 17 '18 at 14:47
• @DanD'silva Once you’re removed the part of $u$ that’s parallel to $p$, all that’s left is the perpendicular part. It’s a not too difficult and useful exercise to prove it in general. – amd Apr 17 '18 at 17:45