Further Pure 1 Lesson 1 – Matrices Working & Transformations Definitions Wiltshire A matrix is just a rectangle of numbers. It’s a bit like a two-way table. You met this concept briefly in D1. The matrix below shows how many arcs exist between each node. Definitions Definitions Wiltshire Here are more examples of matrices. 3 1 = 2 × 2 2 5 2 0 3 1 =4×1 2 3 6 2 3 = 2 × 5 4 4 0 1 5 1 0 3 2 9 0 = 3 × 3 5 2 7 You can see that each matrix is a different size. The size (or order) of a matrix is given as rows × columns. What is the order of each of the above matrices? Definitions Wiltshire Here are two special types of matri that you need to be familiar with. The identity matrix, I. 1 0 0 1 0 I3 0 1 0 I2 0 1 0 0 1 1 0 .. 0 0 1 : In : : 0 .. .. 1 The zero matrix, O. 0 0 O2 0 0 0 0 0 O3 0 0 0 0 0 0 0 0 .. 0 0 0 : On : : 0 .. .. 0 Definitions Wiltshire Matrices with the same number of rows and columns are known as square matrices. 2 2 1 6 Identity matrices are always square as the 1`s on the diagonal must run from corner to corner. 1 0 3 2 9 0 5 2 7 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Definitions Wiltshire Two matrices are equal if: They have the same order Each element in one matrix is equal to the corresponding element in the other matrix. Using Matrices (+/-) Wiltshire We can add and subtract matrices only if they have the same order. All you do is add or subtract corresponding elements. 2 2 1 2 0 0 4 2 1 3 0 5 7 1 8 10 1 3 1 2 2 1 2 0 0 0 2 3 0 5 7 1 8 4 1 13 Why can you not add matrices with different orders? Using Matrices (×) Wiltshire You can multiply a matrix by a number as illustrated in the example below. 3 2 2 1 6 6 3 3 0 5 9 0 15 All that has happened is each element has been multiplied by the number outside the matrix. In general for any 2 × 2 matrix. p q ap aq a r s ar as Remember that this will work for any matrix of any order. Problems Wiltshire Explain why matrix addition is Commutative, i.e. A + B = B + A Associative, i.e. A + (B + C) = (A + B) + C Addition in elements is both commutative and associative. Do Ex 1A pg 3 Using Matrices (×) Wiltshire Sometimes you can multiply two matrices together. However not all matrices can be multiplied together. Lets imagine 2 matrices called A and B. If we want to calculate A × B then A must have the same number of columns as B has rows. The sum you do is multiply each element in the 1st row of A by each element in the first column of B, then add together your answers. You then do the same for all the row and column combinations. On the next slide is a worked example. Using Matrices (×) Wiltshire Let A be a 2 × 3 matrix and B be a 3 × 2 matrix. a1 a2 a3 A a 4 a5 a 6 So A × B is given by a1 a2 a 4 a5 b1 b 4 B b 2 b5 b b 6 3 b1 b 4 a1b1 a2b2 a3b3 a3 b2 b5 a6 a 4b1 a5b2 a6b3 b3 b 6 a1b 4 a2b5 a3b6 a 4b 4 a 5b 5 a 6b 6 Now take every element in the first row of A and multiply them by every element in the first column of B, adding your answers. Now repeat with the 2nd row of A and 1st column of B. Next 1st row of A and 2nd column of B. Finally 2nd row of A and 2nd column of B. Using Matrices (×) Wiltshire Try the numerical example below. 2 3 1 A 1 2 4 So A × B is given by. 1 2 B 2 0 4 5 1 2 4 0 2 3 1 2 0 1 2 4 4 5 19 18 Now take every element in the first row of A and multiply them by every element in the first column of B, adding your answers. Now repeat with the 2nd of A and 1st column of B. Next 1st row of A and 2nd column of B. Finally 2nd row of A and 2nd column of B. Using Matrices (×) Wiltshire What would happen if you found B × A. 2 3 1 A 1 2 4 So B × A is given by. 1 2 B 2 0 4 5 9 1 2 4 1 2 3 1 4 0 6 2 2 4 5 1 2 4 9 2 24 What do you notice about this answer compared to the last? From these examples we can conclude that AB = BA So matrix multiplication is not commutative Using Matrices (×) Wiltshire If two matrices A and B have orders p × q and q × r respectively then A × B does exist, and will have order p × r. p q × q r = p Note: In this case B × A does not exist. q p × r q r Associative Wiltshire Use the following matrices to show that matrix multiplication is associative. i.e. A(BC) = (AB)C 2 1 3 0 A 4 0 4 3 0 3 B 4 6 5 1 2 4 0 9 0 C 2 3 9 0 1 0 5 1 2 6 Using Matrices (×) Wiltshire Note that any matrix multiplied by the identity matrix is itself. 2 1 6 1 0 0 2 1 6 3 1 8 0 1 0 3 1 8 6 9 3 0 0 1 6 9 3 And any matrix multiplied by the zero matrix is the zero matrix. 2 1 6 0 0 0 0 0 0 3 1 8 0 0 0 0 0 0 6 9 3 0 0 0 0 0 0 Questions Wiltshire Try some of the following multiplications. 1 1 4 2 10 2 3 2 0 2 3 8 2 5 8 1 3 4 1 7 1 0 0 0 2 3 6 3 1 0 20 6 1 0 8 2 7 2 3 4 2 1 5 1 5 4 10 6 2 0 3 4 1 3 2 1 1 2 0 0 2 5 29 10 4 31 2 3 Example Wiltshire Below is a league table for the group stage of the world cup 2006. The top 2 teams in each group progress through to the next round. Team MP W D L England 3 2 1 0 Paraguay 3 1 0 2 Sweden 3 1 2 0 3 0 1 2 Trinidad and Tobago Use matrix multiplication to calculate the final points and hence state who progressed through to the next round. Solution Wiltshire We can write the league table as a matrix. Next we can add the w d l matrix that represents E 2 1 0 7 the points awarded. 3 P 1 0 2 3 Its important to make 1 sure that the correct S 1 2 0 5 0 points line up with the 1 T 0 1 2 appropriate column. Now we can multiply the two matrices together. This shows us that England and Sweden progressed through to the next group. Summary Wiltshire Matrix addition is Commutative Matrix addition is Associative Matrix multiplication is not Commutative Matrix multiplication is Associative AI = A AO = O