# Orthonormal basis spanned by 2 matrices

## Homework Statement

Let M1 = [1 1] and M2 = [-3 -2]
________[1 -1]_________[ 1 2]
Consider the inner product <A,B> = trace(transpose(A)B) in the vector space R2x2 of 2x2 matrices. Use the Gram-Schmidt process to determine an orthonormal basis for the subspace of R2x2 spanned by the matrices M1 and M2.

## The Attempt at a Solution

So the inner product of the 2 matrices is <M1,M2> which is [-2 0]
__________________________________________________[-4 -4]
if I calculated it right which I think I did. But I don't what that has to do with Gram-Schmidt or how it relates to orthonormal bases for R2x2. And I know how to use Gram-Schmidt on individual vectors but not on a whole matrix so I'm pretty stuck.

## The Attempt at a Solution

So I figured out one of the matrices that forms the basis from M1 by treating M1 as vector v1 equal to [1 1 1 -1] and got the orthonormal vector to be [1/2 1/2 1/2 -1/2] which corresponds to the orthonormal matrix [1/2 1/2]
________________________________[1/2 -1/2]
and I tried to extrapolate that and use the second matrix as v2 equal to [-3 -2 1 2] and got the orthonormal vector [-3/2 -1/2 5/2 1/2] using Gram-Schmidt but that was wrong. Can anyone help?

Mark44
Mentor
When you used G-S to get your second matrix, what did you use for the inner product? You can't use the normal inner product for vectors - you need to use the inner product that is defined for this space, namely trace(ATB).

so since I'd take v2 - (<v1,v2>/|v1|)v1 the <v1,v2> part would be the trace(A^TB) instead of actually just taking the dot product of v1 and v2?

Mark44
Mentor
That's exactly what I'm saying.

ok so I did A^T*B = [-2 0 -4 -4] and the trace of that is 8 so then I got v2-8*v1 which came out to [-3 -2 1 2] - 8[1/2 1/2 1/2 -1/2] = [-7 -6 -3 6] which wasn't right... did I do somehtin wrong?

ok so I actually calculated trace wrong and it's actually -6 but then I did that and came out to [-3 -3 1 2] - -3[1/2 1/2 1/2 -1/2] = [0 1 4 -1] which is also wrong...

Mark44
Mentor
So let's call v1 and v2 the new basis, with v1 = M1. Calculate v2 as follows.
$$v_2 = M_2 - \frac{<M_2, v_1>}{<v_1, v_1>}v_1$$

Make sure you calculate each inner product using the formula you gave in post #1. I did the calculation and got v2 as a matrix that is orthogonal to v1. I.e. trace(v1T v2) = 0.

That should give you an orthogonal basis. The only thing left after that is to normalize each matrix, by dividing by its magnitude. Here the magnitude of a matrix M is sqrt(<M, M>), where you use the same inner product as you've been using all along.

is v1 supposed to be the vector itself [1 1 1 -1] or the vector in normalized form [1/2 1/2 1/2 -1/2]? I think it should be normalized, right? so then <M2,v1> would be tr(M2Tv1)? and is <v1,v1> going to be tr(v1Tv1) which would just be 1/2 +1/2 =1 if v1 is supposed to be the normalized form?

Mark44
Mentor
I think it's a little less work to first get an orthogonal basis, and then normalize the matrices to get an orthonormal basis.

Also, you should probably be thinking in terms of matrices instead of vectors, if only to reinforce the idea that the inner product in this space is the trace of the product of two matrices.

Yes <M2, v1> is tr(M2Tv1>. That's what I've been saying since post #3.

Ok, I got it right! thank you so much!