Mathematics 13: Lecture 10 Matrices Dan Sloughter Furman University January 25, 2008 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 1 / 19
Matrices Recall: A matrix is a rectangular array of numbers. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 2 / 19
Matrices Recall: A matrix is a rectangular array of numbers. A matrix with m rows and n columns is an m n matrix. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 2 / 19
Matrices Recall: A matrix is a rectangular array of numbers. A matrix with m rows and n columns is an m n matrix. The number in the ith row and jth column of a matrix is the (i, j)-entry of the matrix. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 2 / 19
Examples A 2 3 matrix: [ ] 1 2 8. 1 0 3 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 3 / 19
Examples A 2 3 matrix: [ ] 1 2 8. 1 0 3 A 4 2 matrix: 2 4 3 1 5 6. 3 8 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 3 / 19
Notation We may denote a general m n matrix A as a 11 a 12 a 13 a 1n a 21 a 22 a 23 a 2n A =....... a m1 a m2 a m3 a mn Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 4 / 19
Notation We may denote a general m n matrix A as a 11 a 12 a 13 a 1n a 21 a 22 a 23 a 2n A =....... a m1 a m2 a m3 a mn For a more compact notation, we will often write simply A = [a ij ]. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 4 / 19
Algebraic operations If A = [a ij ] and B = [b ij ] are both m n matrices and c is a scalar, then we define Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 5 / 19
Algebraic operations If A = [a ij ] and B = [b ij ] are both m n matrices and c is a scalar, then we define A + B = [aij + b ij ], Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 5 / 19
Algebraic operations If A = [a ij ] and B = [b ij ] are both m n matrices and c is a scalar, then we define A + B = [aij + b ij ], ca = [ca ij ]. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 5 / 19
Algebraic operations If A = [a ij ] and B = [b ij ] are both m n matrices and c is a scalar, then we define A + B = [aij + b ij ], ca = [ca ij ]. That is, we add two matrices of the same size by adding their respective entries, term by term, and we multiply a matrix by a scalar by multiplying each entry by the scalar. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 5 / 19
Algebraic operations If A = [a ij ] and B = [b ij ] are both m n matrices and c is a scalar, then we define A + B = [aij + b ij ], ca = [ca ij ]. That is, we add two matrices of the same size by adding their respective entries, term by term, and we multiply a matrix by a scalar by multiplying each entry by the scalar. Note: This generalizes addition and scalar multiplication of vectors. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 5 / 19
Examples Let 1 2 0 5 A = 3 4 and B = 8 13. 10 3 1 2 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 6 / 19
Examples Let Then 1 2 0 5 A = 3 4 and B = 8 13. 10 3 1 2 A + B = 1 7 3 6 5 9 and 3A = 9 12. 11 1 30 9 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 6 / 19
Transposition If A = [a ij ] is an m n matrix, then we call the n m matrix the transpose of A. A T = [b ij ] where b ij = a ji Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 7 / 19
Transposition If A = [a ij ] is an m n matrix, then we call the n m matrix the transpose of A. A T = [b ij ] where b ij = a ji That is, we obtain A T by reflecting A across its diagonal entries (the entries a 11, a 22,..., a mm ). Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 7 / 19
Transposition If A = [a ij ] is an m n matrix, then we call the n m matrix the transpose of A. A T = [b ij ] where b ij = a ji That is, we obtain A T by reflecting A across its diagonal entries (the entries a 11, a 22,..., a mm ). That is, the columns of A are the rows of A T and the rows of A are the columns of A T. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 7 / 19
Examples If 2 3 A = 1 0, then A T = 5 4 [ 2 1 ] 5 3 0 4 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 8 / 19
Examples If If 2 3 A = 1 0, then A T = 5 4 [ 2 1 ] 5 3 0 4 1 B = 2, then B T = [ 1 2 3 ]. 3 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 8 / 19
Examples If If 2 3 A = 1 0, then A T = 5 4 [ 2 1 ] 5 3 0 4 1 B = 2, then B T = [ 1 2 3 ]. 3 Note: If B is a column matrix, then B T is a row matrix (and vice versa). Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 8 / 19
Symmetric matrices We say a matrix A is symmetric if A T = A. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 9 / 19
Symmetric matrices We say a matrix A is symmetric if A T = A. A symmetric matrix is necessarily a square matrix, that is, a matrix with the same number of rows and columns. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 9 / 19
Symmetric matrices We say a matrix A is symmetric if A T = A. A symmetric matrix is necessarily a square matrix, that is, a matrix with the same number of rows and columns. Examples: If A = [ ] 1 2 2 3 and B = then A is symmetric and B is not symmetric. [ ] 1 2, 3 4 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 9 / 19
Some Octave Let A = [ ] 1 2 3 1 5 7 and B = [ ] 1 3 8. 10 9 1 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 10 / 19
Some Octave Let A = [ ] 1 2 3 1 5 7 and B = [ ] 1 3 8. 10 9 1 Octave commands to input A and B: A = [1 2 3; -1 5 7] B = [-1 3 8; -10 9 1] Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 10 / 19
Some Octave Let A = [ ] 1 2 3 1 5 7 and B = [ ] 1 3 8. 10 9 1 Octave commands to input A and B: A = [1 2 3; -1 5 7] B = [-1 3 8; -10 9 1] Octave commands to compute A + B, 4B, and 4A 7B: A + B 4*B 4*A - 7*B Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 10 / 19
Some Octave Let A = [ ] 1 2 3 1 5 7 and B = [ ] 1 3 8. 10 9 1 Octave commands to input A and B: A = [1 2 3; -1 5 7] B = [-1 3 8; -10 9 1] Octave commands to compute A + B, 4B, and 4A 7B: A + B 4*B 4*A - 7*B To find A T : A Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 10 / 19
Example Two companies, A and B, each purchase three different types of widgets, α, β, and γ, to manufacture their respective products. They may purchase their widgets from one of two suppliers, I and II. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 11 / 19
Example Two companies, A and B, each purchase three different types of widgets, α, β, and γ, to manufacture their respective products. They may purchase their widgets from one of two suppliers, I and II. The following two arrays specify the demand that each company has for each type of widget and the price each supplier charges for the respective types of widgets: Widget α Widget β Widget γ Company A 600 300 1000 Compnay B 400 800 500 Supplier I Supplier II Widget α 1.00 1.50 Widget β 4.00 3.00 Widget γ 1.00 2.00 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 11 / 19
Example (cont d) The cost for Company A to purchase widgets from Supplier I is then 600 1.00 + 300 4.00 + 1000 1.00 = 2800.00 and the cost from Supplier II is 600 1.50 + 300 3.00 + 1000 2.00 = 3800.00. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 12 / 19
Example (cont d) The cost for Company A to purchase widgets from Supplier I is then 600 1.00 + 300 4.00 + 1000 1.00 = 2800.00 and the cost from Supplier II is 600 1.50 + 300 3.00 + 1000 2.00 = 3800.00. For Company B, the cost from Supplier I is 400 1.00 + 800 4.00 + 500 1.00 = 4100.00 and from Supplier II is 400 1.50 + 800 3.00 + 500 2.00 = 4000.00. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 12 / 19
Example (cont d) The cost for Company A to purchase widgets from Supplier I is then 600 1.00 + 300 4.00 + 1000 1.00 = 2800.00 and the cost from Supplier II is 600 1.50 + 300 3.00 + 1000 2.00 = 3800.00. For Company B, the cost from Supplier I is 400 1.00 + 800 4.00 + 500 1.00 = 4100.00 and from Supplier II is 400 1.50 + 800 3.00 + 500 2.00 = 4000.00. Note: These are the dot products of the rows of the first array with the columns of the second array. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 12 / 19
Example (cont d) Note: we may also present the preceding costs in an array: Suppier I Supplier II Company A 2800.00 3800.00 Company B 4100.00 4000.00 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 13 / 19
Example (cont d) Note: we may also present the preceding costs in an array: Suppier I Supplier II Company A 2800.00 3800.00 Company B 4100.00 4000.00 Now let D be the demand matrix formed from our first array, P be the price matrix formed from our second array, and C be the cost matrix formed from the last array. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 13 / 19
Example (cont d) That is, let D = and C = [ ] 600 300 1000, P = 400 800 500 [ ] 2800.00 3800.00. 4100.00 4000.00 1.00 1.50 4.00 3.00, 1.00 2.00 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 14 / 19
Example (cont d) That is, let D = and C = [ ] 600 300 1000, P = 400 800 500 [ ] 2800.00 3800.00. 4100.00 4000.00 1.00 1.50 4.00 3.00, 1.00 2.00 If we let D = [d ij ], P = [p ij ], and C = [c ij ], then we have c 11 = d 11 p 11 + d 12 p 21 + d 13 p 31, c 21 = d 21 p 11 + d 22 p 21 + d 23 p 31, c 12 = d 11 p 12 + d 12 p 22 + d 13 p 32, c 22 = d 21 p 12 + d 22 p 22 + d 23 p 32. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 14 / 19
Example (cont d) That is, let D = and C = [ ] 600 300 1000, P = 400 800 500 [ ] 2800.00 3800.00. 4100.00 4000.00 1.00 1.50 4.00 3.00, 1.00 2.00 If we let D = [d ij ], P = [p ij ], and C = [c ij ], then we have c 11 = d 11 p 11 + d 12 p 21 + d 13 p 31, c 21 = d 21 p 11 + d 22 p 21 + d 23 p 31, c 12 = d 11 p 12 + d 12 p 22 + d 13 p 32, c 22 = d 21 p 12 + d 22 p 22 + d 23 p 32. We will call C the product of D and P and write C = DP. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 14 / 19
Matrix product If A = [a ij ] is an m n matrix and B = [b ij ] is an n p matrix, then the product of A and B is the m p matrix whose (i, j)-entry is the dot product of the ith row of A with the jth column of B. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 15 / 19
Matrix product If A = [a ij ] is an m n matrix and B = [b ij ] is an n p matrix, then the product of A and B is the m p matrix whose (i, j)-entry is the dot product of the ith row of A with the jth column of B. That is, if C = [c ij ] = AB, then c ij = n a ik b kj = a i1 b 1j + a i2 b 2j + + a in b nj. k=1 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 15 / 19
Examples We have [ ] 6 [ ] 1 2 3 3 1 10 1 38 =. 1 0 4 5 22 2 4 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 16 / 19
Examples We have [ ] 6 [ ] 1 2 3 3 1 10 1 38 =. 1 0 4 5 22 2 4 And [ ] [ ] 1 2 0 5 = 1 3 6 1 but [ ] [ ] 0 5 1 2 = 6 1 1 3 [ ] 12 7, 18 2 [ ] 5 15. 5 15 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 16 / 19
Examples We have [ ] 6 [ ] 1 2 3 3 1 10 1 38 =. 1 0 4 5 22 2 4 And [ ] [ ] 1 2 0 5 = 1 3 6 1 but [ ] [ ] 0 5 1 2 = 6 1 1 3 [ ] 12 7, 18 2 [ ] 5 15. 5 15 Note: AB may not be equal to BA even if both exist and are the same size. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 16 / 19
Definition We call the n n matrix 1 0 0 0 0 1 0 0 I =....... 0 0 0 1 the identity matrix. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 17 / 19
Definition We call the n n matrix 1 0 0 0 0 1 0 0 I =....... 0 0 0 1 the identity matrix. If A is m n, then AI n = A. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 17 / 19
Definition We call the n n matrix 1 0 0 0 0 1 0 0 I =....... 0 0 0 1 the identity matrix. If A is m n, then AI n = A. If B is n p, then I n B = B. Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 17 / 19
Octave commands To find the product of matrices A and B: A*B Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 18 / 19
Octave commands To find the product of matrices A and B: A*B To find the 10 th power of a square matrix (that is, a matrix with the same number of rows and columns): A^10 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 18 / 19
Example The system of equations 3x + 4y 7z = 6 x y + z = 5 may be written as [ 3 4 7 1 1 1 ] x y = z [ ] 6. 5 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 19 / 19
Example The system of equations 3x + 4y 7z = 6 x y + z = 5 may be written as [ 3 4 7 1 1 1 ] x y = z [ ] 6. 5 Or as A x = b, where A = [ ] 3 4 7, x = 1 1 1 x y, and b = z [ ] 6. 5 Dan Sloughter (Furman University) Mathematics 13: Lecture 10 January 25, 2008 19 / 19