Presentation is loading. Please wait.

Presentation is loading. Please wait.

1.  The set N = {1,2,3,4,……..} is known as natural numbers or the set of positive integers  The natural numbers are used mainly for :  counting  ordering.

Similar presentations


Presentation on theme: "1.  The set N = {1,2,3,4,……..} is known as natural numbers or the set of positive integers  The natural numbers are used mainly for :  counting  ordering."— Presentation transcript:

1 1

2  The set N = {1,2,3,4,……..} is known as natural numbers or the set of positive integers  The natural numbers are used mainly for :  counting  ordering and  defining other concepts like generating pseudorandom numbers, assigning memory location to files, encrypting & decrypting messages, etc. 2

3  Associative law (a + b) + c = a + (b + c) (a * b) * c = a * (b * c)  Commutative law a + b = b + c a * b = b * a  Distributive Law a * (b + c) = a * b + a * c  Additive identity a + 0 = 0 + a = a  Multiplicative identity a * 1 = 1 * a = a  Additive inverse a + (-a) = (-a) + a = 0 3

4 4 Prime A +ve integer greater than 1 that has no +ve divisor 1 and the number itself. Composite A +ve integer that has atleast one +ve divisor other than 1 & the number itself or which is not prime Fundamental Theorem of Arithmetic Every +ve integer n > 1 can uniquely be written as product of prime numbers. Find the prime factorization of 100, 999, 1024

5 Let b be a +ve integer > 1. Then any +ve integer n can be uniquely expressed as n = a k b k + a k-1 b k-1 + ….. + a 1 b + a 0 where k is a non-negative integer, a 0, a 1, a 2,…, a k are nonnegative integers  b, and a k ≠ 0 If n = 351, b = 2 351 = 1. 2 8 + 0. 2 7 + 1. 2 6 + 0. 2 5 + 1. 2 4 + 1. 2 3 + 1. 2 2 + 1. 2 1 + 1. 2 0 (351) 10 = (101011111) 2 5

6 If a and b are integers and m is a +ve integer, then a is congruent to b modulo m a  b (mod m) if m divides a - b  a  b (mod m) iff a mod m = b mod m 1) Determine whether 17 is congruent to 5 modulo 6 and whether 24 and 14 are congruent modulo 6. 2) List five integers that are congruent to 4 modulo 12 3) Decide whether each of the integers 80, 103, -29, -122 is congruent to 5 modulo 17 6

7  For direct access in file handling, the program is supplied with a key. Using this key, the program has to locate the required record of information.  Let K be set of keys and A be set of physical addresses. A function h : K  A is called hash function if h(k) = k mod m where k  K and m is the number of memory locations.  A hashing function h assigns memory location h(k) to the record that has k as its key. 7

8 8 Example  If m=111,  h(037149212) = 037149212 mod 111 = 65  h(064212848) = 064212848 mod 111 = 14  h(107405723) = 107405723 mod 111 = 14 This situation creates a collision. To remove collision, there are two methods:  Linear Probe  Chaining

9 is a method of mathematical proof typically used to establish a given statement for all natural numbers. Principle of Mathematical Induction Let P(n) be a statement about a natural number n  N that is either true or false. The purpose of induction is to show that P(n) is true for all n  N. 9

10  Basis Step is to prove the given statement for the first natural number.  Inductive Step is to prove the given statement for any one natural number implies the given statement for the next natural number. 10

11  Basis Step: P(1) is true  Inductive Step: Assume that P(k) is true for any k  N then prove that P(k+1) is true By principle of mathematical induction, P(n) is true for all n  N 11

12 Example: Use mathematical induction to prove S n = 2 + 4 + 6 + 8 +... + 2n = n(n + 1) for every positive integer n. 1.Show that the formula is true when n = 1. S 1 = n(n + 1) = 1(1 + 1) = 2 True 2.Assume the formula is valid for some integer k. Use this assumption to prove the formula is valid for the next integer, k + 1 and show that the formula S k + 1 = (k + 1)(k + 2) is true. S k = 2 + 4 + 6 + 8 +... + 2k = k(k + 1) Assumption 12

13  Example continued:  S k + 1 = 2 + 4 + 6 + 8 +... + 2k + [2(k + 1)] = 2 + 4 + 6 + 8 +... + 2k + (2k + 2) = S k + (2k + 2) Group terms to form S k. = k(k + 1) + (2k + 2) Replace S k by k(k + 1). = k 2 + k + 2k + 2 Simplify. = k 2 + 3k + 2 = (k + 1)(k + 2) = (k + 1)((k + 1)+1)  The formula S n = n(n + 1) is valid for all positive integer values of n. 13

14 Assumption True Group terms to form S k. 14 Replace S k by k(k + 1).

15  The formula is valid for all positive integer values of n. 15 Example continued: Simplify.

16 Prove by Induction (Sums of Powers of Integers) : 16

17  Second Variants : Suppose that b  N and that we can prove these two statements: Base Case: P(k) is true for 0≤k≤b. Inductive Step: If P(k) is true for some k≥b, then P(k+1) is also true. Then, P(n) is true for all n  N.  Third Variants (Strong Induction): Suppose that b  N and we can prove two statements: Base Case: P(k) is true for 0≤k≤b. Inductive Step: If k≥b and P(i) is true for all i≤k, then P(k+1) is also true. Then, P(n) is true for all n  N. 17

18  Let P(n) be statement involving positive integer n=1,2,3,… then  Step 1: Verify P(1) is true. (Basis Step)  Step 2: Assume that P(1),P(2),…,P(k) is true (Strong Inductive Hypothesis)  Step 3: Verify that P(k+1) is true using strong inductive hypothesis. (Inductive Step) 18

19  A chocolate bar consists of a number of squares (say, n>0) arranged in a rectangular pattern. You split the bar into small squares always breaking along the lines between the squares. Prove that minimum number of breaks it takes is n-1.  Let P(n) denote the number of breaks needed to split a bar with n squares.  Base Step: P(1)=0 is true.  Inductive Step: Assume that P(k) is true for 2≤k≤n.  To prove that P(k+1)=k under the above assumption. 19

20  Break the bar into two pieces of sizes n1 and n2, so that n1+n2=k+1.  By inductive hypothesis P(n1) = n1-1 P(n2) = n2-1  Hence the total number of breaks is 1+(n1-1)+(n2-1) = k  Hence P(n) holds for all n>0. 20

21  Sometimes we want to prove that some property P holds for all integers n ≥ b.  Inductive Argument: P(b) : Show that property P is true for b P(k) ⇨ P(k+1) : Show that if property P is true for k, then it’s true for k+1.  We can conclude that P(n) holds for all n ≥ b.  We don’t care about n < b. 21

22  Example: Prove using strong induction that every amount of postage of 8 cents or more can be formed using just 3-cent and 5-cent stamps.  Let P(n) be the proposition that postage of n>8 cents can be formed using 3-cent and 5-cent stamps.  BASIS STEP: 8=3+5  P(8) uses one 3-cent and one 5-cent stamp.  P(8) is true. 22

23  INDUCTIVE STEP: Suppose it’s true for k.  There are two cases:  (1) If used a 5-cent stamp to make k, replace it by two 3-cent stamps. Get k+1.  (2) If did not use a 5-cent stamp to make k, must have used at least three 3-cent stamps. Replace three 3-cent stamps by two 5-cent stamps. Get k+1.  Hence, P(n) holds for all n ≥ 8. 23

24  Example: Use strong mathematical induction to show that if n is an integer > 1, then n can be written as the product of primes.  Let P(n) be the proposition that n can be written as a product of primes.  BASIS STEP: P(2) is true since 2 itself is prime.  INDUCTIVE STEP: The inductive hypothesis P(j) is true for all integers j with 2 ≤ j ≤ k.  To show that P(k + 1) must be true under this assumption, two cases arise -  Case–1: If k + 1 is prime, then P(k + 1) is true. 24

25  Case-2: If k + 1 is composite  k+1 = a.b where a & b are +ve integers with 2≤a≤ b<k+1 By the inductive hypothesis, a & b can be written as the product of primes k + 1 can also be written as the product of those primes.  Hence, by strong mathematical induction, every integer > 1 can be written as the product of primes. 25


Download ppt "1.  The set N = {1,2,3,4,……..} is known as natural numbers or the set of positive integers  The natural numbers are used mainly for :  counting  ordering."

Similar presentations


Ads by Google