2.1 Matrix Operations Notation: An m x n matrix A can be written in two ways: 1. In terms of the columns of A: a1 a2 an 2. In terms of the entries of A: a11 A ai1 am1 a1 j aij amj a1n ain amn The diagonal entries are a11, a22 , a33... . The zero matrix is 0 0 0 0 0 0 0 0 0 0 1 Theorem 1: Let A, B, and C be matrices of the same size and let r and s be scalars. Then: a. A B B A b. A B C A B C c. A 0 A d .r A B rA rB e.r s A rA sA f .r sA rs A Matrix Multiplication: Recall: multiplying B and x results in the vector Bx. Multiplying A times Bx transforms Bx into the vector A(Bx). So, A(Bx) is the composition of two mappings: x → Bx → A(Bx). When we define the product AB, we define it so that A(Bx) = (AB)x. 2 Suppose A is m x n and B is n x p where B b1 b 2 b p and x1 x x p Then, Bx x1b1 x2b 2 x pb p and ABx Ax1b1 x2b 2 x pb p Ax1b1 Ax2b 2 Ax pb p x1 Ab1 x2 Ab 2 x p Ab p Ab1 Ab 2 x1 Ab p x2 xp Therefore, ABx Ab1 Ab 2 Ab p x We define AB Ab1 Ab 2 Ab p , so A(Bx) = (AB)x. 3 Example: Compute AB where 4 2 2 3 A 3 5 B & 6 7 0 1 AB Ab1 Ab2 4 2 2 3 5 6 0 1 42 2 6 32 56 02 16 4 2 3 5 3 7 0 1 4 3 2 7 3 3 5 7 0 3 1 7 -4 - 24 6 2 26 7 -4 2 - 24 26 6 7 4 Note: Ab1 is a linear combo of the columns of A, and Ab2 is a linear combo of the columns of A. ►Each column of AB is a linear combo of the columns of A using weights from the corresponding columns of B. The definition is more important than being able to multiply matrices by hand. Example: Suppose A is 4 x 3 and B is 3 x 2. What is the size of AB? What is the size of BA? In general, if A is m x n and B is n x p, then AB is m x p. An Alternate method for Computing AB Let 2 3 2 3 6 0 1 A B 1 0 1 4 7 5 22 30 64 2 3 01 67 12 00 14 1 3 01 17 28 36 2 10 Note: BA is 3 x 3. Multiplication is not commutative, but matrices have some of the properties of real numbers. Theorem 2 If A is an m x n matrix and B and C have sizes for which the indicated sums and products are defined, a. (AB)C = A(BC) b. A(B + C) = AB + AC c. (B + C)A = BA + CA d. r(AB)= (rA)B = A(rB) for any scalar r. e. ImA = A = AIn 6 WARNINGS These properties are analogous to those we have for real numbers, but not all properties of real numbers apply to matrices. 1. No commutativity 2. If AB = AC, then B may not equal C. 3. It is possible to have AB = 0 and A ≠ 0 and B ≠ 0. Powers of A A A A k k times Example: 3 1 0 1 3 2 3 1 0 1 3 9 4 0 1 0 1 0 2 3 2 3 2 0 2 1 0 21 8 7 Transposes If A is an m x n matrix, the transpose of A is the n x m matrix, denoted by AT, whose columns are formed by the corresponding rows of A. Example: 1 2 3 4 5 A 6 7 8 9 8 7 6 5 4 3 1 2 T A 3 4 5 6 7 8 9 8 7 6 5 4 3 Example: 1 2 1 2 0 0 1 A B 3 0 1 2 4 Compute: AB, (AB)T, ATB T, BTA T 8 1 4 1 1 T AB AB 1 10 4 10 1 3 1 0 2 T T A B 2 0 2 1 4 0 1 7 3 10 2 0 4 2 1 4 1 3 1 0 2 T T B A 2 0 2 1 4 0 1 1 1 4 10 We notice that (AB)T = BTA T. This is not a coincidence. 9 Theorem 3: Let A and B denote matrices whose sizes are appropriate for the following sums and products. T T a. A A b. A B AT BT T c.rA r AT for any scalar r T d . AB BT AT T 10