資訊科學數學11 : Linear Equation and Matrices 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw 1 Linear Algebra Content of B. Kolman and D. R. Hill, Linear Algebra, 8th edition Chap. 1 Linear Equations and Matrices • Linear systems • Matrices • Dot Product and Matrix Multiplication • Properties of Matrix Operations • Matrix Transformations • Solutions of Linear Systems of Equations • The Inverse of a Matrix • LU-Factorization (Optional) 2 Linear Algebra Chap. 3 Determinants Definition and Properties Cofactor Expansion and Applications Determinants from a Computational Point of View Chap. 4 Vectors in Rn Vectors in Plane n-Vectors Linear Transformations 3 Linear Algebra Chap. 6 Real Vector Spaces Vector Spaces Subspaces Linear Independence Basis and Dimension Homogeneous Systems The Rank of a Matrix and Applications Coordinates and Change of Basis Orthonormal Bases in Rn Orthogonal Complements 4 Linear Algebra Chap. 8 Eigenvalues, Eigenvectors, and Diagonalization Eigenvalues and Eigenvalues Diagonalization Diagonalization of Symmetric Matrices 5 Linear Algebra Chap. 2 Applications of Linear Equations and Matrices (Optional) An Introduction to Coding Graph Theory Computer Graphics Electrical Circuits Markov Chains Linear Economic Models Introduction to Wavelets 6 Linear Algebra Chap. 5 Applications of Vectors in R2 and R3 (Optional) Cross Product in R3 Lines and Planes Chap. 7 Applications of Real Vector Spaces (Optional) QR-Factorization Least Squares More on Coding 7 Linear Algebra Chap. 9 Applications of Eigenvalues and Eigenvectors (Optional) The Fibonacci Sequence Differential Equations (Calculus Required) Dynamical Systems (Calculus Required) Quadratic Forms Conic Sections Quadric Surfaces 8 Linear Algebra Chap. 10 Linear Transformations and Matrices Definition and Examples The Kernel and Range of a Linear Transformation The Matrix of a Linear Transformation Introduction to Fractals (Optional) Chap. 11 Linear Programming (Optional) The Linear Programming Problem: Geometric Solution The Simplex Method Duality The Theory of Games 9 Linear Algebra Chap. 12 MATLAB for Linear Algebra Input and Output in MATLAB Matrix Operations in MATLAB Matrix Powers and Some Special Matrices Elementary Row Operations in MATLAB Matrix Inverse in MATLAB Vectors in MATLAB Applications of Linear Combinations in MATLAB Linear Transformations in MATLAB MATLAB Command Summary 10 Linear Algebra Appendix A Complex Numbers A.1 Complex Numbers A.2 Complex Numbers in Linear Algebra Appendix B Further Directions B.1 Inner Product Spaces (Calculus Required) B.2 Composite and Invertible Linear Transformations 11 Linear Equations and Matrices Linear Systems 12 Linear Systems 1.1 Linear systems • What is a linear equation? ax b • Variables and constants a1 x1 a2 x2 an xn b • Unknowns and solutions 13 A Solution to A Linear Equation • A solution to a linear equation 6 x1 3 x 2 4 x3 13 62 33 4 4 13 14 A Linear System • A linear system a11 x1 a12 x 2 a1n x n b1 a 21 x1 a 22 x 2 a 2 n x n b2 a m1 x1 a m 2 x 2 a mn x n bm • A system of m linear equations in n unknowns 15 A Common Method • A commonly used method to find solutions to a linear system is the method of elimination • Example 1 x y 100, 000 0.05 x 0.09 y 7800 x y 100, 000 0.04 y 2800 y 70, 000 x 30, 000 16 Elimination Method: Example 2 • Example 2 – no solution x 3 y 7 2x 6 y 7 x 3 y 7 0 x 0 y 21 Contradiction ! 17 Example 3 – A Unique Solution • Example 3 – a unique solution x 2 y 3z 6 x 2 y 3z 6 x 2 y 3z 6 2 x 3 y 2 z 14 7 y 4 z 2 7 y 4 z 2 5 y 10 z 20 3 x y z 2 y 2z 4 x 2 y 3z 6 y 2z 4 7 y 4z 2 x 2 y 3z 6 x 2 y 3z 6 y 2z 4 10 z 30 y 2z 4 z 3 18 An Over-Determined Example • Example 4 – an over-determined linear system that has many solutions x 2 y 3z 4 2 x y 3z 4 x 2 y 3z 4 3 y 3z 12 y z4 x 4 2 y 3 z 4 2 z 4 3 z z4 xr4 y r4 zr 3 variables, 2 equations. possible solutions : x 5, y 3, z 1 x 2, y 6, z 2 x and y are lead variables, and z is a free variable. 19 An Under-Determined Example • Example 5 – an under-determined linear system that has a unique solution x 2 y 10 x 2 y 10 x 2 y 10 y4 2 x 2 y 4 6 y 24 y4 3 x 5 y 26 y 4 2 variables, 3 equations. 20 Another Under-Determined Example • Example 6 - an under-determined linear system that has no solution x 2 y 10 x 2 y 10 x 2 y 10 2 x 2 y 4 6 y 24 y 4 y 10 y 10 3 x 5 y 20 Contradiction ! 21 Linear Equations and Matrices • A linear system may have one solution (a unique solution), no solution, or infinitely many solutions. 22 Three Elementary Operations Three elementary operations • Interchange two equations (E1) • Multiply an equation by a nonzero constant (E2) • Add a multiple of one equation to another (E3) 23 Equivalent Systems Equivalent systems Linear systems having the same solution set The method of elimination via the three elementary operations yields another equivalent linear system 24 Example 7 • Example 7 - Production Planning 20 x3 x1 2 x1 3x 2 4 x3 80 2 2 x1 2 x 2 3x3 60 x2 20 x3 x3 : 0 x3 20, x3 R 25 Matrices 26 Matrices 1.2 Matrices • An mn matrix A a11 a12 a 21 a22 A ai1 ai 2 am1 am 2 a1 j a2 j aij amj a1n a2 n ain amn 27 Rows & Columns • The i-th row of A Ai ai1 ai 2 ain • The j-th column of A • Elements of A a1 j a 2j Aj amj aij of A 28 Example • Example 1 1 2 3 A 1 0 1 1 1 0 D 2 0 1 3 1 2 1 4 B 2 3 E 3 1 C 1 2 F 1 0 2 29 n-Vectors • n-vector • Example 2 u 1 2 1 0 1 v 1 3 • The set of n-vectors: Rn 30 Tabular Display • Example 3- Tabular Display of Data Taipei Taichung Tainan Hualien 0 210 380 250 Taichung 210 0 170 460 Tainan 380 170 0 630 Hualien 250 460 630 0 Taipei 31 Tabular Display • Example 4 - Tabular Display of Production Product 1 Product 2 Plant 1 560 Plant 2 360 Plant 3 380 Plant 4 0 340 450 420 80 Product 3 280 270 210 380 32 Display Linear Equations by Matrix • Example 5 x 2 y 10 2 x 2 y 4 3 x 5 y 26 Ax b 1 2 10 x A 2 2 , x , b 4 y 3 5 26 A is the coefficient matrix 33 A Diagonal Matrix Definition- The diagonal matrix A square matrix A defined as follows is called the diagonal matrix A = [ aij ], aij = 0 , for all i≠ j . • Example 6 -3 0 0 4 0 0 -2 0 G , H 0 2 0 0 4 34 A Scalar Matrix Definition- The scalar matrix A diagonal matrix A defined as follows is called the scalar matrix A = [ aij ], aij = c , for all i = j , aij = 0 , for all i≠ j . • Example 7 1 0 0 -2 0 I 3 0 1 0 , J 0 -2 0 0 1 35 Equal Matrices Definition- Equal matrices Two mn matrices A = [aij] and B = [bij] are said to be equal if aij = bij , 1≤ i ≤m , 1≤ j ≤n . • Example 8 1 2 1 1 2 w A 2 3 4 and B 2 x 4 0 4 5 y 4 z A, B are equal if x = -3 , y = 0 , z = 5 , w = -1 36 Matrix Addition Matrix addition • Example 9 1 2 4 0 2 4 A and B= 2 1 3 1 3 1 1 0 2 2 4 (4) 1 0 0 A B 2 1 1 3 3 1 3 2 4 37 Application of Matrix Addition • Example 10 Manufacturing Shipping Cost Cost 20 F1 30 40 Manufacturing Shipping Cost Cost 70 15 Model A 10 Model B F2 80 90 5 Model C 55 Model A 45 Model B 65 Model C Compute F1 + F2 38 Scalar Multiplication • Scalar multiplication A = [aij], B = [bij], bij = caij , for 1≤ i ≤m , 1≤ j ≤n . • Difference • The difference of A and B : A – B Example 11 2 3 5 2 1 3 A 4 2 and B = 1 3 5 2 2 2 3 1 5 3 0 4 8 A B 4 3 2 5 1 2 1 3 3 39 Example • Example 12 p 18.95 14.75 8.60 0.20 p (0.20)18.95 (0.20)14.75 (0.20)8.60 3.79 2.95 1.72 p 0.20 p 18.95 14.75 8.60 3.79 2.95 1.72 15.16 11.80 6.88 p 0.20 p 0.80 p 40 Linear Combination • Linear combination of k matrices: A1, …, Ak c1 A1 + c2 A2 + … + ck Ak . • Coefficients: c1 , c2 , … , ck . 41 Example of Linear Combination • Example 13 – B is a linear combination of A1 and A2 0 3 5 5 2 3 A1 2 3 4 and A2 6 2 3 1 2 3 1 2 3 • B = 3A1 – 0.5A2 • Coefficients: c1 = 3 , c2 = -0.5 . 42 Example (cont’d) 0 3 5 5 2 3 1 B 3 2 3 4 6 2 3 2 1 2 3 1 2 3 5 2 3 7 2 27 10 2 21 8 2 21 5 2 43 More Examples • Example 14-1 23 2 35 0 4 2 5 • Example 14-2 1 0.1 0.5 4 0.4 4 6 0.2 44 Transpose of A Matrix • The transpose of a matrix A aij AT aijT a a ji for 1≤ i’ ≤n , 1≤ j’ ≤m . T ij Here, A = [aij] is a mn matrix and AT = [aji] is a nm matrix . 45 Examples of Transpose • Example 15 6 2 4 5 4 4 2 3 3 1 2 , C 3 2 , A , B 0 5 2 0 4 3 2 3 2 D 3 5 1 , E 1 3 4 0 6 3 0 5 3 2 T T T A 2 5 , B 2 1 4 , C , 4 2 3 3 2 4 2 3 3 DT 5 , and E T 2 1 3 1 46