1 / 51

Chapter 2: Integers and Mathematical Induction

Chapter 2: Integers and Mathematical Induction. Discrete Mathematical Structures: Theory and Applications. Learning Objectives. Learn about the basic properties of integers Become aware how integers are represented in computer memory

luyu
Télécharger la présentation

Chapter 2: Integers and Mathematical Induction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 2:Integers and Mathematical Induction Discrete Mathematical Structures: Theory and Applications

  2. Learning Objectives • Learn about the basic properties of integers • Become aware how integers are represented in computer memory • Explore how addition and subtraction operations are performed on binary numbers • Learn how the principle of mathematical induction is used to solve problems Discrete Mathematical Structures: Theory and Applications

  3. Learning Objectives • Learn about loop invariants and how they are used to prove the correctness of loops • Explore various properties of prime numbers • Learn about linear Diophantine equations and how to solve them Discrete Mathematical Structures: Theory and Applications

  4. Integers • Properties of Integers Discrete Mathematical Structures: Theory and Applications

  5. Integers Discrete Mathematical Structures: Theory and Applications

  6. Integers Discrete Mathematical Structures: Theory and Applications

  7. Integers Discrete Mathematical Structures: Theory and Applications

  8. Integers Discrete Mathematical Structures: Theory and Applications

  9. Integers Discrete Mathematical Structures: Theory and Applications

  10. Integers • The div and mod operators • div • a div b = the quotient of a and b obtained by dividing a on b. • Examples: • 8 div 5 = 1 • 13 div 3 = 4 • mod • a mod b = the remainder of a and b obtained by dividing a on b • 8 mod 5 = 3 • 13 mod 3 = 1 Discrete Mathematical Structures: Theory and Applications

  11. Integers Discrete Mathematical Structures: Theory and Applications

  12. Integers Discrete Mathematical Structures: Theory and Applications

  13. Integers Discrete Mathematical Structures: Theory and Applications

  14. Integers Discrete Mathematical Structures: Theory and Applications

  15. Integers • Relatively Prime Number Discrete Mathematical Structures: Theory and Applications

  16. Integers • Least Common Multiples Discrete Mathematical Structures: Theory and Applications

  17. Representation of Integers in Computer • Electrical signals are used inside the computer to process information • Two types of signals • Analog • Continuous wave forms used to represent such things as sound • Examples: audio tapes, older television signals, etc. • Digital • Represent information with a sequence of 0s and 1s • Examples: compact discs, newer digital HDTV signals Discrete Mathematical Structures: Theory and Applications

  18. Representation of Integers in Computers • Digital Signals • 0s and 1s – 0s represent low voltage, 1s high voltage • Digital signals are more reliable carriers of information than analog signals • Can be copied from one device to another with exact precision • Machine language is a sequence of 0s and 1s • The digit 0 or 1 is called a binary digit , or bit • A sequence of 0s and 1s is sometimes referred to as binary code Discrete Mathematical Structures: Theory and Applications

  19. Representation of Integers in Computers • Decimal System or Base-10 • The digits that are used to represent numbers in base 10 are 0,1,2,3,4,5,6,7,8, and 9 • Binary System or Base-2 • Computer memory stores numbers in machine language, i.e., as a sequence of 0s and 1s • Octal System or Base-8 • Digits that are used to represent numbers in base 8 are 0,1,2,3,4,5,6, and 7 • Hexadecimal System or Base-16 • Digits and letters that are used to represent numbers in base 16 are 0,1,2,3,4,5,6,7,8,9,A ,B ,C ,D ,E , and F Discrete Mathematical Structures: Theory and Applications

  20. Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications

  21. Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications

  22. Representation of Integers in Computers • Two’s Complements and Operations on Binary Numbers • In computer memory, integers are represented as binary numbers in fixed-length bit strings, such as 8, 16, 32 and 64 • Assume that integers are represented as 8-bit fixed-length strings • Sign bit is the MSB (Most Significant Bit) • Leftmost bit (MSB) = 0, number is positive • Leftmost bit (MSB) = 1, number is negative Discrete Mathematical Structures: Theory and Applications

  23. Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications

  24. Representation of Integers in Computers • One’s Complements and Operations on Binary Numbers Discrete Mathematical Structures: Theory and Applications

  25. Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications

  26. Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications

  27. Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications

  28. Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications

  29. Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications

  30. Mathematical Deduction Discrete Mathematical Structures: Theory and Applications

  31. Mathematical Deduction • Proof of a mathematical statement by the principle of mathematical induction consists of three steps: Discrete Mathematical Structures: Theory and Applications

  32. Mathematical Deduction • Assume that when a domino is knocked over, the next domino is knocked over by it • Show that if the first domino is knocked over, then all the dominoes will be knocked over Discrete Mathematical Structures: Theory and Applications

  33. Mathematical Deduction • Let P(n) denote the statement that then nth domino is knocked over • Show that P(1) is true • Assume some P(k) is true, i.e. the kth domino is knocked over for some • Prove that P(k+1) is true, i.e. Discrete Mathematical Structures: Theory and Applications

  34. Mathematical Deduction • Assume that when a staircase is climbed, the next staircase is also climbed • Show that if the first staircase is climbed then all staircases can be climbed • Let P(n) denote the statement that then nth staircase is climbed • It is given that the first staircase is climbed, so P(1) is true Discrete Mathematical Structures: Theory and Applications

  35. Mathematical Deduction • Suppose some P(k) is true, i.e. the kth staircase is climbed for some • By the assumption, because the kth staircase was climbed, the k+1st staircase was climbed • Therefore, P(k) is true, so Discrete Mathematical Structures: Theory and Applications

  36. Mathematical Deduction Discrete Mathematical Structures: Theory and Applications

  37. Mathematical Deduction • Preconditions and Postconditions • User of algorithm need not be concerned with how the algorithm is implemented • He or she must know how to use the algorithm and what the algorithm does • Precondition • Assertion (set of statements) that remains true before algorithm executes • Postcondition • Assertion that is true after algorithm executes Discrete Mathematical Structures: Theory and Applications

  38. Mathematical Deduction • Loop Invariant • Set of statements that remains true each time the loop body is executed • Example: the syntax of a while loop is: while booleanExpression do loopBody • The booleanExpression is evaluated. If the booleanExpression evaluates to true ,the loopBody executes. After executing the loopBody ,the booleanExpression is evaluated again. Then the loopBody continues to execute as long as the booleanExpression evaluates to true . Discrete Mathematical Structures: Theory and Applications

  39. Mathematical Deduction • Loop Invariant Example (continued) • The booleanExpression is either true or false. It is a statement. • Let q denote the booleanExpression Discrete Mathematical Structures: Theory and Applications

  40. Mathematical Deduction • We can associate a predicate, P(n). The predicate P(n) is such that: Discrete Mathematical Structures: Theory and Applications

  41. Prime Numbers • For any positive integer n > 1, the integers 1 and n are called the trivial positive divisors of n • An integer n > 1 is a prime integer if and only if n has only trivial positive divisors • An integer n > 1 is a composite integer if and only if n has a nontrivial positive divisor Discrete Mathematical Structures: Theory and Applications

  42. Prime Numbers Discrete Mathematical Structures: Theory and Applications

  43. Prime Numbers Discrete Mathematical Structures: Theory and Applications

  44. Prime Numbers Example: Consider the integer 131. Observe that 2 does not divide 131. We now find all odd primes p such that p2 131. These primes are 3, 5, 7, and 11. Now none of 3, 5, 7, and 11 divides 131. Hence, 131 is a prime. Discrete Mathematical Structures: Theory and Applications

  45. Prime Numbers Discrete Mathematical Structures: Theory and Applications

  46. Prime Numbers • Factoring a Positive Integer • The standard factorization of n Discrete Mathematical Structures: Theory and Applications

  47. Prime Numbers • Fermat’s Factoring Method Discrete Mathematical Structures: Theory and Applications

  48. Prime Numbers • Fermat’s Factoring Method Discrete Mathematical Structures: Theory and Applications

  49. Linear Diophantine Equations • Diophantine equation: Algebraic equation in one or more unknowns with integer coefficients for which integer solutions are sought • Such an equation may have no solution, a finite number of solutions, or an infinite number of solutions • The famous equation xn +yn = zn of Fermat’s Last Theorem is also a Diophantine equation Discrete Mathematical Structures: Theory and Applications

  50. Linear Diophantine Equations Discrete Mathematical Structures: Theory and Applications

More Related