Chapter 3 3 8 Matrices Matrix Arithmetic Algorithms



![Matrix Arithmetic • Definition 3: Let A=[aij] and B=[bij] be m x n matrices. Matrix Arithmetic • Definition 3: Let A=[aij] and B=[bij] be m x n matrices.](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-4.jpg)




![Transposes and Powers of Matrices • Definition 6: Let A=[aij] be an m x Transposes and Powers of Matrices • Definition 6: Let A=[aij] be an m x](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-9.jpg)

![Zero-One Matrices • Definition 8: Let A=[aij] and B=[bij] be m x n zero- Zero-One Matrices • Definition 8: Let A=[aij] and B=[bij] be m x n zero-](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-11.jpg)
![Zero-One Matrices • Definition 9: Let A=[aij] be an m x k zero-one matrix Zero-One Matrices • Definition 9: Let A=[aij] be an m x k zero-one matrix](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-12.jpg)


![Zero-One Matrices • Example 11: Let . Find A[n] for all positive integers n. Zero-One Matrices • Example 11: Let . Find A[n] for all positive integers n.](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-15.jpg)
- Slides: 15

Chapter 3 ‒ ‒ 3. 8 Matrices Matrix Arithmetic Algorithms for Matrix Multiplication Transposes and Powers of Matrices Zero-One Matrices 1

Matrix Arithmetic • Definition 1: • A matrix is a rectangular array of numbers. • A matrix with m rows and n columns is called an m × n matrix. • The plural of matrix is matrices. A matrix with the same number of rows as columns is called square. • Two matrices are equal if they have the same number of rows and the same number of columns and the corresponding entries in every position are equal. 2

Matrix Arithmetic • Definition 2: Let • The ith row of A is the 1 x n matrix [ai 1, ai 2, . . . , ain]. • The jth column of A is the n x 1 matrix The (i, j)th element or entry of is the element aij , that is , the number in the ith row and jth column of A. A convenient shorthand notation for expressing the matrix A is to write A =[aij], which indicates that A is the matrix with its (i, j)th element equal to aij. 3
![Matrix Arithmetic Definition 3 Let Aaij and Bbij be m x n matrices Matrix Arithmetic • Definition 3: Let A=[aij] and B=[bij] be m x n matrices.](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-4.jpg)
Matrix Arithmetic • Definition 3: Let A=[aij] and B=[bij] be m x n matrices. The sum of A and B, denoted by A+B, is the m x n matrix that has aij+bij as its (i, j)th element. In other words, A+B= [aij+bij]. • Example 2: we have 4

Matrix Arithmetic • Definition 4: • Let A be an m x k matrix and B be k x n matrix. • The product of A and B, denoted by AB, is the m x n matrix with its (i , j )th entry equal to the sum of the products of the corresponding elements from the ith row of A and the jth column of B. • In other words, if AB=[cij], then cij = ai 1 b 1 j + ai 2 b 2 j +. . . +aikbkj 5

Matrix Arithmetic 6

Algorithms for Matrix Multiplication • Algorithm 1 : Matrix Multiplication procedure matrix multiplication (A, B: matrices) for i : = 1 to m for j : = 1 to n begin cij : =0 for q : = 1 to k cij : =cij + aiqbqj end {C= [cij] is the product of A and B} • Example 6: In which order should the matrices A 1, A 2, and A 3, where • A 1 is 30 x 20 , A 2 is 20 x 40 , A 3 is 40 x 10, • all with integer entries – be multiplied to use the least number of multiplications of integers? 7

Transposes and Powers of Matrices • Definition 5: the identity matrix of order n is the n x n matrix In = [δij] where δij =1 if i = j and δij = 0 if i ≠ j. Hence, 8
![Transposes and Powers of Matrices Definition 6 Let Aaij be an m x Transposes and Powers of Matrices • Definition 6: Let A=[aij] be an m x](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-9.jpg)
Transposes and Powers of Matrices • Definition 6: Let A=[aij] be an m x n matrix. • The transpose of A, denoted by At, is the n x m matrix obtained by interchanging the rows and columns of A. • In other words, if At=[bij], then bij = aji for i=1, 2, . . . , n and j = 1, 2, . . . , m. • Definition 7: A square matrix A is called symmetric if A = At. • Thus A =[aij] is symmetric if aij = aji for all i and j with 1≤ i ≤ n and 1 ≤ j ≤ n. 9

Symmetric Matrix 10
![ZeroOne Matrices Definition 8 Let Aaij and Bbij be m x n zero Zero-One Matrices • Definition 8: Let A=[aij] and B=[bij] be m x n zero-](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-11.jpg)
Zero-One Matrices • Definition 8: Let A=[aij] and B=[bij] be m x n zero- one matrices. • Then the join of A and B is the zero-one matrix with (i , j )th entry aij v bij. The join of A and B is denoted by A v B. • The meet of A and B is the zero-one matrix with (i , j )th entry aij Λ bij. The meet of A and B is denoted by A Λ B. 11
![ZeroOne Matrices Definition 9 Let Aaij be an m x k zeroone matrix Zero-One Matrices • Definition 9: Let A=[aij] be an m x k zero-one matrix](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-12.jpg)
Zero-One Matrices • Definition 9: Let A=[aij] be an m x k zero-one matrix and B=[bij] be a k x n zero-one matrix. • Then the boolean product of A and B, denote by A⊙B , is the m x n matrix with (i , j)th entry cij where • Example 10: find the Boolean product of A and B, where 12

Zero-One Matrices • Algorithm 2: The Boolean Product procedure Boolean product(A, B: zero-one matrices) for i : = 1 to m for j : = 1 to n begin cij : =0 for q : = 1 to k end {C= [cij] is the Boolean product of A and B} 13

Zero-One Matrices • Definition 10: Let A be a square zero-one matrix ant let r be a positive integer. • The rth Boolean power of A is the Boolean product of r factors of A. The rth Boolean product of A is denoted by A[r] • Hence, • (this is well defined because the Boolean product of matrices is associative. ) • We also define A[0] to be In 14
![ZeroOne Matrices Example 11 Let Find An for all positive integers n Zero-One Matrices • Example 11: Let . Find A[n] for all positive integers n.](https://slidetodoc.com/presentation_image_h2/e533838c9539235aaad253514be9fe63/image-15.jpg)
Zero-One Matrices • Example 11: Let . Find A[n] for all positive integers n. 15