Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Finding a Martix with given null space

Subject: Finding a Martix with given null space

From: Cliff Curry

Date: 16 Sep, 2007 17:29:13

Message: 1 of 5


Hello:

    I am looking for a function that is the inverse of null().
   How would I use MATLAB to generate a matrix, given a set of orthogonal
vectors, that has those vectors as a basis for its null space?
   I realize that there may be many such matrices.

Thanks for your help,


Cliff

Subject: Finding a Martix with given null space

From: ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford)

Date: 16 Sep, 2007 18:33:00

Message: 2 of 5

In article <td-dnfg73r9x-nDbnZ2dnUVZ_oCvnZ2d@comcast.com>, "Cliff Curry"
<cliffcurry_nospam_323@comcast.net> wrote:

> Hello:
>
> I am looking for a function that is the inverse of null().
> How would I use MATLAB to generate a matrix, given a set of orthogonal
> vectors, that has those vectors as a basis for its null space?
> I realize that there may be many such matrices.
>
> Thanks for your help,
>
>
> Cliff
-----------------
  Your question is rather puzzling, Cliff. If the given set of orthogonal
vectors is used as the rows of matrix A, then the rows of B = null(A)'
form a basis of the null space of A. Therefore the rows of A are all
orthogonal to those of B and constitute a basis for the null space of B,
which is what you are asking for.

  Did you mean something as simple as this, or are you requiring more of
matrix B? Perhaps you want a square matrix as your result? I have the
feeling you are asking for something other than what you have stated here.

Roger Stafford

Subject: Finding a Martix with given null space

From: ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford)

Date: 16 Sep, 2007 19:05:56

Message: 3 of 5

In article
<ellieandrogerxyzzy-1609071133000001@dialup-4.233.114.162.dial1.losangeles1.level3.net>,
ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford) wrote:

> In article <td-dnfg73r9x-nDbnZ2dnUVZ_oCvnZ2d@comcast.com>, "Cliff Curry"
> <cliffcurry_nospam_323@comcast.net> wrote:
>
> > Hello:
> >
> > I am looking for a function that is the inverse of null().
> > How would I use MATLAB to generate a matrix, given a set of orthogonal
> > vectors, that has those vectors as a basis for its null space?
> > I realize that there may be many such matrices.
> >
> > Thanks for your help,
> >
> >
> > Cliff
> -----------------
> Your question is rather puzzling, Cliff. If the given set of orthogonal
> vectors is used as the rows of matrix A, then the rows of B = null(A)'
> form a basis of the null space of A. Therefore the rows of A are all
> orthogonal to those of B and constitute a basis for the null space of B,
> which is what you are asking for.
>
> Did you mean something as simple as this, or are you requiring more of
> matrix B? Perhaps you want a square matrix as your result? I have the
> feeling you are asking for something other than what you have stated here.
>
> Roger Stafford
-----------------
  It occurs to me that you might have meant "inverse of null()" in a
strictly literal sense. That is, you might conceivably want a matrix B
such that null(B) generates precisely the original set of orthogonal
vectors themselves.

  That you cannot have! In the first place, the 'null' function generates
only vectors with unit norm and you didn't say that that was true of your
original set of orthogonal vectors. In the second place, if the null
space is more than one-dimensional, there is no telling what particular
set of vectors 'null' may decide to use as a basis. That choice lies
deeply buried in the particular algorithm used by 'null' and is not
subject to control by the user. The only thing you can be sure of is
that, whatever the basis null(B) might come up with, it will span the same
subspace as your original set of vectors.

Roger Stafford

Subject: Finding a Martix with given null space

From: Cliff Curry

Date: 16 Sep, 2007 20:09:46

Message: 4 of 5


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in
message
news:ellieandrogerxyzzy-1609071205560001@dialup-4.233.114.162.dial1.losangeles1.level3.net...
> In article
> <ellieandrogerxyzzy-1609071133000001@dialup-4.233.114.162.dial1.losangeles1.level3.net>,
> ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford) wrote:
>
>> In article <td-dnfg73r9x-nDbnZ2dnUVZ_oCvnZ2d@comcast.com>, "Cliff Curry"
>> <cliffcurry_nospam_323@comcast.net> wrote:
>>
>> > Hello:
>> >
>> > I am looking for a function that is the inverse of null().
>> > How would I use MATLAB to generate a matrix, given a set of
>> > orthogonal
>> > vectors, that has those vectors as a basis for its null space?
>> > I realize that there may be many such matrices.
>> >
>> > Thanks for your help,
>> >
>> >
>> > Cliff
>> -----------------
>> Your question is rather puzzling, Cliff. If the given set of
>> orthogonal
>> vectors is used as the rows of matrix A, then the rows of B = null(A)'
>> form a basis of the null space of A. Therefore the rows of A are all
>> orthogonal to those of B and constitute a basis for the null space of B,
>> which is what you are asking for.
>>
>> Did you mean something as simple as this, or are you requiring more of
>> matrix B? Perhaps you want a square matrix as your result? I have the
>> feeling you are asking for something other than what you have stated
>> here.
>>
>> Roger Stafford
> -----------------
> It occurs to me that you might have meant "inverse of null()" in a
> strictly literal sense. That is, you might conceivably want a matrix B
> such that null(B) generates precisely the original set of orthogonal
> vectors themselves.
>
> That you cannot have! In the first place, the 'null' function generates
> only vectors with unit norm and you didn't say that that was true of your
> original set of orthogonal vectors. In the second place, if the null
> space is more than one-dimensional, there is no telling what particular
> set of vectors 'null' may decide to use as a basis. That choice lies
> deeply buried in the particular algorithm used by 'null' and is not
> subject to control by the user. The only thing you can be sure of is
> that, whatever the basis null(B) might come up with, it will span the same
> subspace as your original set of vectors.
>
> Roger Stafford


Thank You, Roger.
Demonstrating what you explained, a matrix, b, is found as I requested.
x=rand(1,3) % arbitary
x =
    0.9169 0.4103 0.8936
>> input=null(x) % find a null space basis as an input: any orthonormal
>> vectors, really
input =
   -0.3052 -0.6647
    0.9446 -0.1206
   -0.1206 0.7373
>> a=input' % form this into the rows of a matrix
a =
   -0.3052 0.9446 -0.1206
   -0.6647 -0.1206 0.7373
>> b=null(a)' % find the null space basis and transpose it
b =
    0.6820 0.3052 0.6647
>> null(b) % verify that the null space of b is the same as the input
ans =
   -0.3052 -0.6647
    0.9446 -0.1206
   -0.1206 0.7373

Here the two basis sets are the same, but that may not always be true.


Thanks again,
Cliff

Subject: Finding a Martix with given null space

From: ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford)

Date: 16 Sep, 2007 21:38:11

Message: 5 of 5

In article <kaqdneddg8kNEHDbnZ2dnUVZ_g6dnZ2d@comcast.com>, "Cliff Curry"
<cliffcurry_nospam_323@comcast.net> wrote:

> Thank You, Roger.
> Demonstrating what you explained, a matrix, b, is found as I requested.
> x=rand(1,3) % arbitary
> x =
> 0.9169 0.4103 0.8936
> >> input=null(x) % find a null space basis as an input: any orthonormal
> >> vectors, really
> input =
> -0.3052 -0.6647
> 0.9446 -0.1206
> -0.1206 0.7373
> >> a=input' % form this into the rows of a matrix
> a =
> -0.3052 0.9446 -0.1206
> -0.6647 -0.1206 0.7373
> >> b=null(a)' % find the null space basis and transpose it
> b =
> 0.6820 0.3052 0.6647
> >> null(b) % verify that the null space of b is the same as the input
> ans =
> -0.3052 -0.6647
> 0.9446 -0.1206
> -0.1206 0.7373
>
> Here the two basis sets are the same, but that may not always be true.
>
> Thanks again,
> Cliff
------------------
  Your good "luck" has to be attributed to the fact that you used the same
function 'null' on both the parallel vectors x and b. It makes sense
that, whatever particular algorithm 'null' uses, it would be very likely
to produce the same two null space orthogonal vectors as output in such a
case.

  Try generating two orthogonal vectors some other way and then do the
same experiment from there on. For example, define

 v1 = 2*rand(3,1)-1;
 v2 = 2*rand(3,1)-1;
 v2 = v2 - (v1'*v2)/(v1'*v1)*v1; % Make them orthogonal
 v1 = v1/norm(v1); % Normalize them
 v2 = v2/norm(v2)

Now v1 and v2 are random orthonormal vectors. Finish up with

 input = [v1,v2];
 b=null(input')';
 c = null(b);

 input =

    0.4348 0.1088
    0.8495 -0.3790
    0.2988 0.9190

 c =

   -0.4482 0
   -0.7321 -0.5738
   -0.5130 0.8190

As you see, the two vectors in 'input' and in 'c' are not the same.
However they span the same subspace. That is, each vector in 'c' is some
linear combination of the two vectors in 'input' (which you can determine
by taking input\c.)

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us