Presentation is loading. Please wait.

Presentation is loading. Please wait.

Matrix Multiplication

Similar presentations


Presentation on theme: "Matrix Multiplication"— Presentation transcript:

1 Chapter 6 – Intro to Matrices Operations/properties Now  multiplication

2 Matrix Multiplication
The product of matrices A (m x n) and B (n x p) is the m x p matrix C whose entry cij is given by: Check to see if 2 matrices can be multiplied - check for compatibility! Product of matrices A and B can be calculated if : # of columns of A equals # of rows in B

3 Matrix Multiplication Example – Sizes of Matrices and Their Product
A = 3 × 5 matrix ( # columns = 5 ) B = 5 × 3 matrix (# rows = 5) so #columns_A = #rows_B  COMPATIBLE! Product AB is then a 3 × 3 matrix (#rows_A × #columns_B) And(!) BA = 5 × 5 matrix product of 5 × 3 and 3 × 5  5 × 5

4 Matrix Multiplication
Example – Sizes of Matrices and Their Product Assume: C = 3 × 5 matrix (how many columns?) 5 D = 7 × 3 matrix (how many rows?) Are they compatible? Nope! What about product DC ? (different order of multiplication)?

5 Matrix Multiplication
Example – Sizes of Matrices and Their Product Now: D = 7 × 3 matrix (how many columns?) C = 3 × 5 matrix ( how many rows?) 3 So, product CD is undefined, but DC ~is~ defined. Size/dimension of product DC? product of 7 × 3 and 3 × 5  7 × 5

6 Matrix Multiplication
Example – Sizes of Matrices and Their Product In general a m × n matrix is compatible with a n × p matrix and product is matrix of size m × p [m × n ] [n × p ] = [m × p]

7 Matrix Multiplication
Example – Sizes of Matrices and Their Product Try: Compatible or undefined? Size of product? 3 × 6 times 6 × 5 ? 6 × 5 times 3 × 6 ? 2 × 3 times 2 × 3 ? 1 × 4 times 4 × 1 ? 4 × 1 times 1 × 4 ? bird × cat times cat × dog ? So, product CD is undefined, but DC ~is~ defined. Size/dimension of product DC? DC is a 7 × 5 matrix. In general a m × n is compatible with a n × p and product is a matrix of size m × p

8 Matrix Multiplication Example – Sizes of Matrices and Their Product
Try: Compatible or undefined? Size of product? 3 × 6 times 6 × 5 ? Yes, compatible: 3 × 5 6 × 5 times 3 × 6 ? Undefined 2 × 3 times 2 × 3 ? Undefined 1 × 4 times 4 × 1 ? Yes, compatible: 1 × 1 4 × 1 times 1 × 4 ? Yes, compatible: 4 × 4 bird × cat times cat × dog? Yes, compatible: bird × dog

9 Example – Matrix Products
× 3 times 3 × 1  1 × 1 want first row & first column First row of matrix on left? First column of matrix on right? Multiply/add/combine: C11 = 2(4) + 5(0) + 1(2) = = 10 Product: 𝟏𝟎

10 Example – Matrix Products
− × 3 times 3 × 1  2 × 1 𝑪𝟏𝟏 𝐶21 want first row & first column First row of matrix on left? First column of matrix on right? Multiply/add/combine: C11 = 1(1) + 4(-1) + 6(3) = 1 + (-4) = 15 Product: 𝟏𝟓 b. c. d.

11 Example – Matrix Products
− × 3 times 3 × 1  2 × 1 𝟏𝟓 𝐶21 want second row & first column Second row of matrix on left? First column of matrix on right? Multiply/add/combine: C21 = 2(1) + 0(-1) + 3(3) = = 11 Product: 𝟏𝟓 𝟏𝟏 b. c. d.

12 Example – Matrix Products
1 2 0 − × 3 times 3 × 2  2 × 2 𝑪𝟏𝟏 𝐶12 𝐶21 𝐶 (need four entries) C11? First row (left matrix), first column (right): & : C11 = 1(1) + 2(3) + 0(5) = = 7 C12? First row (left matrix), second column(right): & : C12 = 1(2) + 2(4) + 0(6) = = 10

13 Example – Matrix Products
1 2 0 − × 3 times 3 × 2  2 × 2 𝟕 𝟏𝟎 𝑪𝟐𝟏 𝑪𝟐𝟐 C21? Second row (left matrix), first column (right): & : C21 = -2(1) + 0(3) + 5(5) = = 23 C22? Second row (left matrix), second column(right): & : C22 = -2(2) + 0(4) + 5(6) = = 26

14 Example – Matrix Products – Try it …!
2 5 − × 3 times 3 × 2  3 × 2 𝑪𝟏𝟏 𝑪𝟏𝟐 𝑪𝟐𝟏 𝑪𝟐𝟐 𝑪𝟑𝟏 𝑪𝟑𝟐 (need six entries) C11? First row (left matrix), first column (right): C11 = ? C12? First row (left matrix), second column(right): C12 =

15 Example – Matrix Products – Try it …!
2 5 − × 3 times 3 × 2  3 × 2 𝑪𝟏𝟏 𝑪𝟏𝟐 𝑪𝟐𝟏 𝑪𝟐𝟐 𝑪𝟑𝟏 𝑪𝟑𝟐 (need six entries) C11? First row (left matrix), first column (right): C11 = 2(1) + 5(3) + (-1)(5) = = 12 C12? First row (left matrix), second column(right): C12 = 2(2) + 5(4) + (-1)(6) = – 6 = 18 𝟏𝟐 𝟏𝟖 ? ? ? ?

16 Example – Matrix Products – Try it …!
2 5 − × 3 times 3 × 2  3 × 2 𝟏𝟐 𝟏𝟖 𝑪𝟐𝟏 𝑪𝟐𝟐 𝑪𝟑𝟏 𝑪𝟑𝟐 C21? Second row (left matrix), first column (right): C21 = ? C22? Second row (left matrix), second column(right): C22 =

17 Example – Matrix Products – Try it …!
2 5 − × 3 times 3 × 2  3 × 2 𝑪𝟏𝟏 𝑪𝟏𝟐 𝑪𝟐𝟏 𝑪𝟐𝟐 𝑪𝟑𝟏 𝑪𝟑𝟐 C21? Second row (left matrix), first column (right): C21 = 1(1) + 4(3) + (0)(5) = = 13 C22? Second row (left matrix), second column(right): C22 = 1(2) + 4(4) + (0)(6) = = 18 𝟏𝟐 𝟏𝟖 𝟏𝟑 𝟏𝟖 ? ?

18 Example – Matrix Products – Try it …!
2 5 − × 3 times 3 × 2  3 × 2 𝟏𝟐 𝟏𝟖 𝟏𝟑 𝟏𝟖 𝑪𝟑𝟏 𝑪𝟑𝟐 C31? Third row (left matrix), first column (right): C31 = 0(1) + 3(3) + (7)(5) = = 44 C32? Third row (left matrix), second column(right): C32 = 0(2) + 3(4) + (7)(6) = = 54 𝟏𝟐 𝟏𝟖 𝟏𝟑 𝟏𝟖 𝟒𝟒 𝟓𝟒

19 Example – Matrix Products
b. c.

20 If Note that A(BC) = (AB)C. Example – Associative Property
compute ABC in two ways. Solution 1: 𝑨 𝑩𝑪 = 1 −2 −3 − − = 1 −2 −3 − − = −𝟒 −𝟗 −𝟏𝟖 −𝟏𝟑 Solution 2: 𝐀𝐁 𝐂= 1 −2 −3 − − = 1 −2 −5 −13 −4 − = −𝟒 −𝟗 −𝟏𝟖 −𝟏𝟑 Note that A(BC) = (AB)C.

21 Two Special Matrices (Identities)
Identity for addition: zero matrix  O Aij = 0 for all i, j Identity matrix for multiplication  I Aij = 1 for all i = j Aij = 0 for all i ≠ j (all matrix elements on diagonal are 1, all others 0) E.g: A+O = 𝟏 𝟐 𝟑 𝟒 + 𝟎 𝟎 𝟎 𝟎 = 𝟎 𝟎 𝟎 𝟎 + 𝟏 𝟐 𝟑 𝟒 = O+A = 𝟏 𝟐 𝟑 𝟒 = A AI = 𝟏 𝟐 𝟑 𝟒 𝟏 𝟎 𝟎 𝟏 = 𝟏 𝟎 𝟎 𝟏 𝟏 𝟐 𝟑 𝟒 = 𝟏 𝟐 𝟑 𝟒 = A

22 Solution: Example – Matrix Operations Involving I and O If
compute each of the following. Solution:

23 Given the price and the quantities, calculate the total cost.
Example – Cost Vector Given the price and the quantities, calculate the total cost. Solution: The cost vector is

24 in matrix form by using matrix multiplication.
Example – Matrix Form of a System Using Matrix Multiplication Write the system in matrix form by using matrix multiplication. Solution: If then the single matrix equation is


Download ppt "Matrix Multiplication"

Similar presentations


Ads by Google