SOLUTION OF EQUATIONS BY MATRIX METHODS

Similar documents
MATRICES AND MATRIX OPERATIONS

Lemma 8: Suppose the N by N matrix A has the following block upper triangular form:

Introduction to Determinants

Review of Vectors and Matrices

Lesson U2.1 Study Guide

Chapter 3. Determinants and Eigenvalues

ECON 186 Class Notes: Linear Algebra

Matrix Algebra. Matrix Algebra. Chapter 8 - S&B

Linear Algebra and Matrix Inversion

Lecture 12 (Tue, Mar 5) Gaussian elimination and LU factorization (II)

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2

Matrix Arithmetic. j=1

Math 2331 Linear Algebra

7.4. The Inverse of a Matrix. Introduction. Prerequisites. Learning Outcomes

ENGI 9420 Lecture Notes 2 - Matrix Algebra Page Matrix operations can render the solution of a linear system much more efficient.

Linear Systems and Matrices

Matrix operations Linear Algebra with Computer Science Application

Math 240 Calculus III

Elementary maths for GMT

MAC Module 2 Systems of Linear Equations and Matrices II. Learning Objectives. Upon completing this module, you should be able to :

Introduction to Matrices

Fundamentals of Engineering Analysis (650163)

Getting Started with Communications Engineering. Rows first, columns second. Remember that. R then C. 1

Matrices and Determinants

1 Determinants. 1.1 Determinant

1111: Linear Algebra I

MATRICES The numbers or letters in any given matrix are called its entries or elements

Math 3191 Applied Linear Algebra

Lecture Notes in Linear Algebra

7.6 The Inverse of a Square Matrix

Linear Algebra Primer

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

ELEMENTARY LINEAR ALGEBRA

A matrix over a field F is a rectangular array of elements from F. The symbol

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Lesson 3. Inverse of Matrices by Determinants and Gauss-Jordan Method

Exercise Set Suppose that A, B, C, D, and E are matrices with the following sizes: A B C D E

Phys 201. Matrices and Determinants

1300 Linear Algebra and Vector Geometry

William Stallings Copyright 2010

MAC Learning Objectives. Learning Objectives (Cont.) Module 10 System of Equations and Inequalities II

A FIRST COURSE IN LINEAR ALGEBRA. An Open Text by Ken Kuttler. Matrix Arithmetic

Basics. A VECTOR is a quantity with a specified magnitude and direction. A MATRIX is a rectangular array of quantities

Finite Mathematics Chapter 2. where a, b, c, d, h, and k are real numbers and neither a and b nor c and d are both zero.

Chapter 4 - MATRIX ALGEBRA. ... a 2j... a 2n. a i1 a i2... a ij... a in

a11 a A = : a 21 a 22

Numerical Linear Algebra Homework Assignment - Week 2

JUST THE MATHS UNIT NUMBER 9.3. MATRICES 3 (Matrix inversion & simultaneous equations) A.J.Hobson

Introduction to Matrices and Linear Systems Ch. 3

Matrix & Linear Algebra

Section 5.3 Systems of Linear Equations: Determinants

Determinants - Uniqueness and Properties

Linear Algebra V = T = ( 4 3 ).

Lecture 7: Vectors and Matrices II Introduction to Matrices (See Sections, 3.3, 3.6, 3.7 and 3.9 in Boas)

= 1 and 2 1. T =, and so det A b d

Section 2.2: The Inverse of a Matrix

Math 313 Chapter 1 Review

Graduate Mathematical Economics Lecture 1

Undergraduate Mathematical Economics Lecture 1

A Review of Matrix Analysis

UNIT 3 MATRICES - II

The matrix will only be consistent if the last entry of row three is 0, meaning 2b 3 + b 2 b 1 = 0.

Jim Lambers MAT 610 Summer Session Lecture 1 Notes

Properties of the Determinant Function

1 Matrices and Systems of Linear Equations. a 1n a 2n

Linear Algebra. and

5.3 Determinants and Cramer s Rule

Digital Workbook for GRA 6035 Mathematics

Chapter 4. Matrices and Matrix Rings

Some Notes on Linear Algebra

POLI270 - Linear Algebra

Topic 4: Matrices Reading: Jacques: Chapter 7, Section

ENGR-1100 Introduction to Engineering Analysis. Lecture 21

det(ka) = k n det A.

Introduction to Quantitative Techniques for MSc Programmes SCHOOL OF ECONOMICS, MATHEMATICS AND STATISTICS MALET STREET LONDON WC1E 7HX

Chapter 7. Linear Algebra: Matrices, Vectors,

Methods for Solving Linear Systems Part 2

Introduction to Matrices

A = 3 B = A 1 1 matrix is the same as a number or scalar, 3 = [3].

Vectors and matrices: matrices (Version 2) This is a very brief summary of my lecture notes.

Things we can already do with matrices. Unit II - Matrix arithmetic. Defining the matrix product. Things that fail in matrix arithmetic

Linear Algebra: Lecture Notes. Dr Rachel Quinlan School of Mathematics, Statistics and Applied Mathematics NUI Galway

ELEMENTARY LINEAR ALGEBRA

Linear Algebra. Linear Equations and Matrices. Copyright 2005, W.R. Winfrey

MATH2210 Notebook 2 Spring 2018

Written as per the revised G Scheme syllabus prescribed by the Maharashtra State Board of Technical Education (MSBTE) w.e.f. academic year

Chapter 2:Determinants. Section 2.1: Determinants by cofactor expansion

Math Bootcamp An p-dimensional vector is p numbers put together. Written as. x 1 x =. x p

Applied Matrix Algebra Lecture Notes Section 2.2. Gerald Höhn Department of Mathematics, Kansas State University

A primer on matrices

Linear Algebra. The analysis of many models in the social sciences reduces to the study of systems of equations.

c c c c c c c c c c a 3x3 matrix C= has a determinant determined by

MAT 1332: CALCULUS FOR LIFE SCIENCES. Contents. 1. Review: Linear Algebra II Vectors and matrices Definition. 1.2.

APPENDIX: MATHEMATICAL INDUCTION AND OTHER FORMS OF PROOF

Matrix Algebra & Elementary Matrices

Numerical Analysis Lecture Notes

M. Matrices and Linear Algebra

We could express the left side as a sum of vectors and obtain the Vector Form of a Linear System: a 12 a x n. a m2

1 Matrices and matrix algebra

2.1 Matrices. 3 5 Solve for the variables in the following matrix equation.

Transcription:

APPENDIX B SOLUTION OF EQUATIONS BY MATRIX METHODS B.1 INTRODUCTION As stated in Appendix A, an advantage offered by matrix algebra is its adaptability to computer use. Using matrix algebra, large systems of simultaneous linear equations can be programmed for general computer solution using only a few systematic steps. The simplicities of programming matrix additions and multiplications, for example, were presented in Section A.9. To solve a system of equations using matrix methods, it is first necessary to define and compute the inverse matrix. B.2 INVERSE MATRIX If a square matrix is nonsingular (its determinant is not zero), it possesses an inverse matrix. When a system of simultaneous linear equations consisting of n equations and involving n unknowns is expressed as AX B, the coefficient matrix (A) is a square matrix of dimensions n n. Consider the system of linear equations AX B (B.1) 534 The inverse of matrix A, symbolized as A 1, is defined as 1 A A I (B.2) where I is the identity matrix. Premultiplying both sides of matrix Equation (B.1) by A 1 gives Adjustment Computations: Spatial Data Analysis, Fourth Edition. C. D. Ghilani and P. R. Wolf 2006 John Wiley & Sons, Inc. ISBN: 978-0-471-69728-2

B.3 INVERSE OF A 2 2 MATRIX 535 1 1 A AX A B Reducing yields 1 IX A B 1 X A B (B.3) Thus, the inverse is used to find the matrix of unknowns, X. The following points should be emphasized regarding matrix inversions: 1. Square matrices have inverses, with the exception noted below. 2. When the determinant of a matrix is zero, the matrix is said to be singular and its inverse cannot be found. 3. The inversion of even a small matrix is a tedious and time-consuming operation when done by hand. However, when done by a computer, the inverse can be found quickly and easily. B.3 INVERSE OF A 2 2 MATRIX Several general methods are available for finding a matrix inverse. Two are considered herein. Before proceeding with general cases, however, consider the specific case of finding the inverse for a 2 2 matrix using simple elementary matrix operations. Let any 2 2 matrix be symbolized as A. Also, let a b 1 w x A and A c d y z By applying Equation (B.2) and recalling the definition of an identity matrix I as given in Section A.4, it is possible to calculate w, x, y, and z in terms of a, b, c, and d of A 1. Substituting in the appropriate values gives By matrix multiplication a b w x 1 0 c d y z 0 1 aw by 1 ax bz 0 cw dy 0 cx dz 1 (a) (b) (c) (d) The determinant of A is symbolized as A and is equal to ad bc.

536 SOLUTION OF EQUATIONS BY MATRIX METHODS 1 aw cw From (a) y ; from (b) y b d 1 aw cw d d then ; reducing: w b d da bc A ax 1 cx From (b) z ; from (d) z b d ax 1 cx b b then ; reducing: x b d da bc A 1 by dy From (a) w ; from (c) w a c 1 by dy c c then ; reducing: y a c ad cb A bz 1 dz From (b) x ; from (d) x a c bz 1 dz a a then ; reducing: z a c ad bc A a b Thus, for any 2 2 matrix composed of the elements, its inverse is c d simply d b A A 1 d b b a A b a A A 2 3 Example B.1 If A, find A 1. 4 1 SOLUTION 1 1 1 3 A 104 2 A check on the inverse can be obtained by testing it against its definition, or A 1 A I. Thus,

1 1 3 2 3 1 0 I 10 4 2 4 1 0 1 B.4 INVERSES BY ADJOINTS 537 B.4 INVERSES BY ADJOINTS The inverse of A can be found using the method of adjoints with the following equation: adjoint of A adjoint of A 1 A (B.4) determinant of A A The adjoint of A is obtained by first replacing each matrix element by its signed minor or cofactor, and then transposing the resulting matrix. The cofactor of element a ij equals (1) ij times the numerical value of the determinant for the remaining elements after row i and column j have been removed from the matrix. This procedure is illustrated in Figure B.1, where the cofactor of a 12 is 12 (1) (a21a33 a31a 23) a31a23 a21a33 Using this procedure, the inverse of the following A matrix is found: a11 a12 a13 4 3 2 A a21 a22 a23 3 4 1 a a a 2 3 4 31 32 33 For this A matrix, the cofactors are calculated as follows Figure B.1 Cofactor of the a 12 element.

538 SOLUTION OF EQUATIONS BY MATRIX METHODS 2 cofactor of a11 (1) (4 4 1 3) 13 3 cofactor of a (1) (3 4 2 3) 6 cofactor of a cofactor of a 21 4 31 (1) (3 1 2 4) 5 3 12 (l) (3 4 1 2) 10 Following the procedure above, the matrix of cofactors is 13 10 1 matrix of cofactors 6 12 6 5 2 7 Transposing this cofactor matrix produces the following adjoint of A: 13 6 5 adjoint of A 10 12 2 1 6 7 The determinant of A is the sum of the products of the elements in the first row of the original matrix times their respective cofactors. Since the cofactors were obtained in the previous step, this simplifies to The inverse of A is now calculated as A 4(13) 3(10) 2(1) 24 1 13 6 5 13/24 1/4 5/24 1 A 10 12 2 5/12 1/2 1/12 1 6 7 1/24 1/4 7/24 24 Again, a check on the arithmetical work is obtained by using the definition of an inverse: 13/24 1/4 5/24 4 3 2 1 0 0 1 AA 5/12 1/2 1/12 3 4 1 0 1 0 I 1/24 1/4 7/24 2 3 4 0 0 1 B.5 INVERSES BY ROW TRANSFORMATIONS 1. The multiplication of every element in any row by a nonzero scalar. 2. The addition (or subtraction) of the elements in any row to the elements of any other row. 3. Combinations of 1 and 2.

B.5 INVERSES BY ROW TRANSFORMATIONS 539 If elementary row transformations are performed successively on A such that A is transformed into I, and if throughout the procedure the same row transformations are also done to the same rows of the identity matrix I, the I matrix will be transformed into A 1. This procedure is illustrated using the same matrix as that used to demonstrate the method of adjoints. Initially, the original matrix and the identity matrix are listed side by side: A I 4 3 2 1 0 0 3 4 1 0 1 0 2 3 4 0 0 1 With the following three row transformations performed on A and I, they are transformed into matrices A 1 and I 1, respectively: 1. Multiply row 1 of matrices A and I by 1/a 11, or 1/4. Place the results in row 1 of A 1 and I 1, respectively. This converts a 11 of matrix A 1 to 1, as shown below. 1 3/4 1/2 1/4 0 0 3 4 1 0 1 0 2 3 4 0 0 1 2. Multiply row 1 of matrices A 1 and I 1 by a 21, or 3. Subtract the resulting row from row 2 of matrices A and I and place the difference in row 2 of A 1 and I 1, respectively. This converts a 21 of A 1 to zero. 3. Multiply row 1 of matrices A 1 and I 1 by a 31, or 2. Subtract the resulting row from row 3 of matrices A and I and place the difference in row 3 of A 1 and I 1, respectively. This changes a 31 of A 1 to zero. After doing these operations, the transformed matrices A 1 and I 1 are A 1 I 1 1 3/4 1/2 1/4 0 0 0 7/4 1/2 3/4 1 0 0 3/2 3 1/2 0 1 Notice that the first column of A 1 has been made equivalent to the first column of a 3 3 identity matrix as a result of these three row transformations. For matrices having more than three rows, this same general procedure would be followed for each row to convert the first element in each row of A 1 to zero, with the exception to first row of A. Next, the following three elementary row transformations are done on matrices A 1 and I 1 to transform them into matrices A 2 and I 2 :

540 SOLUTION OF EQUATIONS BY MATRIX METHODS 1. Multiply row 2 of A 1 and I 1 by 1/a 22, or 4/7, and place the results in row2ofa 2 and I 2. This converts a 22 to 1, as shown below. 1 3/4 1/2 1/4 0 0 0 1 2/7 3/7 4/7 0 0 3/2 3 1/2 0 1 2. Multiply row 2 of A 2 and I 2 by a 12, or 3/4. Subtract the resulting row from row 1 of A 1 and I 1 and place the difference in row 1 of A 2 and I 2, respectively. 3. Multiply row 2 of A 2 and I 2 by a 32, or 3/2. Subtract the resulting row from row 3 of A 1 and I 1 and place the difference in row 3 of A 2 and I 2, respectively. After doing these operations, the transformed matrices A 2 and I 2 are A 2 I 2 1 0 5/7 4/7 3/7 0 0 1 2/7 3/7 4/7 0 0 0 24/7 1/7 6/7 1 Notice that after this second series of steps is completed, the second column of A 2 conforms to column two of a 3 3 identity matrix. Again, for matrices having more than three rows, this same general procedure would be followed for each row, to convert the second element in each row (except the second row) of A 2 to zero. Finally, the following three row transformations are applied to matrices A 2 and I 2 to transform them into matrices A 3 and I 3. These three steps are: 1. Multiply row 3 of A 2 and I 2 by 1/a 33, or 7/24 and place the results in row3ofa 3 and I 3, respectively. This converts a 33 to 1, as shown below. 1 0 5/7 4/7 3 /7 0 0 1 2/7 3/7 4/7 0 0 0 1 1/24 1/4 7/24 2. Multiply row 3 of A 2 and I 2 by a 13, or 5/7. Subtract the results from row1ofa 2 and I 2 and place the difference in row 1 of A 3 and I 3, respectively. 3. Multiply row 3 of A 2 and I 2 by a 23,or2/7. Subtract the results from row2ofa 2 and I 2 and place the difference in row 2 of A 3 and I 3. Following these operations, the transformed matrices A 3 and I 3 are

TABLE B.1 Inverse Algorithm in BASIC, C, FORTRAN, and PASCAL BASIC Language: REM INVERT A MATRIX FOR k 1TOn FOR j 1TOn IF jk THEN A(k,j) A(k,j)/A(k,k) NEXT j A(k,k) 1/A(k,k) FOR i 1TOn IF ik THEN FOR j1 TOn IF jk THEN A(i,j) A(i,j) A(i,k)*A(k,j) NEXT j A(i,k) A(i,k)*A(k,k) END IF NEXT i: NEXT k C Language: for (k0; kn; k) { for (j0; jn; j) if (j!k) A[k][j] A[k][j]/A[k][k]; A[k][k] 1.0/A[k][k]; for (i0; in; i) if (i!k) { for (j0; jn; j) if (j!k) A[i][j] A[i][j] A[i][k]*A[k][j]; A[i][k] A[i][k]*A[k][k]; }//ifik } / /for k FORTRAN Language: Do 560 k 1,N Do 520 j 1,N If (j.ne.k) Then A(k,j) A(k,j)/A(k,k) 520 Continue A(K,K) 1.0/A(K,K) Do 560 i 1,N If (i.eq.k) Then GOTO 560 Do 550 j 1,N If (j.ne.k) Then A(i,j) A(i,j) A(i,k)*A(k,j) 550 Continue A(i,k) A(i,k) * A(k,k) 560 Continue Pascal Language: For k : 1 to N do Begin Forj: 1toNdo If (jk) then A[k,j] : A[k,j]/A[k,k]; A[k,k] : 1.0/A[k,k]; Fori: 1toNdo If (ik) then Begin Forj: 1toNdo If (jk) then A[i,j] : A[i,j] A[i,k]*A[k,j]; A[i,k] : A[i,k]*A[k,k]; End; {If ik} End; {for k} 541

542 SOLUTION OF EQUATIONS BY MATRIX METHODS A 3 I 3 A 1 1 0 0 12/24 1/4 5/24 0 1 0 5/12 1/2 1/12 0 0 1 1/24 1/4 7/24 Notice that through of these nine elementary row transformations, the original A matrix is transformed into the identity matrix and the original identity matrix is transformed into A 1. Also note that A 1 obtained by this method agrees exactly with the inverse obtained by the method of adjoints. This is because any nonsingular matrix has a unique inverse. It should be obvious that the quantity of work involved in inverting matrices increases greatly with the matrix size, since the number of necessary row transformations is equal to the square of the number of rows or columns. Because of this, it is not considered practical to invert large matrices by hand. This work is done more conveniently with a computer. Since the procedure of elementary row transformations is systematic, it is easily programmed. Table B.1 shows algorithms, written in the BASIC, C, FORTRAN, and Pascal programming languages, for calculating the inverse of any n n nonsingular matrix A. Students should review the code in their preferred language to gain familiarity with computer procedures. B.6 EXAMPLE PROBLEM Example B.2 Suppose that an EDM instrument is placed at point A in Figure B.2 and a reflector is placed successively at B, C, and D. The observed values AB, AC, and AD are shown in the figure. Calculate the unknowns X 1, X 2, and X 3 by matrix methods. The values observed are AB 125.27 AC 259.60 AD 395.85 Figure B.2 Observation of a line.

PROBLEMS 543 SOLUTION Formulate the basic equations: 1X 0X 0X 125.27 1 2 3 1X 1X 0X 259.60 1 2 3 1X 1X 1X 395.85 1 2 3 Represented in matrix notation, these equations are AX L. In this matrix equation, the individual matrices are 1 0 0 x1 125.27 A 1 1 0 X x2 L 259.60 1 1 1 x 395.85 The solution in matrix notation is X A 1 L. Using elementary row transformation, the inverse of A is 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 0 0 1 0 1 1 Solving X A 1 L, the unknowns are 1 0 0 125.27 125.27 1 X A L 1 1 0 259.60 134.33 0 1 1 395.85 136.25 3 X1 125.27 X2 134.33 X3 136.25 PROBLEMS B.1 Describe when a 2 2 matrix has no inverse. B.2 Find the inverse of A using the method of adjoints. 3 1 1 A 1 3 1 1 1 3

544 SOLUTION OF EQUATIONS BY MATRIX METHODS B.3 Find the inverse of A in Problem B.2 using elementary row transformations. B.4 Solve the following system of linear equations using matrix methods. x 5y 8 x 2y 1 B.5 Solve the following system of linear equations using matrix methods. x y z 8 3x y z 4 x 2y 2z 21 B.6 Compute the inverses of the following matrices. 8 5 16 2 A B 3 12 8 3 B.7 Compute the inverses of the following matrices. 3 1 0 4 3 7 A 1 3 1 B 1 0 4 0 1 3 2 8 10 B.8 Compute the inverses of the following matrices. 13 6 0 1 2 6 A 6 18 6 B 2 3 4 0 6 16 0 6 12 B.9 Solve the following matrix system. 13 6 0 A 740.02 6 18 6 B 612.72 0 6 16 C 1072.22 Use the MATRIX software to do each problem. B.10 Problem B.4 B.11 Problem B.5 B.12 Problem B.6

PROBLEMS 545 B.13 Problem B.7 B.14 Problem B.8 B.15 Problem B.9 Programming Problems B.16 Select one of the coded matrix inverse routines from Table B.1, enter the code into a computer, and use it to solve Problem B.7. (Hint: Place the code in Table B.1 in a separate subroutine/function/procedure to be called from the main program.) B.17 Add a block of code to the inverse routine in the language of your choice that will inform the user when a matrix is singular. B.18 Write a program that reads and writes a file with a nonsingular matrix; finds its inverse, and write the results. Use this program to solve Problem B.7. (Hint: Place the reading, writing, and inversing code in separate subroutines/functions/procedures to be called from the main program. Provide a way to identify each matrix in the output file.) B.19 Write a program that reads and writes a file containing a system of equations written in matrix form, solves the system using matrix operations, and writes the solution. Use this program to solve Problem B.9. (Hint: Place the reading, writing, and inversing code in separate subroutines/functions/procedures to be called from the main program. Provide a way to identify each matrix in the output file.)