Docsity

Matrix Multiplication in Computer Science: A Beginner's Guide, Lecture notes of Data Structures and Algorithms

Partial preview of the text

Download Matrix Multiplication in Computer Science: A Beginner's Guide and more Lecture notes Data Structures and Algorithms in PDF only on Docsity!

COSC 2436

Matrix Multiplication

Matrix Multiplication

 A basic matrix operation is matrix multiplication. The product of two matrices has many practical applications in engineering and science, including AI.

Matrix Multiplication

 The general pattern for matrix multiplication is as follows.

Example – Finding the Product of Two Matrices

Find the inner product AB  where A = and B =  Solution: First, note that the product is defined because the number of columns of A is equal to the number of rows of B. Moreover, the product AB has dimension 3  2. To find the entries of the product, multiply each row of A by each column of B.

**Multiply rows times columns. **You can only multiply if the number of columns in the 1 st matrix is equal to the number of rows in the 2 nd matrix.  3 2 5 7 1 0         8 2 1 5 0  3           Dimensions: (^) 2 x 3 3 x 2 They must match. The dimensions of your answer.

2  1 3 4        3  9 2 5 7  6       2(3) + -1(5) 2(-9) + -1(7) 2(2) + -1(-6) 3(3) + 4(5)

1  25 10 29 1  18      

1 2 1 1 1 3 2 7 2 6 1 8 x y z                                 3. x  2 yz  1 x  3 y  2 z  7 2 x  6 yz  8

0 1 4 3 1 0 2 5  ^              4. 2 x 2 2 x 2 *Answer should be a 2 x 2 0(4) + (-1)(-2) 0(-3) + (-1)(5) 1(4) + 0(-2) 1(-3) +0(5)  2 - 4 -      

Matrix Exponentiation (II)

Matrix Exponentiation (III)