Chapter 1 Section 1.5 Matrix Operations Matrices A matrix (despite the glamour of the movie) is a collection of numbers arranged in a rectangle or an array. We use variables like A, B, C, …, [capital letter] to stand for a matrix. We use what are called double scripted variables with a lower case letter of the matrix to refer to the entries in a matrix. The numbers in the subscript give the position the variable is located in with the first number referring to the row and the second number the column. The dimensions or order of the matrix is given in the form (number of rows) (number of columns). Don't multiply leave it this way! 4 3 1 a11 a12 0 7 1 a 21 a22 2 a13 a23 a11 4 a12 3 a13 1 a21 0 a22 7 a23 1 2 We name this matrix A This matrix has 2 rows and 3 columns, or has order or dimension 2 3 "read 2 by 3". b11 b12 b13 5 7 3 b 9 12 0 b b 21 22 23 b31 b32 b33 1 4 6 What do we name this? B What is the entry b21? 9 What is the entry b12? 7 What is the variable for 4? b32 What are the dimensions? 33 Matrix Operations Adding & Subtracting Matrices The way that matrices are added or subtracted is to add or subtract their corresponding entries. This means that the matrices must be of the same dimensions or order. If they are not we say the two matrices are not the same dimensions we say the matrices are nonconformable. 4 35 (6) 4 8 2 3 6 5 A B 1 9 3 5 1 3 9 (5) 4 4 12 4 7 10 12 (7) (4) 10 5 6 The matrices C and D are nonconformable. They can not be added even though they both have 6 entries. 4 7 C D 12 3 5 6 1 0 2 6 Matrix C is 2 3 9 1 Matrix D is 1 6 Multiplication by a Scalar We can multiply a matrix by a number (sometimes called a scalar) by multiplying each entry in the matrix by the number. This operation can always be done. We say it is always conformable. 4 2(4) 8 2A 2 3 2(3) 6 7 2(7) 14 1 3 6 2 1 13 (6) B 1 (7) 7 9 12 3 1 3 1 3 1 3 (2) (9) 1 3 1 3 (1) 2 23 (12) 73 3 4 1 3 We can begin to combine more than one operation at a time. 3C 4D 35 2 4 2 1 3(5) 3(2) 4(2) 4(1) 15 6 8 4 7 10 4 28 3E 7 F 34 2 6 7 3 12 6 18 21 1 7 What you get here is nonconformable since the first matrix is 1 3 and the second matrix is 3 1. Vectors in ℝ𝑛 A vector (or column vector) is a matrix with only 1 column. If number of rows (entries or components) is n we call the vector an n-dimensional vector and it is in the set ℝ𝑛 , which consists of all vectors with n rows. 𝑥1 x = ⋮ x is a vector in ℝ𝑛 𝑥𝑛 𝑥1 ℝ𝑛 = ⋮ : 𝑥1 , ⋯ 𝑥𝑛 ∈ ℝ 𝑥𝑛 Linear Combinations of Vectors If each entry in a vector is a linear combination of the variables 𝑥1 , 𝑥2 , ⋯ , 𝑥𝑛 then that vector can be rewritten (expressed) as each variable being multiplied by a vector. We call this a linear combination of vectors. 𝑎11 𝑎12 𝑎1𝑛 𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 𝑎2𝑛 𝑎21 𝑎22 𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑥 + 𝑥 + ⋯ + 𝑥 1 2 𝑛 ⋮ ⋮ ⋮ ⋮ 𝑎𝑚1 𝑎𝑚2 𝑎𝑚𝑛 𝑎𝑚1 𝑥1 + 𝑎𝑚2 𝑥2 + ⋯ + 𝑎𝑚𝑛 𝑥𝑛 2𝑥1 − 𝑥3 2 −1 0 𝑥1 + 5𝑥2 − 7𝑥3 = 𝑥1 1 + 𝑥2 5 + 𝑥3 −7 𝑥2 0 0 1 2𝑥4 − 5𝑥6 2 −5 3𝑥6 = 𝑥4 0 + 𝑥6 1 −2 1 −2𝑥4 + 𝑥6 9 0 9𝑥4 Vector Form of Solution The general solution to a linear system of equation can be expressed as a linear combination of vectors. The number of vectors required to do this is the same as the number of independent variables and a vector for the constants (if required for a nonhomogeneous system). Some examples are given below. Augmented Matrix 1 0 0 0 0 0 0 0 0 −5 1 3 0 0 0 0 1 0 0 0 2 0 0 0 0 1 0 0 0 −1 0 0 3 −2 0 0 0 0 1 0 0 0 0 0 Vector Form General Solution 3 7 2 0 𝒙𝟏 = 𝟑 + 𝟓𝒙𝟑 𝒙𝟐 = 𝟕 − 𝟑𝒙𝟑 + 𝒙𝟒 𝒙𝟓 = 𝟐 2 −5 0 0 3 + 5𝑥3 3 7 7 − 3𝑥3 + 𝑥4 = 0 + 𝑥3 𝑥3 0 𝑥4 2 2 5 −3 1 + 𝑥4 0 0 0 1 0 1 0 𝑥2 = 2 − 2𝑥3 − 3𝑥5 𝑥4 = −5 + 2𝑥5 𝑥1 0 2 − 2𝑥3 − 3𝑥5 2 𝑥3 0 +𝑥 = 1 −5 + 2𝑥5 −5 𝑥5 0 𝑥6 0 1 0 0 +𝑥 3 0 0 0 0 −2 1 +𝑥 5 0 0 0 0 −3 0 +𝑥 6 2 1 0 0 0 0 0 0 1 Multiplying Matrices This is not as obvious an operation as you might think! It is not as easy as addition or subtraction that you get with the corresponding entries! What you do is to multiply each entry in a row on the matrix on the left with its corresponding entry in a column of the matrix on the right and add them up. AB = (rows of matrix A) (columns of matrix B) Look at the example below: 5 2 1 7 2(5) 1(9) 7(6) 10 9 42 23 AB 9 4 5 3 4 ( 5 ) 5 ( 9 ) 3 ( 6 ) 20 45 18 47 6 23 31 The dimensions of the result are given by the rows of A and columns of B. 21 The matrix A is 2 3 and the matrix B is 3 1. The number of columns for the matrix on the right must be the same as the number of rows for the matrix on the left or else they are nonconformable! 6 0 2 4(6) 1(3) 4(0) 1(5) 4(2) 1(1) 27 5 7 3 5 1 CD 4 1 12 13 23 5 3 2 6 0 2 ED 3 5 1 0 4 1 23 23 The matrix E and the matrix D are nonconformable even though they are the same dimensions. The columns and rows do not match up! 3 2 5 3(5) 2(2) 19 FB 1 2 2 1(5) 2(2) 1 If you multiply a 2 2 matrix by a 2 1 matrix you get another 2 1 matrix! Matrix Multiplication and Linear Systems A linear system of equations can be written (expressed) as a matrix equation of the form 𝐴x = b where A is the coefficient matrix, x is a vector consisting of the variables 𝑥1 , 𝑥2 , ⋯ 𝑥𝑛 and b is a vector of the constants. 𝑎11 𝑎21 𝐴x = ⋮ 𝑎𝑚1 𝑎12 𝑎22 ⋮ 𝑎𝑚2 ⋯ ⋯ ⋯ 𝑎1𝑛 𝑎2𝑛 ⋮ 𝑎𝑚𝑛 𝑥1 𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 𝑏1 𝑥2 𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 𝑏2 = = =b ⋮ ⋮ ⋮ 𝑥𝑛 𝑎𝑚1 𝑥1 + 𝑎𝑚2 𝑥2 + ⋯ + 𝑎𝑚𝑛 𝑥𝑛 𝑏3 2𝑥1 + 𝑥3 − 3𝑥4 = 8 𝑥1 + 5𝑥2 + 𝑥4 = 23 𝑥1 + 𝑥2 − 𝑥3 = 5 Matrix Column Vectors The columns of a matrix can be expressed as vectors. The notation 𝐴𝑖 refers to the ith column of matrix A. 3 𝐴= 1 4 0 0 3 6 , 𝐴1 = 1 , 𝐴2 = 6 5 5 4 2 1 1 𝑥 8 0 1 −3 𝑥1 2 5 0 4 𝑥3 = 23 5 1 −1 −1 𝑥4 𝑎11 𝐴= ⋮ 𝑎𝑚1 𝐵= ⋯ 𝑎1𝑛 𝑎11 𝑎1𝑛 ⋱ ⋮ , 𝐴1 = ⋮ , ⋯ , 𝐴𝑛 = ⋮ ⋯ 𝑎𝑚𝑛 𝑎𝑚1 𝑎𝑚𝑛 𝐴 = 𝐴1 , 𝐴2 , ⋯ , 𝐴𝑖 , ⋯ , 𝐴𝑛 4 2 7 8 9 4 7 9 , 𝐵1 = , 𝐵2 = , 𝐵3 = 1 2 8 1 Column Vectors and Linear Systems A linear system of equations written in matrix form as 𝐴x = b can be expressed as linear combination of the column vectors as shown to the right. Column Vectors and Matrix Multiplication The product of a 𝑚 × 𝑝 matrix A and a 𝑝 × 𝑛 matrix B can be formed by taking each column vector of B and multiplying it by the matrix A. 3 𝐴= 4 1 3 −1 , 𝐵 = −2 0 , 𝐵1 = 1 5 1 1 3 0 −1 𝐴𝐵1 = −2 = 4 2 1 5 3 3 0 −1 𝐴𝐵2 = 0 = 4 2 1 1 0 2 𝑎11 𝑎12 𝑎1𝑛 𝑏1 𝑥1 ⋮ + 𝑥2 ⋮ + ⋯ + 𝑥𝑛 ⋮ = ⋮ 𝑎𝑚1 𝑎𝑚2 𝑎𝑚𝑛 𝑏𝑚 𝐴𝐵 = 𝐴𝐵1 , 𝐴𝐵2 , ⋯ , 𝐴𝐵𝑛 𝑏11 𝑏12 𝑏1𝑛 = 𝐴 ⋮ ,𝐴 ⋮ ,⋯,𝐴 ⋮ 𝑏𝑝1 𝑏𝑝2 𝑏𝑝𝑛 1 3 −2 , 𝐵2 = 0 5 1 −2 5 8 13 𝐴𝐵 1 3 3 0 −1 = −2 0 4 2 1 5 1 −2 8 = 5 13