# How to find orthonormal basis for subspace spanned by matrices and projection?

Let $\ M_{22}$ have the standard inner product and let

A = $\bigl(\begin{bmatrix} -1 & 1 \\ 0 & 2 \\ \end{bmatrix})$, U = $\bigl(\begin{bmatrix} 1 & -1 \\ 3 & 0 \\ \end{bmatrix})$, V = $\bigl(\begin{bmatrix} 4 & 0 \\ 9 & 2 \\ \end{bmatrix})$.

a) Find an orthonormal basis for the subspace span{U,V}

b) Find the orthogonal projection of A onto span{U,V}

I know that the inner product is $\langle A, B \rangle =\operatorname{tr}(A^TB)$ but don't know what to do past here.

Here is one way using Gram Schmidt. Note that the order of computations matters below in the sense that if you start with $V$ instead, you will get a different basis (but the same span, of course).

Compute $\tilde{U} = {1 \over \|U\|} U$ and then $W = V - \langle \tilde{U}, V \rangle$, $\tilde{V} = {1 \over \|W\|} W$.

Note that $\tilde{U}, \tilde{V}$ are orthonormal and $\operatorname{sp} \{ \tilde{U}, \tilde{V} \} = \operatorname{sp} \{ U, V \}$.

The projection of $A$ onto this span is given by $P = \langle \tilde{U}, A \rangle \tilde{U} + \langle \tilde{V}, A \rangle \tilde{V}$.

Now grind through the computations.

$\tilde{U}={ 1\over \sqrt{11}} \begin{bmatrix} 1 & -1 \\ 3 & 0 \end{bmatrix}$, $\tilde{V}={ 1\over \sqrt{11 \cdot 150}} \begin{bmatrix} 13 & 31 \\ 6 & 22 \end{bmatrix}$, $P={ 1\over 75} \begin{bmatrix} 23 & 101 \\ 24 & 62\end{bmatrix}$.

As a quick check, verify that $\langle \tilde{U}, A-P \rangle = \langle \tilde{V}, A-P \rangle = 0$.

In case you want a numerical verification:

# Matlab/Octave code to compute the above...
u = [ 1 -1 ; 3 0 ] ;
v = [ 4 0 ; 9 2 ] ;
a = [ -1 1 ; 0 2 ] ;

# scale u...
u1 = u/sqrt(trace(u'*u)) ;
# make v orthogonal to u...
w = v - trace(u1'*v)*u1 ;
# normalise v...
v1 = w/sqrt(trace(w'*w)) ;

# projection of a onto the span of u, v...
p = trace(u1'*a)*u1+trace(v1'*a)*v1 ;

# check that following matrices have no non unit common divisor...
sqrt(11)*u1
sqrt(11*150)*v1
75*p

# check the error is orthogonal to u, v...
trace(u1'*(a-p))
trace(v1'*(a-p))

• I'm able to compute Ũ okay, but when I true to compute Ṽ I keep ending up with 1/sqrt(150) as the coefficient instead of 1/sqrt(11*150). I have to do the question by hand so perhaps that's where I'm messing up, but would you mind breaking down the steps for Ṽ with the computations? Thank you so much for your help already! – emilysachs Dec 4 '16 at 21:09
• Let me check, I make mistakes too! – copper.hat Dec 4 '16 at 21:10
• I tried again using a slight different computation and got the same answer. – copper.hat Dec 4 '16 at 21:23
• Thank you SO much! I finally got it! I think you may have meant to put a Ũ at the end of the equation for W in your original answer though. Thanks again!! – emilysachs Dec 5 '16 at 16:12