As may be seen, addition is carried out by summing corresponding elements within the two matrices. Thus, for example, we add the top left most elements in the two matrices (2 and 5) and place the result (7) in a corresponding position within the matrix which represents the sum. Subtraction is carried out using the same approach: g46742 31 4g4675−g46745 12 4g4675=g4674−3 2−1 0g4675However, we cannot perform the following addition and subtraction operations – the matrices are not of the same order: g467412g4675+g46741 34 5g4675g46741 75 2g4675−g46701 3g4671Note that the addition of two matrices is commutative (A + B = B + A) whereas subtraction is not commutative (A - B ≠B - A). Multiplication of Matrices The multiplication of two matrices is not quite as simple as the addition and subtraction processes described above. Here, each element within the matrix that represents the result is not obtained by multiplication of corresponding elements. Furthermore in order that two matrices can be multiplied, it is not necessary for them to have the same dimensions: Two matrices can be multiplied if the number of columns in the first matrix equals the number of rows in the second. Thus, for example the following two matrices can be multiplied: g46741 2 32 5 4g4675×g34291 2 33 1 52 −1 4g3433whereas the following two matrices cannot be multiplied: g46742 11 6g4675×g34292 31 26 4g3433To illustrate the way in which matrices are multiplied, let us consider a simple example:
Computer Graphics by Sushma Jaiswal, GGV, Bilaspur (C.G.) Sushma Jaiswal g46741 23 4g4675g46745 67 8g4675Notice that it is usual to omit the multiplication sign – the lack of a sign between two matrices is assumed to indicate multiplication. Consider the diagram presented in Figure. In order to obtain element a in the result matrix, we use the first row of the first matrix and the first column of the second matrix (the latter is shown as being arranged as a row and placed above the first matrix). We then multiply the two pairs of elements and add the result. This result provides us with element a in the solution matrix. We then repeat this process using the second row of the first matrix and the first column of the second. Thus we calculate 3 × 5 + 4 × 7 = 43 and this provides element c in the solution matrix. Having operated on both rows of the first matrix using the first column of the second, we now repeat the process – but this time we make use of the second column in the second matrix. In Figure below, we show the generation of element b in the solution matrix. Element d is obtained by using the second column of the second matrix and the second row of the first. When first encountered, the multiplication process can seem complicated and perhaps confusing. However, the key is to remember that we take each of the columns of the second matrix and use these to operate in turn on each row of the first. Returning to the above example, the Figure To multiply matrices we bring together columns of the second matrix with rows of the first. Here, we illustrate the operation performed using the top row of the first matrix with the first column of the second. This provides element a in the solution matrix.