化工應用數學 授課教師: 郭修伯 Lecture 9 Matrices Consideration a greater numbers of...

24
化化化化化化 化化化化 化化化 Lecture 9 Matrices on a greater numbers of variables as a single quantity called

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

Page 1: 化工應用數學 授課教師: 郭修伯 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.

Page 2: 化工應用數學 授課教師: 郭修伯 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 by m”. Each element is called aij.

• The element of matrix product AB

aij= i, j element = < row i of A > • < column j of B >

Think of the vector product !

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

Differences between Matrix Operations and Real Number Operations

• Matrix multiplication in not commutative.

• There is in general no “cancellation” of A in an equation AB = AC

• The product AB may be a zero matrix with neither A nor B a zero matrix.

AB BA

AB = AC, but BC

Page 4: 化工應用數學 授課教師: 郭修伯 Lecture 9 Matrices Consideration a greater numbers of variables as a single quantity called a 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

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

EA = B

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 In (unit matrix).

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

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 r1 lies in column c1 and the leading entry of row r2 is in column c2, and r1 < r2, then c1 < c2.

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

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.

– The row vectors of A are: F1 = < -1,4,0,1,6 > and F2 = < -2,8,0,2,12 >

– The row space of A is the subspace of R5 consisting of all linear combinations: F1+F2

– rank (A) = 1

122082

61041A

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

The Determinant of a Square Matrix

• A number produced from the matrix 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 |, or det (A)

n

jkjkj

jk MaA1

)1(|| Mkj is the minor of akj in A

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

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| = |At|.• If A and B are n x n matrices, |AB| = |A||B|.

• If U = [uij] is upper triangular, |U| = u11u22…unn.

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

Matrix

• If AX = B, then the augmented matrix is:

• If A and B are n x n matrices, we call each other an inverse of the other if

• A square matrix is called nonsingular when it has an inverse and singular when it does not.

[A B]

AB = BA = In

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

Inverse Matrix

• How to find A-1 ?

– Method (1)

– Method (2)

• Why find A-1 ?

nnnnn

n

n

n

AAAA

AAAA

AAAA

AAAA

.1.000

........

.0.100

.0.010

.0.001

321

3333231

2232221

1131211

nIA 1

)(1 BAXifBAX

jiji

jiij MA

AinaofcofactorA

a

)1(

||

1)(

||

11

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

Cramer’s Rule• If A is an n x n nonsingular matrix, the unique

solution of the nonhomogeneous system AX = B is given by X =A-1 B

• solve

,,...,2,1|);(|||

1nkforBkA

Axk

A(k; B) is the n x n matrix obtained by replacing column k of A with B.

53

143

143

32

321

321

xx

xxx

xxx

310

311

431

A13A

9

315

3114

431

13

11

x

13

10

350

3141

411

13

12

x

13

25

510

1411

131

13

13

x

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

Solutions of linear algebraic equations

632

2242

523

8232

4321

4321

432

421

xxxx

xxxx

xxx

xxx

6

2

5

8

1312

2421

1230

2032

4

3

2

1

x

x

x

x

AX = B

X =A-1 B

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

Eigenvalues and Eigenvectors

• If A is an n x n matrix, a real or complex number is called an eigenvalue of A if, for some nonzero n x 1 matrix X,

• Any nonzero n x 1 matrix X satisfying this equation for some number is called an eigenvector of A associated with the eigenvalue .

• An n x n matrix has exactly n eigenvalues.• Eigenvectors associated with distinct eigenvalues of a

matrix are linearly independent.

XAX

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

Eigenvalues

• If A is an n x n matrix, then is an eigenvalue of A if and only if | In-A | = 0.

– if is an eigenvalue of A, any nontrivial solution of (In-A)X = 0 is an eigenvector of A associated with .

• How to find the eigenvalues of A?– Solving the characteristic equation of A : (In-A)X = 0

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

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

100

110

011

A

03 AI

0

100

110

011

0)1()1( 2

The eigenvalues are 1, 1, -1

The nontrivial solution corresponding to = 1 is:

03 XAI03 XAI

0

200

100

010

3

2

1

x

x

x

0

0

X

The nontrivial solution corresponding to = -1 is:

03 XAI03 XAI

0

000

120

012

3

2

1

x

x

x

4

2X

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

Diagonal Matrix

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

• An n x n matrix is diagonalizable if there exist an n x n matrix P such that P-1AP is a diagonal matrix.

• The Matrix P is composed by the eigenvectors of A

• 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.

nVVVVP ...321

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

200

010

501

A03 AI

The eigenvalues are 1, -1, -2

The associated eigenvectors are:

1

0

5

0

0

1

,

0

1

0

and

100

001

510

P

100

501

0101P

3

2

11

00

00

00

200

010

001

APP

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

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 on the interval J, then the general solution of X' = AX 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 +

51

41A

212

211

5

4

xxx

xxx

AXX

2

1

x

xX

t

t

e

eX

3

3)1( 2

t

t

te

etX

3

3)2( )21(

two independent solutions

t

t

t

t

te

et

e

e3

3

3

3 )21(2

2

1

c

cC

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

Homogeneous Matrix• If A is an n x n constant matrix, then et is a

nontrivial solution of X' = AX if and only if is an eigenvalue of A and is a corresponding eigenvector.

• If = + i is an eigenvalue of A, with a corresponding eigenvector = U + iV, then two linealy independent solutions of X' = AX are:

))sin()cos(( tVtUe t ))cos()sin(( tVtUe t and

33

24A

AXX

2

1

x

xX

02 AIThe eigenvalues are 1, 6

The associated eigenvectors are:

1

1,

3

2

t

t

t

t

e

e

e

e6

6

3

2

X = C

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

6000

0200

0040

0003

A

AXX

04 AIThe 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

t

t

t

t

e

e

e

e

6

2

4

3

000

000

000

000

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

How to Solve X' = AX ?

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

– X(1) = et • Method (2)

– Diagonalizing A by a matrix P: Z=P-1X

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

AXX PZX )()( PZAPZ

P: constant matrix

ZAPZP )(

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

How to Solve X' = AX + G ?

• Diagonalizing A by a matrix P• Z’= (P-1AP)Z + P-1G• X = PZ

How about matrix A which is not diagonalizable?(i.e. does not have n linearly independent eigenvectors)

exponential matrix!

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

Exponential Matrix

• Define

• Procedure to find solutions of X' = AX :– find eigenvalues of A (which is not diagonalizable)

– find C, let (A-I)k C = 0 and (A- I)k-1 0

– A solusion is then eAtC =

• General solution for X' = AX + G:

...!3

1

!2

1 3322 tAtAAtIeAt

22)(

!2

1)( CtIACtIACe t

k=1k=2

dttGttu

tutCtt

)()()(

)()()()(1