If u is orthogonal to v, then u · v = 0
We want u and kv such that kv + u = w, with the condition that u is orthogonal to v. Using trigonometry:
The length of kv = | w | cos θ The orientation of kv is vu
Remember that unit vectors are used to represent orientation in 3D space. The orientation of v is vu. (In the picture, this happens to be horizontal, but that is just for convenience). Since cos θ is wu · vu, we have what we need:
kv = |w| (wu · vu) vu
This formula may look awful, but it is not. This part:
|w| (wu · vu)
is a scalar. It adjusts v to to required length. In the picture this is the length of the horizontal baby blue line.
The remaining part: vu, just says, "same orientation as v."
(Review: ) How do you compute a unit vector?