chapter 2 basic linear algebra ( 基本線性代數 ) to accompany operations research: applications...

36
Chapter 2 Basic Linear Algebra( 基基基基基基 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc.

Upload: martha-sherman

Post on 13-Jan-2016

244 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

Chapter 2

Basic Linear Algebra( 基本線性代數 )

to accompany

Operations Research: Applications and Algorithms

4th edition

by Wayne L. Winston

Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc.

Page 2: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

2

§2.1§2.1 – Matrices( 矩陣 ) & Vectors( 向量 )

A matrix is any rectangular array of numbers

If a matrix If a matrix AA has has mm rows and rows and nn columns it is columns it is referred to as an referred to as an mm x x nn matrix. matrix.

mm x x nn is the is the orderorder( 階 ) of the matrix. It is of the matrix. It is typically written astypically written as

1

3

2

4

1

4

2

5

3

6

1

2

2 1( )

A

a 11

a 21

....

a m1

a 12

a 22

....

a m2

....

....

....

....

a 1n

a 2n

....

a mn

Page 3: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

3

The number in the The number in the iith row and th row and jjth column of A th column of A

is called the is called the ijijthth element element of of AA and is written and is written aaij..

Two matrices A = [aij] and B = [bij] are equal if and only if A and B are the same order and for all i and j, aij = bij.

If A1

3

2

4

and Bx

w

y

z

A = B if and only if x = 1, y = 2, w = 3, and z = 4A = B if and only if x = 1, y = 2, w = 3, and z = 4

Page 4: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

4

Any matrix with only one column is a column

vector( 行向量 ) or column matrix (行矩陣 ). The number of rows in a column vector is the dimension of the column vector.

C=

RRmm will denote the set all m-dimensional column will denote the set all m-dimensional column vectorsvectors

Any matrix with only one row (a 1 x Any matrix with only one row (a 1 x nn matrix) is a matrix) is a row vectorrow vector ( 列向量 ) or rowrow matrix ( 列矩陣 ). . The dimension of a row vector is the number of The dimension of a row vector is the number of columns. R=columns. R=

1

2

1 2 3( )

Page 5: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

5

Any m-dimensional vector (either row or

column) in which all the elements equal zero is called a zero vector (零向量 )or zero matrix (零矩陣 ) (written 0).

Any Any mm-dimensional vector corresponds to a -dimensional vector corresponds to a directed line segment in the directed line segment in the mm-dimensional -dimensional plane.plane. For example, the two-dimensional vector For example, the two-dimensional vector uu

corresponds to the line segment joining the point corresponds to the line segment joining the point (0,0) to the point (1,2)(0,0) to the point (1,2)

0 0 0( )0

0

Page 6: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

6

Other Forms

Diagonal matrix ( 對角線矩陣 )

Identity matrix (單位矩陣 )

Upper triangular matrix(上三角矩陣 )

Lower triangular matrix (下三角矩陣 )

),1,(,][ njijioaaA ijnnij

njiji

jiaaA ijnnij

,1;,0

,1,][

),1,(,][ njijioaaA ijnnij

),1,(,][ njijioaaA ijnnij

njiji

jiaaA ijnnij

,1;,0

,1,][

),1,(,][ njijioaaA ijnnij ),1,(,][ njijioaaA ijnnij

Page 7: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

7

Example :

Page 8: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

8

Transpose Matrix ( 轉置矩陣 ) P.15

,A nnaij

. a

nj1 m,i1aa ,a

mnTij

ijTijnmij

atrixranspose mcalled a tis][A

then)(][AIfT

Page 9: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

9

Example :

34

10

17

41

A TA

3114

4071

Page 10: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

10

轉置矩陣之性質

786

921

543

A

708060

902010

504030

B

p.20 #4

Page 11: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

11

Square Matrix of Order n( 方陣之乘冪 )

Page 12: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

12

31

42A

51

23B

1955

460160

238

167

55

200

2890

432100

170

1610

22

2

2

BA

but

)AB(

Example : (AB)2≠A2B2 (AB = BA)?

Page 13: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

13

Symmetric Matrix ( 對稱矩陣 ) & Skew-symmetric Matrix ( 斜對稱矩陣 )

Page 14: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

14

Example :

029

205

950

653

542

321

B

A is a symmetric matrix

is a skew-symmetric matrix

Page 15: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

15

對稱矩陣與斜對稱矩陣之性質

Page 16: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

16

The directed line segments (vectors The directed line segments (vectors uu, , vv, , ww) ) are shown.are shown.

u1

2

v1

3

w1

2

X1

X2 (1, 2)

(1, -3)

(-1, -2)

(p.12-13)

Page 17: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

17

矩陣之基本運算 (p.13)

The scalar product( 純量積 ) is the result of multiplying two vectors where one vector is a column vector and the other is a row vector. For the scalar product to be defined, the dimensions

of both vectors must be the same.

The scalar product of u and v is written:

u v u 1 v1 u 2 v2 .... u n vn

u 1 2 3( ) v

2

1

2

u v 1 2( ) 2 1( ) 3 2( ) 10

Page 18: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

18

The Scalar Multiple of a MatrixThe Scalar Multiple of a Matrix

Given any matrix Given any matrix AA and any number and any number cc, the matrix , the matrix cAcA is obtained from the matrix is obtained from the matrix AA by multiplying each by multiplying each element of element of AA by by cc..

AdditionAddition of Two Matricesof Two Matrices

Let A = [aij] and B =[bij] be two matrixes with the same order. Then the matrix C = A + B is defined to be the m x n matrix whose ijth element is aij + bij.

Thus, to obtain the sum of two matrixes A and B, we add the corresponding elements of A and B.

A1

1

2

0

3 A3

3

6

0

A1

0

2

1

3

1

B1

2

2

1

3

1

C1 1

0 2

2 2

1 1

3 3

1 1

0

2

0

0

0

0

(p.14)

Page 19: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

19

Definition : 矩陣相加

6753

4812

7543

A

3276

8593

4257

B ?C

Page 20: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

20

This rule for matrix addition may be used to

add vectors of the same dimension.

Vectors may be added using the parallelogram law or by using matrix addition.

v 2 1( )

u 1 2( )

u v 3 3( )

X1

X2

u

v

u+v

1 2 3

1

2

3

(1,2)

(2,1)

(3,3)

Page 21: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

21

Line segments can be defined using scalar

multiplication and the addition of matrices.

If u=(1,2) and v=(2,1), the line segment joining u and v (called uv) is the set of all points in the m-dimensional plane corresponding to the vectorscu +(1-c)v, where 0 ≤ c ≤ 1.

X1

X2

u

v

1 2

1

2c=1

c=1/2

c=0

Page 22: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

22

矩陣加法之性質

Page 23: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

23

常數乘以矩陣之性質

Page 24: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

24

Matrix Multiplication ( 矩陣相乘 ) (p.16)

Given to matrices A and B, the matrix product of A and B (written AB) is defined if and only if the number of columns in A = the number of rows in B.

The matrix product C = AB of A and B is the m x n matrix C whose ijth element is determined as follows: ijth element of C = scalar product of row i of A x

column j of B

Page 25: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

25

矩陣相乘

Page 26: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

26

Page 27: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

27

矩陣乘法之性質

Page 28: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

28

Example 1: Matrix Multiplication

Computer C = AB for

Solution

Because A is a 2x3 matrix and B is a 3x2 matrix, AB is defined, and C will be a 2x2 matrix.

A1

2

1

1

2

3

B

1

2

1

1

3

2

C5

7

8

11

C11

1 1 2( )

1

2

1

5 C12

1 1 2( )

1

3

2

8

C21

2 1 3( )

1

2

1

7 C22

2 1 3( )

1

3

2

11

Page 29: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

29

Many computations that commonly occur in

operations research can be concisely expressed by using matrix multiplication.

Some important properties of matrix multiplications are: Row i of AB = (row i of A)B

Column j of AB = A(column j of B)

A1

2

1

1

2

3

B

1

2

1

1

3

2

Page 30: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

30

Trace of a matrix

1

For any two matrices A and B. Trace(A + B) = Trace(A) + Trace(B)

For any two matrices A and B for which the product AB and BA are defined. Trace(AB) = Trace(BA)

n

iiinnij aATraceaALet

1

)( ,

p.20 #7

Page 31: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

31

Example : Find Trace(A) & Trace(B)

029

205

950

653

542

321

B

A

Page 32: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

32

LU Decomposition (LU 分解法 )

Page 33: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

33

Page 34: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

34

例題:

Page 35: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

35

Page 36: Chapter 2 Basic Linear Algebra ( 基本線性代數 ) to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c)

36

Use the EXCEL MMULT function to multiply the

matrices: Enter matrix A into cells B1:D2 and matrix B into cells

B4:C6.

Select the output range (B8:C9) into which the product will be computed.

In the upper left-hand corner (B8) of this selected output range type the formula: = MMULT(B1:D2,B4:C6).

Press Control-Shift-Enter

A B C D1 Matrix A 1 -1 22 2 1 334 Matrix B 1 15 2 36 1 278 A B = 1 29 7 11

(p.19)