Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Topic 6: Matrices Introduction A matrix is just a convenient way of arranging and displaying numbers or algebra. The order of a matrix is written as; number of rows x number of columns 2 13 is of order 2 x 3 e.g. 1 3 4 A matrix which has only one column is called a column matrix 2 e.g. 1 is a column matrix of order 3 x 1 3 A matrix which has the same number of rows and columns is called a square matrix. 4 6 is a square matrix of order 2 x 2 e.g. 3 2 Each item in a matrix is called an element. The null matrix is a matrix in which all elements are zero. Example 1 Find x and y in the following x 3 y 2 8 25 (a) 2 y 3 4 125 x 2x 1 7 (b) 6 2 y 4 Solution 1 x 3 y 2 8 25 (a) 2 y 3 4 125 x x3 = -8 x = -2 x² = 4 x = ±2 Therefore x = -2 2x 1 7 (b) 6 2 y 4 2x + 1 =7 2x = 7 – 1 2x = 6 x=6÷2 x=3 3x y 8 (c) 4 x 2 y 14 6 – 2y = 4 6 – 4 = 2y 2 = 2y 2÷2=y 1=y 3x y 8 (c) 4 x 2 y 14 3x + y = 8…………………(A) 4x – 2y = 14 ……………….(B) (A) x 2 (B) + (C) 6x + 2y = 16 …………………….(C) 4x – 2y = 14 6x + 2y = 16 10x = 30 x = 30 ÷ 10 x=3 Substitute x = 3 into (A) 3x3+y=8 9+y=8 y=8–9 y = -1 Solution is x = 3, y = -1 Addition of matrices We can only add matrices if they are of the same order. We then simply add the corresponding elements. Matrix addition is commutative i.e. A + B = B + A Matrix addition is associative i.e. A + (B + C) = (A + B) + C Example 2 2 13 , B = If A = 4 5 1 0 4 3 , and C = 4 1 5 2 38 . Find (A + B) + C 4 69 Solution 2 2 13 0 4 3 2 0 1 4 3 3 2 5 6 = = + A + B = 4 5 1 4 1 5 4 4 5 1 1 5 8 6 6 2 5 6 2 3 8 2 2 5 3 6 8 4 214 + = = (A + B) + C = 8 6 6 4 6 9 8 4 6 6 6 9 12 12 15 Subtraction of matrices We can only subtract matrices if they are of the same order. We then simply subtract corresponding elements. Matrix subtraction is not commutative i.e. A – B B – A Matrix subtraction is not associative i.e. (A – B) – C A – (B – C) Example 3 2 13 , B = If A = 4 5 1 0 4 3 and C = 4 1 5 2 38 find A + (B – C) 4 69 Solution 3 0 4 3 2 3 8 0 2 4 3 3 8 2 7 5 - = = B – C = 4 1 5 4 6 9 4 4 1 6 5 9 0 5 4 2 13 2 7 5 2 2 1 7 3 5 = = + A + (B – C) = 4 5 1 0 5 4 4 0 5 5 1 4 0 8 2 4 0 3 Multiplication of a matrix (a) multiplying a matrix by a number When you multiply a matrix by a number you simply multiply each element by that number. 2 13 e.g. if A = 4 5 1 2 13 2A = 2 x 4 5 1 4 2 6 2A = 8 10 2 (b) multiplying a matrix by another matrix We can only multiply matrices if the number of columns in the first matrix is the same as the number of rows in the second matrix. e.g. If A is of order m x n and B is of order n x p we can do the multiplication A.B because (m x n)(n x p) Same The resulting matrix will be a matrix of order m x p. We can not do multiplication B.A because (n x p)(m x n) Not the same Matrix multiplication is only commutative for square matrices i.e. A.B B.A unless they are square. Matrix multiplication is always associative i.e. (A.B).C = A.(B.C) Example 4 3 1 4 If A = 2 1 3 , B = 1 41 21 1 0 3 2 Which of the products A.B and B.A is possible? Simplify the product which exists. Solution 4 A.B (3 x 3)(3 x 2) Same B.A So A.B exists and the resulting matrix will be 3 x 2B.A (3 x 2)(3 x 3) So B.A does not exist Not the same 3 1 4 2 1 3 2 1 1 4 3 3 1 1 0 4 2 A.B = 2 1 3 . 1 0 = 2 2 1 1 3 3 2 1 1 0 3 2 = 1 4 1 3 2 1 2 4 1 1 3 1 1 4 0 1 2 6 1 12 3 0 8 1911 4 1 9 2 0 6 = 14 8 2 4 3 1 0 2 9 3 Example 5 5 3 x 1 4 1 y 5 Find a system of equations in x and y. Hence find x and y. Solution 5 5 3 x 1 4 1 y 5 5x 3 y 1 4x y 5 5x + 3y = 1 …………………….(A) 4x + y = 5 …………………….(B) 3 x (B) – (A) - Substitute x = 2 into (B) Solution is x = 2, y = -3 12x + 3y = 15 5x + 3y = 1 7x = 14 7x = 14 x = 14 ÷ 7 x=2 4x2+y=5 8+y=5 y=5–8 y = -3 Powers of matrices We can only calculate powers of square matrices. We simply multiply the matrix by itself the appropriate number of times. 3 6 e.g. if X = 1 2 X3 = X.X.X 3 6 3 6 3 3 6 1 3 6 2 6 9 6 18 12 15 30 . = = = X.X = X²= 1 2 1 2 1 3 2 1 6 1 2 2 3 2 6 4 5 10 3 6 15 30 3 15 6 5 3 30 6 10 45 30 90 60 75 150 . = = = X3 = X.X² = 1 2 5 10 1 15 2 5 1 30 2 10 15 10 30 20 25 50 The unit matrix, I, is any square matrix which has 1’s on the diagonal and 0’s everywhere else. 1 0 , e.g. 0 1 1 0 0 01 0, 001 1 0 0 0 01 0 0 0 0 1 0 are all unit matrices. 0001 Example 6 4 2 find a and b such that X² = aX + bI If X = 4 3 Solution 6 4 2 X = 4 3 8 6 4 2 4 2 4 4 2 4 4 2 2 3 16 8 . = = = X² = 4 3 4 3 4 4 3 4 4 2 3 3 16 12 8 9 4 2 4a 2a = aX = a 4 3 4a 3a 1 0 = bI = b 0 1 24 14 28 17 b 0 0 b 4a 2a b 0 4a b 2a + = aX + bI = 4a 3a 0 b 4a 3a b X² = aX + bI 24 14 = 28 17 -4a = -28 a=7 4a + b = 24 4 x 7 + b = 24 28 + b = 24 b = -4 4a b 2a 4a 3a b -2a = -14 a=7 3a+ b = 17 3 x 7 + b = 17 21 + b = 17 b = -4 The inverse of a 2 x 2 matrix To find the inverse of a matrix you must first find its determinant. a b its determinant ,Δ, is defined to be For any 2 x 2 matrix c d Δ = ad – bc The inverse of the matrix is then defined as d b 1 m-1 = c a Δ Notice, we have simply swapped the elements on the leading diagonal and changed the signs of the other two elements. Example 7 4 3 Find the inverse of the matrix A = 1 1 Solution 7 4 3 A = 1 1 Δ = 4 x 1 - -1 x -3 =4–3 =1 1 1 3 A-1= 1 1 4 1 3 A-1= 1 4 When you multiply a matrix by its inverse you get the unit matrix. 4 3 1 3 4 1 3 1 4 3 3 4 4 3 12 12 = = = . A. A-1 = 1 1 1 4 1 1 1 1 1 3 1 4 1 1 3 4 1 0 = I 0 1 Singular matrices If the determinant of a 2 x 2 matrix is 0 it is called a singular matrix. 3 6 e.g. 1 2 Δ=3x2–1x6 =6–6 =0 So this matrix is singular If a matrix is singular it does not have an inverse. Solving simultaneous equations using matrices For any matrix equation AX = B If we multiply both sides of the equation by the inverse of A, A-1 we get A-1.A.X = A-1.B When we multiply a matrix by its inverse we get the unit matrix I, so A. A-1 = I I.X = A-1.B When we multiply a matrix by the unit matrix the matrix is unchanged so I.X = X X = A-1.B Example 8 Find the solution of these simultaneous equations by matrix methods 2x + 3y = 7 5x – 4y = 6 Solution 8 2x + 3y = 7 5x – 4y = 6 2 3 x 7 = 5 4 y 6 A X = B We must first find the inverse of A Δ = 2 x -4 – 5 x 3 = -8 – 15 = -23 A-1 = 1 23 4 3 5 2 Multiplying both sides by A-1 gives A-1.A.X = A-1.B I. X = A-1.B X = A-1.B x 1 4 3 7 = 23 5 2 6 y 1 4 7 3 6 = 23 5 7 2 6 1 28 18 = 23 35 12 1 46 = 23 23 x 2 = y 1 Solution is x = 2, y = 1