I have a pair of N-dimensional vectors, N large (hundreds), and I need to generate another N-dimensional vector that is orthogonal to the first two. It doesn't have to be unique; it doesn't even have to be perfectly orthogonal, as long as the normalized dot products are less than, oh, about 0.005. I've searched for "generalized cross product" and similar terms, and all I found was a lot of statements that the cross product only exists for N=3 and N=7, philosophical discussions of what the cross product really means, etc., but nowhere did I find a simple way to find an N-dimensional vector approximately orthogonal to two other N-dimensional vectors. Help and guidance requested and appreciated. Greg
Generalized Cross Product
Started by ●December 8, 2016
Reply by ●December 8, 20162016-12-08
On 2016-12-08 13:47:24 +0000, Greg Berchin said:> I have a pair of N-dimensional vectors, N large (hundreds), and I need > to generate another N-dimensional vector that is orthogonal to the > first two. It doesn't have to be unique; it doesn't even have to be > perfectly orthogonal, as long as the normalized dot products are less > than, oh, about 0.005. > > I've searched for "generalized cross product" and similar terms, and > all I found was a lot of statements that the cross product only exists > for N=3 and N=7, philosophical discussions of what the cross product > really means, etc., but nowhere did I find a simple way to find an > N-dimensional vector approximately orthogonal to two other > N-dimensional vectors. > > Help and guidance requested and appreciated. > > GregPick a random vector. Project out the two vectors you have. The result will be orthogonal (except for bad luck when it is zero). It is called Gram-Schmidt othogonalization.
Reply by ●December 8, 20162016-12-08
On Thursday, December 8, 2016 at 9:55:04 AM UTC-6, Gordon Sande wrote:> It is called Gram-Schmidt othogonalization.Thanks, that looks like what I need. You know, all the searching that I did for orthogonal vectors, and G-S didn't come up once in any of the results.
Reply by ●December 8, 20162016-12-08
On Thu, 08 Dec 2016 11:55:01 -0400, Gordon Sande wrote:> On 2016-12-08 13:47:24 +0000, Greg Berchin said: > >> I have a pair of N-dimensional vectors, N large (hundreds), and I need >> to generate another N-dimensional vector that is orthogonal to the >> first two. It doesn't have to be unique; it doesn't even have to be >> perfectly orthogonal, as long as the normalized dot products are less >> than, oh, about 0.005. >> >> I've searched for "generalized cross product" and similar terms, and >> all I found was a lot of statements that the cross product only exists >> for N=3 and N=7, philosophical discussions of what the cross product >> really means, etc., but nowhere did I find a simple way to find an >> N-dimensional vector approximately orthogonal to two other >> N-dimensional vectors. >> >> Help and guidance requested and appreciated. >> >> Greg > > Pick a random vector. Project out the two vectors you have. The result > will be orthogonal (except for bad luck when it is zero). > > It is called Gram-Schmidt othogonalization.I think you can do something similar with QR decomposition (actually, I think QR may have Gram-Schmidt somewhere inside). Given who you are you must be aware that in an N-dimensional space you can make a set of N mutually orthogonal vectors. So if three orthogonal vectors is magic because there's three spatial dimensions, but you're working with N-dimensional vectors, there may be a mismatch between your problem and whatever solution you're thinking of. -- Tim Wescott Control systems, embedded software and circuit design I'm looking for work! See my website if you're interested http://www.wescottdesign.com
Reply by ●December 8, 20162016-12-08
On Thursday, December 8, 2016 at 11:22:22 AM UTC-6, Tim Wescott wrote:> Given who you are you must be aware that in an N-dimensional space you > can make a set of N mutually orthogonal vectors. So if three orthogonal > vectors is magic because there's three spatial dimensions, but you're > working with N-dimensional vectors, there may be a mismatch between your > problem and whatever solution you're thinking of.No, it has nothing to do with spatial dimensions. I just need three mutually orthogonal vectors; I already have two of them. The third must meet some other criteria, but I figured that I would create several of them and choose the one that came closest to satisfying those other criteria. It's an engineer's solution to a math problem -- doesn't need to be perfect, just arbitrarily close to it. Thanks, Greg
Reply by ●December 8, 20162016-12-08
On 2016-12-08 17:22:14 +0000, Tim Wescott said:> On Thu, 08 Dec 2016 11:55:01 -0400, Gordon Sande wrote: > >> On 2016-12-08 13:47:24 +0000, Greg Berchin said: >> >>> I have a pair of N-dimensional vectors, N large (hundreds), and I need >>> to generate another N-dimensional vector that is orthogonal to the >>> first two. It doesn't have to be unique; it doesn't even have to be >>> perfectly orthogonal, as long as the normalized dot products are less >>> than, oh, about 0.005. >>> >>> I've searched for "generalized cross product" and similar terms, and >>> all I found was a lot of statements that the cross product only exists >>> for N=3 and N=7, philosophical discussions of what the cross product >>> really means, etc., but nowhere did I find a simple way to find an >>> N-dimensional vector approximately orthogonal to two other >>> N-dimensional vectors. >>> >>> Help and guidance requested and appreciated. >>> >>> Greg >> >> Pick a random vector. Project out the two vectors you have. The result >> will be orthogonal (except for bad luck when it is zero). >> >> It is called Gram-Schmidt othogonalization. > > I think you can do something similar with QR decomposition (actually, I > think QR may have Gram-Schmidt somewhere inside). > > Given who you are you must be aware that in an N-dimensional space you > can make a set of N mutually orthogonal vectors. So if three orthogonal > vectors is magic because there's three spatial dimensions, but you're > working with N-dimensional vectors, there may be a mismatch between your > problem and whatever solution you're thinking of.There are several standard methods of achieving a QR decomposition. They differ on how easy it is to recover Q, rather than a factored version of it.The methods carry names like Givens, Householder and even Gram-Schmidt. If you do G-S the way classical math texts describe it you will find that it has numerical problems. There is a minor rearrangement that cures the issue and goes by the name of (wait for it) Modified Gram-Schmidt.
Reply by ●December 8, 20162016-12-08
> I have a pair of N-dimensional vectors, N large (hundreds), and I need > to generate another N-dimensional vector that is orthogonal to the > first two. It doesn't have to be unique; it doesn't even have to be > perfectly orthogonal, as long as the normalized dot products are less > than, oh, about 0.005.Just look at the first three indices. If those two 3-vectors are nonparallel and nonzero, take their cross product. That gives you the first three entries of your vector, and you can fill the rest with zeros. If the cross product is zero, pick another set of three indices and try again until it works. -Ethan
Reply by ●December 8, 20162016-12-08
On Thursday, December 8, 2016 at 8:47:27 AM UTC-5, Greg Berchin wrote:> I have a pair of N-dimensional vectors, N large (hundreds), and I need to generate another N-dimensional vector that is orthogonal to the first two. It doesn't have to be unique; it doesn't even have to be perfectly orthogonal, as long as the normalized dot products are less than, oh, about 0.005. > > I've searched for "generalized cross product" and similar terms, and all I found was a lot of statements that the cross product only exists for N=3 and N=7, philosophical discussions of what the cross product really means, etc., but nowhere did I find a simple way to find an N-dimensional vector approximately orthogonal to two other N-dimensional vectors. > > Help and guidance requested and appreciated. > > GregHere's an extremely simple but powerful way to generate an "N"-dimensional vector orthogonal not only to two but to the whole bunch. You've seen how a 3-D vector cross product (A x B) is expressible as the determinant of a matrix with * a top row made up of unit vectors denoted I J K * the second row containing the scalar components of A * the third row containing the scalar components of B Just follow that pattern, now with the top row having "N" orthogonal unit vectors above "N-1" rows containing the scalar components of the "N"-dimensional vectors. Ref: Integrated Aircraft Navigation, top of page 325
Reply by ●December 9, 20162016-12-09
On Thursday, December 8, 2016 at 7:29:01 PM UTC-5, navaide wrote:> On Thursday, December 8, 2016 at 8:47:27 AM UTC-5, Greg Berchin wrote: > > I have a pair of N-dimensional vectors, N large (hundreds), and I need to generate another N-dimensional vector that is orthogonal to the first two. It doesn't have to be unique; it doesn't even have to be perfectly orthogonal, as long as the normalized dot products are less than, oh, about 0.005. > > > > I've searched for "generalized cross product" and similar terms, and all I found was a lot of statements that the cross product only exists for N=3 and N=7, philosophical discussions of what the cross product really means, etc., but nowhere did I find a simple way to find an N-dimensional vector approximately orthogonal to two other N-dimensional vectors. > > > > Help and guidance requested and appreciated. > > > > Greg > > Here's an extremely simple but powerful way to generate an "N"-dimensional vector orthogonal not only to two but to the whole bunch. > > You've seen how a 3-D vector cross product (A x B) is expressible as the determinant of a matrix with > * a top row made up of unit vectors denoted I J K > * the second row containing the scalar components of A > * the third row containing the scalar components of B > > Just follow that pattern, now with the top row having "N" orthogonal unit vectors above "N-1" rows containing the scalar components of the "N"-dimensional vectors. > Ref: Integrated Aircraft Navigation, top of page 325this determinate thing was the method i was going to guess at, Greg. i am not sure that the Gram-Schmidt orthogonalization process will give you the cross product unless you scale it to be the correct length. (BTW, Greg, i got to meet Jay Frigoletto last weekend. damn good pianist.) L8r r b-j
Reply by ●December 9, 20162016-12-09
On Thu, 8 Dec 2016 16:28:58 -0800 (PST), navaide <navaide@gmail.com> wrote:>Here's an extremely simple but powerful way to generate an "N"-dimensional vector orthogonal not only to two but to the whole bunch.Yes, that looks like the wedge product. I saw several references to it, but they all came with warnings that the vector derived in this manner was in a different vector space than the vectors from which it was derived. I haven't had enough time to dig into it deeply enough to grok the implications. Thanks, Greg