Chapter 2: Systems of Linear Equations and Matrices 2.1 Systems Linear Equations: An Introduction Example Find the solution to the system of equations 2x y = 2 3x + 5y = 15 Solve first equation for y : 1. The two lines intersect. Plug into the second equation Simplify 2. The two lines are the same. Solve for y 3. The two lines are parallel. Check by graphing: 2
Example - find the solution to the system of equations: x + 2y = -1 2x + 4y = -2 Solve first equation for x, Example Find the solution to the system of equations: x 2y = 1 -x + 2y = 4 Solve first equation for x, Plug into second equation, Plug into second equation, Write both in slope-intercept form: Write both in slope-intercept form: This system is called dependent. This system has no solution. The solution is a parametric solution (infinite). We can consider y as a parameter, Particular solutions: 3 4
EXAMPLE: Three Equations and 3 Linear Variables Applications Word Problems Example - An apartment complex is being developed that has small, large and luxury apartments. The developer has decided that there will be a total of 192 apartments. The number of bigger apartments (large and luxury) will equal the number of small apartments. Finally, the number of small apartments will be three times the number of luxury apartments. How many apartments of each type will there be? ONE SOLUTION Answer Define your variables first x = y = z = PARAMETRIC NO SOLUTION 5 6
Try a drawing: 2.2: Systems of Linear Equations: Unique Solutions You may: Interchange any two of the equations. Multiply an equation by a non-zero constant. Add a multiple of one equation to another. If the complex had 1 luxury apartment, it would have 3 small apartments, z = 1 (1 luxury apartment) what comes out for x? x = 3z = 3*1 = 3. 2x y = 6 x + 2y = -2 AUGMENTED MATRIX form Rules are Interchange any of the rows equations. Multiply a row by a non-zero constant. Add a multiple of one row to another. Goal is 7 8
Calculator can help with commands This form of the augmented matrix is called row-reduced echelon form (RREF). What is RREF form? rowswap(matrix, row A, row B) for R A R B *row(value, matrix, row) for R value*r *row+(value, matrix row A, row B) is value*r A + R B R B 2x y = 6 x + 2y = -2 1. All rows consisting entirely of zeros are at the bottom of the matrix 2. The first non-zero entry in any row is a 1 (called a leading 1) 3. In any two successive non-zero rows the leading 1 in the lower row lies to the right of the leading 1 in the upper row. 4. If a column contains a leading 1, then the rest of the entries in that column are 0 s. PIVOT on an element make the element a 1 and the rest of the entries in that column 0 s. Gauss-Jordan Method Pivot until the augmented matrix is in RREF form. 9 10
Apartment Problem x + y + z = 192 y + z = x x = 3z 2.3: Systems of Linear Equations: Underdetermined and Overdetermined Systems Example: x + 2y + z = 2 2x 3y z = 1 2x + 4y + 2z = 4 1 2 1 2 2 3 1 1 2 4 2 4 Use your calculator: Now check is this in RREF? 1 0 1 4 0 1 1 3 0 0 0 0 Are the rows of all zeros is below the non-zero rows? Is the first non-zero entry in any row is a 1? Do the leading 1's go down in a diagonal? If a column has a leading 1 then does the rest of the column have zeros? 11 12
EXAMPLE: 1 0 1 4 0 1 1 3 0 0 0 0 x + 0y z = 4 0x + y + z = 3 0x + 0y + 0z = 0 x + y 2z = 3 2x y + 3z = 7 x 2y + 5z = 0 1 1 2 3 2 1 3 7 1 2 5 0 A column containing a leading 1 is called a unit column and the variable associated with the column is a basic variable. RREF form? Are the rows of all zeros below the non-zero rows? Is the first non-zero entry in any row is a 1? Do the leading 1's go down in a diagonal? If a column has a leading 1 then is the rest of the column is zero? 13 14
Number of Solutions Theorem Case 1: If the number of equations is greater than or equal to the number of variables in a linear system then one of the following is true: The system has no solution The system has exactly one solution The system has infinitely many solutions Case 2: If there are fewer equations than variables then the system has no solution or infinitely many solutions. Example: Solve the following system (Case 2) x1 + 2x2 + 4x3 = 2 x + x + 2x = 1 1 2 3 2.4 Matrices A matrix is a compact way of organizing and displaying data. A matrix is often denoted by a capital letter M or A. A matrix having m rows and n columns is an m x n matrix M 1 1 = 1 is a 3x1 matrix 2 M 2 = [ 1 1 2] is a 1x3 matrix These two matrices are NOT EQUAL. A matrix is called square if it has the same number of rows and columns. 1 2 A = 3 4 is a 2 x 2 square matrix. Example: Solve the following system (Case 1): a ij is the element in the ith row and jth column of matrix A. 4x + 6y = 8 3x 2y = 7 x + 3y = 5 2x + 6y = 10 15 16
Example - There are three stores. In the first week store I sold 88 loaves of bread, 48 quarts of milk, 16 jars of peanut butter and 112 pounds of cold cuts. At the same time, store II sold 105 loaves of bread, 72 quarts of milk, 21 jars of peanut butter and 147 pounds of cold cuts. Store III sold 60 loaves of bread, 40 quarts of milk, 0 jars of peanut butter and 50 pounds of cold cuts. Organize this data in a 3 x 4 matrix. Transpose - The transpose of a matrix is found by switching the rows and columns of the matrix. If A is a 3x2 matrix then A T will be a 2x3 matrix. A 2 3 0 5 0.25 6 MATRIX ALGEBRA Equality - two matrices are equal if and only if each pair of corresponding elements are equal. example - Find the values of a, b, c, d given 1 b a 3 0 = c 1 d Addition - two matrices are added by adding the pairs of elements in each location. 2 3 0.25 7 example - find A+B where A 0 5 and B 3 1.5 0.25 6 9 2 Scalar multiplication A scalar is a number (NOT a matrix). Multiply a matrix by a scalar by multiplying every element in the matrix by the scalar. Example - find -2 A. Answer 17 18
2.5 Multiplication of Matrices Example - A flower shop sells 96 roses, 250 carnations and 130 daisies in a week. The roses sell for $2 each, the carnations for $1 each and the daisies for $0.50 each. Find the revenue of the shop during the week using matrices. Answer - Express the number of flowers in a 1x3 matrix: In general, If A is 1xn and B is nx1, the product AB is a 1x1 matrix: b 11 b 21 AB =[ a a a n ] 11 12 1 b n1 = a b + a b + + a b [ ] 11 11 12 21 1n n 1 Even more general, Next express the price as a 3 x 1 matrix: If A is an mxn matrix and B is a nxp matrix, then the product matrix A B=C is mxp. We can think of this as a type x price matrix. The shop s revenue is $507.00 b11 b12 a a a 11 12 1n b b 21 22 AB = a a a 21 22 2n bn1 ( a11 b11 + a12 b21 + a1 b 1) ( ab) 12 n n = ( ab) 21 ( ab) 22 19 20
Matrix multiplication is not commutative. That means, in general, that AB BA Example: find the products AB and BA where 1 0 A= 2 3 Answer B= 1 2 0 3 Example - Cost Analysis - The Mundo Candy Company makes three types of chocolate candy: cheery cherry (cc), mucho mocha (mm) and almond delight (ad). The company produces its candy in San Diego (SD), Mexico City (MC) and Managua (Ma) using two main ingredients, sugar (su) and chocolate (choc). (a) Each kilogram (kg) of cheery cherry requires.5 kg of sugar and.2 kg of chocolate. Each kilogram of mucho mocha requires.4 kg of sugar and.3 kg of chocolate. Each kilogram of almond delight requires.3 kg of sugar and.3 kg of chocolate. Put this information in a 2x3 matrix. Matching dimensions is not everything! Look back at the flower problem a (3x1)*(1x3) gives a 3x3, but does it mean anything?? One special matrix is called the identity matrix, I. It is a square matrix with 1's on the diagonal and zeros elsewhere, 1 0 0 0 1 0 I = 0 0 1 I 2 is a 2x2 identity matrix and I n is an nxn identity matrix. The identity matrix has the following property 21 22
(b) The cost of 1 kg of sugar is $3 in San Diego, $2 in Mexico City and $1 in Managua. The cost of 1 kg of chocolate is $3 in San Diego, $3 in Mexico City and $4 in Managua. Put this information into a matrix in such a way that when it is multiplied by the matrix in part (a) it will tell us the cost of producing each kind of candy in each city. Matrix multiplication and linear equations: We can express a system of linear equations as a matrix product, AX=B. Consider the system 2x 3y = 6 x+ 2y= 4 In matrix form this looks like 2 3 x 6 = 1 2 y 4 23 24
2.6 Inverse of a Square Matrix Solve the matrix equation D = X AX for X. For any non-zero real number r, the reciprocal (or inverse) is 1 r or 1 r Multiplicative identity: For matrices, the inverse is A -1 and it is defined by A matrix with no inverse is called singular. If needed, find the inverse with the x -1 function on the calculator. The one use of matrix inverses is to solve matrix equations. Solve the matrix equation AX = B for X 25 26
Matrix inverses can be use to encrypt messages. First, assign each letter of the alphabet a number: Decode the message, M = E -1 (EM) = 1 to A 2 to B 3 to C 4 to D 5 to E 6 to F 7 to G 8 to H 9 to I 10 to J 11 to K 12 to L 13 to M 14 to N 15 to O 16 to P 17 to Q 18 to R 19 to S 20 to T 21 to U 22 to V 23 to W 24 to X 25 to Y 26 to Z 27 to space So the word aggies would be written To make this more difficult to decode, we can put the letters in a message matrix. Our encoding matrix will be 3x3, so our message will need to have 3 rows: Decode the message below using the encryption matrix E. 150 114 149 178 113 184 182 148 227 260 193 269 M = And multiply by an encoding matrix E = EM = 27 28
2.7 Leontief Input-Output Model Consider the economy of small village that has two industries, farming and weaving. The villagers find that to produce $1.00 of food, they need $0.40 of food and $0.10 of cloth. To produce $1.00 of cloth, they need $0.30 of food and $0.20 of cloth. The local city is demanding $7200 worth of food and $2700 of cloth. How much food and cloth needs to be produced to meet the villagers internal need and have the necessary exports? Define your variables, x 1 = x 2 = x 1 = 0.40x 1 + 0.30x 2 + 7200 x 2 = 0.10x 1 + 0.20x 2 + 2700 Define the following matrices X = production matrix = A = I-O matrix = D = demand matrix = System can then be written as Solve this matrix equation Set up the system of equations 29 30
X = So the village must produce of food and of cloth to meet the internal and external demands. Given the following IO matrix, interpret the meaning of each element and find the amount each sector needs to produce to meet internal and external demand. auto energy transportation auto 0.2 0.4 0.1 A = energy 0.1 0.2 0.2 transportation 0.2 0.2 0.1 auto 474 D = energy 948 in millions of dollars. transportation 474 31 32