230 likes | 597 Views
Matrices. MSU CSE 260. Outline. Introduction Matrix Arithmetic: Sum, Product Transposes and Powers of Matrices Identity matrix, Transpose, Symmetric matrices Zero-one Matrices: Join, Meet, Boolean product Exercise 2.6. Introduction.
E N D
Matrices MSU CSE 260
Outline • Introduction • Matrix Arithmetic: • Sum, Product • Transposes and Powers of Matrices • Identity matrix, Transpose, Symmetric matrices • Zero-one Matrices: • Join, Meet, Boolean product • Exercise 2.6
Introduction Definition A matrix is a rectangular array of numbers. element in ith row, jth column Also written as A=aij m rows mn matrix n columns When m=n, A is called a square matrix.
Matrix Equality • Definition Let A and B be two matrices. A=B if they have the same number of rows and columns, and every element at each position in A equals element at corresponding position in B.
Matrix Addition, Subtraction Let A = aij, B = bij be mn matrices. Then: A + B = aij + bij, and A - B = aij - bij
Matrix Multiplication Let A be a mk matrix, and B be a kn matrix,
Matching Dimensions To multiply two matrices, inner numbers must match: Otherwise, not defined. 23 34 24 matrix have to be equal 24 23 34
Multiplicative Properties Note that just because AB is defined, BA may not be. ExampleIf A is 34, B is 46, then AB=36, but BA is not defined (46 . 34). Even if both AB and BA are defined, they may not have the same size. Even if they do, matrices do not commute.
Efficiency of Multiplication 34 23 • a11b12 + a12b22 + a13b32 = c12 • Takes 3 multiplications, and 2 additions for each element. • This has to be done 24 (=8) times (since product matrix is 24). So 243 multiplications are needed. • (mk) (kn) matrix product requires m.k.n multiplications.
Best Order? Let A be a 2030 matrix, B 3040, C 4010. (AB)C or A(BC)? (2030 3040) 4010 32000 2030 (3040 4010) 18000 So, A(BC) is best in this case.
Identity Matrix The identity matrix has 1’s down the diagonal, e.g.: For a mn matrix A, Im A = A In mmmn = mn nn
Inverse Matrix Let A and B be nn matrices. If AB=BA=Inthen B is called the inverse of A, denoted B=A-1. Not all square matrices are invertible.
Use of Inverse to Solve Equations Please note that a-1j is NOT necessarily (aj)-1.
Transposes of Matrices Flip across diagonal Transposes are used frequently in various algorithms.
Symmetric Matrix A is called symmetric. is symmetric. Note, for A to be symmetric, is has to be square. is trivially symmetric...
Power Matrix • For a nn square matrix A, the power matrix is defined as: Ar = A A … A r times • A0 is defined as In.
Zero-one Matrices • All entries are 0 or 1. • Operations are and . • Boolean product is defined using: for multiplication, and for addition.
Boolean Operations Terminology is from Boolean Algebra.Think “join” is “put together”, like union, and “meet” is “where they meet”, or intersect.
Boolean Product (Should be a ‘dot’) Since this is “or’d”, you can stop when you find a ‘1’
Boolean Product Properties • In general, A B B A • Example
Boolean Power • A Boolean power matrix can be defined in exactly the same way as a power matrix. For a nn square matrix A, the power matrix is defined as: A[r] = A A … A r times A[0] is defined as In.