Materials engineering Collage \\ Ceramic & construction materials department Numerical Analysis \\Third stage by \\ Dalya Hekmat Linear Algebra Lecture 2 1.3.7 Matrix Matrix multiplication using Falk s scheme For practical computation we again use Falk s scheme and evaluate AB C in tabular form as follows: B A C A ( 1 2 3 4, B ( 4 3 2 2 1 1 Evaluate AB as follows 4 3 2 2 1 1 1 2 (1 4 + 2 2 (1 3 + 2 1 (1 2 + 2 1 3 4 (3 4 + 4 2 (3 3 + 4 1 (3 2 + 4 1 Place the elements at the intersection of the rows of the left matrix and the columns of the right matrix The result 4 3 2 2 1 1 1 2 (1 4 + 2 2 (1 3 + 2 1 (1 2 + 2 1 3 4 (3 4 + 4 2 (3 3 + 4 1 (3 2 + 4 1 therefore gives AB ( 8 5 4 20 13 10 1
1.3.8 Differences from multiplication with numbers (i Matrix multiplication is not commutative ( 1 2 4 1 ( 2 2 3 1 AB BA ( 1 2 + 2 3 1 2 + 2 1 4 2 + 1 3 4 2 + 1 1 ( 8 4 11 9 ( 2 2 3 1 ( 1 2 4 1 ( 2 1 + 2 4 2 2 + 2 1 3 1 + 1 4 3 2 + 1 1 ( 10 6 7 7 We must be careful how we multiply out! (ii AB 0 does not imply A 0, B 0 or BA 0 ( 1 1 2 2 ( 1 1 1 1 ( 0 0 0 0 ( 1 1 1 1 ( 1 1 2 2 ( 1 1 1 1 2
(iii AC AD does not necessarily imply C D ( 1 1 2 2 ( 2 1 2 2 ( 4 3 8 6 ( 1 1 2 2 ( 3 0 1 3 ( 4 3 8 6 (iv BUT other properties are similar to numbers A(B + C AB + AC A(BC (ABC distributive law associative law 3
1.4 Transpose of a matrix The transpose of a matrix is obtained by interchanging its rows and columns a T ij a ji for i 1,..., m; j 1,..., n The transpose is denoted by a superscript T and the general matrix given in equation (1 becomes a 11 a 21 a 31... a m1 a 12 a 22 a 32... a m2 A T a 13 a 23 a 33... a m3....... a 1n a 2n a 3n... a mn A ( 1 2 3 5 6 7 A T 1 5 2 6 3 7 If A A T then A is a symmetric matrix, e.g. 3 2 1 A 2 7 0 1 0 8 The matrix transpose also satisfies the following rules: i (A T T A for any matrix A; ii (A + B T A T + B T and (AB T B T A T, provided that matrices A and B have compatible dimensions. 4
< Proof of the identity (AB T B T A T If the rows of A R m n are the vectors a T 1, a T 2,..., a T m R n and the columns of B R n p are b 1, b 2,..., b p R n. Taking the transpose of equation (4 a T 1 b 1 a T 2 b 1... a T m b 1 (AB T a T 1 b 2 a T 2 b 2... a T m b p...... a T 1 b p a T 2 b p... a T m b p For column vectors a i and b j vector multiplication a T i b j is defined as the dot product between a i and b j. The dot product is commutative so a T i b j a i b j b j a j b T j a i which implies that b T 1 a 1 b T 1 a 2... b T 1 a m (AB T b T 2 a 1 b T 2 a 2... b T 2 a m...... BT A T b T p a 1 b T p a 2... b T p a m since B T b T 1 b T 2. b T p and AT ( a 1 a 2... a m. > Here and further in these notes, the material between the markers < and > is for advanced reading. 5
1.5 Determinant of a matrix The determinant of a 2 2 matrix ( a11 a A 12 a 21 a 22 is written det A or A or a 11 a 12 a 21 a 22 a 11a 22 a 12 a 21 A ( 1 2 4 7, det A 7 8 15. The determinant of a 3 3 matrix is written as a 11 a 12 a 13 A a 21 a 22 a 23 a 31 a 32 a 33 a 11 a 22 a 23 a 32 a 33 a 12 a 21 a 23 a 31 a 33 + a 13 a 21 a 22 a 31 a 32 a 11 (a 22 a 33 a 32 a 23 a 12 (a 21 a 33 a 31 a 23 + a 13 (a 21 a 32 a 31 a 22 That is the 3 3 determinant is defined in terms of determinants of 2 2 sub-matrices of A. These are called the minors of A. 6
m 12 a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 a 21 a 23 a 31 a 33 is obtained by suppressing the elements in row 1 and column 2 of matrix A. Cofactors The cofactor c ij is defined as the coefficient of a ij in the determinant A. If is given by the formula c ij ( 1 i+j m ij where the minor is the determinant of order (n 1 (n 1 formed by deleting the column and row containing a ij. s c 11 ( 1 1+1 m 11 +1 c 23 ( 1 2+3 m 23 1 a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 a 22a 33 a 32 a 23 a 11a 32 + a 31 a 12 7
General determinant The value of an n n determinant equals the sum of the products of the elements in any row (or column and their cofactors, i.e. n A a ij c ij, for i 1,..., n 1, or n or A j1 n a ij c ij, for j 1,..., n 1, or n i1 For a 3 3 matrix or det A a 11 c 11 + a 12 c 12 + a 13 c 13 det A a 12 c 12 + a 22 c 22 + a 32 c 32 (1st row (2nd column Points to note: the determinant det A is equal to zero if (i rows or columns of A are multiples of each other, (ii rows or columns are linear combinations of each other, (iii entire rows or columns are zero; if det A 0 the matrix A is called a singular matrix; for any square matrices A and B there holds det A det(a T, det(ab det(a det(b. for the unit matrix I one has det I 1. 8
1.6 The matrix inverse The inverse a 1 of a scalar (a number a is defined by a a 1 1. For square matrices we use a similar definition: the inverse A 1 of a n n matrix A fulfils the relation AA 1 I where I is the n n unit matrix defined earlier. Note: if A 1 exists then det(a det(a 1 det(aa 1 det I 1. Hence, det(a 1 (det A 1. The inverse of is given by since AB A B A 1 ( 3 2 7 5 ( 5 2 7 3 5 2 7 3 3 2 (3 5 2 7 ( 3 2 + 2 3 7 5 (7 5 5 7 ( 7 2 + 5 3 which gives as required. AB ( 1 0 0 1 I 9
The matrix inverse can be computed as follows 1. Find the determinant det A 2. Find the cofactors of all elements in A and form a new matrix C of cofactors, where each element is replaced by its cofactor. 3. The inverse of A is now given as A 1 CT det A Note: the inverse A 1 exists if (and only if det A 0. Find the inverse of 1 1 2 A 3 1 2. 3 2 1 det A 1 1 2 2 1 ( 1 3 2 3 1 + 2 3 1 3 2 1 3 + 1 ( 3 + 2 3 6 Since the determinant is nonzero an inverse exists. 10
Calculate the matrix of minors 1 2 2 1 3 2 3 1 M 1 2 2 1 1 2 3 1 1 2 1 2 1 2 3 2 3 3 3 5 7 1 4 8 2 3 1 3 2 1 1 3 2 1 1 3 1 Modify the signs according to whether i + j is even or odd to calculate the matrix of cofactors 3 3 3 C 5 7 1. 4 8 2 It follows that A 1 1 6 CT 1 3 5 4 3 7 8. 6 3 1 2 To check that we have made no mistake we can compute A 1 A 1 3 5 4 1 1 2 1 0 0 3 7 8 3 1 2 0 1 0. 6 3 1 2 3 2 1 0 0 1 This way of computing the inverse is only useful for hand calculations in the cases of 2 2 or 3 3 matrices. 11