5.4 Diagonalization¶
The diagonalization of a matrix \(A\), provided it exists, can be written as
$$A = PDP^{-1}$$
where \(D\) is a diagonal matrix of eigenvalues and \(P\) has columns which are the corresponding eigenvectors.
Example¶
Diagonalize the matrix \(A\).
Finding the eigenvalues and matrix \(D\)¶
As we found in section 5.2, the characteristic polynomial is found by calculating the determinant of the matrix \(A-\lambda I\).
A = [-3 -7 -2 ; 0 -2 0 ; 1 7 0 ];
syms x
y = charpoly(A,x)
y =
x^3 + 5*x^2 + 8*x + 4
Testing factors for zero remainder using polynomialReduce
function¶
MATLAB’s polynomialReduce
function divides one polynomial by another of lesser degree returning the remainder. This allows us to test likely factors quickly. Here, the candidate factors are \(x \pm 1, x \pm 2, x \pm 4\). Let’s try \(x=\pm 1\) fist.
Tip
We can ask the polynomialReduce
function to return both quotient and remainder.
[r,q] = polynomialReduce(y,x-1)
r =
18
q =
x^2 + 6*x + 14
The remainder is not zero which means \(x-1\) is not a factor of \(y\).
[r,q] = polynomialReduce(y,x+1)
r =
0
q =
x^2 + 4*x + 4
With \(x+1\) confirmed as a factor, we can see the factors have to be:
z = (x+1)*(x+2)^2
z =
(x + 1)*(x + 2)^2
We would like to test our factorization by expanding.
expand(z)
ans =
x^3 + 5*x^2 + 8*x + 4
Matrix \(D\)¶
The diagonal matrix we seek must include all the eigenvalues listed as many times as indicated by their multiplicity.
D = [-1 0 0 ; 0 -2 0 ; 0 0 -2 ]
D =
-1 0 0
0 -2 0
0 0 -2
Finding the eigenvectors and the matrix \(P\)¶
rref([A + 1 * eye(3), zeros(3,1)])
ans =
1 0 1 0
0 1 0 0
0 0 0 0
v1 = [ -1 ; 0 ; 1]
v1 =
-1
0
1
rref([A + 2 * eye(3), zeros(3,1)])
ans =
1 7 2 0
0 0 0 0
0 0 0 0
v21 = [ -2 ; 0 ; 1];
v22 = [-7 ; 1 ; 0];
To test the vectors, we muliply.
A * v1
ans =
1
0
-1
A * v21
ans =
4
0
-2
A * v22
ans =
14
-2
0
This means we have found and confirmed the eigenvectors for \(A\), and we can construct the matrix \(P\). We only need to ensure that they are in the same order as their associated eigenvalues are in \(D\).
P = [v1, v21, v22]
P =
-1 -2 -7
0 0 1
1 1 0
P * D * inv(P)
ans =
-3 -7 -2
0 -2 0
1 7 0
A
A =
-3 -7 -2
0 -2 0
1 7 0
We can also test with a conditional statement.
A == P * D * inv(P)
ans =
3x3 logical array
1 1 1
1 1 1
1 1 1
Thus, \(A\) is diagonalizable using the invertible matrix
and the diagonal matrix
Exercises¶
Determine if the following matrices are diagonlizable. If so, determine an invertible matrix \(C\) and diagonal matrix \(D\) such that
HW Question 1
Solution
Answers vary.
HW Question 2
Solution
Answers vary.