Matrices PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document introduces matrices, explaining their properties, and how to perform different matrix operations. The document is suitable for an undergraduate-level mathematics course.
Full Transcript
# Programme 5: Matrices ## Learning Outcomes When you have completed this Programme you will be able to: - Define a matrix - Understand what is meant by the equality of two matrices - Add and subtract two matrices - Multiply a matrix by a scalar and multiply two matrices together - Obtain the tran...
# Programme 5: Matrices ## Learning Outcomes When you have completed this Programme you will be able to: - Define a matrix - Understand what is meant by the equality of two matrices - Add and subtract two matrices - Multiply a matrix by a scalar and multiply two matrices together - Obtain the transpose of a matrix - Recognize special types of matrix - Obtain the determinant, cofactors and adjoint of a square matrix - Obtain the inverse of a non-singular matrix - Use matrices to solve a set of linear equations using inverse matrices - Use the Gaussian elimination method to solve a set of linear equations - Evaluate eigenvalues and eigenvectors ## Matrices - Definitions A matrix is a set of real or complex numbers (or elements) arranged in rows and columns to form a rectangular array. A matrix having m rows and n columns is called an m x n (i.e. 'm by n') matrix and is referred to as having order m x n. A matrix is indicated by writing the array within brackets. For example, the matrix: ``` 1 5 7 ( 2 6 3 8 ) ``` is a 2 x 3 matrix, i.e. a '2 by 3' matrix, where 5, 7, 2, 6, 3, 8 are the elements of the matrix. Note that when describing a matrix, the number of rows is stated first and the number of columns second. For example, the matrix: ``` 5 6 4 2 -3 2 7 8 7 6 7 5 ``` is a matrix of order 4 x 3, i.e. 4 rows and 3 columns. The matrix: ``` 6 4 0 1 2 3 ``` is of order 3 x 2. And the matrix: ``` ( 2 5 3 4 6 7 4 9 ) ``` is of order 2 x 4. A matrix is simply an array of numbers. There is no arithmetical connection between the elements and it therefore differs from a determinant in that the elements cannot be multiplied together in any way to find a numerical value of the matrix. A matrix has no numerical value. Also, in general, rows and columns cannot be interchanged as was the case with determinants. *Row matrix:* A row matrix consists of 1 row only. For example, (4 3 7 2) is a row matrix of order 1 x 4. *Column matrix:* A column matrix consists of 1 column only. For example, the matrix: ``` ( 6 3 8 ) ``` is a column matrix of order 3 x 1. To conserve space in printing, a column matrix is sometimes written on one line but with ‘curly’ brackets, e.g. {638} is the same column matrix of order 3 x 1. ## Matrix Notation Where there is no ambiguity, a whole matrix can be denoted by a single general element enclosed in brackets, or by a single letter printed in bold type. This is a very neat shorthand and saves much space and writing. For example: ``` ( A11 A12 A13 A14 a21 A22 A23 a24 A31 A32 A33 A34 ``` can be denoted by (aij) or (a) or by A. Similarly ``` ( x1 x2 x3 ) ``` can be denoted by (xi) or (x) or simply by x For an (m x n) matrix, we use a bold capital letter, e.g. A. For a row or column matrix, we use a lower-case bold letter, e.g. x. (In handwritten work, we can indicate bold-face type by a wavy line placed under the letter, e.g. A or x.) So, if B represents a 2 x 3 matrix, write out the elements bij in the matrix, using the double suffix notation. This gives: ``` B = ( b11 b12 b13 b21 b22 b23 ) ``` ## Equal Matrices By definition, two matrices are said to be equal if corresponding elements throughout are equal. Thus, the two matrices must also be of the same order. For Example; ``` 4 6 = ( 2 3 ) ``` If A11 = 4; a12 = 6; a13 = 5; a21 = 2; etc. Therefore, if (aij) = (xij) then aij = xij for all values of i and j. For example; If: ``` ( a b c d e f g h k ) = ( 5 -7 3 2 0 4 8 6 0 ) ``` Then: d =..... b =..... a - k=..... d = 1 b = 7 a - k = -3 ## Addition and Subtraction of Matrices To be added or subtracted, two matrices must be of the same order. The sum or difference is then determined by adding or subtracting corresponding elements. For example; ``` ( 4 2 3 5 7 6 ) + ( 1 8 9 3 5 4 ) = ( 4+1 2+8 3+9 5+3 7+5 6+4 ) = ( 5 10 12 8 12 10 ) ``` and ``` ( 6 -3 9 4 ) - ( 2 10 3 -2 11 ) = ( 6-2 -3-10 9-3 4-11 ) = ( 4 -13 6 -7 ) ``` Therefore, given the matrices: (a) ``` ( 2 3 6 5 ) + ( 1 8 3 4 0 5 ) =...... ``` (b) ``` ( 5 2 7 1 0 4 8 3 6 ) - ( 1 2 3 4 5 6 7 8 9 ) =...... ``` ## Multiplication of Matrices ### Scalar Multiplication To multiply a matrix by a single number (i.e. a scalar), each individual element of the matrix is multiplied by that factor: For example; ``` 4 x ( 3 5 1 7 ) = ( 12 20 4 28 ) ``` i.e. in general, k(aij) = (kaij). It also means that, in reverse, we can take a common factor out of every element - not just one row or one column as in determinants. Therefore, ``` ( 3 10 25 45 35 15 50. ) ``` can be written: ``` 5 x ( 3 5 9 10 ) ``` ### Multiplication of Two Matrices Two matrices can be multiplied together only when the number of columns in the first is equal to the number of rows in the second. For example, if: ``` A = ( aij ) = ( A11 A12 A13 A21 A22 A23 ) ``` and ``` b = ( bi ) = ( b1 ) = ( b1 b2 b3 ) ``` Then: ``` A.b = ( aij ) ( bi ) = ( A11 A12 A13 A21 A22 A23 ) ( b1 b2 b3 ) = ( a11b1 + a12b2 + a13b3 a21b1 + a22b2 + a23b3 ) ``` i.e. each element in the top row of A is multiplied by the corresponding element in the first column of b and the products added. Similarly, the second row of the product is found by multiplying each element in the second row of A by the corresponding element in the first column of b. **Example 1** ``` ( 2 3 6 4 7 1 ) ( 8 5 3 1 6 9 ) = ( 2x8 + 3x5 + 6x9 4x8 + 7x3 + 1x9 ) = ( 32+15+54 32+21+9 ) = ( 121 62 ) ``` Similarly: ``` ( 2 3 5 1 4 6 3 0 7 1 42 ) ( 2 4 9 ) =.... ``` In just the same way, if A = 8 and B = then AB = ``` A = ( 1 6 2 0 3 4 ) ``` ``` b= ( 3 4 0 5 ) ``` A.b = ``` ( 85 17 ) ``` The same process is carried out for each row and column. **Example 2** If A = (aij) = and B = (bij) = ``` A = ( 1 5 2 7 3 4 ) ``` ``` B = ( 8 4 3 1 2 5 8 6 ) ``` Then: ``` A.B = ( 1 5 2 7 3 4 ) ( 8 4 3 1 2 5 8 6 ) ``` ``` = ( 1x8+5x2 1x4+5x5 1x3+5x8 1x1+5x6 2x8+7x2 2x4+7x5 2x3+7x8 2x1+7x6 3x8+4x2 3x4+4x5 3x3+4x8 3x1+4x6 ) ``` ``` = ( 8+10 4+25 3+40 1+30 16+14 8+35 6+56\ 24+8 12+20 9+32 3+24 ) ``` ``` = ( 18 29 43 31 30 43 62 44 32 32 41 27 ) ``` Note that multiplying a (3 x 2) matrix and a (2 x 4) matrix gives a product matrix of order (3 x 4) i.e. order (3x2) x order (2 x 4) → order (3 x 4). In general then, the product of an (1x m) matrix and an (mxn) matrix has order (1 x n). If A = ``` A = ( 2 4 6 3 9 5 ) ``` and B = ``` B= ( 7 1 -2 9 4 3 ) ``` then A.B =..... since A.B = ``` A.B = ( 2 4 6 3 9 5 ) ( 7 1 -2 9 4 3 ) ``` ``` = ( 14-8-24 2+36+18 21-18+20 3+81+15 ) ``` ``` = ( 30 56 23 99 ) ``` **Example 3** It follows that a matrix can be squared only if it is itself a square matrix, i.e. the number of rows equals the number of columns. If: ``` A = ( 4 7 2 5 ) ``` A²= (4 7) (4 7) = ``` A²= ( 4 7 2 5 ) ( 4 7 2 5 ) ``` ``` = ( 16+35 28 +14 20+10 35+4 ) ``` ``` = ( 51 42 30 39 ) ``` Remember that multiplication of matrices is defined only when: - the number of columns in the first - equals the number of rows in the second That is correct. If: ``` ( 1 5 6 4 9 7 2 3 5 ) ( 2 3 8 7 1 1 ) ``` has no meaning. If A is an (m x n) matrix and B is an (n x m) matrix then products A.B and B.A are possible. **Example** If: ``` A = ( 1 2 3 4 5 6 ) ``` and: ``` B = ( 7 10 8 11 9 12 ) ``` then: ``` A.B = ( 1 2 3 4 5 6 ) ( 7 10 8 11 9 12 ) ``` ``` = ( 7+16+27 10+22+36 28+40+54 40+55+72 ) ``` ``` = ( 68 50 122 167 ) ``` and: ``` B.A = ( 7 10 8 11 9 12 ) ( 1 2 3 4 5 6 ) ``` ``` = ( 7+40 14+50 21+60 8+44 16+55 24+66 9+48 18+60 27+72 ) ``` ``` = ( 47 64 81 52 71 90 57 78 99 ) ``` Note that, in matrix multiplication, A.B ≠ B.A, i.e. multiplication is not commutative. The order of the factors is important! In the product A.B, - B is pre-multiplied by A - A is post-multiplied by B. So, if: ``` A = ( 5 2 7 4 3 1 ) ``` and: ``` B = ( 9 2 4 - 2 3 6 ) ``` Then: A.B =..... and B.A =..... ``` A.B = ( 41 16 32 55 26 52 25 9 18 ) ; B.A = ( 71 30 29 14 ) ``` ## Transpose of a matrix If the rows and columns of a matrix are interchanged: - the first row becomes the first column, - the second row becomes the second column, - the third row becomes the third column, etc., then the new matrix so formed is called the transpose of the original matrix. If A is the original matrix, its transpose is denoted by A or AT. We shall use the latter. For example: If: ``` A = ( 4 6 7 2 5 ) ``` Then: ``` A = ( 4 7 5 6 2 9 ) ``` Therefore, given that: ``` A = ( 2 7 6 3 1 5 ) ``` and: ``` B = ( 4 0 3 7 1 5 ) ``` Then: ``` A.B = ( 35 79 20 32 ) ``` and: ``` (A.B) = ( 35 20 79 32 ) ``` ## Special Matrices *Square Matrix:* is a matrix of order m × m. For example: ``` ( 1 2 5 6 8 9 1 7 4 ) ``` is a 3 x 3 matrix *Symmetric Matrix:* A square matrix (aij) is symmetric if aij = aji. For example, ``` ( 1 2 5 2 8 9 5 9 4 ) ``` i.e. it is symmetrical about the leading diagonal. Note that A = AT. *Skew-Symmetric Matrix:* A square matrix (aij) is skew-symmetric if aij = - aji. For example: ``` ( 0 2 5 -2 0 9 -5 -9 0 ) ``` In that case, A = -AT. *Diagonal Matrix:* is a square matrix with all elements zero except those on the leading diagonal. For example: ``` ( 5 0 0 0 2 0 0 0 7 ) ``` *Unit Matrix:* is a diagonal matrix in which the elements on the leading diagonal are all unity, i.e. ``` ( 1 0 0 0 1 0 0 0 1 ) ``` The unit matrix is denoted by I. If A = ``` A= ( 5 2 4 1 3 8 7 9 6 ) ``` and: I= ``` I= ( 1 0 0 0 1 0 0 0 1 ) ``` Then: A.I =..... i.e. A.I = A A.I = ``` ( 5 2 4 1 3 8 7 9 6 ) ( 1 0 0 0 1 0 0 0 1 ) ``` ``` = ( 5 2 4 1 3 8 7 9 6 ) ``` Similarly, if we form the product I.A we obtain: ``` I.A = ( 1 0 0 0 1 0 0 0 1 ) ( 5 2 4 1 3 8 7 9 6 ) ``` ``` = ( 5+0+0 2+0+0 4+0+0 0+1+0 0+3+0 0+8+0 0+0+7 0+0+9 0+0+6 ) ``` ``` = ( 5 2 4 1 3 8 7 9 6 ) ``` I.A = A.I = A Therefore, the unit matrix I behaves very much like the unit factor in ordinary algebra and arithmetic. *Null Matrix:* A null matrix is one whose elements are all zero. For example: ``` ( 0 0 0 0 0 0 0 0 0 ) ``` i.e. and is denoted by O. If A.B = O, then A ≠ 0 or B ≠ 0. For example, if A = (2 1 -3) and B = (2 1 -3) then: ``` A = ( 2 1 -3 -9 6 3 ) ``` and: ``` B = ( 2 1 -3 -9 6 3 ) ``` Then: ``` A.B = ( 2 1 -3 -9 6 3 ) ( 2 1 -3 -9 6 3 ) ``` ``` = ( 2+4-6 2+12-18 4-6 18-6-12 54-18-36 ) ``` ``` = ( 0 0 0 0 0 0 0 0 0 ) ``` That is, A.B = O, but clearly A ≠ 0 and B≠ 0. Now a short revision exercise. Do these without looking back. **1)** If A = (4 6 5 7) and B = (3 -1 3 2 3 8) determine (a) A + B and (b) A – B. **2)** If: ``` A = ( 4 3 2 7 ) ``` and: ``` B = ( 3 2 8 5 9 4 ) ``` Determine (a) 5A; (b) A.B; (c) В.А. **3)** If A = (2 5 7) and B = (4 2 6) then A.B = ____ and B.A = ______. **4)** Given that: ``` A = ( 4 2 6 1 8 7 ) ``` Determine (a) AT and (b) A.AT. When you have completed them, check your results with the next frame. **Here are the solutions. Check your results.** **(1)** (a) A+B= (6 14 8 8 3 5) (b) A - B = (-2 2 2 8 -1 3 2) (c) B.A = (50 80 -1 32 36 32 64 20 38 18 60 34 54 20) **(2)** (a) 5A = (20 15 10 35) (b) A.B = 41 26 (c) B.A = 50 80 -1 32 36 32 64 20 38 18 60 34 54 20. **(3)** A.B = (2 1 2 3 2 3 is not possible since the number of columns in the first must be equal to the number of rows in the second. **(4)** ``` A = ( 4 2 6 1 8 7 ) ``` ``` A = ( 4 1 2 8 6 7 ) ``` ``` A.AT = ( 4 2 6 1 8 7 ) ( 4 1 2 8 6 7 ) ``` ``` = ( 16+4+36 4+16+42 4+16+42 1+64+49 ) ``` ``` = ( 56 62 62 114 ) ``` ## Determinant of a Square Matrix The determinant of a square matrix is the determinant having the same elements as those of the matrix. For example: if: The determinant of: ``` ( 5 2 1 0 6 3 8 4 7 ) ``` The value of this determinant: ``` ( 5 2 1 0 6 3 8 4 7 ) ``` is: 5(42-12)-2(0-24)+1(0-48) = 5(30)-2(-24)+1(-48) =150+48-48 = 150. Note that the transpose of the matrix: ``` ( 5 0 8 2 6 4 1 3 7 ) ``` is: ``` ( 5 0 8 2 6 4 1 3 7 ) ``` And the determinant of the transpose is: 5(42-12)-0 (14-4)+8(6-6) = 5(30) = 150. That is, the determinant of a square matrix has the same value as that of the determinant of the transposed matrix. A matrix whose determinant is zero is called a _singular matrix_. The determinant of the matrix: ``` ( 3 2 5 4 7 9 1 8 6 ) ``` has the value:..... And the determinant value of the diagonal matrix: ``` ( 2 0 0 0 5 0 0 0 4 ) ``` has the value: The determinant of: ``` ( 3 2 5 4 7 9 1 8 6 ) ``` is 3(-30)-2(15)+5(25) = 5. and the determinant of: ``` ( 2 0 0 0 5 0 0 0 4 ) ``` is 2(20)+0+0 = 40 ## Cofactors If A = (aij) is a square matrix, we can form a determinant of its elements: ``` A11 A12 A13..... A1n A21 A22 A23..... A2n A31 A32 A33..... A3n : : : : An1 An2 An3..... Ann ``` Each element gives rise to a cofactor, which is simply the minor of the element in the determinant together with its ‘place sign’, which was described in detail in the previous programme. For example, the determinant of the matrix: ``` A = ( 2 3 5 4 1 6 1 4 0 ) ``` is: det A = |A| = ``` A = ( 2 3 5 4 1 6 1 4 0 ) ``` which has a value of 45. The minor of the element 2 is: ``` ( 1 6 4 0 ) ``` = 0-24 = -24. The place sign is +. Therefore the cofactor of the element 2 is +(-24) i.e. -24. Similarly, the minor of the element 3 is: ``` ( 4 6 1 0 ) ``` = 0-6 = -6. The place sign is -. Therefore the cofactor of the element 3 is -(-6) = 6. In each case the minor is found by striking out the line and column containing the element in question and forming a determinant of the remaining elements. The appropriate place signs are given by: ``` + - + - + - + - + ``` alternate plus and minus from the top left-hand corner which carries a + Therefore, in the example above, the minor of the element 6 is: ``` ( 2 3 1 4 ) ``` i.e. 8-3 = 5. The place sign is -. Therefore the cofactor of the element 6 is -5. So, for the matrix: ``` ( 7 1 -2 6 3 8 4 5 9 ) ``` the cofactor of the element 3 is: ____ and that of the element 4 is: ____ Cofactor of 3 is ``` ( 4 -10 3 -1 ) ``` = 4-(-10) = 14 Cofactor of 4 is ``` ( 56 -3 ) ``` = (56-3) = -53 ## Adjoint of a Square Matrix If we start afresh with A = ``` A = ( 2 3 5 4 1 6 1 4 0 ) ``` its determinant: ``` A = ( 2 3 5 4 1 6 1 4 0 ) ``` is: det A = |A| = ``` ( 2 3 5 4 1 6 1 4 0 ) ``` from which we can form a new matrix C of the cofactors. ``` C = ( A11 A12 A13 A21 A22 A23 A31 A32 A33 ) ``` Where - A11 is the cofactor of a11 - A22 is the cofactor of a22 etc. ``` A11 = 6 ( 4 0 1 4 ) ``` = +(0-24) = -24 ``` A12 = ( 4 6 1 0 ) ``` = (0 -6) = -6 ``` A13 = ( 4 1 1 4 ) ``` = +(16 -1) = 15 ``` A21 = ( 3 5 4 0 ) ``` = -(0-20) = 20 ``` A22 = ( 2 5 1 0 ) ``` = +(0-5) = -5 ``` A23 = - ( 2 3 1 4 ) ``` = -(8-3) = -5 ``` A31 = ( 3 5 1 6 ) ``` = +(18-5) = 13 ``` A32 = ( 2 5 4 6 ) ``` = (12-20) = -8 ``` A33 = ( 2 3 4 1 ) ``` = +(2-12) = -10... The matrix of cofactors is C = ``` C = ( A11 A12 A13 A21 A22 A23 A31 A32 A33 ) ```... The matrix of cofactors is C = ``` C= ( -24 6 15 20 -5 -5 13 8-10 ) ``` And the transpose of C, i.e. CT = ``` CT= ( -24 20 13 6 -5 8 15 -5 -10 ) ``` This is called the adjoint of the original matrix A and is written adj A. Therefore, to find the adjoint of a square matrix A: (a) we form the matrix C of cofactors, (b) we write the transpose of C, i.e. CT. Hence the adjoint of: ``` ( 5 2 1 3 1 4 4 6 3 ) ``` is:..... ``` adj A = CT = ( -21 7 0 -11 - 17 -1 14 - 22 1 ) ``` ## Inverse of a Square Matrix The adjoint of a square matrix is important, since it enables us to form the inverse of the matrix. If each element of the adjoint of A is divided by the value of the determinant of A, i.e. |A|, (provided |A| ≠ 0), the resulting matrix is called the inverse of A and is denoted by A -1. For the matrix which we used in the last frame, A = (2 3 5) ``` A = ( 2 3 5 4 1 6 1 4 0 ) ``` det A = |A| = ``` ( 2 3 5 4 1 6 1 4 0 ) ``` = 2(0-24)-3(0-6)+5(16-1) = 45. the matrix of cofactors: ``` C = ( -24 6 -5 15 -5 -5 13 8 -10 ) ``` and the adjoint of A is: ``` adj A = C = ( 15 -5 -5 13 8 -10 -24 6 -5 ) ``` Then the inverse of A is given by: ``` A-1 = 1 A adj A ``` ``` A-1 = 1 45 ( -24 20 13 6 -5 8 15 -5 -10 ) ``` ``` A-1 = ( -24 20 13 15 -5 -10 -24 20 13 6 -5 8 15 -5 -10 6 -5 8 15 -5 -10 6 -5 8 15 -5 -10 ) ``` Therefore, to form the inverse of a square matrix A: (a) Evaluate the determinant of A, i.e. |A| (b) Form a matrix C of the cofactors of the elements of A (c) Write the transpose of C, i.e. CT, to obtain the adjoint of A (d) Divide each element of CT by |A| (e) The resulting matrix is the inverse A¯¹ of the original matrix A. Let us work through an example in detail: To find the inverse of A = ``` A = ( 1 2 3 4 1 5 6 0 2 ) ``` (a) Evaluate the determinant of A, i.e. |A|. A =...... |A| =