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?

  • 3
    $\begingroup$ Isn't it just NullSpace[{v}] that you ask? $\endgroup$
    – MeMyselfI
    Nov 25, 2018 at 14:49
  • $\begingroup$ @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 $\endgroup$
    – glS
    Nov 25, 2018 at 14:51

2 Answers 2


general solution

normalVecs[vec_] := Module[{l = Length@vec}, 
Cross[vec,##&@@#]&/@ Subsets[IdentityMatrix@l,{l-2}] //DeleteCases@Table[0,l]]  

normalVecs[{1, 0, 0, 0, 0, 0}]    


  • $\begingroup$ Note that, unlike Nullspace[{v}], this does not produce a minimal basis of the orthogonal vector space. See for example normalVecs[{1, 1, 0}] which outputs two vectors that are the same up to an overal constant. It is clear that the built in NullSpace is preferable. $\endgroup$
    – Kvothe
    Apr 19, 2023 at 23:04

One can find a set of orthogonal vectors, orthogonal to each other and to the given vector v, using NullSpace[{v}]. (Credit goes to MeMyselfI, see their comment on the question.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.