Programme 5: Matrices PROGRAMME 5 MATRICES STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions A matrix is a set of real or complex numbers (called elements) arranged in rows and columns to form a rectangular array. A matrix having m rows and n columns is called an m × n matrix. For example: 5 6 7 2 3 8 is a 2 × 3 matrix. STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Row matrix A row matrix consists of a single row. For example: 4 3 7 2 Column matrix A column matrix consists of a single column. For example: 6 3 8 STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Double suffix notation Each element of a matrix has its own address denoted by double suffices, the first indicating the row and the second indicating the column. For example, the elements of 3 × 4 matrix can be written as: a 11 a21 a 31 STROUD a12 a22 a32 a13 a14 a23 a24 a33 a34 Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrix notation Where there is no ambiguity a matrix can be represented by a single general element in brackets or by a capital letter in bold type. a 11 a21 a 31 STROUD a12 a22 a32 a13 a14 a23 a24 can be denoted by aij or by A a33 a34 Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Equal matrices Two matrices are equal if corresponding elements throughout are equal. ( ) ( ) A = B that is aij = bij if aij = bij for all values of i and j STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Addition and subtraction of matrices Two matrices are added (or subtracted) by adding (or subtracting) corresponding elements. For example: 4 5 STROUD 2 3 1 8 9 4 1 2 8 3 9 7 6 3 5 4 5 3 7 5 6 4 5 10 12 8 12 10 Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Multiplication of matrices Scalar multiplication Multiplication of two matrices STROUD Worked examples and exercises are in the text Programme 5: Matrices Multiplication of matrices Scalar multiplication To multiply a matrix by a single number (a scalar), each individual element of the matrix is multiplied by that number. For example: 3 4 6 2 5 12 8 20 1 7 24 4 28 That is: k aij kaij STROUD Worked examples and exercises are in the text Programme 5: Matrices Multiplication of matrices Multiplication of two matrices Two matrices can only be multiplied when the number of columns in the first matrix equals the number of rows in the second matrix. The ijth element of the product matrix is obtained by multiplying each element in the ith row of the first matrix by the corresponding element in the jth column of the second matrix and the element products added. For example: STROUD Worked examples and exercises are in the text Programme 5: Matrices Multiplication of matrices Multiplication of two matrices æ a a12 11 If A = ç çè a21 a22 a13 a23 æ a a12 11 then A.B = ç çè a21 a22 STROUD æ b 11 ö ç ÷ and B = ç b21 ÷ø ç b è 31 a13 a23 æ b ö ç 11 ÷ .ç b21 ÷ø ç è b23 ö ÷ ÷ ÷ ø ö ÷ æ a11b11 +a12 b21 +a13b31 ÷ =ç ÷ çè a21b11 +a22 b21 +a23b31 ø Worked examples and exercises are in the text ö ÷ ÷ø Programme 5: Matrices Multiplication of matrices Multiplication of two matrices If A aij is an n m matrix and B bij is an m q matrix then C = A.B cij is an n q matrix where m c aik bkj ij k 1 STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Transpose of a matrix If a new matrix is formed by interchanging rows and columns the new matrix is called the transpose of the original matrix. For example, if: 4 6 4 7 2 A 7 9 then AT 6 9 5 2 5 STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Special matrices Square matrix Diagonal matrix Unit matrix Null matrix STROUD Worked examples and exercises are in the text Programme 5: Matrices Special matrices Square matrix A square matrix is of order m × m. A square matrix is symmetric if aij a ji . For example: 1 2 5 2 8 9 5 9 4 A square matrix is skew-symmetric if aij a ji . For example: 0 2 5 STROUD 2 0 9 5 9 0 Worked examples and exercises are in the text Programme 5: Matrices Special matrices Diagonal matrix A diagonal matrix is a square matrix with all elements zero except those on the leading diagonal. For example: 5 0 0 STROUD 0 2 0 0 0 7 Worked examples and exercises are in the text Programme 5: Matrices Special matrices Unit matrix A unit matrix is a diagonal matrix with all elements on the leading diagonal being equal to unity. For example: 1 I 0 0 0 1 0 0 0 1 The product of matrix A and the unit matrix is the matrix A: A.I = A STROUD Worked examples and exercises are in the text Programme 5: Matrices Special matrices Null matrix A null matrix is one whose elements are all zero. 0 0 0 0 0 0 0 0 0 0 Notice that A.0 = 0 But that if A.B = 0 we cannot deduce that A = 0 or B = 0 STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Determinant of a square matrix Singular matrix Cofactors Adjoint of a square matrix STROUD Worked examples and exercises are in the text Programme 5: Matrices Determinant of a square matrix Singular matrix Every square matrix has its associated determinant. For example, the determinant of 5 0 8 2 6 4 1 5 2 1 3 is 0 7 8 6 4 3 150 7 The determinant of a matrix is equal to the determinant of its transpose. A matrix whose determinant is zero is called a singular matrix. STROUD Worked examples and exercises are in the text Programme 5: Matrices Determinant of a square matrix Cofactors Each element aij of a square matrix has a minor which is the value of the determinant obtained from the matrix after eliminating the ith row and jth column to which the element is common. The cofactor of element aij is then given as the minor of aij multiplied by 1i j STROUD Worked examples and exercises are in the text Programme 5: Matrices Determinant of a square matrix Adjoint of a square matrix Let square matrix C be constructed from the square matrix A where the elements of C are the respective cofactors of the elements of A so that if: A aij and Aij is the cofactor of aij then C Aij Then the transpose of C is called the adjoint of A, denoted by adjA. STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Inverse of a square matrix If each element of the adjoint of a square matrix A is divided by the determinant of A then the resulting matrix is called the inverse of A, denoted by A-1. A1 1 adjA det A Note: if det A = 0 then the inverse does not exist STROUD Worked examples and exercises are in the text Programme 5: Matrices Inverse of a square matrix Product of a square matrix and its inverse The product of a square matrix and its inverse is the unit matrix: A.A-1 = A-1.A = I STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Solution of a set of linear equations The set of n simultaneous linear equations in n unknowns can be written in matrix form as: STROUD Worked examples and exercises are in the text Programme 5: Matrices Solution of a set of linear equations Since: A.x = b then A1.Ax = A1.b that is I.x = A1.b and I.x = x The solution is then: x = A1.b STROUD Worked examples and exercises are in the text Programme 5: Matrices Solution of a set of linear equations Gaussian elimination method for solving a set of linear equations Given: æ a 11 ç ç a21 ç ç çè an1 a12 a13 a1n a22 a23 a2n an2 an3 ann öæ x 1 ÷ç ÷ ç x2 ÷ç ÷ç ÷ø çè xn æ ö çç b1 ÷ ç ÷ çç b2 ÷ =ç ÷ çç ÷ø ç b ç n è ö ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ø Create the augmented matrix B, where: æ ç a11 ç a B = ç 21 ç ç a çè n1 STROUD a12 a13 a1n a22 a23 a2n an2 an3 ann b1 ö ÷ b2 ÷ ÷ ÷ ÷ bn ÷ø Worked examples and exercises are in the text Programme 5: Matrices Solution of a set of linear equations Gaussian elimination method for solving a set of linear equations æ ç a11 ç a B = ç 21 ç ç a çè n1 a12 a13 a1n a22 a23 a2n an2 an3 ann b1 ö ÷ b2 ÷ ÷ ÷ ÷ bn ÷ø Eliminate the elements other than a11 from the first column by subtracting a21/a11 times the first row from the second row, a31/a11 times the first row from the third row, etc. This gives a new matrix of the form: STROUD Worked examples and exercises are in the text Programme 5: Matrices Solution of a set of linear equations Gaussian elimination method for solving a set of linear equations æ ç a11 ç 0 ç ç ç 0 çè a12 a13 a1n c22 c23 c2n cn2 cn3 cnn b1 ö ÷ d2 ÷ ÷ ÷ ÷ d n ÷ø This process is repeated to eliminate the ci2 from the third and subsequent rows until a matrix of the following form is arrived at: æ a ç 11 ç 0 ç ç 0 ç çè 0 STROUD a1,n-2 a1,n-1 a1n pn-3,n-2 pn-2,n-1 pn-2,n 0 pn-1,n-1 pn-1,n 0 0 pnn b1 ö ÷ q2 ÷ ÷ ÷ ÷ qn ÷ø Worked examples and exercises are in the text Programme 5: Matrices Solution of a set of linear equations Gaussian elimination method for solving a set of linear equations æ a ç 11 ç 0 ç ç 0 ç çè 0 a1,n-2 a1,n-1 a1n pn-3,n-2 pn-2,n-1 pn-2,n 0 pn-1,n-1 pn-1,n 0 0 pnn b1 ö ÷ q2 ÷ ÷ ÷ ÷ qn ÷ø From this augmented matrix we revert to the product: æ a 11 ç ç 0 ç ç 0 ç çè 0 STROUD a1,n-2 a1,n-1 a1n pn-3,n-2 pn-2,n-1 pn-2,n 0 pn-1,n-1 pn-1,n 0 0 pnn öæ x ÷ç 1 ÷ç x ÷ç 2 ÷ç ÷ç x ÷ø è n ö æ b ö 1 ÷ ç ÷ q ÷ ç 2 ÷ ÷ =ç ÷ ÷ ç ÷ ÷ø çè qn ÷ø Worked examples and exercises are in the text Programme 5: Matrices Solution of a set of linear equations Gaussian elimination method for solving a set of linear equations æ a 11 ç ç 0 ç ç 0 ç çè 0 a1,n-2 a1,n-1 a1n pn-3,n-2 pn-2,n-1 pn-2,n 0 pn-1,n-1 pn-1,n 0 0 pnn öæ x ÷ç 1 ÷ç x ÷ç 2 ÷ç ÷ç x ÷ø è n ö æ b ö 1 ÷ ç ÷ ÷ ç q2 ÷ ÷ =ç ÷ ÷ ç ÷ ÷ø çè qn ÷ø From this product the solution is derived by working backwards from the bottom starting with: pnn xn qn so xn STROUD qn pnn Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Matrices – definitions Matrix notation Equal matrices Addition and subtraction of matrices Multiplication of matrices Transpose of a matrix Special matrices Determinant of a square matrix Inverse of a square matrix Solution of a set of linear equations Eigenvalues and eigenvectors STROUD Worked examples and exercises are in the text Programme 5: Matrices Eigenvalues and eigenvectors Equations of the form: A.x x where A is a square matrix and l is a number (scalar) have non-trivial solutions (x ¹ 0) for x called eigenvectors or characteristic vectors of A. The corresponding values of l are called eigenvalues, characteristic values or latent roots of A. STROUD Worked examples and exercises are in the text Programme 5: Matrices Eigenvalues and eigenvectors Expressed as a set of separate equations: æ a 11 ç ç a21 ç : ç çè an1 a12 a13 ... a22 a23 ... : an2 : an3 ... a1n ö æ x1 ÷ç a2n ÷ ç x2 : ÷ç : ÷ç ann ÷ø çè xn ö æ x 1 ÷ ç ÷ = l ç x2 ÷ ç : ÷ ç ÷ø çè xn ö ÷ ÷ ÷ ÷ ÷ø That is: a11x1 + a12 x2 + a13x3 +… + a1n xn = l x1 a21x1 + a22 x2 + a23x3 +… + a2n xn = l x2 : : : : : an1x1 + an2 x2 + an3x3 +… + ann xn = l xn STROUD Worked examples and exercises are in the text Programme 5: Matrices Eigenvalues and eigenvectors These can be rewritten as: æ a -l 11 ç a21 ç ç ç çè an1 a12 a13 a22 - l a23 an2 an3 öæ x 1 ÷ç a2n ÷ ç x2 ÷ç ÷ç ann - l ÷ø çè xn a1n ö æ ö ÷ ç 0 ÷ ÷ ç 0 ÷ ÷ =ç ÷ ÷ ç ÷ø è 0 ÷ø That is: A I .x 0 Which means that, for non-trivial solutions: A I 0 STROUD Worked examples and exercises are in the text Programme 5: Matrices Eigenvalues and eigenvectors Eigenvalues To find the eigenvalues of: 4 A 3 solve the characteristic equation: 4 3 That is: ( 1)( 5) 0 This gives eigenvalues STROUD 1 2 1 0 2 1 1; 2 5 Worked examples and exercises are in the text Programme 5: Matrices Eigenvalues and eigenvectors Eigenvectors 4 1 To find the eigenvectors of A solve the equation A.x x 3 2 For the eigenvalues l = 1 and l = 5 For =1 4 1 x1 x1 k 3 2 x 1 x and so x2 3x1 giving eigenvector 3k 2 2 For =5 x1 4 1 x1 k 5 and so x x giving eigenvector x 3 2 x k 2 1 2 2 STROUD Worked examples and exercises are in the text Programme 5: Matrices Learning outcomes 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 the 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 STROUD Worked examples and exercises are in the text