Maybe this is really basic, but I couldn't figure it out.

I would like to find the "hat vector" of a vector I defined: it's a vector orthogonal to the given one, assuming two dimensions. So for instance if I create a vector a = {1, 2}, I would like to use some function which gives {-2, 1} as the output.

  • 1
    $\begingroup$ I think it's OK to leave this as a valid question - but only after changing the wording to clarify what "hat vector" means here. $\endgroup$ – Jens Sep 27 '14 at 19:13

It's already built-in. It's called Cross.

Cross[{1, 2}]

Output is

{-2, 1}

foo[v_]:= ({a, b} /. Solve[{a, b} . v = 0, {a, b}])[[1]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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