aLe77183_appa_A-A08 11/03/05 18:46 Page 2 Appendix A Simultaneous Equations and Matrix Inversion In circuit analysis, we often encounter a set of simultaneous equations having the form a11x1 a12 x2 p a1n xn b1 a21x1 a22 x2 p a2n xn b2 (A.1) o o o an1x1 an2 x2 p ann xn bn where there are n unknown x1, x2, p , xn to be determined. Equation (A.1) can be written in matrix form as a11 a12 p a1n x1 b2 a21 a22 p a2n x2 b2 ≥ ¥ ≥ ¥ ≥ ¥ (A.2) p o o o o o an1 an2 p ann xn bn This matrix equation can be put in a compact form as AX B (A.3) where a11 a12 a21 a22 A ≥ o o an1 an2 p p p p a1n a2n ¥, o ann x1 x2 X ≥ ¥, o xn b1 b2 B ≥ ¥ o bn (A.4) A is a square (n n) matrix while X and B are column matrices. There are several methods for solving Eq. (A.1) or (A.3). These include substitution, Gaussian elimination, Cramer’s rule, matrix inversion, and numerical analysis. A.1 Cramer’s Rule In many cases, Cramer’s rule can be used to solve the simultaneous equations we encounter in circuit analysis. Cramer’s rule states that the solution to Eq. (A.1) or (A.3) is ¢1 ¢ ¢2 x2 ¢ o ¢n xn ¢ x1 A (A.5) aLe77183_appa_A-A08 10/27/05 22:30 Page A-1 Appendix A Simultaneous Equations and Matrix Inversion where the ¢ ’s are the determinants given by a11 a12 p a1n a21 a22 p a2n ¢4 4, o o p o an1 an2 p ann ¢2 4 ¢1 4 b1 b2 o bn a12 p a1n a22 p a2n 4 o p o an2 p ann o p a1n a11 a12 p a2n a21 a22 p o 4, p , ¢ n 4 o o p ann an1 an2 a11 b1 a21 b2 o o an1 bn o p b1 p b2 p o 4 p bn (A.6) Notice that ¢ is the determinant of matrix A and ¢ k is the determinant of the matrix formed by replacing the kth column of A by B. It is evident from Eq. (A.5) that Cramer’s rule applies only when ¢ 0. When ¢ 0, the set of equations has no unique solution, because the equations are linearly dependent. The value of the determinant ¢ , for example, can be obtained by expanding along the first row: a11 a12 a13 p a1n a21 a22 a23 p a2n ¢ 5 a31 a32 a33 p a3n 5 o o o p o an1 an2 an3 p ann (A.7) a11M11 a12 M12 a13 M13 p (1)1na1n M1n where the minor Mi j is an (n 1) (n 1) determinant of the matrix formed by striking out the ith row and jth column. The value of ¢ may also be obtained by expanding along the first column: ¢ a11 M11 a21M21 a31M31 p (1)n1an1 Mn1 (A.8) We now specifically develop the formulas for calculating the determinants of 2 2 and 3 3 matrices, because of their frequent occurrence in this text. For a 2 2 matrix, ¢2 a11 a12 2 a11a22 a12 a21 a21 a22 (A.9) For a 3 3 matrix, a11 a12 a13 a22 a23 a12 a13 ¢ 3 a21 a22 a23 3 a11(1)2 2 2 a21(1)3 2 2 a32 a33 a32 a33 a31 a32 a33 a31(1)4 2 a12 a13 2 a22 a23 a11(a22 a33 a32 a23) a21(a12 a33 a32 a13) a31(a12 a23 a22 a13) (A.10) A-1 aLe77183_appa_A-A08 11/03/05 18:46 Page A-2 Appendix A A-2 Simultaneous Equations and Matrix Inversion An alternative method of obtaining the determinant of a 3 3 matrix is by repeating the first two rows and multiplying the terms diagonally as follows. a11 a12 a13 a21 a22 a23 ¢ 5 a31 a32 a33 5 a11 a12 a13 a21 a22 a23 a11a22 a33 a21a32 a13 a31a12 a23 a13 a22 a31 a23 a32 a11 a33 a12 a21 (A.11) In summary: The solution of linear simultaneous equations by Cramer’s rule boils down to finding xk ¢k , ¢ k 1, 2, . . . , n (A.12) where ¢ is the determinant of matrix A and ¢ k is the determinant of the matrix formed by replacing the k th column of A by B. One may use other methods, such as matrix inversion and elimination. Only Cramer’s method is covered here, because of its simplicity and also because of the availability of powerful calculators. Example A.1 You may not find much need to use Cramer’s method described in this appendix, in view of the availability of calculators, computers, and software packages such as MATLAB, which can be used easily to solve a set of linear equations. But in case you need to solve the equations by hand, the material covered in this appendix becomes useful. At any rate, it is important to know the mathematical basis of those calculators and software packages. Solve the simultaneous equations 4x1 3x2 17, 3x1 5x2 21 Solution: The given set of equations is cast in matrix form as c 4 3 x1 17 d c d c d 3 5 x2 21 The determinants are evaluated as ¢2 4 3 2 4 5 (3)(3) 11 3 5 ¢1 2 17 3 2 17 5 (3)(21) 22 21 5 ¢2 2 4 17 2 4 (21) 17 (3) 33 3 21 aLe77183_appa_A-A08 10/27/05 22:30 Page A-3 Appendix A Simultaneous Equations and Matrix Inversion A-3 Hence, x1 ¢1 22 2, ¢ 11 x2 ¢2 33 3 ¢ 11 Practice Problem A.1 Find the solution to the following simultaneous equations: 3x1 x2 4, 6x1 18x2 16 Answer: x1 1.833, x2 1.5. Determine x1, x2, and x3 for this set of simultaneous equations: 25x1 5x2 20x3 50 5x1 10x2 4x3 0 5x1 4x2 9x3 0 Solution: In matrix form, the given set of equations becomes 25 5 20 x1 50 £ 5 10 4 § £ x2 § £ 0 § 5 4 9 x3 0 We apply Eq. (A.11) to find the determinants. This requires that we repeat the first two rows of the matrix. Thus, 25 5 20 ¢ 3 5 10 4 3 5 4 9 25 5 20 5 10 4 5 5 4 95 25 5 20 5 10 4 50 5 20 ¢ 1 3 0 10 4 3 0 4 9 50 5 20 0 10 4 5 0 4 95 50 5 20 0 10 4 25(10)9 (5)(4)(20) (5)(5)(4) (20)(10)(5) (4)(4)25 9(5)(5) 2250 400 100 1000 400 225 125 Similarly, 4500 0 0 0 800 0 3700 Example A.2 aLe77183_appa_A-A08 11/03/05 18:46 Page A-4 Appendix A A-4 Simultaneous Equations and Matrix Inversion 25 50 20 25 50 20 5 0 4 ¢ 2 3 5 0 4 3 5 5 0 95 5 0 9 25 50 20 5 0 4 0 0 1000 0 0 2250 3250 25 5 50 25 5 50 5 10 0 ¢ 3 3 5 10 0 3 5 5 4 0 5 5 4 0 25 5 50 5 10 0 0 1000 0 2500 0 0 3500 Hence, we now find ¢1 3700 29.6 ¢ 125 ¢2 3250 x2 26 ¢ 125 ¢2 3500 x3 28 ¢ 125 x1 Practice Problem A.2 Obtain the solution of this set of simultaneous equations: 3x1 x2 2x3 1 x1 6x2 3x3 0 2x1 3x2 6x3 6 Answer: x1 3 x3, x2 2. A.2 Matrix Inversion The linear system of equations in Eq. (A.3) can be solved by matrix inversion. In the matrix equation AX B, we may invert A to get X, i.e., X A1B (A.13) where A1 is the inverse of A. Matrix inversion is needed in other applications apart from using it to solve a set of equations. By definition, the inverse of matrix A satisfies A1A AA1 I (A.14) aLe77183_appa_A-A08 11/03/05 18:46 Page A-5 Appendix A Simultaneous Equations and Matrix Inversion where I is an identity matrix. A1 is given by adj A det A A1 (A.15) where adj A is the adjoint of A and det A 0A 0 is the determinant of A. The adjoint of A is the transpose of the cofactors of A. Suppose we are given an n n matrix A as A ≥ a11 a12 p a1n a21 a22 p a2n o ¥ (A.16) an1 an2 p ann The cofactors of A are defined as C cof (A) ≥ c11 c12 p c1n c21 c22 p c2n ¥ o (A.17) cn1 cn2 p cnn where the cofactor ci j is the product of (1)ij and the determinant of the 1n 12 1n 12 submatrix is obtained by deleting the ith row and jth column from A. For example, by deleting the first row and the first column of A in Eq. (A.16), we obtain the cofactor c11 as c11 (1)2 4 a22 a23 p a2n a32 a33 p a3n 4 (A.18) o an2 an3 p ann Once the cofactors are found, the adjoint of A is obtained as c11 c12 p c1n T c21 c22 p c2n adj (A) ≥ ¥ CT o cn1 cn2 p cnn (A.19) where T denotes transpose. In addition to using the cofactors to find the adjoint of A, they are also used in finding the determinant of A which is given by n 0A 0 a ai j ci j (A.20) j1 where i is any value from 1 to n. By substituting Eqs. (A.19) and (A.20) into Eq. (A.15), we obtain the inverse of A as CT 0A 0 (A.21) a b d c d (A.22) A1 For a 2 2 matrix, if A c A-5 aLe77183_appa_A-A08 11/03/05 18:46 Page A-6 Appendix A A-6 Simultaneous Equations and Matrix Inversion its inverse is A1 1 d b 1 d b c d c d 0A 0 c a ad bc c a (A.23) For a 3 3 matrix, if a11 a12 a13 A £ a21 a22 a23 § a31 a32 a33 (A.24) we first obtain the cofactors as c11 c12 c13 C £ c21 c22 c23 § c31 c32 c33 (A.25) where c11 2 a22 a23 2, a32 a33 c21 2 c31 2 a21 a23 2, a31 a33 c13 2 a11 a13 2, a31 a33 c23 2 c12 2 a12 a13 2, a32 a33 c22 2 a12 a13 2, a22 a23 c32 2 a11 a13 2, a21 a23 c33 2 a21 a22 2, a31 a32 a11 a12 2, a31 a32 a11 a12 2 a21 a22 (A.26) The determinant of the 3 3 matrix can be found using Eq. (A.11). Here, we want to use Eq. (A.20), i.e., 0 A 0 a11c11 a12 c12 a13c13 (A.27) The idea can be extended n 7 3, but we deal mainly with 2 2 and 3 3 matrices in this book. Example A.3 Use matrix inversion to solve the simultaneous equations 2x1 10x2 2, x1 3x2 7 Solution: We first express the two equations in matrix form as c 2 10 x1 2 d c d c d 1 3 x2 7 or AX B ¡ X A1B where A c 2 10 d, 1 3 X c x1 d, x2 2 B c d 7 The determinant of A is 0A 0 2 3 10(1) 16, so the inverse of A is A1 1 3 10 c d 16 1 2 aLe77183_appa_A-A08 11/03/05 18:46 Page A-7 Appendix A Simultaneous Equations and Matrix Inversion A-7 Hence, X A1B 1 3 10 2 1 64 4 c d c d c d c d 16 1 2 7 16 16 1 i.e., x1 4 and x2 1. Practice Problem A.3 Solve the following two equations by matrix inversion. 2y1 y2 4, y1 3y2 9 Answer: y1 3, y2 2. Determine x1, x2, and x3 for the following simultaneous equations using matrix inversion. x1 x2 x3 5 x1 2x2 9 4x1 x2 x3 2 Solution: In matrix form, the equations become 1 1 1 x1 5 £ 1 2 0 § £ x2 § £ 9 § 4 1 1 x3 2 or AX B ¡ X A1B where 1 1 1 A £ 1 2 0§, 4 1 1 x1 X £ x2 § , x3 5 B £ 9§ 2 We now find the cofactors c11 2 2 0 1 0 1 2 2 2, c12 2 2 1, c13 2 2 9 1 1 4 1 4 1 c21 2 c31 2 1 1 1 1 2 2, c22 2 2 5, 1 1 4 1 1 1 2 2, 2 0 c32 2 c23 2 1 1 23 4 1 1 1 1 1 2 1, c33 2 23 1 0 1 2 Example A.4 aLe77183_appa_A-A08 10/27/05 22:30 Page A-8 Appendix A A-8 Simultaneous Equations and Matrix Inversion The adjoint of matrix A is 2 1 9 T 2 2 2 adj A £ 2 5 3 § £ 1 5 1 § 2 1 3 9 3 3 We can find the determinant of A using any row or column of A. Since one element of the second row is 0, we can take advantage of this to find the determinant as 0A 0 1c21 2c22 (0)c23 1(2) 2(5) 12 Hence, the inverse of A is A1 2 2 2 1 £ 1 5 1 § 12 9 3 3 2 2 2 5 1 1 XA B £ 1 5 1 § £ 9 § £ 4 § 12 9 3 3 2 2 1 i.e., x1 1, x2 4, x3 2. Practice Problem A.4 Solve the following equations using matrix inversion. y1 y3 1 2y1 3y2 y3 1 y1 y2 y3 3 Answer: y1 6, y2 2, y3 5.