# Find projection vector on a plane

I have three 3D vectors. Two of them define an (imaginary) plane (the green and red arrow in the picture). The third vector (the darker blue) can point anywhere it wants. All them have the same origin (lets say [0, 0, 0]) and the same length (say |1|).

How to get a vector that is the (shortest) projection of the dark blue one on that plane (in the image the lighter blue one) and should have the same length afterwards? It must also work when the dark blue vector stands perpendicular on the plane.

Let $a_1$ and $a_2$ be the two vectors which form your plane, and $\nu$ be the vector you want to project. Assuming that they all have length 1, the projection will be $$\nu_{\text{proj}} = a_1(a_1\cdot \nu) + a_2(a_2\cdot \nu)$$ If you want that $\nu_{\text{proj}}$ has the same length then $\nu$, just multiply by $^{\mid \nu \mid}/_{\mid \nu_{ \text{proj}} \mid}$
• If $a_1 = [1,0,0] ~;~ a_2 = [0,1,0] ~;~ \nu = [0,0,1]$, then $\nu_{\text{proj}} = [1,0,0]$ and $\nu_{\text{proj}} = [0,1,0]$ would both be fine anwers (they are shortest projections with length 1), but every vector $\nu_{\text{proj}} = [\cos\varphi ,sin\varphi ,0]$ will aslo be fine. Since there is no preference in taking one over the other, the best anwer is to stick with 0 in this case. – Nemo Aug 6 '16 at 4:03