Page 383 - Applied Numerical Methods Using MATLAB
P. 383
372 MATRICES AND EIGENVALUES
and then substitute the λ i ’s, one by one, into Eq. (8.1.1) to solve it for the
eigenvector v i ’s. This is, however, not always so simple, especially if some root
(eigenvalue) of Eq. (8.1.2) has multiplicity k> 1, sincewehavetogenerate k
independent eigenvectors satisfying Eq. (8.1.1) for such an eigenvalue. Still, we
do not have to worry about this, thanks to the MATLAB built-in routine “eig()”,
which finds us all the eigenvalues and their corresponding eigenvectors for a given
matrix. How do we use it? All we need to do is to define the matrix, say A,and
type a single statement into the MATLAB command window as follows.
>>[V,Lambda] = eig(A) %e = eig(A) just for eigenvalues
Let us take a look at the following example.
Example 8.1. Eigenvalues/Eigenvectors of a Matrix.
Let us find the eigenvalues/eigenvectors of the matrix
0 1
A = (E8.1.1)
0 −1
First, we find its eigenvalues as
−λ 1 2
|A − λI|= = λ + λ = 0
0 −1 − λ
λ(λ + 1) = 0, λ 1 = 0,λ 2 =−1 (E8.1.2)
and then, get the corresponding eigenvectors as
0 1 v 11 v 21 0
[A − λ 1 I]v 1 = = = ,
0 −1 v 21 −v 21 0
v 11 1
v 21 = 0, v 1 = = (E8.1.3a)
v 21 0
11 v 12 v 12 + v 22 0
[A − λ 2 I]v 2 = = = ,
00 v 22 0 0
√
v 12 1/ 2
v 12 =−v 22 , v 2 = = √ (E8.1.3b)
v 22 −1/ 2
where wehavechosen v 11 ,v 12 ,and v 22 so that the norms of the eigenvectors
become one.
Alternatively, we can use the MATLAB command “eig(A)” for finding eigen-
values/eigenvectors or “roots(poly(A))” just for finding eigenvalues as the
roots of the characteristic equation as illustrated by the program “nm811.m”.

