化工應用數學 授課教師: 郭修伯 Lecture 9 Matrices Consideration a greater numbers of variables as a single quantity called a matrix.

Download Report

Transcript 化工應用數學 授課教師: 郭修伯 Lecture 9 Matrices Consideration a greater numbers of variables as a single quantity called a matrix.

化工應用數學

授課教師: 郭修伯

Lecture 9 Matrices Consideration a greater numbers of variables as a single quantity called a matrix.

Matrices

• We can store objects (numbers, functions …) in named locations/grids.

• A matrix has

n

rows and

m

columns. A is “

n m

”. Each element is called

a ij

.

• The element of matrix product AB by

a ij = i, j

element = < row

i

of A > • < column

j

of B > Think of the vector product !

Differences between Matrix Operations and Real Number Operations

• Matrix multiplication in not commutative.

AB  BA • There is in general no “cancellation” of A in an equation AB = AC AB = AC, but B  C • The product AB may be a zero matrix with neither A nor B a zero matrix.

Matrices

• What do we need to know about matrices?

– square matrix • the number of rows of elements is equal to the number of columns of elements – diagonal matrix • all the elements except those in the diagonal from the top left-hand corner to the bottom right-hand corner are zero – unit matrix • a diagonal matrix in which all the diagonal elements are all unity – the transpose matrix • A (

n

x

m

)  A’ (

m

x

n

) • If AA’ = I, the matrix A is “orthogonal” • the transpose of the product of two matrices is equal to the product of their transposes taken in the reverse order: (AB)’ = B’A’ – symmetric matrix

Matrices

• Elementary row operations – interchange of two rows – Multiplication of a row by a nonzero scalar – Addition of a scalar multiple of one row to another row – Any elementary row operation on an

n

x

m

matrix A can be achieved by multiplying A on the left by the elementary matrix formed by performing the same row operation on

I n

(unit matrix).

EA = B

The

Reduced Form of a Matrix

• A is a reduced matrix if – the leading entry of any nonzero row is 1 – a row has its leading entry in column c, all other elements of column are zero – each row having all zero elements lies below any row having a nonzero element – the leading entry in row r 1 the leading entry of row r 2 r 1 < r 2 , then c 1 < c 2 .

lies in column c 1 and is in column c 2 , and

The rank of a Matrix

• rank (A) = number of nonzero rows of the reduced form of a matrix A = dimension of the row space of A.

• The

row space

of A means all the linear combinations of the row vectors of A.

A

     1 2 – rank (A) = 1 4 8 0 0 1 2 6 12   – The row vectors of A are: F 1 = < -1,4,0,1,6 > and F 2 – The row space of A is the subspace of R 5 combinations:  F 1 +  F 2 = < -2,8,0,2,12 > consisting of all linear

The Determinant of a

Square Matrix

• A number produced from the matrix A: |

A

|, or det (

A

) • It is defined as a sum of multiples of (n-1) x (n-1) determinants formed from the elements of A.

• The cofactor (or Laplace) expansion of |A| by row k is defined to be the sum of the element of row k, each multiplied by its cofactor: |

A

| 

j n

  1 (  1 )

k

j a kj M kj M kj

is the minor of

a kj

in

A

The Determinant of a Square Matrix

• If B is formed from A by multiplying any row or column of A by a scalar  , |B| =  |A|.

• If A has a zero row or column, |A| = 0.

• If B is obtained from A by interchanging two rows or columns, |B| = -|A|.

• If two rows or columns of A are identical, |A| = 0.

• If one row (or column) is a constant multiple of another, |A| = 0.

• Suppose we obtained B from A by adding a constant multiple of one row (or column) to another row (or column). Then |B| = |A|.

• For any square matrix A, |A| = |A t |.

• If A and B are

n

x

n

matrices, |AB| = |A||B|.

• If U = [u ij ] is upper triangular, |U| = u 11 u 22 …u nn .

Matrix

• If AX = B, then the augmented matrix is: [A B] • If A and B are

n

x

n

matrices, we call each other an inverse of the other if AB = BA = I n • A square matrix is called nonsingular when it has an inverse and singular when it does not.

Inverse Matrix

• How to find A -1 – Method (1)  1   0     0 0 .

.

0 1 0 0 ?

0 0 1 0 .

.

.

.

.

0 0 .

0 1

A

11

A

21

A

31 .

A n

1

A

12

A

22

A

32 .

A n

2

A

13

A

23

A

33 .

A n

3 .

.

.

.

A A A

.

1

n

2 3

A nn n n

       

A

 1

I

– Method (2) • Why find A -1

a

 1

ij

   | 1

A

|   (

cofactor of

?

X

A

 1

B

(

if a ji in A

)  | 1

A

| (  1 )

i

j M ji AX

B

)

n

Cramer’s Rule

• If A is an

n

x

n

nonsingular matrix, the unique solution of the nonhomogeneous system

AX = B

given by

X =A -1 B

is

x k

 | 1

A

| |

A

(

k

;

B

) |

for k

 1 , 2 ,...,

n

,

A(k; B)

is the

n

x

n

matrix obtained by replacing column

k

of

A

with

B

.

• solve

x

1  3

x

2  4

x

3 

x

2

x

1   3

x x

3 2   3 5

x

3  1  14

A

       1 0 1  3 1 1    4 3 3     

A

 13

x

1  1 13   1   14 5

x

2  1 13     1  1 0

x

3  1 13      1 0 1  3 1 1 1 14 5  1 1 3    4 3    3    9    4 3    3    10 13 1 14 5       25 13

Solutions of linear algebraic equations 2

x

1 3

x

2

x

1   2 2

x

2

x

3  2

x

1   3

x

2

x

2    4

x

3 3 2

x

4

x x

3 4     2

x

5 4 8

x

4   6 2       2 0 1 2  3 3  2 1 0 2  4  3   1 2 2 1            

x x x x

4 1 2 3              8 5 2 6       AX = B X =A -1 B

Eigenvalues and Eigenvectors

• If

A

is an

n

x

n

matrix, a real or complex number called an eigenvalue of

A

if, for some nonzero

n

 x

1

is matrix

X

,

AX

 

X

• Any nonzero

n

some number  x

1

matrix

X

is called an eigenvector of

A

with the eigenvalue  .

satisfying this equation for associated • An

n

x

n

matrix has exactly n eigenvalues.

• Eigenvectors associated with distinct eigenvalues of a matrix are linearly independent.

Eigenvalues

• If

A

is an

n

x

n

matrix, then –  is an eigenvalue of A if and only if | 

I n -A

| = 0.

– if 

(

I n

is an eigenvalue of

A

, any nontrivial solution of

-A)X

= 0 is an eigenvector of

A

associated with  .

• How to find the eigenvalues of A?

– Solving the characteristic equation of A :

(

I n -A)X

– The eigenvalues of a diagonal matrix are its main = 0 diagonal elements.

A

   1   0 0  1 1 0  0 1 1     

I

3 

A

 0      0 0  1   1  1 0  0 1     1   0 The nontrivial solution corresponding to  = 1 is: 

I

3 

A X

 0

I

3 

A X

 0

X

      0 0         0 0 0 1 0 0  0 2 1        

x x

2

x

1 3      0 The nontrivial solution corresponding to  = -1 is: 

I

3 

A X

 0 

I

3 

A X

 0 (   1 ) 2 (   1 )  0 The eigenvalues are 1, 1, -1

X

      2  4            0 0 2 1  2 0  0 0 1        

x x

2

x

1 3      0

Diagonal Matrix

• The eigenvalues of a diagonal matrix are its main diagonal elements.

• An

n P

x

n

matrix is diagonalizable if there exist an

n

such that

P -1 AP

is a diagonal matrix.

x

n

matrix • The Matrix P is composed by the eigenvectors of A

P

 

V

1

V

2

V

3 ...

V n

 • NOT every matrix is diagonalizable. If

A

does not have

n

linearly independent eigenvectors,

A

is not diagonalizable.

• Any

n

x

n

matrix with

n

distinct eigenvalues is diagonalizable.

A

      0 0 1 0 1 0  5 0 2     

I

3 

A

 0 The eigenvalues are 1, -1, -2

P

     0 1 0 1 0 0  5 0 1     The associated eigenvectors are:   0   1 0     ,   1   0 0    

and

     5 0 1    

P

 1      0 1 0 1 0 0  0 5 1    

P

 1

AP

   1   0 0 0  1 0  0 0 2           1 0 0 0  2 0 0 0  3    

Matrix Solution of Systems of Differential Equations

• Best advantage: Solve many differential equations simutaneously!

• A fundamental matrix for the system

X' = AX

has columns consisted of the linearly independent solutions.

• If  is the fundamental matrix for

X' = AX

the general solution of

X' = AX

on the interval

J

, then is

X =

C

, where

C

is an

n

x

1

matrix of arbitrary constants.

• Let  be any solution of

X' = AX + G

, then the general solution of

X' = AX + G

is  =  C + 

x

1 

x

2   

x

1

x

1  4

x

2  5

x

2

A

   1 1

X

 

AX

 5 4  

X

  

x x

2 1  

X

( 1 )   

e

2

e

3

t

3

t

 

X

( 2 )   ( 1 2

te

3

t t

)

e

3

t

  two independent solutions      2

e

3

t e

3

t

( 1  2

t

)

e

3

t te

3

t

 

C

  

c c

2 1  

Homogeneous Matrix

• If

A

is an

n

x

n

constant matrix, then 

e

t

is a nontrivial solution of

X' = AX

eigenvalue of

A

and  if and only if  is an is a corresponding eigenvector.

• If 

=

+ i

eigenvector   is an eigenvalue of A, with a corresponding =

U

+

iV

, then two linealy independent solutions of

X' = AX

are:

e

t

(

U

cos( 

t

) 

V

sin( 

t

)) 

I

2 

A

 0

X

 

AX

and

e

t

(

U

sin( 

t

) 

V

cos( 

t

)) The eigenvalues are 1, 6

A

   4 3 2 3  

X

  

x x

2 1   The associated eigenvectors are:    2 3   ,   1 1        2

e

3

e t t e

6

t e

6

t

 

X =

C

X

 

AX A

  3   0   0  0 0 4 0 0 0 0  2 0 0  0   0   6  

I

4 

A

 0 The eigenvalues are 3, 4,-2 and 6 The associated eigenvectors are:       1 0 0 0       ,       0 1 0 0       ,       0 0 1 0       ,       0 0 0 1              

e

3

t

0 0 0 0

e

4

t

0 0 0 0

e

 2

t

0 0 0 0

e

6

t

     

How to Solve

X' = AX

?

• Method (1) – Find eigenvalues of A and the corresponding eigenvectors – X (1) = 

e

t

• Method (2) – Diagonalizing A by a matrix P: Z=P -1 X

X

 

AX X

PZ

(

PZ

)  

A

(

PZ

) – Z’= (P – X = PZ -1 AP)Z P: constant matrix

P Z

  (

AP

)

Z

How to Solve

X' = AX

+ G ?

• Diagonalizing A by a matrix P • Z’= (P -1 AP)Z + P -1 G • X = PZ How about matrix A which is not diagonalizable?

(i.e. does not have

n

linearly independent eigenvectors) exponential matrix!

Exponential Matrix

• Define

e At

I

At

 1 2 !

A

2

t

2  1 3 !

A

3

t

3  ...

• Procedure to find solutions of

X' = AX

: – find eigenvalues of

A (which is not diagonalizable)

– find C, let

(A-

I) k C = 0

– A solusion is then

e At C =

and

(A e

t

 

C

 

I) k-1

(

A

 

I

0

)

Ct

 1 2 !

(

A

 

I

) 2

Ct

2   k=1 k=2 • General solution for

X' = AX + G

:  (

t

)   (

t

)

C

  (

t

)

u

(

t

)

u

(

t

)     1 (

t

)

G

(

t

)

dt