Re:Generating Two Unit Orthogonal Vectors to a 3D Vector

• To: mathgroup at smc.vnet.net
• Subject: [mg36373] Re:Generating Two Unit Orthogonal Vectors to a 3D Vector
• From: Goyder Dr HGD <H.Goyder at rmcs.cranfield.ac.uk>
• Date: Wed, 4 Sep 2002 02:56:27 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```
There are many cases in graphics, and otherwise, where it is useful to
obtain two orthogonal unit vectors to a given vector. I know a number of
ways to do it, but they all seem to be slightly inelegant. I thought I would
pose the problem to MathGroup. Who has the most elegant Mathematica
routine...

OrthogonalUnitVectors::usage = "OrthogonalUnitVectors[v:{_,_,_}] will return
two unit vectors orthogonal to each other and to v."

You can assume that v is nonzero.

David Park

David,
My suggestion

In:=
<< "LinearAlgebra`Orthogonalization`"
In:=
OrthogonalUnitVectors[v:{_, _, _}] := GramSchmidt[NullSpace[{v}]]
In:=
v = {1, 2, 3};
{v1, v2} = OrthogonalUnitVectors[v]
Out=
{{-(3/Sqrt), 0, 1/Sqrt}, {-(1/Sqrt), Sqrt[5/7], -(3/Sqrt)}}
In:=
{v . v1, v . v2, v1 . v2, v1 . v1, v2 . v2}
Out=
{0, 0, 0, 1, 1}

Also works with symbolic expressions

Hugh Goyder

```

• Prev by Date: Re: approximation for partitial binomial sum
• Next by Date: Re: 3D plot
• Previous by thread: RE: Generating Two Unit Orthogonal Vectors to a 3D Vector
• Next by thread: Fwd: Generating Two Unit Orthogonal Vectors to a 3D Vector
{"ft_lang_label":"__label__en","ft_lang_prob":0.74190766,"math_prob":0.8930188,"size":1197,"snap":"2023-40-2023-50","text_gpt3_token_len":398,"char_repetition_ratio":0.13327745,"word_repetition_ratio":0.06629834,"special_character_ratio":0.34502923,"punctuation_ratio":0.23357664,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.994945,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-24T04:22:25Z\",\"WARC-Record-ID\":\"<urn:uuid:d0959af6-0d23-41ec-9951-a61e2fbecb22>\",\"Content-Length\":\"44655\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cc776aaf-6b19-47e5-857b-4c06647e5b4d>\",\"WARC-Concurrent-To\":\"<urn:uuid:e396a8c6-a216-46e7-830b-d08b28ffdd98>\",\"WARC-IP-Address\":\"140.177.205.73\",\"WARC-Target-URI\":\"https://forums.wolfram.com/mathgroup/archive/2002/Sep/msg00051.html\",\"WARC-Payload-Digest\":\"sha1:SYZBEUTQK3R3Y3OUITKGDMLTRVHEX2LJ\",\"WARC-Block-Digest\":\"sha1:4OY7WXIZUKQA2HJHGBJVWN3PICCOSXUG\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233506559.11_warc_CC-MAIN-20230924023050-20230924053050-00147.warc.gz\"}"}