ANA RITA PIRES: In lecture, you've learned about
Gram-Schmidt orthogonalization, and that's
what today's problem is about.
We have a matrix A, and its columns are a, b, and c.
And I want you to find orthonormal vectors q1, q2,
and q3 from those three columns.
Then I want you to write A as a--
it's Q R decomposition where Q is an orthogonal matrix, and R
is an upper triangular matrix.
Remember, an orthogonal matrix is a matrix whose columns are
orthonormal vectors.
Work on it for a little while, hit pause, and when you're
ready I'll come back and we'll do it together.
Did you manage to solve that all right?
Well let's start solving it together.
So Gram-Schmidt orthogonalization, as you
should remember from lecture, consists of the following.
At each step you find you orthonormal vector by taking
the vector that you started with, a, b, or c in this case,
and making it orthonormal to the previous ones.
Let's actually do it.
We want to find q1.
Well to find q1, start with a, and make it orthonormal to the
previous one.
There's no previous one, so that's very easy.
The direction of a is fine and you just need to ensure that
your vector has length 1.
Well a is the vector 1 0 0.
So you should divide it by its length, but its length is 1,
so this is simply 1 0 0.
q1 is done.
Now let's do q2.
So with q2, I will start with my vector b.
And then I want to make it, well first of all, orthogonal
to what I already have, which is q1.
For that I'm going to subtract off from b the projection of b
onto q1 minus b dot q1 times q1.
Usually, when you're doing the projection of a vector onto
another vector, you have to divide it by the length of, in
this case, q1.
But because q1 has length 1, you don't need to do that.
So what will it be here?
Well b dot q1 is going to be--
b is 2 0 3 minus b dot q1 will be 2, and 1 0 0.
So this will be 0 0 3.
This vector is orthogonal to this one, and you can check by
doing your dot product.
It should be 0, and it is.
We need it also to be length 1, because we want these two
vectors to be orthonormal.
So this is not actually q2.
Let's call this one q2 prime, and set q2 equals to q2 prime
divided by its length, which in this case is 3, 0 0 1.
That's my vector q2.
Let's go on to the third one, q3.
Well again, I start with my third vector, c.
And then I want to subtract the projection of c onto q1
and onto q2, and that will give me a q3 that is
orthogonal to both q1 and q2.
c minus c dot q1 times q1 minus c dot q2 dot q2.
This will be c, 4 5 6 minus q1 was 1 0 0, so 4, times 1 0 0
minus q2, 6 0 0 1.
So this vector will be 0 5 0.
And once again, this one is orthogonal to q1 and q2, but
it is not norm 1 yet.
So q3--
I'll call that one q3 prime--
and I'll set q3 equal to q3 prime divided by its length
which is 5.
q3 is the vector 0 1 0.
One thing that I want you to note is that my vectors q1,
q2, q3 are very nice in this case.
Usually, when you perform Gram-Schmidt
orthogonalization, you end up with lots of square roots
because you're dividing by the length.
In this case, we have everything is integers, which
is, well, very lucky.
Next part of the problem is we want to write the Q R
decomposition of the matrix A. A equals Q R. Well the matrix
A, you already know what it is.
It is the matrix 1 2 4, 0 0 5, 0 3 6.
And q you want to be an orthogonal matrix.
Like I said before, an orthogonal matrix has
orthonormal vectors for its columns.
And we already have such a matrix.
It's the matrix that has q1, q2, and q3
as its column vectors.
1 0 0, 0 0 1, and 0 1 0.
Now, we need an upper triangular matrix that makes
this equality true.
Take a moment to look at your matrix q.
It is simply a permutation matrix, so it's very easy to
come up with a matrix that should fit here.
What this permutation matrix does is it exchanges rows two
and three from my matrix R to give you A. So you
know what R must be.
It must be 1 2 4, 0 3 6--
that's the third row of A--
and then 0 0 5, which is the second row of A.
And indeed, R is upper triangular.
This is your Q R decomposition of the matrix A. Q is
orthogonal, R is upper triangular.
But let's see where these numbers in the matrix R are
coming from.
Let me label these columns for you, a b, c in q1, q2, q3.
And then I have my matrix R.
You know from the way that matrix multiplication works
that A is going to be this matrix Q times the first
column of R. So you can regard that as these numbers in the
first column of R are giving you the linear coefficients in
which you need to take these vectors to add up to A. Let me
write that down.
A is going to be 1 times q1 plus 0 times q2
plus 0 times q3.
Let's do it for b.
The second column of this matrix will be
q times this column.
So it will be 2 times q1 plus 3 times q2 plus 0 times q3.
And finally, for c I will have c is equal to this matrix
times this vector, 4q1 plus 6q2 plus 5q3.
Now let's go back and see where these numbers are
showing up.
I wanted to have A equals 1 times q1.
Well that's very easy.
It comes from here, a equals 1 times q1.
Let's try the second one.
b equals 2q1 plus 3q2.
Well q2, let's see.
q2 prime is equal to 3 times q2, so let me write
this here to help.
3q2.
Now let me remind you that b dot q1 was equal to 2.
Now look at this equation.
You we have b is equal to 2q1 plus 3q2,
which is what we wanted.
Let's check q3.
q3 prime is equal to 5q3, so let me write that here, 5q3.
And now I have c is equal to this number was 4, and this
number was 6.
c is equal to 4q1 plus 6q2 plus 5q3, which indeed, is
what we wanted.
So this is where these numbers from the matrix
R are coming from.
And that finishes this problem.
I hope you have a better grasp of the Q R decomposition now.
Bye.
See you next time.