All right, in this video I want to go over how to orthogonally diagonalize a matrix. I
have an example here. It's a 2x2 matrix and it's also symmetric because, by definition,
if you have that the transpose of a matrix is equal to a matrix, that means it's symmetric.
If you did the transpose of this, you'd still get (2 1; 1 2). These orthogonally
diagonalize problems could get a little bit more complicated because you could have--well,
obviously you could have a larger matrix and also sometimes, if you have repeated eigenvalues,
so if you have 0 and then 1, for example, and then 1 again, so it has multiplicity, then you have
to do Gram-Schmidt to get the values that you're going to put on your matrix, the Q matrix that's
orthogonally diagonalizable. I'm not going to do that in this problem but maybe I'll make another
video where you do have to do Graham-Schmidt but in this one you won't have to and you'll
see what I mean when we get started. Before I do the actual problem, I guess I'll go over some of
the definitions of what diagonalization means and the difference between diagonalizing and
orthogonally diagonalizing a matrix. If you have a matrix, say A, and then P, and then let's say B. A
matrix is similar if you have an invertible--and these are all square matrices, let's say n by
n--if you have P inverse AP is equal to B, this is the definition for A is similar to B because you
have--there exists a P matrix that's invertible that you can do P inverse times A times P to get
B. The definition of diagonalization is that A is similar to a diagonal matrix. That would
mean that there exists a P inverse AP equal to D. And a diagonal matrix, in this case,
is a matrix with only nonzero values on the main diagonal and zeros everywhere else. And for these
problems, the diagonal values happen to have the eigenvalues of A, so A1 to lambda An. Now,
not all matrices are orthogonally diagonalizable. If you have a question that asks, for example,
is the matrix orthogonally diagonalizable, one of the theorems is that, well if you have a symmetric
matrix, every symmetric matrix is orthogonally diagonalizable. And also not every matrix itself
is diagonalizable. There's a theorem that says you need, for an n by n matrix, you need n linearly
independent eigenvectors to be diagonalizable. But if you have a symmetric matrix and it's a
square matrix, then yeah, it is orthogonally diagonalizable. If you have the matrix Q, the
definition of orthogonally diagonalizable is that you have Q inverse AQ is equal to the diagonal,
where Q is an orthogonal matrix. That means that this would be equivalent to saying Q transpose
AQ is equal to D because the definition of an orthogonal matrix is that Q inverse is equal
to Q^T. Or you could say Q^TQ is equal to the identity matrix. That's the same thing. Now that
we have all those definitions, we can go ahead and get started on solving the problem. For this
problem, we want to find a Q such that Q^TAQ is equal to D and we're also, along the way,
just going to find the diagonal matrix D because we actually have to find the eigenvalues first
anyway. But the question is asking you to find the Q matrix, basically. The first thing we're going
to do for these problems is always to find the eigenvalues of the given matrix. The way I write
that would be, to find the determinant of (2 minus lambda 1; 1 2 minus lambda). Setting that equal to
0. We're going to get 2 minus lambda times 2 minus lambda minus 1 is equal to 0. That equals 4 minus
4 lambda plus lambda squared minus 1 is equal to 0. That gives lambda squared minus 4 lambda plus
3 is equal to 0. That's going to give you minus 3 minus 1 and that gives you lambda1 is equal to
3 and lambda2 is equal to 1. In this case, as you can see, we have a 2 by 2 matrix and we have two
distinct eigenvalues. If you have two--n distinct eigenvalues, you have n distinct eigenvectors for
the matrix. We know that we have two--we are going to have two distinct eigenvectors. And since we're
dealing with 2x2 matrices, we know that we don't have to do Graham Schmidt. If you had another
lambda3 equal to 1 in a 3x3 matrix, then you would have to do Graham Schmidt for the eigenvector that
you get for the eigenvalue of 1. But again, I'm not doing that for this problem. I'll just put
that at the top here. Lambda1 is 3 and lambda2 is 1. And now we want to find eigenvectors that
correspond to the eigenvalues that we got. The second step let's do for eigenvalue1 first. We
have (2 minus 3 1; 1 2 minus 3) times (V1; V2) is going to equal 0. That's going to give us (-1 1;
1 -1) (V1; V2) equal to 0. That gives, if you look at the first row, -1 times V1 plus V2 is
equal to 0. V1 is equal to V2. If you plug in 1, you could get (1; 1) as an eigenvector. That works
for lambda1. (1; 1). Now doing lambda2. That is equal to 1, so we're gonna get (1 1; 1 1) (V1;
V2). Looking at that quickly, you can already tell it's going be (1; -1) but if you write it out,
it's V1 plus V2 is equal to 0. So V1 is equal to -V2. If you plug in 1 for V2, that gives you
-1. We have two eigenvectors. Now the way that you get the Q is that you have to have--well hold on,
let me just erase this first. We have two eigenvectors now and by definition the Q
is going to be columns of eigenvectors that are orthonormal to each other. We know that these,
if you just check it quickly, -1 times 1 plus 1 is equal to 0. We already have two
orthogonal matrices that we can put as columns in Q but before we do that, the final answer,
we need to have the columns be orthonormal. We're going to have to normalize (1; 1) and (-1;
1) and then we can write the final answer. If you do that you get one over the square root of
one squared plus one squared is two times (1; 1). And then it's the same thing for V2 or the second
eigenvector. It's going to be -1 squared plus 1 squared. That gives two times (-1; 1). That
gives one over square root 2; 1 over square root 2. And for this column, it's going to be -1 over
square root 2; 1 over square root 2. And you can simplify that again if you multiply square root 2
over square root 2, you get square root 2 over 2; square root 2 over 2. And the same thing but with
a negative on this side, so negative square root 2 over 2; square root 2 over 2. And now we are ready
to write the final answer. It's going to be again columns of orthonormal vectors that we got from
the eigenvalues of B. We got that here. It's going to be the first column is square root 2 over 2;
square root 2 over 2 and then negative square root 2 over 2; square root 2 over 2. And this is
going to correspond to the diagonal matrix that is 2x2 where we have lambda1 and lambda2 and then 0,
0. The order of the columns has to correspond with the order of the columns in D. If you had,
for example, if you had instead that one, which is lambda2 first and then 3,
you would have to switch the order of the columns here. You'd have to have -2 over 2 here first but
because I did it this way, we have this as the final answer and we are done with this problem.