Matrix Algebra Review AGEC 317 Material from MATH 141 The ability to manipulate matrices is critical in economics. The following review problems provide matrix algebra definitions and examples of matrix manipulation. 1. A matrix is a rectangular array of numbers, parameters, or variables placed in rows and columns. The elements (members) of the matrix are usually enclosed in brackets. Ordering of the elements into rows and columns is important. The number of rows and the number of columns in a matrix together define the dimension of the matrix. A square matrix is a matrix in which the number of rows, m, equals the number of columns, n. Elements are usually denoted as a ij where a denotes the element in row i and column j. Vectors are special matrixes that contain only one column (column vector) or only one row (row vector). Matrices are associated with linear equations. Answer the following questions as they pertain to matrices, A, B, C, and D: 7 2 6 1 3 4 5 A B 1 C 1 4 4 D 1 3 5 . 2 4 6 3 3 8 2 (a) What is the dimension of each matrix? Write as Gm,n. (b) Which matrix is a square matrix? Column vector? Row vector? (c) What is the value for the following elements a2,3, b1,1, c 2,1, and d3,3? 2. Two matrices can be added or subtracted only if they have the same dimensions. Addition (subtraction) is defined as the addition (subtraction) of each pair of corresponding elements. In general, the rules are aij bij cij or a b c . In addition to matrices A, B, C, and D from question 1, consider the following matrices ij ij ij 2 4 6 32 21 1 E F 2 4 10 G 4 9 1 14 10 4 6 4 3 (a) Find the following matrices A + E, A + F, C + F, G + D, and D + G. (b) Find A - E, and F - C. (c) In general, does the commutative law of addition hold for matrices, that is, does H + K = K + H? 3. Multiplication by a scalar (single number) is accomplished by multiplying every element of a matrix by the scalar. Multiplication by a scalar is commutative, that is, wA = Aw if w is a scalar. If w = 3, find wA, Aw, wF. 4. Although any matrix can be multiplied by a scalar, matrix multiplication (multiplication of two matrices) requires a conformability condition. This condition is that the column dimension of H (the “lead” matrix in the expression HR) must be equal to the row dimension of R (the “lag matrix). In general, if H is of dimension m x n and R is dimension p x q, the matrix product HR will defined if and only if n = p. The dimension of S is m x q. For the product HR = S, each of the elements of S are defined as the sum of products of the elements of a particular row in H and a particular column in R. Given the following 1 4 5 matrices H 2 6 and R , elements of S are found as follows. First, 3 8 7 check for conformability by examining the dimensions: H3,2 and R2,1. The number of columns in H equals the number of rows in R; therefore, the matrices are conformable for multiplication. The dimension of S is the number of rows from H and the number of columns from R, S3,1. S is found as follows s11 h 11r11 h 12 r21 1 * 5 4 * 3 17 s 21 h 21r11 h 22 r21 2 * 5 6 * 3 28 s 31 h 31r11 h 32 r21 8 * 5 7 * 3 61 17 HR S 28 . If R had additional columns, the process would continue. 61 Matrix multiplication can be written using summation notation (see summation review). Each element of the matrix S could be written as 2 s11 h 1i ri1 i 1 2 s 21 h 2i ri 2 i 1 2 s13 h 3i ri 3 i 1 More general, the formula for matrix multiplication in summation notation is n s ij h ik rkj k 1 5. 6. 7. i 1, 2, , m j 1, 2, , p (a) Find the following matrices AB, CD, AG, DC. (b) Does the commutative law of multiplication hold for matrix multiplication, that is, in general, does AB=BA? (c) Does the associative law hold for matrix multiplication, that is, does (AB)C = A(BC)? (d) Does the distributive law hold for matrix multiplication, that is, does A(B+C)=AB+AC or (B+C)A=BA+BC? An identity matrix (usually denoted by I) is a square matrix with ones in its principle diagonal (the diagonal running northwest to southeast) and zeros everywhere else. (a) Write identity matrices of dimensions: 3 x 3, 5 x 5, and 3 x 6. (b) Multiply matrix A by the appropriate identity matrix, I, that is, find AI. Calculate IA, using the appropriate identity matrix. (c) What unique property does the identity matrix have? Identity matrix plays the role of what scalar number in algebra? The null matrix is a matrix of zeros for all elements; it can be of any dimension. Null matrices are usually denoted by 0. (a) Write null matrices of the dimensions: 2 x 2 and 2 x 3. (b) Using matrix A from problem one and a null matrix of dimension 2 x 3, find A 0 and A + 0. What role does the null matrix play? The transpose of a matrix is obtained by interchanging the rows and columns of a matrix. Transpose is usually denoted by a prime symbol, ′, or a superscript T. Properties, which characterize transposes, are: (A′)′ = A (A + B)′ = A′ + B′ (AB)′ =B′ A′. Find A′, B′, C′, D′, and (D′)′. The transpose of a column (row) vector becomes what? 8. Inverse matrix is another type of derived matrix and is denoted by A-1 and is only defined if matrix A is a square matrix. However, not every square matrix has an inverse, squareness is a necessary, but not sufficient condition. If A does not have an inverse, A is a singular matrix. Roughly, speaking singular matrices contain a row that is a multiple of another row. An example of a singular matrix is 2 4 Q . In this matrix, if you multiple each element in the second row by 2, 1 2 you obtains the first row. These rows are linearly dependent, that is one row can be expressed as a linear combination of the other row, namely row 1 = 2 times row 2. We will not find the inverse of matrices of dimensions larger than 3x3 by hand, as this requires considerable algebra, but the use of inverse matrices is very important. Finding the inverse of a 2x2 will give you the idea of what is involved. Finding the inverse requires calculating the determinant. A determinant of a square matrix, denoted by |R|, is a uniquely defined scalar (number) associated with that matrix. To have a determinant, a matrix must be square and be nonsingular, that is, no linearly dependent rows. If the determinant of a matrix equals zero, the matrix cannot be inverted. Next, the cofactor matrix must be found. Cofactor for each element is the determinant of what remains when the row and column of an element are deleted. The cofactor matrix is the matrix of cofactors with alternating signs (+ and -). The adjoint matrix, symbolized by “adj” is the transpose of the cofactor matrix. The inverse is then found as 1 R 1 adj R . R 3 5 Example, find the inverse of the following matrix R . 2 4 First, find the determinant of the 2 x 2 matrix R by multiplying the diagonals and subtracting: R 3 * 4 2 * 5 12 10 2 . Then find the cofactor matrix by crossing out each row and column and finding the determinant of the remaining number. Remember, the determinant of a scalar is the number itself. First, cross out the first row and column, this leaves finding the determinant of |4|. Next, cross out the first row and second column, this leaves |2|. Continuing for the second row and alternating sings one obtains the following cofactor matrix 4 2 4 2 4 5 cof R . The adjoint matrix is adj R . 5 3 5 3 2 3 Finally, the inverse is R 1 1 4 5 2 2.5 . 2 2 3 1 1.5 (a) Find the inverse of the following matrices: 1 2 1 6 1 0 5 KK , JJ , and LL 3 4 1 . 0 2 1 4 0 2 0 For a 3 x 3 matrix the procedure is similar. To find the determinant, expand the cofactors along any row or column (use only one row or column). Starting in the upper right element, alternate signs and then multiple by the element of the row you are expanding around and sum. Using the first row, the determinant of matrix D is 3 5 1 5 1 3 D 2 6 1 2(6 40) 6(2 15) 1(8 9) 9 . If you 8 2 3 2 3 8 expand on the second row, the determinant will equal 9 also. The determinant is unique to the matrix. To find the cofactor matrix, after crossing out the row and column, you are left with a 2 x 2 matrix. You then find the determinant of the 2 x 2 matrix. (b) 9. Show, why the inverse of Q from question 8 does not exist. In economics, matrices are commonly used to organize data and to make manipulation of such data and equations easier. Put the following data observations into a matrix, each row should be a separate observation, whereas each column should correspond to a particular variable. (a) Last night while at the Chicken, you asked four A&M students their GPA, hourly wage, and if they were from Texas (1=yes, no=0). Response were: Joe has a GPA of 3.24, hourly wage of $10/hour and is from Arkansas, Shelly has a GPA of 3.25, does not work, and is from Houston, Temm is from Dallas, makes $4/hour and has a 2.3 GPA, and Frank has a 2.00 GPA, is from Louisiana, and makes $1/hour. Place the data into a matrix. (b) Place the following system of equations into appropriate matrices: 2 x 2 y 4z 9 5x y 3z 12 7 x 2 y 5z 2. Answers and Hints 1. 2. (a) A2,3 B3,1 C1,3 D3,3 (b) B is a column vector, C is a row vector, and D is a square matrix (c) a2,3 = 6, b1,1 = 7, c2,1 does not exist, there are not two rows in C, d3,3 = 8. (a) 35 25 6 AE , 16 14 10 A + F not confirmable for matrix addition, dimensions differ C F 3 8 14 4 10 D G G D 5 12 9 12 7 6 5 (b) 29 17 4 A E F C 1 0 6 12 6 2 (c) Yes, matrix addition is commutative. 3 * 3 3 * 4 3 * 5 9 12 15 wA Aw 3 * 2 3 * 4 3 * 6 6 12 18 3. 4. wF 6 12 30 (a) 7 3 4 5 3 * 7 4 * 1 5 * 3 AB 1 2 4 6 3 2 * 7 4 * 1 6 * 3 CD 18 50 29 52 68 37 AG 56 68 34 DC not conformabl e for matrix multiplica tion 40 36 (b) Matrix multiplication is not commutative. (c) and (d) yes for associative and distributive laws as long as the conformability conditions for multiplication and addition hold. 5. (a) 1 0 0 0 0 0 1 0 0 0 1 0 0 I 3,3 0 1 0 I 5,5 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 3 x 6 is not a square matrix so it is not an identity matrix. 1 0 0 3 4 5 3 4 5 AI 0 1 0 2 4 6 0 0 1 2 4 6 1 0 3 4 5 3 4 5 IA 0 1 2 4 6 2 4 6 (b) (c) 6. Identity matrix has the property that AI = IA = A. It plays the role of the number one. (a) 0 0 A2, 2 . 0 0 0 0 0 A2,3 . 0 0 0 (b) 3 4 5 0 0 0 0 0 0 A0 . 2 4 6 0 0 0 0 0 0 3 4 5 0 0 0 3 4 A0 2 4 6 0 0 0 2 4 5 . 6 The null matrix plays the role of the number zero. 7. 3 A 4 5 2 1 2 1 3 2 6 1 4 B 7 1 3 C 4 D 6 3 8 ( D) 1 3 5 . 4 1 5 2 3 8 2 6 A column vector becomes a row vector and a row vector becomes a column vector. 8. (a) 1 0 KK 1 0 .5 .43 .29 JJ 1 .07 .36 .25 .25 .75 LL 0 0 .5 .75 .25 .25 1 9. (b) Q-1 does not exist because the determinant is equal to zero and division by zero is undefined. |Q| = 2 * 2 - 1 * 4 = 0. Q is a singular matrix. (a) 3.24 3.25 2.30 2.00 (b) 10 0 0 1 4 1 1 0 4 x 9 2 2 5 1 3 y 12 Hint: keep the matrices conformable for 7 2 5 z 2 multiplication.