CSE 504 Discrete Mathematics & Foundations of Computer Science

Slides:



Advertisements
Similar presentations
CSNB143 – Discrete Structure
Advertisements

Chapter Matrices Matrix Arithmetic
Mathematics. Matrices and Determinants-1 Session.
CALCULUS – II Matrix Multiplication by Dr. Eman Saad & Dr. Shorouk Ossama.
Matrices MSU CSE 260.
MATRICES. Matrices A matrix is a rectangular array of objects (usually numbers) arranged in m horizontal rows and n vertical columns. A matrix with m.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
3.8 Matrices.
CSE 504 Discrete Mathematics & Foundations of Computer Science
ECON 1150 Matrix Operations Special Matrices
Chapter 3: The Fundamentals: Algorithms, the Integers, and Matrices
Matrices. A matrix, A, is a rectangular collection of numbers. A matrix with “m” rows and “n” columns is said to have order m x n. Each entry, or element,
1 C ollege A lgebra Systems and Matrices (Chapter5) 1.
Lecture 7 Matrices CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Chapter 4 – Matrix CSNB 143 Discrete Mathematical Structures.
Operations with Matrices
Matrices Matrices A matrix (say MAY-trix) is a rectan- gular array of objects (usually numbers). An m  n (“m by n”) matrix has exactly m horizontal.
2009/9 1 Matrices(§3.8)  A matrix is a rectangular array of objects (usually numbers).  An m  n (“m by n”) matrix has exactly m horizontal rows, and.
Module #9: Matrices Rosen 5 th ed., §2.7 Now we are moving on to matrices, section 7.
Chapter 6 Systems of Linear Equations and Matrices Sections 6.3 – 6.5.
Copyright © Cengage Learning. All rights reserved. 7 Linear Systems and Matrices.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Chapter 6 Matrices and Determinants Copyright © 2014, 2010, 2007 Pearson Education, Inc Matrix Operations and Their Applications.
Meeting 18 Matrix Operations. Matrix If A is an m x n matrix - that is, a matrix with m rows and n columns – then the scalar entry in the i th row and.
CSCI 171 Presentation 9 Matrix Theory. Matrix – Rectangular array –i th row, j th column, i,j element –Square matrix, diagonal –Diagonal matrix –Equality.
Matrices Section 2.6. Section Summary Definition of a Matrix Matrix Arithmetic Transposes and Powers of Arithmetic Zero-One matrices.
CALCULUS – III Matrix Operation by Dr. Eman Saad & Dr. Shorouk Ossama.
Chapter 2 … part1 Matrices Linear Algebra S 1. Ch2_2 2.1 Addition, Scalar Multiplication, and Multiplication of Matrices Definition A matrix is a rectangular.
Greatest Common Divisors & Least Common Multiples  Definition 4 Let a and b be integers, not both zero. The largest integer d such that d|a and d|b is.
Copyright © Cengage Learning. All rights reserved. 2 SYSTEMS OF LINEAR EQUATIONS AND MATRICES.
Matrices and Determinants
Section 2.4. Section Summary  Sequences. o Examples: Geometric Progression, Arithmetic Progression  Recurrence Relations o Example: Fibonacci Sequence.
CS 285- Discrete Mathematics Lecture 11. Section 3.8 Matrices Introduction Matrix Arithmetic Transposes and Power of Matrices Zero – One Matrices Boolean.
A very brief introduction to Matrix (Section 2.7) Definitions Some properties Basic matrix operations Zero-One (Boolean) matrices.
Linear Algebra by Dr. Shorouk Ossama.
MTH108 Business Math I Lecture 20.
CSE15 Discrete Mathematics 03/01/17
The Euclidean Algorithm
CSNB 143 Discrete Mathematical Structures
3.8 Matrices L Al-zaid Math1101.
4.5 Matrices.
Properties and Applications of Matrices
Boyce/DiPrima 10th ed, Ch 7.2: Review of Matrices Elementary Differential Equations and Boundary Value Problems, 10th edition, by William E. Boyce and.
MATRICES.
Discrete Structures – CNS2300
Applied Discrete Mathematics Week 5: Mathematical Reasoning
MATHEMATICS Matrix Algebra
4.6 Matrices.
MATHEMATICS Matrix Multiplication
CSE 504 Discrete Mathematics & Foundations of Computer Science
L5 matrix.
Dr. Ameria Eldosoky Discrete mathematics
Applied Discrete Mathematics Week 4: Number Theory
Rosen 5th ed., §2.7 ~18 slides, ~1 lecture
Applied Discrete Mathematics Week 10: Equivalence Relations
Section 7.4 Matrix Algebra.
Sequences and Summations
7.3 Matrices.
Section 2.4 Matrices.
CS100: Discrete structures
Matrices and Matrix Operations
Copyright © 2006 Brooks/Cole, a division of Thomson Learning, Inc.
Properties of Relations
Section 9.4 Matrix Operations
Discrete Mathematics and its Applications
Rosen 5th ed., §2.7 ~18 slides, ~1 lecture
3.8 Matrices L Al-zaid Math1101.
Chapter 8 (Part 2): Relations
Applied Discrete Mathematics Week 4: Functions
Matrices and Determinants
Presentation transcript:

CSE 504 Discrete Mathematics & Foundations of Computer Science Dr. Djamel Bouchaffra Chapter 3 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices Matrices (Section 3.8) © by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Ch. 2 (Part 4) Section 2.7

Introduction Express relationship between elements in set Solve large systems of equations Useful in graph theory CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Example: The matrix is a 3 X 2 matrix. Definition 1 A matrix is a rectangular array of numbers. A matrix with m rows and n columns is called an m x 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. Example: The matrix is a 3 X 2 matrix. CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Definition 2 Let The ith row of A is the 1 x n matrix [ai1, ai2, …, ain]. The jth column of A is the n x 1 matrix The (i, j)th element or entry of A 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. CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

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: CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Cij = ai1b1j + ai2b2j + … + aikbkj. Definition 4 Let A be an m x k matrix and B be a 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. CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Example: Let Find AB if it is defined. Solution: Since A is a 4 x 3 matrix and B is a 3 x 2 matrix, the product AB is defined and is a 4 x 2 matrix. To find the elements of AB, the corresponding elements of the rows of A and the columns of B are first multiplied and then these products are added. For instance, the element in the (3, 1)th position of AB is the sum of the products of the corresponding elements of the third row of A and the first column of B; namely 3 * 2 + 1 * 1 + 0 * 3 = 7. When all the elements of AB are computed, we see that Matrix multiplication is not commutative.

Example: Let Does AB = BA? Solution: We find that Hence, AB  BA. CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Matrix chain multiplication Problem: How should the matrix-chain A1A2…An be computed using the fewest multiplication of integers, where A1A2…An are m1 x m2, m2 x m3, …, mn x m n+1 matrices respectively and each has integers as entries? CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Solution:  2 possibilities to compute A1A2A3 Example: A1 = 30 x 20 (30 rows and 20 columns) A2 = 20 x 40 A3 = 40 x 10 Solution:  2 possibilities to compute A1A2A3 A1 (A2A3) (A1A2)A3 1) First A2A3 requires 20 * 40 * 10 = 8000 multiplications A1(A2A3) requires 30 * 20 * 10 = 6000 multiplications Total: 14000 multiplications. 2) First A1A2 requires 30 * 20 * 40 = 24000 multiplications (A1A2)A3 requires 30 * 40 * 10 = 12000 Total: 36000 multiplications.  (1) is more efficient! CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Transposes and power 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 CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Example: The transpose of the matrix is . Definition 6 Let A = [aij] be an m x n matrix. The transpose of A, denoted At, is the n x m matrix obtained by interchanging the rows and the columns of A. In other words, if At = [bij], then bij = aij for i = 1, 2, …, n and j = 1, 2, …, m. Example: The transpose of the matrix is . CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Example: The matrix is symmetric. 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. Example: The matrix is symmetric. CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Zero-one matrices It is a matrix with entries that are 0 or 1. They represent discrete structures using Boolean arithmetic. We define the following Boolean operations: CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & 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  bij. The join of A and B is denoted A  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. CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Example: Find the join and meet of the zero-one matrices Solution: We find that the joint of A and B is: The meet of A and B is: CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

cij = (ai1  b1j)  (ai2  b2j)  …  (aik  bkj). 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, denoted by A  B, is the m x n matrix with (i, j)th entry [cij] where cij = (ai1  b1j)  (ai2  b2j)  …  (aik  bkj). CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Example: Find the Boolean product of A and B, where Solution: CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Algorithm 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 (aiq  bqj) end {C = [cij] is the Boolean product of A and B} CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Definition 10 Let A be a square zero-one matrix and 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 since the Boolean product of matrices is associative.) We also define A[0] to be In. CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices

Example: Let . Find A[n] for all positive integers n. Solution: We find that We also find that Additional computation shows that The reader can now see that A[n] = A[5] for all positive integers n with n  5.

Exercises 2a p.204 4b p.204 8 p.205 28 p.206 30 p.206 CSE 504, Chapter 2 (Part 4): The Fundamentals: Algorithms, the Integers & Matrices