5
$\begingroup$

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.

$\endgroup$
  • 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
15
$\begingroup$

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

Cross[{1, 2}]

Output is

{-2, 1}

$\endgroup$
2
$\begingroup$
foo[v_]:= ({a, b} /. Solve[{a, b} . v = 0, {a, b}])[[1]]
$\endgroup$

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.