# What is the best way to compute the set of vectors normal to a given one?

For 2D vectors, computing the vector orthogonal to a given $$v$$ is straightforwardly done using Cross, as for example shown here.

However, Cross does not seem to work for more than two dimensions, and I couldn't find any function giving a complete set of normal vectors to a given $$v$$.

For example, I'm looking for a function that, given v={1,0,0}, will give me back {{0,1,0},{0,0,1}}, or some other equivalent set of vectors (that is, I want a basis for the orthogonal space $$v^\perp$$).

An easy way to do this in 3D is with something like:

normalVecs[v_] := Cross[v, #] & /@ IdentityMatrix@3 // Orthogonalize // Select[Norm@# > 0 &];
normalVecs @ {1, 0, 0}


but using Cross does not generalize to more than 3 dimensions.

What is the best way to do this?

• Isn't it just NullSpace[{v}] that you ask? – MeMyselfI Nov 25 '18 at 14:49
• @MeMyselfI Ah! I knew there had to be some function doing this, but didn't think of looking with that name. I think that would be the natural answer to this question – glS Nov 25 '18 at 14:51

normalVecs[vec_] := Module[{l = Length@vec},