Matrices-Unit21.mws

MATRICES AND MATRIX OPERATIONS: Unit 21

Dr. Wlodzislaw Kostecki

The Papua New Guinea University of Technology (PNGUT)

Department of Electrical and Communication Engineering

Lae, Morobe Province

Papua New Guinea

Copyright © 2000 by Wlodzislaw Kostecki

All rights reserved

-------------------------------------------------------------------

(21) Eigenvalues and eigenvectors of matrices

OBJECTIVES :

To provide a concise analysis of solution of a homogeneous system of algebraic equations.

To introduce the concepts of the characteristic matrix , characteristic determinant , characteristic polynomial , and characteristic equation of a square matrix.

To introduce the concepts of eigenvalues or characteristic roots of a square matrix and of eigenvectors or characteristic vectors corresponding to matrix eigenvalues.

To provide a step-by-step example of computing eigenvalues and eigenvectors of a matrix with numerical elements.

To introduce the function eigenvects and analyse the structure returned by the function.

To provide selection procedures for extracting in a unique way eigenvalues and eigenvectors from the structure returned by the eigenvects function.

To introduce the concept of the Frobenius norm of a vector and show how to use it for computing the norm of eigenvectors.

To show how to perform normalization of eigenvectors using the normalize function.

To specify and illustrate properties of eigenvalues and eigenvectors.

To give the Cayley-Hamilton theorem and provide a numerical example for verification of the theorem.

To suggest an application of the Cayley-Hamilton theorem to computing functions of matrices.

> restart : interface(warnlevel=0) : with(linalg, charmat, charpoly, det, diag, eigenvals, eigenvects, inverse, norm, normalize, trace, transpose, vector) :

A. Definitions and properties

It was stated in Unit (19) that a system of linear algebraic inhomogeneous equations may be written in the matrix form

[ A ] [ X ] = [ K ] (1)

where [ A ] is an ( n × n ) coefficient matrix, [ X ] is a ( n × 1 ) solution column matrix (vector), and [ K ] is a ( n × 1 ) inhomogeneous column matrix (vector).

It follows from matrix equation (1) that [ K ] is proportional to [ X ], or

[ K ] = lambda [ X ] (2)

where lambda is some scalar multiplier.

Therefore, equation (1) may be rewritten in the form

[ A ] [ X ] = lambda [ X ] (3)

which is the matrix form of the system of homogeneous equations

( [ A ] lambda [ U ] ) [ X ] = [ 0 ] (4)

where [ U ] is the unit matrix and [ 0 ] is the zero column matrix (vector).

There is a theorem, which states that the homogeneous system of equations

[ A ] [ X ] = [ 0 ] (5)

always has the trivial solution [ X ] = [ 0 ] and it has a non-trivial solution only when the determinant of matrix [ A ] is zero . If [ X ] is a non-trivial solution, so also is lambda [ X ], where lambda is an arbitrary scalar.

According to this theorem, equation (4) can only have a non-trivial solution when

Det( [ A ] lambda [ U ] ) = [ 0 ] (6)

When expanded, this determinant gives rise to an algebraic polynomial equation of degree n in lambda of the form

lambda^n+alpha[1]*lambda^(n-1)+alpha[2]*lambda^(n-2... + ... + alpha[n] = 0 (7)

The matrix lambda [ U ] [ A ] is called the characteristic matrix of [ A ].

The determinant Det( [ A ] lambda [ U ] ) is called the characteristic determinant associated with [ A ], and equation (7) is called the characteristic equation of [ A ]. The left-hand side of equation (7) is called the characteristic polynomial of [ A ]. The characteristic equation of [ A ] has n roots, lambda[1] , lambda[2] , ..., lambda[n] , each of which is called either an eigenvalue , a characteristic root , or, in some texts, a latent root of [ A ]. The roots may be real , complex , or multiples of each other.

Once the eigenvalues have been determined, any of them can be substituted into equation (3) to find a corresponding solution vector [ X ]. Thus, setting lambda = lambda[i] will yield a solution vector X[i] , which, because of the aforementioned theorem, will only be determined to within an arbitrary scalar multiplier.

This vector X[i] is called either an eigenvector , a characteristic vector or, a latent vector of [ A ] corresponding to lambda[i] .

Eigenvalues of a matrix may be zero , whereas an eigenvector may not be the zero vector.

For example, consider a ( 2 × 2 ) matrix [ A ] given as

> A := matrix(2, 2, [1, 2, 3, 0]) : A = matrix(A) ;

A = matrix([[1, 2], [3, 0]])

and find its characteristic equation, eigenvalues, and eigenvectors.

Step 1 . Obtain the matrix [ A ] lambda [ U ]:

The appropriately sized unit matrix corresponding to this case is

> U := diag(1, 1) : U = matrix(U) ;

U = matrix([[1, 0], [0, 1]])

Therefore,

> l := lambda : `A - lU` := evalm(A - l*U) : A - l*U = matrix(`A - lU`) ;

A-lambda*U = matrix([[1-lambda, 2], [3, -lambda]])

* * *

N.B. The matrix [ A ] lambda [ U ] may also be obtained using the charmat function, viz.

> `A - lU` := evalm(-charmat(A, l)) : A - l*U = matrix(`A - lU`) ;

A-lambda*U = matrix([[1-lambda, 2], [3, -lambda]])

* * *

Step 2 . Find the determinant Det( [ A ] lambda [ U ] ) , or the characteristic polynomial of [ A ]:

> `det(A - lU)` := det(`A - lU`) : Det(A - l*U) = `det(A - lU)` ;

Det(A-lambda*U) = -lambda+lambda^2-6

* * *

N.B. The characteristic polynomial may be obtained in Maple directly , using the charpoly function. For this particular case,

> `charpoly(A)` := charpoly(A, l) : char_poly(A) = `charpoly(A)` ;

char_poly(A) = -lambda+lambda^2-6

* * *

Step 3 . Form the relevant characteristic equation of [ A ]:

> char_eq(A) := `det(A - lU)` = 0 : char_eq(A) ;

-lambda+lambda^2-6 = 0

or, using direct computation of the characteristic polynomial,

> char_eq(A) := `charpoly(A)` = 0 : char_eq(A) ;

-lambda+lambda^2-6 = 0

Step 4 . Solve the characteristic equation of [ A ]:

> solution(char_eq(A)) := solve({char_eq(A)}, {l}) : solution(char_eq(A)) ;

{lambda = 3}, {lambda = -2}

Denoting the roots by lambda[1] and lambda[2] and extracting either of them from the solution sequence yields

> l[`1_n`] := lambda[1] : l[`2_n`] := lambda[2] : l[`1_v`] := subs(solution(char_eq(A))[1], lambda) :

> l[`2_v`] := subs(solution(char_eq(A))[2], lambda) : l[`1_n`] = l[`1_v`] ; l[`2_n`] = l[`2_v`] ;

lambda[1] = 3

lambda[2] = -2

The roots lambda[1] = 3 and lambda[2] = -2 are the eigenvalues or characteristic roots of [ A ].

* * *

N.B. The eigenvalues may be obtained in Maple directly , using the eigenvals function. For this particular case,

> charroots(A) := eigenvals(A) : char_roots(A) = charroots(A) ;

char_roots(A) = (3, -2)

Denoting the characteristic roots by lambda[1] and lambda[2] and extracting each from the above sequence yields

> l[`1_v`] := charroots(A)[1] : l[`2_v`] := charroots(A)[2] : root1(A) := l[`1_v`] : root2(A) := l[`2_v`] :

> l[`1_n`] = l[`1_v`] ; l[`2_n`] = l[`2_v`] ;

lambda[1] = 3

lambda[2] = -2

Alternatively, the inert Eigenvals function may be used, but it must be evaluated with evalf . For this case,

> charroots(A) := evalf(Eigenvals(A)) : char_roots(A) = charroots(A) ;

char_roots(A) = vector([3.000000000, -2.000000000])...

The returned output is an array structure, from which the characteristic roots may be extracted using subscript notation, viz.

> charroots(A)[1] ; charroots(A)[2] ;

3.000000000

-2.000000000

* * *

Step 5 . Determine the eigenvector of [ A ] corresponding to lambda[1] :

The zero column matrix (vector) appropriately sized for this case is

> `0` := matrix(2,1, [0, 0]) : `0` = matrix(`0`) ;

`0` = matrix([[0], [0]])

(a) The eigenvector X[lambda1] is

> x[1][l1_n] := x[1][l[`1_n`]] : x[2][l1_n] := x[2][l[`1_n`]] : X[l1_n] := X[lambda[1]] :

> X[l1_sv] := matrix(2, 1, [x[1][l1_n], x[2][l1_n]]) : X[l1_n] = matrix(X[l1_sv]) ;

X[lambda[1]] = matrix([[x[1][lambda[1]]], [x[2][lam...

(b) The matrix [ A ] lambda[1] [ U ] is

> `f(A - l1U)` := subs(lambda=l[`1_n`], matrix(`A - lU`)) : A - l[`1_n`]*U = matrix(`f(A - l1U)`) ;

A-lambda[1]*U = matrix([[1-lambda[1], 2], [3, -lamb...

or, upon substitution of the numerical value of lambda[1] ,

> `v(A - l1U)` := subs(l[`1_n`]=l[`1_v`], matrix(`f(A - l1U)`)) : A - l[`1_n`]*U = matrix(`v(A - l1U)`) ;

A-lambda[1]*U = matrix([[-2, 2], [3, -3]])

(c) The matrix equation [ A ] lambda[1] [ U ] = [ 0 ] is

> matrix(`v(A - l1U)`) * matrix(X[l1_sv]) = matrix(`0`) ;

matrix([[-2, 2], [3, -3]])*matrix([[x[1][lambda[1]]...

(d) The corresponding system of homogeneous equations is

> s_l1 := evalm(matrix(`v(A - l1U)`) &* matrix(X[l1_sv])) :

> Eq_1_l1 := s_l1[1,1] = 0 : Eq_1_l1 ; Eq_2_l1 := s_l1[2,1] = 0 : Eq_2_l1 ;

-2*x[1][lambda[1]]+2*x[2][lambda[1]] = 0

3*x[1][lambda[1]]-3*x[2][lambda[1]] = 0

(e) The solution of the system is obtained as follows:

Assign an arbitrary non- zero value to x[1][lambda[1]] , e.g.

> x[1][l1_v] := 1 : x[1][l1_n] = x[1][l1_v] ;

x[1][lambda[1]] = 1

Substitute this value in, say, the second equation and solve it for the other unknown, i.e.

> x[2][l1_v] := solve(subs(x[1][l1_n]=1, Eq_2_l1)) : x[2][l1_n] = x[2][l1_v] ;

x[2][lambda[1]] = 1

(f) Substitute the roots x[1][lambda[1]] and x[2][lambda[1]] in the symbolic expression for the eigenvector X[lambda[1]] :

> X[l1_nv] := subs(x[1][l1_n]=x[1][l1_v], x[2][l1_n]=x[2][l1_v], matrix(X[l1_sv])) :

> X[l1_n] = matrix(X[l1_nv]) ;

X[lambda[1]] = matrix([[1], [1]])

(g) Check the resultant of the matrix operation [ A ] lambda[1] [ U ]:

> A - l[`1_n`] * U = matrix(`v(A - l1U)`) * matrix(X[l1_nv]) ;

A-lambda[1]*U = matrix([[-2, 2], [3, -3]])*matrix([...

or

> A - l[`1_n`] * U = evalm(matrix(`v(A - l1U)`) &* matrix(X[l1_nv])) ;

A-lambda[1]*U = matrix([[0], [0]])

* * *

N.B. For any arbitrary scalar mu[1] , the product vector mu[1]*X[lambda[1]] is also the eigenvector of [ A ], i.e.

> A - l[`1_n`] * U = mu[1] * X[l1_n] ; A - l[`1_n`] * U = mu[1] * matrix(X[l1_sv]) ;

A-lambda[1]*U = mu[1]*X[lambda[1]]

A-lambda[1]*U = mu[1]*matrix([[x[1][lambda[1]]], [x...

since the resultant of the matrix equation

> A - l[`1_n`] * U = matrix(`v(A - l1U)`) * matrix(evalm(mu[1] * X[l1_nv])) ;

A-lambda[1]*U = matrix([[-2, 2], [3, -3]])*matrix([...

is

> A - l[`1_n`] * U = evalm(matrix(`v(A - l1U)`) &* matrix(evalm(mu[1]*X[l1_nv]))) ;

A-lambda[1]*U = matrix([[0], [0]])

Notice, therefore, that the eigenvector of a matrix is not unique.

* * *

Step 6 . Determine the eigenvector of [ A ] corresponding to lambda[2] :

(a) The eigenvector X[lambda[2]] is

> x[1][l2_n] := x[1][l[`2_n`]] : x[2][l2_n] := x[2][l[`2_n`]] : X[l2_n] := X[lambda[2]] :

> X[l2_sv] := matrix(2, 1, [x[1][l2_n], x[2][l2_n]]) : X[l2_n] = matrix(X[l2_sv]) ;

X[lambda[2]] = matrix([[x[1][lambda[2]]], [x[2][lam...

(b) The matrix [ A ] lambda[2] [ U ] is

> `f(A - l2U)` := subs(lambda=l[`2_n`], matrix(`A - lU`)) : A - l[`2_n`]*U = matrix(`f(A - l2U)`) ;

A-lambda[2]*U = matrix([[1-lambda[2], 2], [3, -lamb...

or, upon substitution of the numerical value of lambda[2] ,

> `v(A - l2U)` := subs(l[`2_n`]=l[`2_v`], matrix(`f(A - l2U)`)) : A - l[`2_n`]*U = matrix(`v(A - l2U)`) ;

A-lambda[2]*U = matrix([[3, 2], [3, 2]])

(c) The matrix equation [ A ] lambda[2] [ U ] = [ 0 ] is

> matrix(`v(A - l2U)`) * matrix(X[l2_sv]) = matrix(`0`) ;

matrix([[3, 2], [3, 2]])*matrix([[x[1][lambda[2]]],...

(d) The corresponding system of (identical) homogeneous equations is

> s_l2 := evalm(matrix(`v(A - l2U)`) &* matrix(X[l2_sv])) :

> Eq_1_l2 := s_l2[1,1] = 0 : Eq_1_l2 ; Eq_2_l2 := s_l2[2,1] = 0 : Eq_2_l2 ;

3*x[1][lambda[2]]+2*x[2][lambda[2]] = 0

3*x[1][lambda[2]]+2*x[2][lambda[2]] = 0

(e) The solution of the system is obtained as follows:

Assign an arbitrary non- zero value to x[1][lambda[2]] , e.g.

> x[1][l2_v] := 1 : x[1][l2_n] = x[1][l2_v] ;

x[1][lambda[2]] = 1

Substitute this value in, say, the second equation and solve it for the other unknown, i.e.

> x[2][l2_v] := solve(subs(x[1][l2_n]=1, Eq_2_l2)) : x[2][l2_n] = x[2][l2_v] ;

x[2][lambda[2]] = -3/2

(f) Substitute the roots x[1][lambda[2]] and x[2][lambda[2]] in the symbolic expression for the eigenvector X[lambda[2]] :

> X[l2_nv] := subs(x[1][l2_n]=x[1][l2_v], x[2][l2_n]=x[2][l2_v], matrix(X[l2_sv])) :

> X[l2_n] = matrix(X[l2_nv]) ;

X[lambda[2]] = matrix([[1], [-3/2]])

(g) Check the resultant of the matrix operation [ A ] lambda[2] [ U ]:

> A - l[`2_n`] * U = matrix(`v(A - l2U)`) * matrix(X[l2_nv]) ;

A-lambda[2]*U = matrix([[3, 2], [3, 2]])*matrix([[1...

or

> A - l[`2_n`] * U = evalm(matrix(`v(A - l2U)`) &* matrix(X[l2_nv])) ;

A-lambda[2]*U = matrix([[0], [0]])

* * *

N.B. For any arbitrary scalar mu[2] , the product vector mu[2]*X[lambda[2]] is also the eigenvector of [ A ], i.e.

> A - l[`2_n`] * U = mu[2] * X[l2_n] ; A - l[`2_n`] * U = mu[2] * matrix(X[l2_sv]) ;

A-lambda[2]*U = mu[2]*X[lambda[2]]

A-lambda[2]*U = mu[2]*matrix([[x[1][lambda[2]]], [x...

since the resultant of the matrix equation

> A - l[`2_n`] * U = matrix(`v(A - l2U)`) * matrix(evalm(mu[2] * X[l2_nv])) ;

A-lambda[2]*U = matrix([[3, 2], [3, 2]])*matrix([[m...

is

> A - l[`2_n`] * U = evalm(matrix(`v(A - l2U)`) &* matrix(evalm(mu[2]*X[l2_nv]))) ;

A-lambda[2]*U = matrix([[0], [0]])

* * *

N.B. The eigenvectors may be obtained in Maple directly , using the eigenvects function. This function computes the eigenvalues and eigenvectors of a matrix. The result returned is a sequence of lists . For the matrix [ A ] analysed above, the eigenvects function yields

> `roots&vectors(A)` := eigenvects(A) : roots_and_vectors(A) = `roots&vectors(A)` ;

roots_and_vectors(A) = ([3, 1, {vector([1, 1])}], [...

However, the eigenvects function returns an unordered sequence of its elements, i.e. lists may appear in the above or reverse order. This implies that the first eigenvalue in the sequence returned by the eigenvects function may not be the same as the first eigenvalue in the sequence returned by the eigenvals function, which returns eigenvalues in a unique, reproducible order.

On the other hand, it is essential that every eigenvalue be used together with the eigenvector corresponding to it. Therefore, it is necessary to develop a procedure that will extract pairs of lists in a unique way. This is ensured by the selection procedure that follows.

For the case under consideration, two different lists of eigenvalues and eigenvectors are extracted from the above solution in the desired order, viz.

> e[1] := `roots&vectors(A)`[1][1] : e[2] := `roots&vectors(A)`[2][1] :

list containing the first eigenvalue:

> if e[1] = root1(A) then l := root1(A) : list1 := `roots&vectors(A)`[1] else l := e[2] : list1 := `roots&vectors(A)`[2] fi : list[1](roots_and_vectors(A)) = list1 ;

list[1](roots_and_vectors(A)) = [3, 1, {vector([1, ...

list containing the second eigenvalue:

> if e[2] = root2(A) then l := root2(A) : list2 := `roots&vectors(A)`[2] else l := e[1] : list2 := `roots&vectors(A)`[1] fi : list[2](roots_and_vectors(A)) = list2 ;

list[2](roots_and_vectors(A)) = [-2, 1, {vector([1,...

In either list, the first number is an eigenvalue and the second value is its multiplicity , indicating how many times this eigenvalue appears in the solution to the characteristic equation of the matrix. This may be verified by inspection of the characteristic polynomial in its factored form. For this case,

> `charpoly(A)` := factor(charpoly(A, lambda)) : char_poly(A) = `charpoly(A)` ;

char_poly(A) = (lambda+2)*(lambda-3)

It is evident from the above that multiplicity of either eigenvalue is 1 , or either eigenvalue is a simple root of the characteristic equation of [ A ].

The last object in the solution list is a set containing an eigenvector (or, in the case of matrices of a higher order, several eigenvectors separated with the comma) corresponding to the eigenvalue of a given list.

Extracting the eigenvalue and its corresponding eigenvector from the first list gives

> l1 := list1[1] : charvector[1] := list1[3][1] : v1 := charvector[1] :

> lambda[1] = l1 ; char_vector[lambda[1]](A) = eval(charvector[1]) ;

lambda[1] = 3

char_vector[lambda[1]](A) = vector([1, 1])

or, as a column matrix (vector),

> X[l1] := convert(eval(charvector[1]), matrix) : X[lambda[1]] = matrix(X[l1]) ;

X[lambda[1]] = matrix([[1], [1]])

Extracting the eigenvalue and its corresponding eigenvector from the second list gives

> l2 := list2[1] : charvector[2] := list2[3][1] : v2 := charvector[2] :

> lambda[2] = l2 ; char_vector[lambda[2]](A) = eval(charvector[2]) ;

lambda[2] = -2

char_vector[lambda[2]](A) = vector([1, -3/2])

or, as a column matrix (vector),

> X[l2] := convert(eval(charvector[2]), matrix) : X[lambda[2]] = matrix(X[l2]) ;

X[lambda[2]] = matrix([[1], [-3/2]])

Both eigenvectors are equal to the eigenvectors obtained earlier "manually" and either of them is associated with a proper eigenvalue.

* * *

Since mu[1]*X[lambda[1]] and mu[2]*X[lambda[2]] are also eigenvectors of [ A ], this fact is often used to normalize eigenvectors of a matrix by setting the scalars mu to be equal to the the reciprocal of the Frobenius norm of the pertinent vector.

The Frobenius norm of a vector [ X ] having n elements x[i] is defined to be the square root of the sum of the squares of the magnitudes of each element of the vector. In other words, it is the length (or magnitude) of the vector, which is given by

abs(X) = sqrt(Sum(abs(x[i])^2,i = 1 .. n))

For the case under analysis, the Frobenius norm or length of eigenvectors X[lambda[1]] and X[lambda[2]] may be computed as follows.

for eigenvector corresponding to the first eigenvalue:

> `abs(v1)` := sqrt(v1[1]^2 + v1[2]^2) : abs(char_vector[lambda[1]](A)) = `abs(v1)` ;

abs(char_vector[lambda[1]](A)) = sqrt(2)

or, directly by using the function norm together with the norm name frobenius , viz.

> `norm(v1)` := norm(v1, frobenius) : abs(char_vector[lambda[1]](A)) = `norm(v1)` ;

abs(char_vector[lambda[1]](A)) = sqrt(2)

for eigenvector corresponding to the second eigenvalue:

> `abs(v2)` := sqrt(v2[1]^2 + v2[2]^2) : abs(char_vector[lambda[2]](A)) = `abs(v2)` ;

abs(char_vector[lambda[2]](A)) = 1/2*sqrt(13)

or, directly,

> `norm(v2)` := norm(v2, frobenius) : abs(char_vector[lambda[2]](A)) = `norm(v2)` ;

abs(char_vector[lambda[2]](A)) = 1/2*sqrt(13)

Consequently, the scalars mu assume the following values:

> mu[1] := 1/`abs(v1)` : mu[2] := 1/`abs(v2)` : 'mu[1]' = mu[1] ; 'mu[2]' = mu[2] ;

mu[1] = 1/2*sqrt(2)

mu[2] = 2/13*sqrt(13)

The normalized characteristic vectors of [ A ] are

> `v1[N]` := evalm(mu[1] * v1) : `v2[N]` := evalm(mu[2] * v2) : mu[1] := 'mu[1]' : mu[2] := 'mu[2]' :

> char_vector[lambda[1]][N](A) = op(`v1[N]`) ; char_vector[lambda[2]][N](A) = op(`v2[N]`) ;

char_vector[lambda[1]][N](A) = vector([1/2*sqrt(2),...

char_vector[lambda[2]][N](A) = vector([2/13*sqrt(13...

Alternatively, normalization of vectors may be performed in Maple directly , using the normalize function. In this particular case, it gives

> `v1[N]` := normalize(v1) : `v2[N]` := normalize(v2) :

> char_vector[lambda[1]][N](A) = op(`v1[N]`) ; char_vector[lambda[2]][N](A) = op(`v2[N]`) ;

char_vector[lambda[1]][N](A) = vector([1/2*sqrt(2),...

char_vector[lambda[2]][N](A) = vector([1/13*sqrt(13...

Note that the magnitude of normalized vectors is unity . Verification of this fact for the analysed case gives

> `abs(v1[N])` := sqrt(`v1[N]`[1]^2 + `v1[N]`[2]^2) : `abs(v2[N])` := sqrt(`v2[N]`[1]^2 + `v2[N]`[2]^2) :

> abs(char_vector[lambda[1]][N](A)) = `abs(v1[N])` ; abs(char_vector[lambda[2]][N](A)) = `abs(v2[N])` ;

abs(char_vector[lambda[1]][N](A)) = 1

abs(char_vector[lambda[2]][N](A)) = 1

* * *

N.B. If one of the eigenvalues of a matrix is zero , its determinant is zero and the matrix is singular.

For example, consider a ( 3 × 3 ) matrix [ A ] given as

> A := matrix(3, 3, [1, 2, 5, 3, 1, 5, -5, 0, -5]) : A = matrix(A) ;

A = matrix([[1, 2, 5], [3, 1, 5], [-5, 0, -5]])

(a) The eigenvalues of [ A ] are

> charroots(A) := eigenvals(A) : char_roots(A) = charroots(A) ;

char_roots(A) = (0, -3/2+1/2*I*sqrt(31), -3/2-1/2*I...

(b) The determinant of [ A ] is

> `det(A)` := det(A) : Det(A) = `det(A)` ;

Det(A) = 0

* * *

N.B. If lambda is an eigenvalue of a matrix [ A ], then an eigenvalue of k [ A ] is k*lambda .

For example, consider a ( 3 × 3 ) matrix [ A ] given as

> A := matrix(3, 3, [-2, 2, 0, 2, 1, 0, -2, -1, -1]) : A = matrix(A) ;

A = matrix([[-2, 2, 0], [2, 1, 0], [-2, -1, -1]])

(a) The eigenvalues of [ A ] are

> charroots(A) := eigenvals(A) : char_roots(A) = charroots(A) ;

char_roots(A) = (-1, 2, -3)

(b) The eigenvalues of k [ A ] are

> charroots(kA) := eigenvals(evalm(k*A)) : char_roots(k*A) = charroots(kA) ;

char_roots(k*A) = (-k, 2*k, -3*k)

* * *

N.B. If X[1] , X[2] , ..., X[n] are all eigenvectors of a matrix [ A ] corresponding to the same eigenvalue lambda , then any non- zero linear combination of these vectors is also an eigenvector of [ A ] corresponding to lambda . This implies that the vector

X[lambda] = mu[1]*X[1][lambda]+mu[2]*X[2][lambda] + ... + mu[n]*X[n][lambda]

is a solution vector to the equation

([ A ] – lambda [ U ]) X[lambda] = [ 0 ]

with the selected eigenvalue lambda .

Coefficients mu[1] , mu[2] , ..., mu[n] are arbitrary scalars.

For example, consider a ( 3 × 3 ) matrix [ A ] given as

> A := matrix(3, 3, [-2, 2, 3, 2, 1, 6, 3, 6, 6]) : A = matrix(A) ;

A = matrix([[-2, 2, 3], [2, 1, 6], [3, 6, 6]])

(a) The eigenvalues of [ A ] are

> charroots(A) := eigenvals(A) : char_roots(A) = charroots(A) ;

char_roots(A) = (11, -3, -3)

from which two distinct roots are extracted, viz.

> root1(A) := charroots(A)[1] : root2(A) := charroots(A)[2] :

> char_root[1](A) = root1(A) ; char_root[2](A) = root2(A) ;

char_root[1](A) = 11

char_root[2](A) = -3

The eigenvalue -3 is a double root (root of multiplicity two), as clearly seen from inspection of the characteristic polynomial of [ A ] in its factored form

> `charpoly(A)` := factor(charpoly(A, lambda)) : char_poly(A) = `charpoly(A)` ;

char_poly(A) = (lambda-11)*(lambda+3)^2

(b) The sequence of lists containing eigenvalues and eigenvectors of [ A ] is

> `roots&vectors(A)` := eigenvects(A) : roots_and_vectors(A) = `roots&vectors(A)` ;

roots_and_vectors(A) = ([11, 1, {vector([1/2, 1, 3/...

It can be seen from the above sequence that only one eigenvalue ( -3 ) is associated with two eigenvectors. This eigenvalue together with its multiplicity and both corresponding eigenvectors are contained in one of the two lists of the sequence.

Since only eigenvalue = -3 and its corresponding eigenvectors are of interest in this case, it is necessary to develop a selection procedure, which will extract these items from the sequence irrespective of the actual order of the lists in it. This is performed under (c).

(c) The eigenvalue involved and the sequence containing eigenvectors corresponding to it are

> e[1] := `roots&vectors(A)`[1][1] : e[2] := `roots&vectors(A)`[2][1] :

> if e[1] = root1(A) then l := root2(A) : vectors(A) := op(`roots&vectors(A)`[2][3]) else l := e[1] : vectors(A) := op(`roots&vectors(A)`[1][3]) fi :

> l := l : lambda = l ; char_vectors[lambda](A) = vectors(A) ;

lambda = -3

char_vectors[lambda](A) = (vector([-2, 1, 0]), vect...

(d) Assigning the names X[1][lambda] and X[2][lambda] to the eigenvectors of the above sequence, extracting them, and converting into column matrices give

> X[1][l] := convert(vectors(A)[1], matrix) : X[2][l] := convert(vectors(A)[2], matrix) :

> X[1][lambda] = matrix(X[1][l]) ; X[2][lambda] = matrix(X[2][l]) ;

X[1][lambda] = matrix([[-2], [1], [0]])

X[2][lambda] = matrix([[-3], [0], [1]])

(e) Let a linear combination of the two eigenvectors be of the form

> X[lambda] = mu[1] * X[1][lambda] + mu[2] * X[2][lambda] ;

X[lambda] = mu[1]*X[1][lambda]+mu[2]*X[2][lambda]

Substituting both eigenvectors with their respective numerical elements yields

> X[lambda] = mu[1] * matrix(X[1][l]) + mu[2] * matrix(X[2][l]) ;

X[lambda] = mu[1]*matrix([[-2], [1], [0]])+mu[2]*ma...

Evaluation of X[lambda] gives

> X[l] := evalm(mu[1]*X[1][l] + mu[2]*X[2][l]) : X[lambda] = matrix(X[l]) ;

X[lambda] = matrix([[-2*mu[1]-3*mu[2]], [mu[1]], [m...

(f) Let the unit matrix [ U ] appropriately sized for this case be

> U := diag(1,1,1) : U = matrix(U) ;

U = matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])

(g) Substituting the respective matrices and eigenvalue into ( [ A ] lambda [ U ] ) X[lambda] gives

> '(A - lambda*U)' * X[lambda] = (matrix(A) - l * matrix(U)) * matrix(X[l]) ;

(A-lambda*U)*X[lambda] = (matrix([[-2, 2, 3], [2, 1...

Evaluation of ( [ A ] lambda [ U ] ) X[lambda] yields the zero column matrix (vector)

> (matrix(A) - l * matrix(U)) * matrix(X[l]) = evalm((A - l * U) &* X[l]) ;

(matrix([[-2, 2, 3], [2, 1, 6], [3, 6, 6]])+3*matri...

irrespective of numerical values of the coefficients mu[1] and mu[2] .

* * *

N.B. Raising a matrix to a positive or negative integer power does not change its eigenvectors, but raises its eigenvalues to the same power.

For example, consider a ( 2 × 2 ) matrix [ A ] given as

> A := matrix(2, 2, [5, 8, 1, 7]) : A = matrix(A) ;

A = matrix([[5, 8], [1, 7]])

Let the positive and negative exponents be

> p := 3 : n := -2 : 'p' = p ; 'n' = n ;

p = 3

n = -2

(a) The eigenvalues of [ A ] are

> charroots(A) := eigenvals(A) : char_roots(A) = charroots(A) ;

char_roots(A) = (9, 3)

whence

> root1(A) := charroots(A)[1] : root2(A) := charroots(A)[2] :

> char_root[1](A) = root1(A) ; char_root[2](A) = root2(A) ;

char_root[1](A) = 9

char_root[2](A) = 3

(b) The sequence of lists containing eigenvalues and eigenvectors of [ A ] is

> `roots&vectors(A)` := eigenvects(A) : roots_and_vectors(A) = `roots&vectors(A)` ;

roots_and_vectors(A) = ([3, 1, {vector([-4, 1])}], ...

(c) The individual eigenvalues and corresponding eigenvectors are

> e[1] := `roots&vectors(A)`[1][1] : e[2] := `roots&vectors(A)`[2][1] :

pair consisting of the first eigenvalue and the corresponding eigenvector:

> if e[1] = root1(A) then l := root1(A) : `vector(A)` := op(`roots&vectors(A)`[1][3]) else l := e[2] : `vector(A)` := op(`roots&vectors(A)`[2][3]) fi :

> l1 := l : lambda[1] = l1 ; char_vector[lambda[1]](A) = op(`vector(A)`) ;

lambda[1] = 9

char_vector[lambda[1]](A) = vector([2, 1])

or, as a column matrix (vector),

> X[l1] := convert(`vector(A)`, matrix) : X[lambda[1]] = matrix(X[l1]) ;

X[lambda[1]] = matrix([[2], [1]])

pair consisting of the second eigenvalue and the corresponding eigenvector:

> if e[2] = root2(A) then l := root2(A) : `vector(A)` := op(`roots&vectors(A)`[2][3]) else l := e[1] : `vector(A)` := op(`roots&vectors(A)`[1][3]) fi :

> l2:=l : lambda[2]=l2 ; char_vector[lambda[2]](A) = op(`vector(A)`) ; l:='l' : e[1]:='e[1]' : e[2]:='e[2]':

lambda[2] = 3

char_vector[lambda[2]](A) = vector([-4, 1])

or, as a column matrix (vector),

> X[l2] := convert(`vector(A)`, matrix) : X[lambda[2]] = matrix(X[l2]) ;

X[lambda[2]] = matrix([[-4], [1]])

(d) Raising the matrix [ A ] to the power p = 3 yields the following matrix:

> `A^3` := evalm(A^3) : A^3 = matrix(`A^3`) ;

A^3 = matrix([[261, 936], [117, 495]])

(e) The eigenvalues of [ A ] ^ 3 are

> charroots(A^3) := eigenvals(`A^3`) : char_roots(A^3) = charroots(A^3) ;

char_roots(A^3) = (729, 27)

whence

> root1(A^3) := charroots(A^3)[1] : root2(A^3) := charroots(A^3)[2] :

> char_root[1](A^3) = root1(A^3) ; char_root[2](A^3) = root2(A^3) ;

char_root[1](A^3) = 729

char_root[2](A^3) = 27

For a comparison, the eigenvalues of [ A ] raised to the power p = 3 are

> [char_root[1](A)]^p = root1(A)^p ; [char_root[2](A)]^p = root2(A)^p ;

[char_root[1](A)]^3 = 729

[char_root[2](A)]^3 = 27

It can be seen from this comparison that either eigenvalue of [ A ] ^ 3 is the cube of the corresponding eigenvalue of [ A ].

(f) The sequence of lists containing eigenvalues and eigenvectors of [ A ] ^ 3 is

> `roots&vectors(A^3)` := eigenvects(`A^3`) : roots_and_vectors(A^3) = `roots&vectors(A^3)` ;

roots_and_vectors(A^3) = ([27, 1, {vector([-4, 1])}...

It follows from the inspection of the above that the eigenvectors of [ A ] ^ 3 are the same as those of matrix [ A ].

(g) Raising the matrix [ A ] to the power n = -2 yields the following matrix:

> `A^(-2)` := evalm(A^(-2)) : A^` -2` = matrix(`A^(-2)`) ;

A^` -2` = matrix([[19/243, -32/243], [-4/243, 11/24...

(h) The eigenvalues of [ A ] ^( -2 ) are

> charroots(A^(-2)) := eigenvals(`A^(-2)`) : char_roots(A^` -2`) = charroots(A^(-2)) ;

char_roots(A^` -2`) = (1/9, 1/81)

whence

> root1(A^(-2)) := charroots(A^(-2))[1] : root2(A^(-2)) := charroots(A^(-2))[2] :

> char_root[1](A^` -2`) = root1(A^(-2)) ; char_root[2](A^` -2`) = root2(A^(-2)) ;

char_root[1](A^` -2`) = 1/9

char_root[2](A^` -2`) = 1/81

For a comparison, the eigenvalues of [ A ] raised to the power n = -2 are

> '[char_root[1](A)]'^` -2` = root1(A)^n ; '[char_root[2](A)]'^` -2` = root2(A)^n ;

[char_root[1](A)]^` -2` = 1/81

[char_root[2](A)]^` -2` = 1/9

It can be seen from this comparison that either eigenvalue of [ A ] ^( -2 ) is the square of the reciprocal of the corresponding eigenvalue of [ A ].

(i) The sequence of lists containing eigenvalues and eigenvectors of [ A ] ^( -2 ) is

> `roots&vectors(A^(-2))` := eigenvects(`A^(-2)`) : roots_and_vectors(A^` -2`) = `roots&vectors(A^(-2))` ;

roots_and_vectors(A^` -2`) = ([1/81, 1, {vector([2,...

It follows from the inspection of the above that the eigenvectors of [ A ] ^( -2 ) are the same as those of matrix [ A ].

* * *

N.B. If lambda is an eigenvalue of a matrix [ A ] with corresponding eigenvector X[lambda] , then for any scalar mu , X[lambda] is an eigenvector of [ A ] mu [ U ] corresponding to the eigenvalue lambda-mu .

For example, consider a ( 2 × 2 ) matrix [ A ] given as

> A := matrix(2, 2, [-1, -5, 2, 6]) : A = matrix(A) ;

A = matrix([[-1, -5], [2, 6]])

(a) The eigenvalues of [ A ] are

> charroots(A) := eigenvals(A) : char_roots(A) = charroots(A) ;

char_roots(A) = (4, 1)

whence

> root1(A) := charroots(A)[1] : root2(A) := charroots(A)[2] :

> char_root[1](A) = root1(A) ; char_root[2](A) = root2(A) ;

char_root[1](A) = 4

char_root[2](A) = 1

(b) The sequence of lists containing eigenvalues and eigenvectors of [ A ] is

> `roots&vectors(A)` := eigenvects(A) : roots_and_vectors(A) = `roots&vectors(A)` ;

roots_and_vectors(A) = ([4, 1, {vector([1, -1])}], ...

(c) Choosing and extracting, for instance, the smaller eigenvalue of [ A ] give

> e[1](A) := `roots&vectors(A)`[1][1] : e[2](A) := `roots&vectors(A)`[2][1] :

> l(A) := min(e[1](A), e[2](A)) : lambda[A] = l(A) ;

lambda[A] = 1

(d) The corresponding eigenvector of [ A ] is

> if e[1](A) = l(A) then `vector(A)` := op(`roots&vectors(A)`[1][3]) else `vector(A)` := op(`roots&vectors(A)`[2][3]) fi : char_vector[lambda](A) = op(`vector(A)`) ;

char_vector[lambda](A) = vector([-5/2, 1])

or, as a column matrix (vector),

> X[l(A)] := convert(`vector(A)`, matrix) : X[lambda[A]] = matrix(X[l(A)]) ;

X[lambda[A]] = matrix([[-5/2], [1]])

(e) Let the unit matrix [ U ] appropriately sized for this case be

> U := diag(1,1) : U = matrix(U) ;

U = matrix([[1, 0], [0, 1]])

(f) Let a ( 2 × 2 ) matrix [ B ] be defined as

> B := A - mu*U : 'B' = B ;

B = A-mu*U

Substituting [ A ] and [ U ] with their numerical values and evaluating [ B ] yield

> B := evalm(B) : B = matrix(B) ;

B = matrix([[-1-mu, -5], [2, 6-mu]])

(g) The eigenvalues of [ B ] are

> charroots(B) := eigenvals(B) : char_roots(B) = charroots(B) ;

char_roots(B) = (-mu+1, -mu+4)

whence

> root1(B) := charroots(B)[1] : root2(B) := charroots(B)[2] :

> char_root[1](B) = root1(B) ; char_root[2](B) = root2(B) ;

char_root[1](B) = -mu+1