2.75 Find orthonormal vectors that span the range of matrix A

Problem: Given the matrix \(A\) whose columns represents some vectors, find the set of orthonormal vectors that span the same space as \(A\) and verify the result. Let \[ A=\begin {bmatrix} 0 & 1 & 1 & 2\\ 1 & 2 & 3 & 4\\ 2 & 0 & 2 & 0 \end {bmatrix} \]

Notice that \(A\) has rank 2, so we should get no more than 2 vectors in the orthonormal set.

With MATLAB use the orth(A) function, With Mathematica, use {u,s,v}=SingularValueDecomposition[A] , and since the rank is 2, then the first 2 columns of matrix u will give the answer needed (any 2 columns of u will also give a set of orthonormal vectors).

Mathematica

Remove["Global`*"]; 
mat = {{0, 1, 1, 2}, 
       {1, 2, 3, 4}, 
       {2, 0, 2, 0}}; 
r = MatrixRank[mat]
 

2

{u,s,v}=SingularValueDecomposition[mat]; 
orth=N[u[[All,{1,r}]]]
 

 {{0.378151, -0.308379}, 
  {0.887675, -0.146825}, 
 {0.262747, 0.939864}}
 

Chop[Transpose[orth].orth]
 

{{1.,0}, 
{0,1.}}
 

 

Matlab

clear all; 
A=[0 1 1 2 
   1 2 3 4 
   2 0 2 0]; 
R=orth(A)
 

R = 
   -0.3782    0.3084 
   -0.8877    0.1468 
   -0.2627   -0.9399
 

R'*R
 

    1.0000    0.0000 
    0.0000    1.0000