Docsity

Examples of Eigenvalues, Eigenvectors, and Quadratic Forms in Linear Algebra - Prof. B. Pe, Study notes of Calculus

Toggle sidebar
bg1
Eigenvalues, Eigenvectors and Quadratic Forms: Examples
Mth 254 Mar 12 2001
Bent E. Petersen
Filename: 254w2001_eigenvects_examp.mws
Linear Algebra supplement for Vector Calculus 1.
In this worksheet I give a few examples of eigenvalues and eigenvectors of matrices in the first part. In the
second part I provide the answeres, as given by Maple, to the problems in the Mth 254 Study Guide (Parks
2000-01 revision).
If you try a few of these examples by hand you will develop a deep appreciation for Maple, or a similar tool.
> restart;
> with(linalg):
Warning, new definition for norm
Warning, new definition for trace
Part 1. Examples
Example 1
> A1:=matrix(3,3,[-1,2,2,2,2,2,-3,-6,-6]);
:= A1
-1 2 2
222
-3 -6 -6
> eigenvals(A1);
, ,0 -3 -2
A1 has distinct eigenvalues. Thus A1 is diagonizable. Let's diagonalize it explicitly.
> v1:=eigenvects(A1);
:= v1 , ,[ ], ,-3 1{ }[ ], ,-1 0 1 [ ], ,0 1 { }[ ], ,0 -1 1[ ], ,-2 1{ }[ ], ,-2 1 0
> s1:={}: for k from 1 to 3 do s1:=s1 union op(3,op(k,[v1])): od:
unassign('k'): s1;
{ }, ,[ ], ,-1 0 1 [ ], ,0 -1 1[ ], ,-2 1 0
> S1:=matrix(3,0,[]);
:= S1 ( )array , , .. 1 3 .. 1 0 [ ]
> S1:=augment(S1,op(s1));
Page 1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Examples of Eigenvalues, Eigenvectors, and Quadratic Forms in Linear Algebra - Prof. B. Pe and more Study notes Calculus in PDF only on Docsity!

Eigenvalues, Eigenvectors and Quadratic Forms: Examples

Mth 254 Mar 12 2001

Bent E. Petersen

Filename: 254w2001_eigenvects_examp.mws

Linear Algebra supplement for Vector Calculus 1.

In this worksheet I give a few examples of eigenvalues and eigenvectors of matrices in the first part. In the

second part I provide the answeres, as given by Maple, to the problems in the Mth 254 Study Guide (Parks

2000-01 revision).

If you try a few of these examples by hand you will develop a deep appreciation for Maple, or a similar tool.

> restart;

> with(linalg):

Warning, new definition for norm

Warning, new definition for trace

Part 1. Examples

Example 1

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

A1 :=

> eigenvals(A1);

A1 has distinct eigenvalues. Thus A1 is diagonizable. Let's diagonalize it explicitly.

> v1:=eigenvects(A1);

v1 :=[ -3 1 {, , [ -1 0 1, , ]}], [ 0 1 {, , [ 0 -1 1, , ]}],[ -2 1 {, , [ -2 1 0, , ]}]

> s1:={}: for k from 1 to 3 do s1:=s1 union op(3,op(k,[v1])): od:

unassign('k'): s1;

{ [ -1 0 1, , ], [ 0 -1 1, , ],[ -2 1 0, , ]}

> S1:=matrix(3,0,[]);

S1 :=array( 1 .. 3 , 1 ..0 [ ], )

> S1:=augment(S1,op(s1));

S1 :=

> inverse(S1) & A1 & S1: D1:=evalm(%);**

D1 :=

Alternate Calculation for Example 1

There is an easier way to do these calculations. Let's start over. First we compute the eigenvaules of A1 and

put them in a diagonal matrix. We can do this as follows:

> D1b:=diag(eigenvals(A1));

D1b :=

Now if A1 is diagonizable the it will be 'similar' to D1b - so we ask Maple to check:

> issimilar(A1,D1b,'P1b');

true

The return value indicates A1 is diagonizable. In this case P1b has been assigned a matrix which plays the

role of the inverse of S1 above. let's check it;

> evalm(P1b); S1b:=inverse(P1b);

S1b :=

It doesn't look the same, but let's check that it works:

> inverse(S1b) & A1 & S1b: evalm(%);**

A3 :=

> eigenvals(A3);

Again we have an eigenvalue (1) with algebraic multiplicity 2. We do not yet know if A3 is diagonizable or

not. Let's compute the eigenvectors.

> s3:=eigenvects(A3);

s3 :=[ 1 2 {, , [ 1 1 1, , ]}],[ 2 1 {, , [ 0 1 1, , ]}]

Oops. We see the eigenvalue 1 has geometric multiplicity 1 (only one eigenvector for 1 is listed by Maple).

Thus A3 is not diagonizable. The "closest" we can get it the Jordan canonical form

> jordan(A3);

You probably suspect we could have used the jordan() function above to verify the diagonizability of A1 and

A2. If so, you are correct, but it would have been less fun.

> jordan(A1);

> jordan(A2);

Example 4

This time consider a symmetric matrix. We know that a symmetric matrix has real eigenvalues and is

diagonizable whether it has repeated eigenvalues or not.

> A4:=matrix(4,4,[0,1,-1,2,1,1,0,-1,-1,0,-1,1,2,-1,1,0]);

A4 :=

If we compute the exact eigenvalues we get a nearly incomprehensible expression, so let's compute

approximate eigenvalues instead.

> evalf(eigenvals(A4),16);

  • I − .357926367518500 −.2 10 - I

Those imaginary parts should not be there! They are due to roundoff as you can see by doing the calculation

at several precisions. For example

> evalf(eigenvals(A4),22);

  • I − 3.323404276086477625772 −.1 10 - , , I ,
  • I

That A4 is diagonizable we can verify by computing the Jordan canonical form

> evalf(jordan(A4));

  • I 0 0

0 0 -3.323404277 0

0 0 0 -.

Example 5

Here is another symmetric example:

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

A5 :=

> jordan(A5);

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

M04 :=

> eigenvects(M04);

[ − 4 + 2 I , 1 {, [ 1 , 1 + 2 I ]}] ,[ − 4 − 2 I , 1 {, [ 1 , 1 − 2 I ]}]

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

M05 :=

> eigenvects(M05);

[ -2 1 {, , [ 1 2, ]}] ,[ -7 1 {, , [ -2 1, ]}]

> M06:=matrix(2,2,[6,2,2,3]);

M06 :=

> eigenvects(M06);

[ 2 1 {, , [ 1 -2, ]}] ,[ 7 1 {, , [ 2 1, ]}]

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

M07 :=

> eigenvects(M07);

[ -3 1 {, , [ 1 -2 -2, , ]}] , [ -2 1 {, , [ 0 -1 1, , ]}],[ 6 1 {, , [ 4 1 1, , ]}]

> M08:=matrix(3,3,[5,3,3,3,2,0,3,0,2]);

M08 :=

> eigenvects(M08);

[ 2 1 {, , [ 0 -1 1, , ]}] , [ 8 1 {, , [ 2 1 1, , ]}],[ -1 1 {, , [ 1 -1 -1, , ]}]

> M09:=matrix(3,3,[-7,0,3,0,-7,2,3,2,5]);

M09 :=

> eigenvects(M09);

[ -8 1 {, , [ -3 -2 1, , ]}]

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

M10 :=

> eigenvects(M10);

[ 6 1 {, , [ 1 2 5, , ]}] , [ 0 1 {, , [ -1 -2 1, , ]}],[ 1 1 {, , [ -2 1 0, , ]}]

Quadratic Forms

Once we know the eigenvalues of the symmetric matrix of a quadratic form we can write down the

diagonalized version of the quadratic form. In general we are after more. We want to know an explicit change

of variables that diagonalizes the quadratic form. With a little coaching, Maple can solve this sort of problem.

I'll show you one way of doing it here, but there may be better ways. If you use Maple, you should

experiment.

> Q11:=-6x^2+4xy-3y^2;**

Q11 :=− 6 x + −

2 4 x y 3 y

2

> M11:=hessian(Q11/2,[x,y]);

M11 :=

> D11:=diag(eigenvals(M11));

D11 :=

> issimilar(M11,D11,P11);

true

We would like to use the inverse of P11 to define our change of variables, but we have to normalize the

columns of the inverse first. Let's call the result S

> normalize(col(inverse(P11),1)),normalize(col(inverse(P11),2)):

S11:=augment(matrix(2,0,[]),%);

S11 :=

> sub11:=evalm(S11 & matrix(2,1,[u,v]));*

sub11 :=

5 u

5 v

5 u

5 v

> subs(x=sub11[1,1], y=sub11[2,1], Q11); 'Q11'=expand(%);

5 u

5 v

2

4

5 u

5 v

5 u

5 v 3

5 u

5 v

2

Q11 =− 7 u −

2 2 v

2

> M:=hessian(Q/2,[x,y,z]);

M :=

> D0:=diag(eigenvals(M));

D0 :=

> issimilar(M,D0,P);

true

> normalize(col(inverse(P),1)),normalize(col(inverse(P),2)),norma

lize(col(inverse(P),3)): S:=augment(matrix(3,0,[]),%);

S :=

> sub:=evalm(S & matrix(3,1,[u,v,w]));*

sub :=

21 u 6

v

w

21 u

( 17 + 85 ) 85 v

( − 17 + 85 ) 85 w

21 u

( 5 + 85 ) 85 v

( − 5 + 85 ) 85 w

> T:=subs(x=sub[1,1], y=sub[2,1], z=sub[3,1], Q);

T :=3 %5 + + − + +

2 12 %5 %4 24 %4 %3 6 %5 %3 6 %

2 6 %

2

21 u

( 5 + 85 ) 85 v

( − 5 + 85 ) 85 w

21 u

( 17 + 85 ) 85 v

( − 17 + 85 ) 85 w

21 u 6

v

w

It is not obvious that we have diagonalized Q, so let's expand T

> T:=expand(T);

T 6 u

2 1608

v

2 85

w

2 85

v

2

w

2

Now it is obvious, but it would be nice if we could collect the terms as well:

> collect(T,[u,v,w]);

6 u

2

v

2

w

2

The coefficients do not look like the original eigenvalues, so let's check them:

> c2:=subs(u=0,v=1,w=0,T);

c2 := 1608 +

> is(c2=D0[2,2]);;

true

> c3:=subs(u=0,v=0,w=1,T);

c3 := 13260 −

> is(c3=D0[3,3]);

true

In spite of appearances the coefficients are correct.