Solving Linear Systems Using Gaussian Elimination DEFINITION: A linear equation in the variables x 1,..., x n is an equation that can be written in the form a 1 x 1 +...+a n x n = b, where a 1,...,a n and b are constants, x 1,...,x n are variables. EXAMPLE: The equation is linear. The equation is NOT linear. 2x 1 +x 2 7x 3 = 5 3x 1 x 2 +2x 2 3 = 1 DEFINITION: A system of linear equations (or a linear system) is a collection of one or more linear equations. EXAMPLE: 3x 1 +2x 2 +7x 3 x 4 = 6 x 1 +x 2 x 3 +x 4 = 1 4x 1 +3x 2 +6x 3 = 8 Solving a Linear System in Two Variables EXAMPLE: Solve the following system of linear equations: { x1 2x 2 = 1 x 1 +3x 2 = 3 Solution: We have { x1 2x 2 = 1 x 1 +3x 2 = 3 { x1 2x 2 = 1 x 2 = 2 { x1 = 3 x 2 = 2 1
EXAMPLE: Solve the system of equations. Solution: Begin by solving for in Equation 1. Next, substitute this expression for y into Equation 2 and solve the resulting single-variable equation for x. Finally, you can solve for by back-substituting x = 3 into the equation y = 4 x, to obtain The solution is the ordered pair (3,1). You can check this solution as follows. 2
EXAMPLE: Solve the system of equations. Solution: You can eliminate the y-terms by adding the two equations. So, x = 12 8 = 3. By back-substituting into Equation 1, you can solve for y. 2 The solution is ( ) 3 2, 1. You can check the solution algebraically by substituting into the original system. 4 3
EXAMPLE: Find all solutions of the system 2x+y = 1 3x+4y = 14 Solution 1(Substitution Method): We solve for y in the first equation. 2x+y = 1 y = 1 2x Now we substitute for y in the second equation and solve for x: 3x+4y = 14 3x+4(1 2x) = 14 3x+4 8x = 14 5x = x = 2 Finally, we back-substitute x = 2 into the equation y = 1 2x: y = 1 2( 2) = 5 Solution 2(Elimination Method): We have 2x+y = 1 8x+4y = 4 3x+4y = 14 3x+4y = 14 5x = 3x+4y = 14 x = 2 3x+4y = 14 Next we substitute x = 2 into the equation 3x+4y = 14: 3( 2)+4y = 14 6+4y = 14 4y = 20 y = 5 4
EXAMPLE: Find all solutions of the system 2x+3y = 4 5x 7y = 1 Solution 1(Substitution Method): We solve for x in the first equation. 2x+3y = 4 2x = 4 3y x = 4+3y 2 Now we substitute for x in the second equation and solve for y: 5x 7y = 1 5 4+3y 2 7y = 1 Finally, we back-substitute y = 22 29 5(4+3y) 14y = 2 20 15y 14y = 2 29y = 22 y = 22 29 into the equation x = 4+3y: 2 x = 4+3( ) 22 29 = 25 2 29 Solution 2(Elimination Method): On the one hand, we have 2x+3y = 4 x+15y = 20 5x 7y = 1 x 14y = 2 = 29y = 22 y = 22 29 On the other hand, we have 2x+3y = 4 5x 7y = 1 14x+21y = 28 15x 21y = 3 = 29x = 25 x = 25 29 EXAMPLE: Find all solutions of the system 3 5 x+ 1 2 y = 7 2 1 3 x+ 4 5 y = 3 2 5
EXAMPLE: Find all solutions of the system Solution (Elimination Method): We have 3 5 x+ 1 2 y = 7 2 On the one hand, we have 6x+5y = 35 x+24y = 45 On the other hand, we have 6x+5y = 35 x+24y = 45 1 3 x+ 4 5 y = 3 2 3 5 x+ 1 2 y = 7 2 1 3 x+ 4 5 y = 3 2 30x+25y = 175 30x+72y = 135 144x+120y = 840 50x+120y = 225 EXAMPLE: Solve the system of linear equations 6x+5y = 35 x+24y = 45 = 97y = 3 y = 3 97 = 194x = 615 x = 615 194 Solution: Because the coefficients in this system have two decimal places, you can begin by multiplying each equation by 0 to produce a system with integer coefficients. Now, to obtain coefficients that differ only by sign, multiply revised Equation 1 by 3 and multiply revised equation 2 by -2. So, you can conclude that y = 322 23 the following. = 14. Back-substitution this value into revised Equation 2 produces 6
EXAMPLE: Find all solutions of the system Answer: No solution. EXAMPLE: Find all solutions of the system x+y = 1 x+y = 2 3x 2y = 4 6x+4y = 7 Solution: We have 3x 2y = 4 6x+4y = 7 3x 2y = 4 3x 2y = 7 2 It follows that the system has no solution (inconsistent). EXAMPLE: Find all solutions of the system x+y = 1 x+y = 1 Answer: The system has infinitely many solutions (dependent). EXAMPLE: Find all solutions of the system Solution: We have 8x 2y = 4 4x+y = 2 8x 2y = 4 4x+y = 2 8x 2y = 4 8x 2y = 4 It follows that the system has infinitely many solutions (dependent). 7
EXAMPLE: Solve the system of linear equations. Larger Systems of Linear Equations Solution: From Equation 3, you know the value z. To solve for y, substitute z = 2 into Equation 2 to obtain Finally, substitute y = 1 and z = 2 into Equation 1 to obtain The solution is x = 1, y = 1 and z = 2. EXAMPLE: Solve the system of linear equations. Solution: Because the leading coefficient of the first equation is 1, you can begin by saving the x at the upper left and eliminating the other x-terms from the first column. Now that all but the first x have been eliminated from the first column, go to work on the second column. (You need to eliminate y from the third equation.) Finally, you need a coefficient of 1 for z in the third equation. This is the same system that was solved in Example 1. As in that example, you can conclude that the solution is x = 1, y = 1, and z = 2. 8
EXAMPLE: Find all solutions of the system x 2y +z = 1 2x 3y z = 2 Solution (Elimination Method): We have x 2y +z = 1 2x 3y z = 2 2x 4y +2z = 2 2x 3y z = 2 3y z = 1 2y 4z = 1 12y 4z = 4 2y 4z = 1 therefore so 12y 4z = 4 y = 3 12y 4z = 4 y = 3 ( 2x 3 ) ( +3 1 ) = 1 z = 1 y = 3 ( 12 3 ) 4z = 4 y = 3 x = 1 2 z = 1 y = 3 z = 1 y = 3 EXAMPLE: Solve the system of linear equations. Solution: Because 0 = 2 is false statement, you can conclude that this system is inconsistent and so has no solution. Moreover, because this system is equivalent to the original system, you can conclude that the original system also has no solution. 9
EXAMPLE: Solve the system of linear equations. Solution: This result means that Equation 3 depends on Equations 1 and 2 in the sense that it gives us no additional information about the variables. So, the original system is equivalent to the system { x+y 3z = 1 y z = 0 In the last equation, solve for y in terms of z to obtain y = z. Back-substituting y = z in the first equation produces x = 2z 1. Finally, letting z = a, where a is a real number, the solutions to the given system are all of the form x = 2a 1, y = a, and z = a So, every ordered triple of the form (2a 1,a,a) is a solution of the system.
The Augmented Matrix of a Linear System We can write a system of linear equations as a matrix, called the augmented matrix of the system, by writing only the coefficients and constants that appear in the equations. Here is an example. The next Example demonstrates the elementary row operations described above. EXAMPLE: (a) Add 2 times the first row of the original matrix to the third row. (b) Multiply the first row of the original matrix by 1 2. (c) Interchange the first and second rows of the original matrix. 11
EXAMPLE: Solve the system of linear equations. x y +3z = 4 x+2y 2z = 3x y +5z = 14 Solution: Our goal is to eliminate the x-term from the second equation and the x- and y-terms from the third equation. For comparison, we write both the system of equations and its augmented matrix. Now we use back-substitution to find that The solution is (2,7,3). EXAMPLE: Solve the system of linear equations. z = 3 y 2z = 1 x y +3z = 4 y 2(3) = 1 x 7+3(3) = 4 y 6 = 1 x+2 = 4 y = 7 x = 2 x 2y +3z = 9 x+3y +z = 2 2x 5y +5z = 17 12
EXAMPLE: Solve the system of linear equations. Solution: x 2y +3z = 9 x+3y +z = 2 2x 5y +5z = 17 Now we use back-substitution to find that z = 2 y +4z = 7 x 2y +3z = 9 y +4(2) = 7 x 2( 1)+3(2) = 9 y +8 = 7 x+8 = 9 y = 1 x = 1 The solution is (1, 1,2). 13
EXAMPLE: Show that the following system has no solutions. Solution: We have x 3y +2z = 12 2x 5y +5z = 14 x 2y +3z = 20 Now if we translate the last row back into equation form, we get 0x + 0y + 0z = 1, or 0 = 1, which is false. No matter what values we pick for x, y, and z, the last equation will never be a true statement. This means the system has no solution. EXAMPLE: Show that the following system has infinitely many solutions. Solution: We have 3x 5y +36z = x+7z = 5 x+y z = 4 The third row corresponds to the equation 0 = 0. This equation is always true, no matter what values are used for x, y, and z. The complete solution of this system will be discussed in the next section. 14
Gaussian Elimination In general, to solve a system of linear equations using its augmented matrix, we use elementary row operations to arrive at a matrix in a certain form. This form is described in the following box. REMARK: Some authors say that a leading entry in a row-echelon form is 1, others say that it is just a nonzero number. Echelon Form Reduced Echelon Form 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 In the following matrices the first matrix is in reduced row-echelon form, but the second one is just in row-echelon form. The third matrix is not in row-echelon form. The entries in red are the leading entries. 15
EXAMPLE: Solve the system of linear equations using Gaussian elimination. 4x+8y 4z = 4 3x+8y +5z = 11 2x+y +12z = 17 Solution: We first write the augmented matrix of the system, and then use elementary row operations to put it in row-echelon form. We now have an equivalent matrix in row-echelon form, and the corresponding system of equations is x+2y z = 1 y +4z = 7 z = 2 We use back-substitution to solve the system. So the solution of the system is ( 3,1, 2). 16
DEFINITION: A pivot position in a matrix is a location in A that corresponds to a leading 1 in the reduced echelon form of A. A pivot column is a column of A that contains a pivot position. DEFINITION: The variables corresponding to pivot columns are called basic variables. The other variables are called free variables. EXAMPLE: Solve { x1 + 3x 2 + 4x 3 = 7 3x 1 + 9x 2 + 7x 3 = 6 Solution: We have [ 1 3 4 7 3 9 7 6 Therefore our system can be rewritten as ] [ 1 3 4 7 0 0 5 15 ] { x1 +3x 2 = 5 x 3 = 3 [ 1 3 4 7 0 0 1 3 ] [ 1 3 0 5 0 0 1 3 ] which gives This implies that x 1 x 2 x 3 = 5 3x 2 x 2 3 = x 1 = 5 3x 2 x 3 = 3 x 2 is free 5 3 x 2 0+1 x 2 3+0 x 2 = 5 0 3 +x 2 3 1 0 The Effect of Row Operations on Matrix Multiplication We conclude this section with a property involving row operations and matrix multiplication that will be useful later. The following notation is helpful: if a row operation R is performed on a matrix A, we represent the resulting matrix by R(A). Theorem 2.1 Let A and B be matrices for which the product AB is defined. (1) If R is any row operation, then R(AB) (R(A))B. (2) If R 1,...,R n are row operations, then R n ( (R 2 (R 1 (AB))) ) (R n ( (R 2 (R 1 (A))) ))B. Part(1)ofthistheoremassertsthatwheneverarowoperationisperformedontheproductoftwomatrices, the same answer is obtained by performing the row operation on the first matrix alone before multiplying. Part (1) is proved by considering each type of row operation in turn. Part (2) generalizes this result to any finite number of row operations, and is proved by using part (1) and induction. 17