資訊科學數學14 : Determinants & Inverses 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw 1 Linear Equations and Matrices Determinants 2 3.1 Determinants • With each nn matrix A it is possible to associate a scalar det(A), called the determinant of the matrix, whose value will tell us whether the matrix is singular or not. • Case 1: 11 matrices - If A = (a), then A will have a multiplicative inverse iff a≠0 . - A is nonsingular iff det(A)≠0 . 3 22 Matrices • Case 2: 22 matrices a11 a12 - Let A = . a21 a22 - A will be nonsingular iff det(A) = a11a22 – a12a21≠ 0 . 4 33 Matrices • Case 3: 33 matrices a a a 11 12 - Let A = . 13 a a a 21 22 23 a31 a32 a33 - A will be nonsingular iff det(A) = a11a22a33 + a12a31a23 + a13a21a32 – a11a32a23 – a12a21a33 – a13a31a22 ≠ 0 . 5 Example 4 & 5 • Example 4 If A = [a11] is a 11 matrix, then det(A) = a11 . • Example 5 If a11 a12 A ⇒ det(A) = a a – a a a a 11 22 12 21 21 22 2 3 ⇒ det(A) = (2)(5) – (-3)(4) = 22 A 4 5 6 Example 6 & 7 • Example 6 If a11 a12 a13 A a21 a22 a23 ⇒ det(A) = a11a22a33 + a12a31a23 + a13a21a32 a31 a32 a33 – a11a32a23 – a12a21a33 – a13a31a22 • Example 7 1 2 3 A 2 1 3 ⇒ det(A) = (1)(1)(2) + (3)(2)(1) + (2)(3)(3) – (3)(1)(3) – (1)(1)(3) – (2)(2)(2) = 6 3 1 2 If 7 Properties of Determinants • Theorem 3.1 The determinants of a matrix and its transpose are equal, i.e., det(A) = det(AT). 8 Example 8 • Example 8 If 1 2 3 A 2 1 3 3 1 2 1 2 3 AT 2 1 1 3 3 2 ⇒ det(AT) = (1)(1)(2) + (3)(1)(2) + (2)(3)(3) – (3)(1)(3) – (1)(1)(3) – (2)(2)(2) = 6 = det(A) 9 Theorem 3.2 & 3.3 • Theorem 3.2 If matrix B results from matrix A by interchanging two rows (or two columns) of A, then det(B) = -det(A). • Theorem 3.3 If two rows (or columns) of A are equal, then det(A) = 0. 10 Example 9 & 10 • Example 9 If 2 1 3 2 7 and 7 3 2 2 1 • Example 10 If 1 2 3 1 0 7 0 1 2 3 11 Theorem 3.4 • Theorem 3.4 If a row (or column) of A consists entirely of zeros, then det(A) = 0. • Example 11 1 2 3 4 5 6 0 0 0 0 12 Theorem 3.5 • Theorem 3.5 If B is obtained from A by multiplying a row (column) of A by a real number c, then det(B) = c det(A) . • Example 12 2 6 1 3 1 1 2 23 64 1 18 1 12 1 12 1 4 13 Example 13 • Example 13 1 2 3 1 2 3 1 2 1 1 5 3 21 5 3 231 5 1 230 0 2 8 6 1 4 3 1 4 1 14 Theorem 3.6 • Theorem 3.6 If B = [bij] is obtained from A = [aij] by adding to each element of the rth row (column) of A a constant c times the corresponding element of the sth row (column) r≠s of A, then det(B) = det(A) . • Example 14 1 2 3 5 0 9 2 1 3 2 1 3 1 0 1 1 0 1 15 Theorem 3.7 • Theorem 3.7 If a matrix A = [aij] is upper (lower) triangular, then, then det(A) = a11 a22 … ann . • Corollary 1.3 The determinant of a diagonal matrix is the product of the entries on its main diagonal. 16 Example 15 • Example 15 2 3 4 3 0 0 5 0 0 A 0 4 5 , B 2 5 0 , C 0 4 0 0 0 3 6 8 4 0 0 6 det( A) 24, det( B) 60, det(C ) 120 17 Elementary Operations • Elementary row and elementary column operations I - Interchange rows (columns) i and j : ri ⇔ rj (ci ⇔ cj ) II - Replace row (column) i by a nonzero value k times row (column) i : kri ⇔ ri (kci ⇔ ci ) III - Replace row (column) j by a nonzero value k times row (column) i+ row (column) j : kri + rj ⇔ rj (kci + cj ⇔ cj ) 18 … then … det( Ari rj ) det( A), i j det(Akri ri ) k det( A) det (Akri rj rj ) det( A), i j 19 Example 16 • E.g. 16 4 3 2 A 3 2 5 2 4 6 4 3 2 det( A) 2 det( A1 r3 r3 ) 2 det ( 3 2 5 ) 2 1 2 3 4 3 2 1 2 3 2 det( 3 2 5 ) ( 1) 2 det( 3 2 5 ) 1 2 3 r r 4 3 2 1 3 20 Example 16 (cont’d) 3 1 2 1 2 3 ) 2 det( 0 -8 4 ) 2 det( 3 2 5 0 -5 10 4 3 2 -3r1 r2 r2 4 r r r 1 3 3 3 3 1 2 1 2 ) 2 det( 0 -8 4 ) 2 det( 0 -8 4 0 0 304 0 -5 10 5 r r r 3 8 2 3 det( A) 2(1)(8)(30 / 4) 120 21 Theorem 3.8 • Theorem 3.8 The determinant of a product of two matrices is the product of their determinants det(AB) = det(A)det(B) . • Example 17 1 2 A 3 4 A 2 4 3 AB 10 5 2 1 B 1 2 B 5 AB 10 A B 22 Example 17 (cont’d) • Remark 1 0 BA 7 10 AB≠BA |BA| = |B| |A|= -10 = |AB| 23 Corollary 3.2 • Corollary 3.2 If A is nonsingular, then det(A) ≠ 0, thus det(A-1) = 1/det(A). If A is singular, then det(A) = 0 ( 1 = |I| = |AA-1| = |A| |A-1| ) 24 • Example 18 Example 18 1 2 A 3 4 1 2 A 3/ 2 1/ 2 1 det( A) 2 1 1 det( A ) 2 det( A) 1 25 Cofactor Expression and Applications 26 3.2 Cofactor Expression and Applications Cofactor expression and applications • Definition – Minor and cofactor Let A = [aij] be an nn matrix. Let Mij be the (n-1) (n-1) submatrix of A obtained by deleting the ith row and jth column of A. The determinant det(Mij) is called the minor of aij. The cofactor Aij of aij is defined as Aij (1)i j det (M ij ) 27 Example 1 • E.g. 1 Let 3 1 2 A 4 5 6 7 1 2 4 6 det( M 12 ) 8 42 34 7 2 A12 (1)1 2 det( M 12 ) (1)(34) 34 3 1 det( M 23 ) 3 7 10 7 1 23 A23 (1) 1 2 det( M 31 ) 6 10 16 5 6 det( M 23 ) (1)(10) 10 A31 (1)31 det( M 31 ) (1)(16) 16 28 Theorem 3.9 • Theorem 3.9 Let A = [aij] be an nn matrix. Then for each 1≤ i ≤ n, det(A) = ai1Ai1 + ai2Ai2 + … + ainAin , and for each 1≤ j ≤ n, det(A) = a1jA1j + a2jA2j + … + anjAnj . 29 Example 2 To evaluate the determinant 1 2 3 4 4 2 1 3 3 0 0 3 2 0 2 3 1 4 3 2 2 3 4 2 3 4 1 3 4 2 1 3 (1)31 (3) 2 1 3 (1)3 2 (0) 4 1 3 0 0 3 0 2 3 2 2 3 0 2 3 1 2 4 1 2 3 (1)33 (0) -4 2 3 ( 1)3 4 (3) 4 2 1 2 0 3 2 0 2 (1)(3)(20) 0 0 (1)(3)(4) 48 30 Example 3 Consider the determinant of the matrix 1 4 3 2 2 3 4 1 2 1 3 4 0 0 3 3 0 2 3 c c c 2 4 1 2 3 5 2 1 1 0 0 0 0 2 5 4 2 3 5 0 4 6 (1)31 (3) 2 1 1 ( 1) 4 (3) 2 1 1 0 2 5 r r r 0 2 5 1 2 1 (1) 4 (3)(2)(8) 48 31 Theorem 3.10 • Theorem 3.10 If A = [aij] be an nn matrix, then ai1Ak1 + ai2Ak2 + … + ainAkn = 0, for i≠k , a1jA1k + a2jA2k + … + anjAnk = 0, for j≠k . 32 Example 4 • E.g. 4 1 2 3 A 2 3 1 4 5 2 3 2 1 2 A21 1 19 5 2 A22 1 1 3 14 4 2 A23 1 1 2 3 4 5 2 2 23 a31 A21 a32 A22 a33 A23 419 5 14 23 0 a11 A21 a12 A22 a13 A23 119 2 14 33 0 33 Adjoint • Definition – Adjoint Let A = [aij] be an nn matrix. The nn matrix adj A, called the adjoint of A, is the matrix whose j, ith element is the cofactor Aij of aij . Thus A11 A adjA 12 A1n A21 An1 A22 An 2 A2 n Ann 34 Remark • Remark The adjoint of A is formed by taking the transpose of the matrix of cofactors Aij of the elements of A. 35 Example 5 • Example 5 Compute adj A 3 2 1 A 5 6 2 1 0 3 36 Solution A11 1 11 6 2 0 3 18 A12 1 5 2 17 1 3 A13 1 5 6 1 2 1 3 A21 1 1 0 2 1 A22 1 2 2 A23 1 23 6 1 1 3 A32 1 3 1 1 5 2 A33 1 3 2 3 2 3 3 2 1 6 0 3 3 A31 1 2 1 10 6 2 31 10 3 2 2 1 0 5 6 28 18 6 10 Then, adj A 17 10 1 6 2 28 37 Theorem 3.11 • Theorem 3.11 If A = [aij] be an nn matrix, then A(adj A) = (adj A)A = det(A) In . 38 • E.g. 6 Example 6 Consider the matrix 3 2 1 A 5 6 2 1 0 3 0 3 2 1 18 6 10 94 0 1 0 0 5 6 2 17 10 1 0 94 0 94 0 1 0 1 0 3 6 2 28 0 0 0 1 0 94 and 18 6 10 3 2 1 1 0 0 17 10 1 5 6 2 94 0 1 0 6 2 28 1 0 3 0 0 1 39 • Corollary 3.3 Corollary 3.3 If A = [aij] be an nn matrix and det(A)≠0, then A det A A 1 1 adjA det A A det A A det A A A det A det A A A det A det A A A det A det A 40 Example 7 • Example 7 Consider the matrix 3 2 1 A 5 6 2 1 0 3 Then det(A) = -94, and 18 94 1 1 17 A adjA 94 det( A) 946 6 94 10 94 2 94 1 94 128 94 10 94 41 Theorem 3.12 • Theorem 3.12 A matrix A = [aij] is nonsingular iff det(A) ≠ 0. • Corollary 3.4 For an nn matrix A, the homogeneous system Ax = 0 has a nontrival solution iff det(A) = 0. 42 • Example 8 Example 8 Let A be a 4x4 matrix with det(A) = -2 (a) describe the set of all solutions to the homogeneous system Ax = 0. (b) If A is transformed to reduced row echelon form B, what is B? (c) Given an expression for a solution to the linear system Ax = b, where b = [b1 , b2 , b3 , b4 ]T . (d) Can the linear system Ax = b have more than one solution? Explain. (e) Does A-1 exist? 43 Solutions of Example 8 • Solutions (a) Since det(A)≠0, Ax = 0 has only the trivial solution. (b) Since det(A)≠0, A is a nonsingular matrix, so B = In (c) A solution to the given system is given by x = A-1b (d) No. The solution is unique. (e) Yes. 44 Nonsingular Equivalence • List of nonsingular equivalence The following statements are equivalent. 1. A is nonsingular. 2. x = 0 is the only solution to Ax = 0. 3. A is row equivalence to In . 4. The linear system Ax = b has a unique solution for every n1 matrix b. 5. det(A)≠0 . 45 Determinants • • • • Linearly independent Nonsingular Trivial solution x = 0 to Ax = 0 det(A) ≠ 0 46 Determinants • • • • Linearly dependent Singular Nontrivial solution to Ax = 0 det(A) = 0 47 Cramer’s Rule Theorem 3.13 (Cramer’s Rule) Let a11x1 + a12x2 + … + a1nxn = b1 a21x1 + a22x2 + … + a2nxn = b2 … an1x1 + an2x2 + … + annxn = bn Then, x1 = det(A1)/det(A) , x2 = det(A2)/det(A) , … , xn = det(An)/det(A) . 48 Cramer’s Rule Cramer’s Rule for solving the linear system Ax = b, where A is nn, is as follows: Step 1. Compute det(A). If det(A) = 0, Cramer’s rule is not applicable. Use Gauss-Jordan Reduction. Step 2. If det(A)≠0, for each i, xi = det(Ai)/det(A) , where Ai is the matrix obtained from A by replacing the ith column of A by b. 49 Example 9 • Consider the following linear system: -2x1 + 3x2 – x3 = 1 x1 + 2x2 – x3 = 4 -2x1 – 2x2 + x3 = -3 Then 2 3 1 A 1 2 1 2 2 1 1 50 Example 9 (cont’d) Hence, x1 x2 1 3 1 4 2 1 3 1 1 A 4 2 2 2 1 1 2 3 1 1 4 1 1 2 4 2 3 A 1 6 3 2 x3 2 1 3 A 8 4 2 51 Polynomial Interpolation Revisited • Polynomial Interpolation Revisited To find a quadratic polynomial that interpolates the following points: (x1, y1), (x2, y2), (x3, y3), where x1≠x2 , x1≠ x3 , x2≠ x3 . 52 … more … The polynomial has the form: y = a2x2 + a1x + a0 . The corresponding linear system y1 = a2x12 + a1x1 + a0 , y2 = a2x22 + a1x2 + a0 , y3 = a2x32 + a1x3 + a0 . 53 … more … The coefficient matrix x12 2 x2 x32 x1 1 x2 1 x3 1 The Vandermount determinant (x1 – x2 )( x1 – x3 )( x2 – x3 ) 54 55 Linear Equations and Matrices LU-Factorization 56 LU-Factorization • 1.8 LU-Factorization If a square matrix can be reduced to upper triangular form using only 3 row operations, then it is possible to represent the reduction process in terms of a matrix factorization. 57 Type I Operation An elementary matrix of type I is a matrix obtained by interchanging two rows of identity matrix I. Example 0 1 0 0 1 0 E1 1 0 0 , E11 1 0 0 0 0 1 0 0 1 E1 A Interchange the first row and the second row of A AE1 Interchange the first column and the second column of A 58 Type II Operation An elementary matrix of type II is a matrix obtained by multiplying a row of I by a nonzero constant. Example 1 0 0 1 0 0 E2 0 1 0 , E2 1 0 1 0 0 0 3 0 0 1/ 3 E2 A Multiply the third row of A by 3 AE2 Multiply the third column of A by 3 59 Type III Operation An elementary matrix of type III is a matrix obtained from I by adding a multiple of one row to another row. Example 1 0 3 1 0 3 E3 0 1 0 , E31 0 1 0 0 0 1 0 0 1 E3 A Add three times the third row to the first row of A AE3 Add three times the third column to the first column of A 60 In General In general, the elementary matrix by adding m times of row i to row j 1 0 E3 0 Row j 0 aji 1 0 1 1 , E3 0 m 1 0 0 0 1 1 m 1 0 0 1 Column i 61 Theorem • Theorem If A and B are nonsingular square matrices, then AB is also nonsingular. i.e. (AB)-1 = B-1A-1 . In general, if E1, E2, …, Ek are all nonsingular, then the product E1E2 … Ek is also nonsingular and (E1E2 … Ek )-1 = Ek-1 … E2-1 E1-1 . 62 Row Equivalence • A matrix B is row equivalent to A if there exists a finite sequence E1E2 … Ek of elementary matrices such that B = Ek … E2 E1A . 63 LU-Factorization • LU-Factorization If a square matrix can be reduced to upper triangular form using only 3 row operations, then it is possible to represent the reduction process in terms of a matrix factorization. 64 Example • Let 2 4 2 A 1 5 2 4 1 9 2 4 E1 A 1 5 4 1 1 E1 1/ 2 0 2 2 4 2 2 0 3 1 9 4 1 9 0 0 1 0 , a21 1/ 2 0 1 65 (cont’d) 2 4 E2 A 0 3 4 1 1 0 E2 0 1 2 0 2 2 4 2 2 1 0 3 1 E3 A 0 0 9 0 9 5 0 1 0 , a31 2 E3 0 0 1 2 2 4 2 1 0 3 1 9 5 0 0 8 0 0 1 0 , a32 3 3 1 4 3 66 (cont’d) 2 4 2 E3 E2 E1 A 0 3 1 U 0 0 8 A ( E3 E2 E1 ) 1U E11 E21 E31U LU 1 1 L E11 E21 E31 2 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 2 0 1 0 3 1 0 1 67