Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction Math 1038 Lect 1: Technique of solving system of linear equations System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Charles Li The Chinese University of Hong Kong Substitution Elimination More examples System of linear equations with parameters (new) Warning: The notes may be updated later. Check online for the latest version. Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction Last updated: September 3, 2022 System of linear equations of two unknowns Substitution Reference: 1. Strang : Linear Algebra and Its Applications Section 1.3 Elimination System of linear equations of three unknowns Substitution Elimination 2. Beezer, A first course in Linear algebra. Ver 3.5 More examples Downloadable at System of linear equations with http://linear.ups.edu/download.html parameters (new) Print version can be downloaded at http://linear.ups.edu/download/fcla-3.50-print.pdf Beezer, Ver 3.5 Sect SSLE (print version p7 - p14) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination Introduction System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) In this section we give examples of systems of linear equations and solve one example. Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Example 1 Solve the system of equations 2x1 + 3x2 = 3 Introduction System of linear equations of two unknowns Substitution x1 − x2 = 4 Answer: Equation 1 − 2 × equation 2 Elimination System of linear equations of three unknowns Substitution Elimination 5x2 = −5. So x2 = −1. Substitute x2 = −1 into equation 1: 2x1 + 3(−1) = 3 x1 = 3. So x1 = 3 and x2 = −1 is a solution. More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction Checking: 2(3) + 3(−1) = 3 (3) − (−1) = 4. In fact it is the unique solution. System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Main goal: One of the main goals of this course is to solve systems of linear equations with more variables and more equations. Elimination More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Example 2 Charles Li Introduction x1 + 2x2 + 2x3 = 4 x1 + 3x2 + 3x3 = 5 2x1 + 6x2 + 5x3 = 6 System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Example 3 Elimination More examples x1 + 2x2 + x4 = 7 x1 + x2 + x3 − x4 = 3 3x1 + x2 + 5x3 − 7x4 = 1 System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of two unknowns: Substitution System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) You should all be very familiar with the procedure of solving a system equations of two unknowns. Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Example 4 Introduction 3x + 4y = 2 (1) 4x + 5y = 3 (2) System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Use (2), we can solve for y in terms of x: Substitution 3 4 y = − x. 5 5 Substitution this into (1): 3 4 3x + 4( − x) = 2 5 5 12 x − =2 5 5 x = 2. Elimination (3) More examples System of linear equations with parameters (new) Substituting x = 2 into (3), we can solve for y: y= 3 4 − × 2 = −1. 5 5 So the solution is x = 2, y = −1. Remark: There are other ways to use substitution, for example 1. Solve x by (2) in terms of y and substitute it into (1) 2. Solve y by (1) in terms of x and substitute it into (2) 3. Solve x by (1) in terms of y and substitute it into (2) But you cannot get the solution by 1. Solve y by (2) in terms of x and substitute it into (2) (No substitution back to the original equation) 2. Solve y by (1) in terms of x and substitute it into (1) 3. Solve x by (2) in terms of y and substitute it into (2) 4. Solve x by (1) in terms of y and substitute it into (1) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of two unknowns: Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Example 5 Again, let’s solve the system of linear equations from the previous example. Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction 3x + 4y = 2 (4) 4x + 5y = 3 (5) System of linear equations of two unknowns Substitution Elimination Consider (4) − 34 (5). −) System of linear equations of three unknowns 3x 3x + + 4y 15 4 y 1 4y = = = 2 9 4 − 14 Thus y = −1. Substituting it into (4): 3x + 4(−1) = 2 x = 2. So we obtain the solution x = 2, y = −1. Substitution Elimination More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction Remark: 1. The number 34 is so chosen such that the coefficient of x is eliminated. 2. At some point, we still need to use substitution to get the solution. System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns: Substitution System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) (Cold joke) There were two men trying to decide what to do for a living. They went to see a counselor, and he decided that they had good problem solving skills. He tried a test to narrow the area of specialty. He put each man in a room with a stove, a table, and a pot of water on the table. He said ”Boil the water”. Both men moved the pot from the table to the stove and turned on the burner to boil the water. Next, he put them into a room with a stove, a table, and a pot of water on the floor. Again, he said ”Boil the water”. The first man put the pot on the stove and turned on the burner. The counselor told him to be an Engineer, because he could solve each problem individually. The second man moved the pot from the floor to the table, and then moved the pot from the table to the stove and turned on the burner. Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) The counselor told him to be a mathematician because he reduced the problem to a previously solved problem. Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction Example 6 System of linear equations of two unknowns Solve the following system of linear equations Substitution x + 2y + 2z = 4 (1) x + 3y + 3z = 5 (2) 2x + 6y + 5z = 6 (3) Elimination System of linear equations of three unknowns Substitution Elimination System of linear equations with parameters (new) Find x in terms of y, z by (1) : x = 4 − 2y − 2z. Substituting (4) into (2), we obtain (4 − 2y − 2z) + 3y + 3z = 5 More examples (4) i.e., y + z = 1. (5) Substituting (4) into (3), we obtain Math 1038 Lect 1: Technique of solving system of linear equations Charles Li 2(4 − 2y − 2z) + 6y + 5z = 6, Introduction System of linear equations of two unknowns i.e., 2y + z = −2 (6) The equations are reduced to solving a linear system of equations with two unknowns: ( y +z =1 2y + z = −2 Solve y in terms of z by (5): y =1−z Then substitute y = 1 − z into (6): 2(1 − z) + z = −2 (7) Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li i.e. Introduction z = 4. By (7) System of linear equations of two unknowns Substitution Elimination y = 1 − z = −3. Substitute y = −3, z = 4 into (4), System of linear equations of three unknowns Substitution Elimination x = 4 − 2y − 2z = 4 − 2 × (−3) − 2 × 4 = 2. Hence x = 2, y = −3, z = 4 is a solution. More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns: Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Using substitution all the way to solve linear equations is not the best way. Instead, we can use elimination to simplify the system of linear equations first. Example 7 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction We solve the following system by a sequence of equation operations. System of linear equations of two unknowns x + 2y + 2z = 4 System of linear equations of three unknowns Substitution Elimination x + 3y + 3z = 5 2x + 6y + 5z = 6 −1 times equation 1, add to equation 2: x + 2y + 2z = 4 0x + 1y + 1z = 1 2x + 6y + 5z = 6 Substitution Elimination More examples System of linear equations with parameters (new) −2 times equation 1, add to equation 3: x + 2y + 2z = 4 0x + 1y + 1z = 1 0x + 2y + 1z = −2 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination −2 times equation 2, add to equation 3: x + 2y + 2z = 4 System of linear equations of three unknowns Substitution Elimination 0x + 1y + 1z = 1 More examples 0x + 0y − 1z = −4 System of linear equations with parameters (new) −1 times equation 3: x + 2y + 2z = 4 0x + 1y + 1z = 1 0x + 0y + 1z = 4 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction which can be written more clearly as System of linear equations of two unknowns Substitution x + 2y + 2z = 4 y +z =1 z=4 The third equation requires that z = 4 to be true. Making this substitution into equation 2 we arrive at y = −3, and finally, substituting these values of y and z into the first equation, we find that x = 2. Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Remark: We can add several more eliminations to solve x, y, z without substitution: x + 2y + 2z = 4 0x + 1y + 1z = 1 0x + 0y + 1z = 4 −1 times equation 3, add to equation 2 and −2 times equation 3, add to equation 1 x + 2y + 0z = −4 0x + 1y + 0z = −3 0x + 0y + 1z = 4 −2 times equation 2, add to equation 1 x + 0y + 0z = 2 0x + 1y + 0z = −3 0x + 0y + 1z = 4 So x = 2, y = −3, z = 4 is a solution. Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination More examples System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Example 8 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li x1 − 5x2 + 3x3 = 1 2x1 − 4x2 + x3 = 0 x1 + x2 − 2x3 = −1 Introduction System of linear equations of two unknowns Substitution Elimination −2 times equation 1, add to equation 2: x1 − 5x2 + 3x3 = 1 0x1 + 6x2 − 5x3 = −2 x1 + x2 − 2x3 = −1 −1 times equation 1, add to equation 3: x1 − 5x2 + 3x3 = 1 0x1 + 6x2 − 5x3 = −2 0x1 + 6x2 − 5x3 = −2 System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) −1 times equation 2, add to equation 3: Math 1038 Lect 1: Technique of solving system of linear equations Charles Li x1 − 5x2 + 3x3 = 1 0x1 + 6x2 − 5x3 = −2 0x1 + 0x2 + 0x3 = 0 Introduction System of linear equations of two unknowns Substitution Elimination 5 6 times equation 2, add to equation 1: 2 7 x1 + 0x2 − x3 = − 6 3 0x1 + 6x2 − 5x3 = −2 0x1 + 0x2 + 0x3 = 0 We can express x1 , x2 in terms of x3 : 2 7 x1 = − + x3 3 6 1 5 x2 = − + x3 3 6 System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) The solution set is 2 7 1 5 {(− + a, − + a, a) | a real numbers.} 3 6 3 6 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction Example 9 System of linear equations of two unknowns Substitution Elimination x1 − 5x2 + 3x3 = 1 2x1 − 4x2 + x3 = 0 x1 + x2 − 2x3 = −2 −2 times equation 1, add to equation 2: x1 − 5x2 + 3x3 = 1 0x1 + 6x2 − 5x3 = −2 x1 + x2 − 2x3 = −2 System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li −1 times equation 1, add to equation 3: x1 − 5x2 + 3x3 = 1 Introduction System of linear equations of two unknowns 0x1 + 6x2 − 5x3 = −2 Substitution 0x1 + 6x2 − 5x3 = −3 System of linear equations of three unknowns Elimination Substitution −1 times equation 2, add to equation 3: Elimination More examples x1 − 5x2 + 3x3 = 1 0x1 + 6x2 − 5x3 = −2 0x1 + 0x2 + 0x3 = −1 The last equation, 0 = −1 has no solution. So the system of linear equations has no solution. System of linear equations with parameters (new) Example 10 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li x1 + 2x2 + 0x3 + x4 = 7 x1 + x2 + x3 − x4 = 3 3x1 + x2 + 5x3 − 7x4 = 1 Introduction System of linear equations of two unknowns Substitution Elimination −1 times equation 1, add to equation 2: x1 + 2x2 + 0x3 + x4 = 7 0x1 − x2 + x3 − 2x4 = −4 3x1 + x2 + 5x3 − 7x4 = 1 −3 times equation 1, add to equation 3: x1 + 2x2 + 0x3 + x4 = 7 0x1 − x2 + x3 − 2x4 = −4 0x1 − 5x2 + 5x3 − 10x4 = −20 System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) −5 times equation 2, add to equation 3: x1 + 2x2 + 0x3 + x4 = 7 0x1 − x2 + x3 − 2x4 = −4 0x1 + 0x2 + 0x3 + 0x4 = 0 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination −1 times equation 2: System of linear equations of three unknowns x1 + 2x2 + 0x3 + x4 = 7 Substitution 0x1 + x2 − x3 + 2x4 = 4 More examples 0x1 + 0x2 + 0x3 + 0x4 = 0 −2 times equation 2, add to equation 1: x1 + 0x2 + 2x3 − 3x4 = −1 0x1 + x2 − x3 + 2x4 = 4 0x1 + 0x2 + 0x3 + 0x4 = 0 Elimination System of linear equations with parameters (new) which can be written more clearly as Math 1038 Lect 1: Technique of solving system of linear equations Charles Li x1 + 2x3 − 3x4 = −1 x2 − x3 + 2x4 = 4 0=0 Introduction System of linear equations of two unknowns Substitution Elimination The last equation 0 = 0 is always true, so we can ignore it and only consider the first two equations. We can analyze the second equation without consideration of the variable x1 . It would appear that there is considerable latitude in how we can choose x2 , x3 , x4 and make this equation true. Let us choose x3 and x4 to be anything we please, say x3 = a and x4 = b. Now we can take these arbitrary values for x3 and x4 , substitute them in equation 1, to obtain x1 + 2a − 3b = −1 x1 = −1 − 2a + 3b System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Similarly, equation 2 becomes x2 − a + 2b = 4 x2 = 4 + a − 2b So our arbitrary choices of values for x3 and x4 (a and b) translate into specific values of x1 and x2 . Now we can easily and quickly find many more (infinitely more). Suppose we choose a = 5 and b = −2, then we compute Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution x1 = −1 − 2(5) + 3(−2) = −17 x2 = 4 + 5 − 2(−2) = 13 and you can verify that (x1 , x2 , x3 , x4 ) = (−17, 13, 5, −2) makes all three equations true. The entire solution set is written as {(−1 − 2a + 3b, 4 + a − 2b, a, b) | a, b real numbers}. Elimination More examples System of linear equations with parameters (new) Example 11 Solve the following system of linear equations: Math 1038 Lect 1: Technique of solving system of linear equations Charles Li x2 + x3 + 2x4 + 2x5 = 2 x1 + 2x2 + 3x3 + 2x4 + 3x5 = 4 −2x1 − x2 − 3x3 + 3x4 + x5 = 3 Swap equation 1 and equation 2: x1 + 2x2 + 3x3 + 2x4 + 3x5 = 4 x2 + x3 + 2x4 + 2x5 = 2 −2x1 − x2 − 3x3 + 3x4 + x5 = 3 2 times equation 1, and add it to equation 3: x1 + 2x2 + 3x3 + 2x4 + 3x5 = 4 x2 + x3 + 2x4 + 2x5 = 2 3x2 + 3x3 + 7x4 + 7x5 = 11 Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) -3 times equation 2 and add it to equation 3: x1 + 2x2 + 3x3 + 2x4 + 3x5 = 4 x2 + x3 + 2x4 + 2x5 = 2 x4 + x5 = 5 Now the system of linear equations looks like an ”inverted stair”. We can then solve the system of linear equations by substitution (a better method well be given later). By the last equation: x4 = 5 − x5 . Solve x2 in terms of other variables by equation 2: x2 = 2 − x3 − 2x4 − 2x5 = 2 − x3 − 2(5 − x5 ) − 2x5 = −8 − x3 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Solve x1 in terms of other variables by equation 1: x1 = 4 − 2x2 − 3x3 − 2x4 − 3x5 = 4 − 2(−8 − x3 ) − 3x3 − 2(5 − x5 ) − 3x5 = 10 − x3 − x5 . Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction x3 , x5 can be taken as any values. Set x3 = a, x5 = b, the solution set can be given by System of linear equations of two unknowns Substitution Elimination {(10 − a − b, −8 − a, a, 5 − b, b) | a, b real numbers}. A better method Instead of subsitution, we use more elimination: x1 + 2x2 + 3x3 + 2x4 + 3x5 = 4 x2 + x3 + 2x4 + 2x5 = 2 x4 + x5 = 5 -2 times equation 3 and add it to equation 2: x1 + 2x2 + 3x3 + 2x4 + 3x5 = x2 + x3 4 = −8 x4 + x5 = 5 System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) -2 times equation 3 and add it to equation 1: x1 + 2x2 + 3x3 + + x5 = −6 = −8 x2 + x3 x4 + x5 = 5 -2 times equation 2 and add it to equation 1: Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution x1 + + x3 x2 + x3 + x5 = 10 = −8 x4 + x5 = 5 Notice the following: 1. The system of equations looks like an ”inverted” stairs. 2. The leftmost variables in the equations are x1 , x2 and x4 . 3. Only the first equation has variable x1 . 4. Only the second equation has variable x2 . 5. Only the third equation has variable x4 . Elimination System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Move x3 , x5 to another side. x1 = 10 − x3 − x5 x2 = −8 − x3 x4 = 5 − x5 The right hand sides have x3 , x5 as variables only and x3 , x5 can be taken as any values. Set x3 = a, x5 = b, the solution set can be given by {(10 − a − b, −8 − a, a, 5 − b, b) | a, b real numbers}. Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples Observations: 1. some systems of linear equations have exactly one solution. 2. some systems of linear equations have no solution. 3. some systems of linear equations have infinite many solutions. The solutions can be expressed in terms of 1 or 2 (or even more) variables. System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Charles Li Introduction System of linear equations of two unknowns Substitution Elimination System of linear equations with parameters (new) System of linear equations of three unknowns Substitution Elimination More examples System of linear equations with parameters (new) Math 1038 Lect 1: Technique of solving system of linear equations Example 12 Let α be a real number. Denote the following system of linear equation by (Sα ). Charles Li Introduction System of linear equations of two unknowns x1 + x2 + (1 + α)x3 = 1 + α −αx1 −αx3 = 1 − α (1 − α)x1 + x2 + (2 − α)x3 = 3 − α Substitution 2 Elimination System of linear equations of three unknowns Substitution 1. Suppose the system (Sα ) has a solution. What are the possible values of α. 2. For each such value of α that the system (Sα ) has a solution, write down the solution set. x1 + x2 + (1 + α)x3 = 1 + α −αx1 −αx3 = 1 − α (1 − α)x1 + x2 + (2 − α)x3 = 3 − α2 Elimination More examples System of linear equations with parameters (new) α× equation 1 + equation 2, −(1 − α)× equation 1 + equation 3 Math 1038 Lect 1: Technique of solving system of linear equations Charles Li x1 + x2 + (1 + α)x3 = 1 + α αx2 + α 2 x3 = 1 + α 2 2 αx2 + (1 − α + α )x3 = 2 Introduction System of linear equations of two unknowns Substitution Elimination −equation 2 + equation 3 System of linear equations of three unknowns x1 + x2 + (1 + α)x3 = 1 + α αx2 + 2 α x3 = 1 + α Substitution Elimination 2 + (1 − α)x3 = 1 − α2 When α = 0, the second equation is 0 = 1. It has no solution. So suppose α 6= 0. More examples System of linear equations with parameters (new) When α = 1, the system of equations is x1 + x2 + 2x3 = 2 x2 + x3 = 2 + 0=0 Charles Li Introduction System of linear equations of two unknowns −equation 2 + equation 1. x1 Math 1038 Lect 1: Technique of solving system of linear equations + x3 = 0 x2 + x3 = 2 + 0=0 Substitution Elimination System of linear equations of three unknowns Substitution Elimination The solution set is therefore {(−a, 2 − a, a) | a is a real number}. For α 6= 0, 1 by the third equation, we have x3 = 1 + α. By the second equation αx2 = 1 + α2 − α2 x3 = 1 + α2 − α2 (1 + α) = 1 − α3 . More examples System of linear equations with parameters (new) So x2 = α−1 − α2 . By the first equation Math 1038 Lect 1: Technique of solving system of linear equations Charles Li x1 = 1 + α − x2 − (1 + α)x3 = −α−1 − α. Introduction System of linear equations of two unknowns Conclusion 1. When α 6= 0, the system of linear equations has solution. 2. When α = 1, The solution set is Substitution Elimination System of linear equations of three unknowns Substitution Elimination More examples {(−a, 2 − a, a) | a is a real number}. When α 6= 0, 1, the system has a unique solution. x1 = −α−1 − α. x2 = α−1 − α2 . x3 = 1 + α. System of linear equations with parameters (new)