[18871] in s-news-athena

home help back first fref pref prev next nref lref last post

Re: [S] finding vectors orthogonal to a given set? (fwd)

daemon@ATHENA.MIT.EDU (Ranjan Maitra)
Thu Aug 5 11:26:28 1999

Date: Thu, 5 Aug 1999 11:19:45 -0400 (EDT)
From: Ranjan Maitra <maitra@math.umbc.edu>
To: S-news <s-news@wubios.wustl.edu>
Message-Id: <Pine.LNX.4.04.9908051118140.4580-100000@param.math.umbc.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII


Many thanks to Douglas Bates for providing me with the following suggestion.
Ranjan

---------- Forwarded message ----------
Date: 05 Aug 1999 10:16:43 -0500
From: Douglas Bates <bates@stat.wisc.edu>
To: Ranjan Maitra <maitra@math.umbc.edu>
Subject: Re: [S] finding vectors orthogonal to a given set?

Ranjan Maitra <maitra@math.umbc.edu> writes:

> I have a set of orthogonal vectors: U_1,U_2,\ldots,U_k in R^n. I want to 
> find a set of vectors U_{k+1},U_{k+2},\ldots,U_n such that they together
> form an orthonormal basis in R^n. Can this be done using Splus routines?

The Q matrix from a QR decomposition provides the vectors that you
want.  See the documentation for the functions qr and qr.Q.

> v1 <- rnorm(4)
> v2 <- rnorm(4)
> cbind(v1, v2)  # bind the columns into a matrix
          [,1]     [,2]
[1,] -0.010532  1.05105
[2,] -1.036434 -0.55333
[3,] -0.455156 -1.58401
[4,] -0.897544 -0.94624
> qr.Q( qr(cbind(v1, v2)), complete = TRUE ) # orthogonal 4 by 4 matrix
           [,1]      [,2]     [,3]     [,4]
[1,] -0.0072901  0.653992  0.74677 -0.12075
[2,] -0.7174213  0.311509 -0.36184 -0.50729
[3,] -0.3150596 -0.689156  0.54161 -0.36395
[4,] -0.6212817 -0.017908  0.13442  0.77176

The last two columns of this result are an orthogonal basis for the
orthogonal complement to the span of v1 and v2.

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

home help back first fref pref prev next nref lref last post