* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download matrix
Tensor operator wikipedia , lookup
Linear algebra wikipedia , lookup
Bra–ket notation wikipedia , lookup
System of linear equations wikipedia , lookup
Capelli's identity wikipedia , lookup
Cartesian tensor wikipedia , lookup
Quadratic form wikipedia , lookup
Eigenvalues and eigenvectors wikipedia , lookup
Rotation matrix wikipedia , lookup
Jordan normal form wikipedia , lookup
Determinant wikipedia , lookup
Four-vector wikipedia , lookup
Symmetry in quantum mechanics wikipedia , lookup
Singular-value decomposition wikipedia , lookup
Matrix (mathematics) wikipedia , lookup
Non-negative matrix factorization wikipedia , lookup
Perron–Frobenius theorem wikipedia , lookup
Matrix calculus wikipedia , lookup
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 a11 a A 21 an1 a12 a22 • The ith row of A is the 1 x n matrix [ai1,ai2,. . .,ain]. a1n • The jth column of A is a2 n the n x 1 matrix a1 j a 2j an 2 The (i, j)th element or entry of is the element aij , a nj 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. ann 3 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 1 2 3 0 2 4 1 3 3 1 0 1 4 3 1 4 1 0 3 2 2 2 1 3 5 2 4 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 = ai1b1j + ai2b2j +. . . +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 A1, A2, and A3, where • A1 is 30x20 , A2 is 20x40 , A3 is 40x10, • 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, 1 0 0 0 0 1 0 0 In 0 0 0 1 8 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 Zero-One Matrices • Definition 8: Let A=[aij] and B=[bij] be m x n zeroone 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 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 with (i , j)th entry cij where cij = (a i1 b1j ) ( a i2 b 2j ) . . . (a ik b kj ) • Example 10: find the Boolean product of A and B, 1 0 where 1 1 0 A 0 1, B 0 1 1 1 0 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 cij := cij (a iq b qj ) 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, A[r] A ⊙ A ⊙ A ⊙⊙ A r times • (this is well defined because the Boolean product of matrices is associative.) • We also define A[0] to be In 14 Zero-One Matrices • Example 11: Let 0 0 1 . A 1 0 0 1 1 0 Find A[n] for all positive integers n. 15