1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen)...

46
1 資資資資資資 資資資資資資 11 11 : : Linear Equation and Matrices Linear Equation and Matrices 陳陳陳陳陳陳陳 陳陳陳陳陳陳陳 (Kuang-Chi Chen) (Kuang-Chi Chen) [email protected] [email protected]

Transcript of 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen)...

Page 1: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

11

資訊科學數學資訊科學數學 11 11 ::

Linear Equation and Matrices Linear Equation and Matrices

陳光琦助理教授 陳光琦助理教授 (Kuang-Chi Chen)(Kuang-Chi Chen)[email protected]@mail.tcu.edu.tw

Page 2: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

22

Linear AlgebraLinear AlgebraContent of B. Kolman and D. R. Hill, Linear Algebra, 8Content of B. Kolman and D. R. Hill, Linear Algebra, 8

thth edition  edition  Chap. 1 Linear Equations and MatricesChap. 1 Linear Equations and Matrices• Linear systemsLinear systems• MatricesMatrices• Dot Product and Matrix MultiplicationDot Product and Matrix Multiplication• Properties of Matrix OperationsProperties of Matrix Operations• Matrix TransformationsMatrix Transformations• Solutions of Linear Systems of EquationsSolutions of Linear Systems of Equations• The Inverse of a MatrixThe Inverse of a Matrix• LU-Factorization (Optional)LU-Factorization (Optional)

Page 3: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

33

Linear AlgebraLinear AlgebraChap. 3 DeterminantsChap. 3 Determinants Definition and PropertiesDefinition and Properties Cofactor Expansion and ApplicationsCofactor Expansion and Applications Determinants from a Computational Point of ViewDeterminants from a Computational Point of View

Chap. 4 Vectors in Chap. 4 Vectors in RRnn

Vectors in PlaneVectors in Plane nn-Vectors-Vectors Linear Transformations Linear Transformations

Page 4: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

44

Linear AlgebraLinear AlgebraChap. 6 Real Vector SpacesChap. 6 Real Vector Spaces Vector SpacesVector Spaces SubspacesSubspaces Linear IndependenceLinear Independence Basis and DimensionBasis and Dimension Homogeneous SystemsHomogeneous Systems The Rank of a Matrix and ApplicationsThe Rank of a Matrix and Applications Coordinates and Change of BasisCoordinates and Change of Basis Orthonormal Bases in Orthonormal Bases in RRnn

Orthogonal ComplementsOrthogonal Complements

Page 5: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

55

Linear AlgebraLinear Algebra

Chap. 8 Eigenvalues, Eigenvectors, and DiagonalizatiChap. 8 Eigenvalues, Eigenvectors, and Diagonalizationon

Eigenvalues and EigenvaluesEigenvalues and Eigenvalues DiagonalizationDiagonalization Diagonalization of Symmetric MatricesDiagonalization of Symmetric Matrices

Page 6: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

66

Linear AlgebraLinear AlgebraChap. 2 Applications of Linear Equations and Chap. 2 Applications of Linear Equations and

Matrices (Optional)Matrices (Optional) An Introduction to CodingAn Introduction to Coding Graph TheoryGraph Theory Computer GraphicsComputer Graphics Electrical CircuitsElectrical Circuits Markov ChainsMarkov Chains Linear Economic ModelsLinear Economic Models Introduction to WaveletsIntroduction to Wavelets

Page 7: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

77

Linear AlgebraLinear Algebra

Chap. 5 Applications of Vectors in Chap. 5 Applications of Vectors in RR22 and and RR3 3 (Optional)(Optional) Cross Product in Cross Product in RR3 3

Lines and Planes Lines and Planes

Chap. 7 Applications of Real Vector Spaces (Optional)Chap. 7 Applications of Real Vector Spaces (Optional) QR-FactorizationQR-Factorization Least SquaresLeast Squares More on Coding More on Coding

Page 8: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

88

Linear AlgebraLinear Algebra

Chap. 9 Applications of Eigenvalues and Eigenvectors Chap. 9 Applications of Eigenvalues and Eigenvectors (Optional)(Optional)

The Fibonacci SequenceThe Fibonacci Sequence Differential Equations (Calculus Required)Differential Equations (Calculus Required) Dynamical Systems (Calculus Required)Dynamical Systems (Calculus Required) Quadratic FormsQuadratic Forms Conic SectionsConic Sections Quadric SurfacesQuadric Surfaces

Page 9: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

99

Linear AlgebraLinear AlgebraChap. 10 Linear Transformations and MatricesChap. 10 Linear Transformations and MatricesDefinition and ExamplesDefinition and Examples The Kernel and Range of a Linear TransformationThe Kernel and Range of a Linear Transformation The Matrix of a Linear Transformation The Matrix of a Linear Transformation Introduction to Fractals (Optional)Introduction to Fractals (Optional)

Chap. 11 Linear Programming (Optional)Chap. 11 Linear Programming (Optional) The Linear Programming Problem: Geometric The Linear Programming Problem: Geometric

SolutionSolution The Simplex MethodThe Simplex Method DualityDuality The Theory of Games The Theory of Games

Page 10: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1010

Linear AlgebraLinear AlgebraChap. 12 MATLAB for Linear AlgebraChap. 12 MATLAB for Linear Algebra Input and Output in MATLABInput and Output in MATLAB Matrix Operations in MATLABMatrix Operations in MATLAB Matrix Powers and Some Special MatricesMatrix Powers and Some Special Matrices Elementary Row Operations in MATLABElementary Row Operations in MATLAB Matrix Inverse in MATLABMatrix Inverse in MATLAB Vectors in MATLABVectors in MATLAB Applications of Linear Combinations in MATLABApplications of Linear Combinations in MATLAB Linear Transformations in MATLABLinear Transformations in MATLAB MATLAB Command Summary MATLAB Command Summary

Page 11: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1111

Linear AlgebraLinear AlgebraAppendix A Complex NumbersAppendix A Complex Numbers

A.1 Complex NumbersA.1 Complex Numbers

A.2 Complex Numbers in Linear AlgebraA.2 Complex Numbers in Linear Algebra

Appendix B Further Directions Appendix B Further Directions

B.1 Inner Product Spaces (Calculus Required)B.1 Inner Product Spaces (Calculus Required)

B.2 Composite and Invertible Linear B.2 Composite and Invertible Linear TransformationsTransformations

Page 12: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1212

Linear Equations and Linear Equations and MatricesMatrices

Linear SystemsLinear Systems

Page 13: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1313

Linear SystemsLinear Systems

1.1 Linear systems1.1 Linear systems

• What is a linear equation?What is a linear equation?

• Variables and constantsVariables and constants

• Unknowns and solutionsUnknowns and solutions

bxaxaxa nn 2211

bax

Page 14: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1414

A Solution to A Linear A Solution to A Linear EquationEquation

• A solution to a linear equationA solution to a linear equation

13443326

13436 321

xxx

Page 15: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1515

A Linear SystemA Linear System

• A linear systemA linear system

• A system of A system of mm linear equations linear equations in in nn unknowns unknowns

mnmnmm

nn

nn

bxaxaxa

bxaxaxa

bxaxaxa

2211

22222121

11212111

Page 16: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1616

A Common MethodA Common Method

• A commonly used A commonly used method to find method to find solutions to a linear solutions to a linear system is the method system is the method ofof eliminationelimination

• Example 1 Example 1

100,000

0.05 0.09 7800

x y

x y

100,000

0.04 2800

x y

y

70,000

30,000

y

x

Page 17: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1717

Elimination Method: Elimination Method: Example 2Example 2

• Example 2 – no solutionExample 2 – no solution

3 7

2 6 7

x y

x y

3 7

0 0 21

x y

x y

Contradiction

!

Page 18: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1818

Example 3 – A Unique Example 3 – A Unique SolutionSolution

• Example 3 – a unique solutionExample 3 – a unique solution

23

14232

632

zyx

zyx

zyx

20105

247

632

zy

zy

zyx

42

247

632

zy

zy

zyx

247

42

632

zy

zy

zyx

3010

42

632

z

zy

zyx

3

42

632

z

zy

zyx

Page 19: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

1919

An Over-Determined ExampleAn Over-Determined Example

• Example 4 – an Example 4 – an over-determined over-determined linear linear system that has system that has many solutionsmany solutions

432

432

zyx

zyx

1233

432

zy

zyx

4zy

4 2 3

4 2 4 3

4

x y z

z z

z

rz

ry

rx

4

4possible solutions :

5, 3, 1

2, 6, 2

x y z

x y z

x and y are lead variables, and z is a free variable.

3 variables, 2 equations.

Page 20: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2020

An Under-Determined ExampleAn Under-Determined Example

• Example 5 – an Example 5 – an under-determinedunder-determined linear linear system that has system that has a unique solutiona unique solution

4

246

102

y

y

yx

4

4

102

y

y

yx

2653

422

102

yx

yx

yx

2 variables, 3 equations.

Page 21: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2121

Another Under-Determined Another Under-Determined ExampleExample• Example 6 - an Example 6 - an under-determinedunder-determined linear linear

system that has system that has no solutionno solution

2053

422

102

yx

yx

yx

10

246

102

y

y

yx

10

4

102

y

y

yx

Contradiction !

Page 22: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2222

Linear Equations and Linear Equations and MatricesMatrices

• A linear system may have A linear system may have one solutionone solution (a (a unique solution), unique solution), no solutionno solution, or , or infinitely infinitely many solutionsmany solutions..

Page 23: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2323

Three Elementary Three Elementary OperationsOperations

Three elementary operationsThree elementary operations

• Interchange two equations (Interchange two equations (EE1)1)

• Multiply an equation by a nonzero constant Multiply an equation by a nonzero constant ((EE2)2)

• Add a multiple of one equation to another (Add a multiple of one equation to another (EE3)3)

Page 24: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2424

Equivalent SystemsEquivalent Systems

Equivalent systemsEquivalent systems Linear systems having the same Linear systems having the same solution setsolution set

The method of elimination via the three The method of elimination via the three elementary operations yields another elementary operations yields another equivalentequivalent linear system linear system

Page 25: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2525

31

2 3

3 3 3

20

220

: 0 20,

xx

x x

x x x R

Example 7Example 7

• Example 7 - Production PlanningExample 7 - Production Planning

60322

80432

321

321

xxx

xxx

Page 26: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2626

MatricesMatrices

Page 27: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2727

MatricesMatrices

1.2 Matrices1.2 Matrices

• An An mmnn matrix matrix AA

11 12 1 1

21 22 2 2

1 2

1 2

j n

j n

i i ij in

m m mj mn

a a a a

a a a a

a a a a

a a a a

A

Page 28: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2828

Rows & ColumnsRows & Columns

• The The i-i-th row of th row of AA

• The The jj-th column of -th column of AA

• Elements of Elements of AA

1 2i i i ina a a A

1

2

j

j

j

mj

a

a

a

A

of ija A

Page 29: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

2929

ExampleExample

• Example 1Example 1

101

321A

32

41B

2

1

1

C

213

102

011

D 3E 201F

Page 30: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3030

nn-Vectors-Vectors

• n-n-vectorvector

• Example 2Example 2

• The set of The set of n-n-vectors: vectors: RRnn

0121 u

3

1

1

v

Page 31: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3131

Tabular DisplayTabular Display

• Example 3- Tabular Display of DataExample 3- Tabular Display of Data

Taipei Taichung Tainan Hualien

Taipei

Taichung

Tainan

Hualien

0 210 380 250

210 0 170 460

380 170 0 630

250 460 630 0

Page 32: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3232

Tabular DisplayTabular Display

• Example 4 - Tabular Display of ProductionExample 4 - Tabular Display of Production

Product 1 Product 2 Product 3

Plant 1

Plant 2

Plant 3

Plant 4

560 340 280

360 450 270

380 420 210

0 80 380

Page 33: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3333

Display Linear Equations by Display Linear Equations by MatrixMatrix

• Example 5Example 5

bAx 2 10

2 2 4

3 5 26

x y

x y

x y

1 2 10

2 2 , , 4

3 5 26

xA x b

y

A is the coefficient matrix

Page 34: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3434

A Diagonal MatrixA Diagonal Matrix

Definition- The Definition- The diagonal matrixdiagonal matrix

A A square matrixsquare matrix AA defined as follows is called the defined as follows is called the diagonal matrixdiagonal matrix

AA = [ = [ aaijij ], ], aaijij = 0 , for all = 0 , for all ii≠ ≠ jj . .

•Example 6Example 6 -3 0 04 0

, 0 -2 00 2

0 0 4

G H

Page 35: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3535

A Scalar MatrixA Scalar Matrix

Definition- The Definition- The scalar matrixscalar matrix

A A diagonal matrixdiagonal matrix AA defined as follows is called the defined as follows is called the scalar matrixscalar matrix

AA = [ = [ aaijij ], ], aaijij = = cc , for all , for all ii = = jj , ,

aaijij = 0 , for all = 0 , for all ii≠ ≠ jj . .

•Example 7Example 73

1 0 0-2 0

0 1 0 , 0 -2

0 0 1

I J

Page 36: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3636

Equal MatricesEqual Matrices

Definition- Definition- Equal matricesEqual matrices

Two Two mmnn matrices matrices AA = [ = [aaijij] and ] and BB = [ = [bbijij] are s] are s

aid to be aid to be equalequal if if aaijij = = bbijij , 1 , 1≤≤ ii ≤≤mm , 1 , 1≤≤ jj ≤≤nn . .

•Example 8Example 81 2 1 1 2

2 3 4 and 2 4

0 4 5 4

w

A B x

y z

A, B are equal if x = -3 , y = 0 , z = 5 , w = -1

Page 37: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3737

Matrix AdditionMatrix Addition

Matrix additionMatrix addition

• Example 9Example 9

1 2 4 0 2 4 and =

2 1 3 1 3 1A B

1 0 2 2 4 ( 4) 1 0 0

2 1 1 3 3 1 3 2 4A B

Page 38: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3838

Application of Matrix Application of Matrix AdditionAddition

• Example 10Example 10 Manufacturing Shipping Manufacturing ShippingManufacturing Shipping Manufacturing Shipping Cost Cost Cost CostCost Cost Cost Cost

Compute Compute FF11 + + FF22

1

Model A

Model B

Model C

20 15

30 10

40 5

F

2

Model A

Model B

Model C

70 55

80 45

90 65

F

Page 39: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

3939

Scalar MultiplicationScalar Multiplication• Scalar multiplicationScalar multiplication

AA = [ = [aaijij], ], BB = [ = [bbijij], ],

bbijij = = cacaijij , for 1 , for 1≤≤ ii ≤≤mm , 1 , 1≤≤ jj ≤≤nn . .

• DifferenceDifference

The difference of The difference of AA and and BB : : AA – – BB

• Example 11Example 11 2 3 5 2 1 3 and =

4 2 1 3 5 2A B

2 2 3 1 5 3 0 4 8

4 3 2 5 1 2 1 3 3A B

Page 40: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

4040

ExampleExample• Example 12Example 12

18.95 14.75 8.60p

0.20 (0.20)18.95 (0.20)14.75 (0.20)8.60

3.79 2.95 1.72

p

0.20 18.95 14.75 8.60 3.79 2.95 1.72

15.16 11.80 6.88

p p

0.20 0.80p p p

Page 41: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

4141

Linear CombinationLinear Combination

• Linear combination of Linear combination of kk matrices: matrices: AA11, …, , …, AAkk

cc1 1 AA11 + + cc2 2 AA22 + … + + … + cckk AAkk . .

• Coefficients: Coefficients: cc11 , , cc2 2 , … , , … , cckk . .

Page 42: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

4242

Example of Linear Example of Linear CombinationCombination

• Example 13 – Example 13 – BB is a linear combination of is a linear combination of AA11 and and AA22

• BB = 3 = 3AA11 – 0.5 – 0.5AA22

• Coefficients: Coefficients: cc11 = 3 , = 3 , cc22 = -0.5 . = -0.5 .

1 2

0 3 5 5 2 3

2 3 4 and 6 2 3

1 2 3 1 2 3

A A

Page 43: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

4343

Example Example (cont’d)(cont’d)

5 2710

2 221

3 82

7 215

2 2

0 3 5 5 2 31

3 2 3 4 6 2 32

1 2 3 1 2 3

B

Page 44: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

4444

More ExamplesMore Examples

• Example 14-1Example 14-1

• Example 14-2Example 14-2

524053232

1 0.1

0.5 4 0.4 4

6 0.2

Page 45: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

4545

Transpose of A MatrixTranspose of A Matrix

• The The transposetranspose of a matrix of a matrix

for 1for 1≤≤ i’i’ ≤≤nn , 1 , 1≤≤ j’j’ ≤≤mm . .

Here, Here, AA = [ = [aaijij] is a ] is a mmnn matrix and matrix and

AATT = [ = [aajiji] is a ] is a nnmm matrix . matrix .

ijA a T T

ijA a Tij jia a

Page 46: 1 資訊科學數學 11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw.

4646

Examples of TransposeExamples of Transpose• Example 15Example 15

6 2 4 5 44 2 3

, 3 1 2 , 3 2 ,0 5 2

0 4 3 2 3

2

3 5 1 , 1

3

A B C

D E

4 0 6 3 05 3 2

2 5 , 2 1 4 , ,4 2 3

3 2 4 2 3

3

5 , and 2 1 3

1

T T T

T T

A B C

D E