 Diagonal matrices are actually very convenient, they are very easy to understand and for instance if you have a diagonal matrix, its eigenvalues are the diagonal elements and so on. There are so many nice properties that diagonal matrices have and so in general we want to know if a given matrix A is similar to a diagonal matrix that is to say that the matrix A belongs to a certain equivalence class and does this equivalence class contain any diagonal matrix in it. So that is the following definition is diagonalizable if it is similar to a diagonal matrix. So when is a matrix diagonalizable? We have the following result is diagonalizable if and only if it has an linearly independent eigenvectors. So that is the requirement that it must have n linearly independent eigenvectors and we have already seen that if a matrix has distinct eigenvalues then the corresponding eigenvectors will be linearly independent and so any matrix that has n distinct eigenvalues will necessarily be diagonalizable. Of course a matrix could have repeated eigenvalues and still be diagonalizable and the identity matrix is an immediate example all its eigenvalues are equal to 1 it has n repeated eigenvalues and it is already diagonal so it is diagonalizable and in this case you can also see that any non-singular S is such that if I do S inverse times the identity times S gives me a diagonal matrix. So the matrix S that transforms the identity matrix to a diagonal matrix can be any non-singular matrix S. So that also shows you that this matrix S that defines the similarity transform connecting A and B to matrices it need not be unique. Okay so let us just see how this is proved so if there are n independent linearly independent eigenvectors x1 through xn then let the matrix S just be a stacking of these vectors not right here with commas x1 stacked with x2 xn so this is an n cross n matrix we will show that this matrix works okay it will reduce A to a diagonal matrix. So all we do is we consider S inverse AS which is equal to S inverse times A times this matrix x1 through xn and this matrix so if I expand this product I will get S inverse the first column of the product will be A x1 the second column will be A x2 A xn and because these are eigenvectors of this matrix A this A x1 is some lambda 1 x1 S inverse times lambda 1 x1 lambda 2 x2 up to lambda n xn and if I consider a diagonal matrix with lambda 1 through lambda n as its diagonal entries then I can write this as S inverse times x1 xn times this matrix lambda where lambda equals it's a diagonal matrix okay this is just rewriting this product here but then this matrix is just S and so I have S inverse S which is the identity matrix which is equal to lambda so we've shown that the matrix actually gets diagonalized so what this shows is that if there are n linearly independent eigenvectors then the matrix A is diagonalizable by a similarity transform I've reduced A to a diagonal matrix since it's an if and only if condition I need to show the converse also so if what it what we need to show is that if A is diagonalizable then it must have n linearly independent eigenvectors so if there exists an S such that S inverse A S equals lambda where lambda is some diagonal matrix then it means that A S equals S lambda I'm just pre multiplying by S so this just if I write out what this means in words this means that A times the ith column of S is equal to but lambda is a diagonal matrix and so that will be so the ith column of so this will be the ith column of A S so A times the ith column of S S is equal to the ith diagonal entry of lambda times the ith column of S which means that the ith column of S S is the eigenvector of A associated with the ith diagonal entry of lambda as eigenvalue okay so so basically what this means is that the columns of S are essentially eigenvectors of this matrix A and the diagonal entries of lambda are the eigenvalues of this matrix A and of course since by definition A is similar to a diagonal matrix this S is a non-singular matrix so since S is non-singular there are or A has n linearly independent eigenvectors so that completes the proof so basically this result that A is diagonalizable if and only if it has n linearly independent eigenvector so in principle this is a way to diagonalize a matrix if it is indeed diagonalizable so all you need to do is to find eigenvalues and eigenvectors of the matrix A and then you check whether the eigenvectors are linearly independent and if there are n linearly independent eigenvectors then you can just stack those eigenvectors together and that gives you the matrix S which is a diagonalizing similarity matrix okay so this is one way to find how to diagonalize a matrix A so again coming back to our previous example this matrix 0 1 0 0 is not diagonalizable okay what it means is that it does not have two linearly independent eigenvectors so I mean if if this was actually diagonalizable then there must be a matrix S such that S inverse times 0 1 0 0 times S is equal to a diagonal matrix containing the eigenvalues which is the all zero matrix because both its eigenvalues are zero but then this implies that if I pre and post multiply by S and S inverse it means that 0 1 0 0 must be equal to 0 0 0 0 which is not possible okay so this matrix is not diagonalizable and in fact this matrix has only one one eigenvector corresponding to lambda equal to 0 which is the main the vector 1 0 so if I multiply this vector this matrix by 1 0 I will get 0 0 so that is so 1 0 times this matrix is equal to 0 times 1 0 and so 1 0 is an eigenvector of this matrix corresponding to lambda equal to 0 and I cannot find any other linearly independent eigenvector of this matrix A so we see that the number of linearly independent eigenvectors of a matrix that you can find corresponding to an eigenvalue can be less than the multiplicity of the eigenvalue okay the multiplicity of the eigenvalue 0 in this matrix is 2 okay it is an eigenvalue of multiple 3 2 but the matrix has only one linearly independent eigenvector it does not have two linearly independent eigenvectors corresponding to lambda equal to 0 so basically not every n cross n matrix will have a full set of n linearly independent eigenvectors okay so here is so here's another direct consequence of what we just saw if a in c to the n cross n has n distinct eigenvalues then a is diagonalizing this is an immediate consequence because if it has n distinct eigenvalues then it has n linearly independent eigenvectors okay and so we just saw that result a has n linearly independent eigenvectors which implies that a is diagonalizable okay obviously the converse need not hold that if a is diagonalizable then it need not have distinct eigenvalues and I already gave you the identity matrix as a as an example okay it does not have a distinct eigenvalues all its eigenvalues are equal to one but it's of course diagonalizable okay so now you've seen that this similarity matrix that say diagonalizes a matrix need not be unique so a related question is is it possible that there is a single matrix similarity matrix that will diagonalize both two different matrices so we say that a and b are simultaneously diagonalizable if there exists a single matrix s such that s inverse a s and s inverse b s are both diagonal okay what this and in words means is that there is a basis in which the representations of both these linear transforms are diagonal okay so both these are diagonal they need not be the same matrix the same diagonal matrix all you need is that s inverse a s and s inverse b s are both diagonal okay in other words a and b need not be similar to each other but they can be simultaneously diagonalizable here is one result which I won't prove but it's nonetheless true is let a and b be n cross n matrices okay and so suppose these two matrices are diagonalizable okay then a and b commute that means a b equals b a if and only if they are simultaneously diagonalizable the proof is not difficult it's just somewhat long and so I don't want to do that in class it uses an induction argument on the matrix size to show that they commute if and only if they're simultaneously diagonalizable okay there's one other important result which which we will use quite quite a lot in this course and it's also a very useful result so that is this result so let a in c to the m by n now no longer square matrices and hello sir yes sir what do you mean by a and b will commute even there I just said it in words but okay okay please m less than or equal to m okay then has the same eigenvalues as a b counting multiplicities together with an additional n minus m eigenvalues is equal to zero okay so in another way to say it is that that is if I look at the characteristic polynomial p b a of t that is equal to t power n minus m p a b of t so this has n minus m extra zeros because t equal to zero is a repeated eigenvalue zero of this polynomial with repetition n minus m times so there are additional n minus m zeros of course the matrix b a okay is of size n by m n by n and this is a matrix of size m by m and m is smaller than n less than or equal to n and so this has more number of eigenvalues it has exactly n minus m additional eigenvalues more on top of whatever are the eigenvalues of a b but the there are the m eigenvalues of a b will also appear as m eigenvalues of b a and in addition b a will have n minus m extra eigenvalues which are all going to be equal to zero and if m equals n and at least one of a or b is non-singular so the both square matrices of the same size then a b is similar to b a okay so this is one example where from this result we see that if I apply this result to the case where m equals n then a b and b a will have the same eigenvalues but we've already seen that two matrices could have the same eigenvalues but not be similar to each other but what this is saying is that if at least one of these two matrices is non-singular then these two matrices will be similar to each other okay so this is one example where having the same eigenvalues is actually sufficient in for the matrices to be similar but provided two other conditions are satisfied namely that m equals n and at least one of a or b is non-singular okay of course yeah the thing is we are only comparing checking whether a b and b a are similar okay so there isn't time to see the proof of this in this class so we'll see the proof in the next class which will be Wednesday of next week that's all for today