You are on page 1of 5

Applications of

Differential and Difference Equations


(MAT2002)
LAB

Experiment 3
Cayley-Hamilton’s theorem

Department of Mathematics

Vellore Institute of Technology,


Vellore - 632014 (TN)

December 11, 2019


Cayley-Hamilton’s theorem Experiment 3

1 Aim

To verify Cayley-Hamilton’s Theorem for a square matrix using MATLAB

2 Mathematical Description

Let A be square matrix of order n. Consider the matrix equation

Ax = λx, (2.1)

where λ is a scalar.

The system (2.1) has nontrivial solutions x 6= 0, only if

det(A − λI) = 0. (2.2)

The determinant det(A − λI) on the left hand side of (2.2) is an nth degree poly-
nomial, and is known as the characteristic equation of A.
Theorem 2.1 (Cayley-Hamilton Theorem). Every square matrix A satisfies its
characteristic equation.
Thus if
c1 λn + c2 λn−1 + · · · + cn λ + cn+1 = 0 (2.3)

is the characteristic equation of a square matrix A of nth order, where c1 6= 0, then


we have
c1 An + c2 An−1 + · · · + cn A + cn+1 I = 0, (2.4)

where I is the unit matrix of nth order.

Inverse by Cayley-Hamilton Theorem


Let A be a nonsingular matrix of order n with the characteristic equation (2.3),
where cn+1 6= 0. Then A−1 exists. Multiplying by A−1 both sides of (2.4), and
simplifying
1
A−1 = − [c1 An−1 + c2 An−2 + · · · + cn I]. (2.5)
cn+1

3 Matlab Code for verifying Cayley-Hamilton Theorem

Example 3.1.
Write a Matlab code to verify Cayley-Hamilton Theorem for a square matrix of

ADDE(MAT2002) - ELA 1 Department of Mathematics


Cayley-Hamilton’s theorem Experiment 3

 
1 2 3
order n. Then verify it for A =  2 −1 4 ·
 
−1 0 1
solution.

(a) Code

clear
clc
A= input ( ' Enter the matrix A : ' )
DimA= s i z e ( A )
charp = poly ( A )
P= zeros ( DimA ) ;
for i = 1 : DimA ( 1 ) + 1
P = P+ charp ( i ) *A ˆ ( DimA(1)+1 − i ) ;
end
disp ( ' RHS o f the c h a r a c t e r i s t i c equation = ' )
disp ( round ( P ) )
i f round ( P ) = = 0
disp ( ' Caylay−Hamilton theorem i s v e r i f i e d ' )
end
 

(b) Input

Enter the matrix A : [ 1 2 3 ; 2 −1 4; −1 0 1 ]
 

(c) Output

A =
1 2 3
2 −1 4
−1 0 1
DimA =
3 3
charp =
1.0000 −1.0000 −2.0000 16.0000
RHS o f the c h a r a c t e r i s t i c equation =
0 0 0
0 0 0
0 0 0
Caylay−Hamilton theorem i s v e r i f i e d
 

ADDE(MAT2002) - ELA 2 Department of Mathematics


Cayley-Hamilton’s theorem Experiment 3

4 Self-check Exercises

Exercise 4.1.
Verify Cayley-Hamilton Theorem for each of the following matrices using Matlab:
!
1 1
1. A =
−2 4
!
2 0
2. A =
1 −3
!
5 −2
3. A =
4 −1
!
1 1
4. A =
1 0
!
−3 4
5. A =
4 3

Exercise 4.2.
Verify Cayley-Hamilton Theorem for each of the following matrices using Matlab:
 
2 2 0
1. A =  2 1 1 
 
−7 2 −3
 
1 2 1
2. A =  6 −1 0 
 
−1 −2 −1
 
0 −1 −3
3. A =  2 3 3
 
−2 1 1
 
2 2 −2
4. A =  2 −1 4 
 
−2 4 −1
 
1 2 0
5. A = 2 −1 0
 
0 0 1

ADDE(MAT2002) - ELA 3 Department of Mathematics


Cayley-Hamilton’s theorem Experiment 3

5 Concept-based Exercises

Exercise 5.1.
Given a square matrix A of order 3, write a Matlab code to find its determinant.
Then use it to verify if A is invertible.
 
1 2 1
1. A = 2 1 1
 
1 1 2
 
1 2 3
2. A = 3 4 5
 
4 5 6
 
−5 4 2
3. A =  4 −5 2 
 
2 2 −8

Exercise 5.2.
Given a square matrix A of order 3, write a Matlab code to find its inverse through
Caley-Hamilton theorem. Hence verify it for
 
2 1 1
1. A = 1 2 1
 
1 1 2
 
−5 4 2
2. A =  4 −5 2 
 
2 2 −8
 
1 3 1
3. A = 3 1 3  ·
 
1 1 −2

ADDE(MAT2002) - ELA 4 Department of Mathematics

You might also like