2: Matrices as Systems of Linear Equations 33A Linear Algebra, Puck Rombach Last updated: April 13, 2016 Systems of Linear Equations Systems of linear equations can represent many things You have probably come across such a problem before Here are some examples; in each case, write down the system of linear equations that needs to be solved Balance the following chemical reaction C 7 H 10 N + O 2 CO 2 + H 2 O + NO 2 Find the exact time between 2 and 3 o clock that the minute and hour hands of a clock make a 180 angle A mother gave to her three children 30 boxes of candy, of which 10 were full, 10 were half full, and the last 10 were empty Divide the candy and boxes so that there will be equal division among the three children of both candy and boxes Find all the solutions of this problem You probably already know how to solve systems of linear equations via substitution or addition/elimination We will start doing this in a more standardized way, using matrices Matrix basics A matrix is an n-by-m array of numbers We refer to the elements of a matrix A by a i j, meaning the p 28-30 element in the ith row and jth column We can add an subtract matrices, if they have the same dimensions, by adding/subtracting elementwise We have that if C = A + B, and A and B are n-by-m matrices, then c i j = a i j + b i j, for all 1 i n and for all 1 j m We can also multiply a matrix by a scalar (a single real number) If C = za, then c i j = za i j, for all 1 i n and for all 1 j m Multiplying matrices takes a little more work If A is an n-by-k matrix, and B is a k-by-m matrix, p 78-81 Thm 232-8 then C = AB is an n-by-m matrix with c i j = k l=1 a il b l j, for all 1 i n and for all 1 j m As shown in class, we can also think of matrix multiplication in terms of dot products of vectors First of all, we denote vectors as follows:
2 v 1 v 2 v = The dot product of two vectors v w is defined as follows: v n v w = v 1 w 1 + v 2 w 2 + + v n w n Note that the dot product of two vectors is a scalar, and that it is only defined if the two vectors have the same dimension When we multiply a matrix with a vector, we can think of that in terms of ordinary matrix multiplication (since a vector is an n-by-1 matrix), or we can think of it in terms of dot products, either by thinking of A as a set of horizontal row vectors: w 1 w 1 x w 2 A x = x =, w n w n x or as a set of vertical column vectors: p 31-32 Thm 138-10 x 1 A x = v 1 v 2 v m = x 1 v 1 + + x n v n x n Reduced row echelon form We will start representing systems of linear equations as matrices, and then solving them using p 8-15 matrix operations This method is known as Gauss-Jordan elimination For example, the system 3x + 6y z = 3 2x 4y + 3z = 2 can be represented by its coefficient matrix, which contains the coefficients of each variable in the equations: ( 3 6 ) 1 2 4 3 or its augmented matrix, which contains all of the information in the system of equations:
3 ( ) 3 6 1 3 2 4 3 2 Exercise 21 In the lecture, we showed that a system of linear equations can be interpreted as a question about linear combinations of vectors Show by yourself, ( ) that the system above can 3 be phrased as the question: how can we write the vector as a linear combination of the 2 ( ) ( ) ( ) 3 6 1 vectors,, and? 2 4 3 In order to solve the system of equations, we would like to write the augmented matrix into a p 16-18 standardized form, the so-called reduced row echelon form A matrix in reduced row echelon form satisfies the following properties: The leading (first non-zero) entry in each row is 1 A column that contains such a leading entry has 0 everywhere else The rows are in order of the position of their leading coefficients The reduced row echelon form of a matrix is unique, and can be achieved by using a series of the following elementary row operations Swapping two rows Multiplying a row by a non-zero scalar Adding a multiple of one row to another row We will introduce a general algorithm for rewriting a matrix into its RREF in lecture 4 Let s first get familiar with the RREF and discover why it is useful Example 22 Here are some examples of matrices in RREF, together with solutions to the system Write down the corresponding equations yourself In the last example, the variable z does not have its own leading 1, and is therefore free We give it an arbitrary value t The variable y is then dependent on z = t (We could have let z depend on y = t instead, but the rref gives us a canonical method in which the earlier variable receives the leading 1 and is named as the dependent variable) 1 2 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 2 0 0 1 3 - Inconsistent - 0 solutions (one of the equations is 0=1) - Consistent - Independent - 1 solution x = 1 y = 2 z = 3
4 1 0 0 1 0 1 2 2 0 0 0 0 - Consistent - Dependent - solution x = 1 y + 2z = 2 y = 2 2t z = t Exercise 23 Try to find the augmented matrices for the problems given at the start of these notes Finding the right system of equations is hard! Exercise 24 Suggested exercises from Bretscher: 12: 1, 8, 18, 27, 29, 32, 36, 46, 77 13: 7, 22, 24, 25, 47, 50, 53 The RREF algorithm We use the following general algorithm for rewriting a matrix into its RREF Algorithm 1 RREF for row i = 1 n do let a i j be the leading coefficient of row i; divide row i by a i j so that a i j becomes 1; subtract row i a k j times from all other rows so that a k j becomes 0 for all k i; end for arrange the rows in order of the position of their leading coefficients; Once you have written your system of linear equations as an augmented matrix, and then written the augmented matrix into reduced row echelon form, you can find the solutions Note that a diagonal matrix is a matrix in which all entries outside the main diagonal are 0 So, A is diagonal whenever a i, j = 0 for all i j If the RREF matrix contains a row where the final entry is non-zero and all other entries are 0, then the system is inconsistent and there are no solutions If the RREF is a diagonal matrix if you ignore the last column, then the system is consistent and independent, and it has exactly one solution Else, if the RREF is not a diagonal matrix (ignoring the last column), then the system is consistent and dependent, and it has infinitely many solutions
5 The rank of a matrix The rank of a matrix A, denoted rank(a), is the number of leading 1s in the RREF of A We will p 26 learn other, equivalent definitions for the rank of A later In a system of n linear equations in m variables, where A is the coefficient matrix: If the system is inconsistent, then rank(a) < n If the system is consistent and independent, then rank(a) = m If the system is consistent and dependent, then rank(a) < m Conversely: If rank(a) = n, then the system is consistent If rank(a) < m, then the system is either inconsistent or consistent and dependent If rank(a) = m, then the system is either inconsistent or consistent and independent If n = m, then { system has unique solution } rank(a) = n Exercise 25 Examine the statements above until they feel natural and you can explain them intuitively Using the RREF to answer questions about independence Suppose that we have an n m matrix A Then we can think of this matrix either in terms of a set of column vectors v 1, v 2,, v m or in terms of row vectors w 1, w 2,, w n w 1 A = v 1 v 2 v m = w 2 w n We may be interested in the vector spaces spanned by either the set of columns of A or the set of rows of A We call these the column span of A (= span( v 1, v 2,, v m )) and the the row span of A (= span( w 1, w 2,, w n )) The following properties related to linear dependence among the rows and columns of A are extremely useful (The row-related facts are much easier to intuit than the column-related facts)
6 Theorem 26 The following properties related to linear dependence among the rows and columns of A are extremely useful (The row-related facts are much easier to intuit than the column-related facts) The set of column vectors of A which receive a pivot in rref(a) form a basis for the column span of A (This is a subset of { v 1, v 2,, v m }!) The set of rows in rref(a) that contain a pivot form a basis for the row span of A (This is not necessarily a subset of { w 1, w 2,, w n }!) Exercise 27 Is the set of vectors linearly independent? 1 2 1 2, 0, 0 1 1 2 1 1 Exercise 28 Find equations that describe the subspace of R 3 spanned by the vectors 1 and 2 1 4 0 0 Exercise 29 Find equations that describe the subspace of R 3 spanned by the vectors 1 and 2 2 4 Solutions to Exercises Solution 21 Exactly the same as the example from the lecture Solution 23 :) Solution 24 These will be discussed on Piazza and in the sections, and you may also ask about them in office hours Solution 27 We use this set as the columns for a matrix A and look at its rref: 1 2 1 rref 2 0 0 = I 3 1 1 2 Therefore, the full set is a basis and they are linearly independent Solution 28 In order to find equations we first find an alternate basis in reduced form (It is easy to see that these vectors are independent and are therefore already a basis for the span We use rref ( ) 1 1 1 = 1 2 4 ( ) 1 0 2 0 1 3
1 0 Therefore, the space can also be expressed by the basis 0, 1 This means that vectors 2 3 in this space are of the form 1 0 s s 0 + t 1 = t, 2 3 2s + 3t and we see they must satisfy the equation 2x 1 + 3x 2 x 3 = 0 Solution 29 You probably notice immediately that this is not an independent set, and this space is 0 0 1-dimensional, with basis 1 Vectors must be of the form s, giving us two equations: 2 2s x 1 = 0 2x 2 x 3 = 0 7