Presentation is loading. Please wait.

Presentation is loading. Please wait.

February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 1 Addition of Integers How do we (humans) add two integers? Example: 7583.

Similar presentations


Presentation on theme: "February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 1 Addition of Integers How do we (humans) add two integers? Example: 7583."— Presentation transcript:

1 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 1 Addition of Integers How do we (humans) add two integers? Example: 7583 +4932 51521 111 carry Binary expansions: (1011) 2 + (1010) 2 10 carry 1 10 1 1( )2)2)2)2

2 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 2 Addition of Integers Let a = (a n-1 a n-2 …a 1 a 0 ) 2, b = (b n-1 b n-2 …b 1 b 0 ) 2. How can we algorithmically add these two binary numbers? First, add their rightmost bits: a 0 + b 0 = c 0  2 + s 0, where s 0 is the rightmost bit in the binary expansion of a + b, and c 0 is the carry. Then, add the next pair of bits and the carry: a 1 + b 1 + c 0 = c 1  2 + s 1, where s 1 is the next bit in the binary expansion of a + b, and c 1 is the carry.

3 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 3 Addition of Integers Continue this process until you obtain c n-1. The leading bit of the sum is s n = c n-1. The result is: a + b = (s n s n-1 …s 1 s 0 ) 2

4 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 4 Addition of Integers Example: Add a = (1110) 2 and b = (1011) 2. a 0 + b 0 = 0 + 1 = 0  2 + 1, so that c 0 = 0 and s 0 = 1. a 1 + b 1 + c 0 = 1 + 1 + 0 = 1  2 + 0, so c 1 = 1 and s 1 = 0. a 2 + b 2 + c 1 = 1 + 0 + 1 = 1  2 + 0, so c 2 = 1 and s 2 = 0. a 3 + b 3 + c 2 = 1 + 1 + 1 = 1  2 + 1, so c 3 = 1 and s 3 = 1. s 4 = c 3 = 1. Therefore, s = a + b = (11001) 2.

5 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 5 Addition of Integers procedure add(a, b: positive integers) c := 0 for j := 0 to n-1 begin d :=  (a j + b j + c)/2  s j := a j + b j + c – 2d c := d end s n := c {the binary expansion of the sum is (s n s n-1 …s 1 s 0 ) 2 }

6 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 6Matrices A matrix is a rectangular array of numbers. A matrix with m rows and n columns is called an m  n matrix. Example: is a 3  2 matrix. A matrix with the same number of rows and columns is called square. Two matrices are equal if they have the same number of rows and columns and the corresponding entries in every position are equal.

7 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 7Matrices A general description of an m  n matrix A = [a ij ]: i-th row of A j-th column of A

8 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 8 Matrix Addition Let A = [a ij ] and B = [b ij ] be m  n matrices. The sum of A and B, denoted by A+B, is the m  n matrix that has a ij + b ij as its (i, j)th element. In other words, A+B = [a ij + b ij ]. Example:

9 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 9 Matrix Multiplication Let A be an m  k matrix and B be a k  n matrix. The product of A and B, denoted by AB, is the m  n matrix with (i, j)th entry equal to the sum of the products of the corresponding elements from the i-th row of A and the j-th column of B. In other words, if AB = [c ij ], then

10 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 10 Matrix Multiplication A more intuitive description of calculating C = AB: - Take the first column of B - Turn it counterclockwise by 90  and superimpose it on the first row of A - Multiply corresponding entries in A and B and add the products: 3  2 + 0  0 + 1  3 = 9 - Enter the result in the upper-left corner of C

11 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 11 Matrix Multiplication - Now superimpose the first column of B on the second, third, …, m-th row of A to obtain the entries in the first column of C (same order). - Then repeat this procedure with the second, third, …, n-th column of B, to obtain to obtain the remaining columns in C (same order). - After completing this algorithm, the new matrix C contains the product AB.

12 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 12 Matrix Multiplication Let us calculate the complete matrix C: 9 8 15 -2 7 15 20 -2

13 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 13 Identity Matrices The identity matrix of order n is the n  n matrix I n = [  ij ], where  ij = 1 if i = j and  ij = 0 if i  j: Multiplying an m  n matrix A by an identity matrix of appropriate size does not change this matrix: AI n = I m A = A

14 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 14 Powers and Transposes of Matrices The power function can be defined for square matrices. If A is an n  n matrix, we have: A 0 = I n, A r = AAA…A (r times the letter A) The transpose of an m  n matrix A = [a ij ], denoted by A t, is the n  m matrix obtained by interchanging the rows and columns of A. In other words, if A t = [b ij ], the b ij = a ji for i = 1, 2, …, n and j = 1, 2, …, m.

15 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 15 Powers and Transposes of Matrices Example: A square matrix A is called symmetric if A = A t. Thus A = [a ij ] is symmetric if a ij = a ji for all i = 1, 2, …, n and j = 1, 2, …, m. A is symmetric, B is not.

16 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 16 Zero-One Matrices A matrix with entries that are either 0 or 1 is called a zero-one matrix. Zero-one matrices are often used like a “table” to represent discrete structures. We can define Boolean operations on the entries in zero-one matrices: ab abababab 000 010 100 111ab abababab000 011 101 111

17 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 17 Zero-One Matrices Let A = [a ij ] and B = [b ij ] be m  n zero-one matrices. Then the join of A and B is the zero-one matrix with (i, j)th entry a ij  b ij. The join of A and B is denoted by A  B. The meet of A and B is the zero-one matrix with (i, j)th entry a ij  b ij. The meet of A and B is denoted by A  B.

18 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 18 Zero-One Matrices Example: Join: Meet:

19 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 19 Zero-One Matrices Let A = [a ij ] be an m  k zero-one matrix and B = [b ij ] be a k  n zero-one matrix. Then the Boolean product of A and B, denoted by A  B, is the m  n matrix with (i, j)th entry [c ij ], where cij = (a i1  b 1j )  (a i2  b 2i )  …  (a ik  b kj ). Note that the actual Boolean product symbol has a dot in its center. Basically, Boolean multiplication works like the multiplication of matrices, but with computing  instead of the product and  instead of the sum.

20 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 20 Zero-One Matrices Example:

21 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 21 Zero-One Matrices Let A be a square zero-one matrix and r be a positive integer. The r-th Boolean power of A is the Boolean product of r factors of A. The r-th Boolean power of A is denoted by A [r]. A [0] = I n, A [r] = A  A  …  A (r times the letter A)

22 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 22 Let’s proceed to… Mathematical Reasoning

23 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 23 Mathematical Reasoning We need mathematical reasoning to determine whether a mathematical argument is correct or incorrect and determine whether a mathematical argument is correct or incorrect and construct mathematical arguments. construct mathematical arguments. Mathematical reasoning is not only important for conducting proofs and program verification, but also for artificial intelligence systems (drawing inferences).

24 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 24Terminology An axiom is a basic assumption about mathematical structured that needs no proof. We can use a proof to demonstrate that a particular statement is true. A proof consists of a sequence of statements that form an argument. The steps that connect the statements in such a sequence are the rules of inference. Cases of incorrect reasoning are called fallacies. A theorem is a statement that can be shown to be true.

25 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 25Terminology A lemma is a simple theorem used as an intermediate result in the proof of another theorem. A corollary is a proposition that follows directly from a theorem that has been proved. A conjecture is a statement whose truth value is unknown. Once it is proven, it becomes a theorem.

26 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 26 Rules of Inference Rules of inference provide the justification of the steps used in a proof. One important rule is called modus ponens or the law of detachment. It is based on the tautology (p  (p  q))  q. We write it in the following way: p p  q ____  q q q q The two hypotheses p and p  q are written in a column, and the conclusion below a bar, where  means “therefore”.

27 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 27 Rules of Inference The general form of a rule of inference is: p 1 p 1 p 2 p 2... p n p n____  q q q q The rule states that if p 1 and p 2 and … and p n are all true, then q is true as well. These rules of inference can be used in any mathematical argument and do not require any proof.

28 February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 28 Rules of Inference p_____  pq pq pq pq Addition pq pq pq pq_____  p p p p Simplification p q_____  pq pq pq pq Conjunction q q q q pq pq pq pq_____  p p p p Modus tollens pq pq pq pq qr qr qr qr_____  pr pr pr pr Hypothetical syllogism pq pq pq pq p p p p_____  q q q q Disjunctive syllogism


Download ppt "February 25, 2002Applied Discrete Mathematics Week 5: Mathematical Reasoning 1 Addition of Integers How do we (humans) add two integers? Example: 7583."

Similar presentations


Ads by Google