# Induction and Recursion

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Induction and Recursion Winter 2010

2 Mathematical Induction Mathematical Induction Principle (of Mathematical Induction) Suppose you want to prove that a statement about an integer n is true for every positive integer n. Define a propositional function P (n) that describes the statement to be proven about n. To prove that P (n) is true for all n 1, do the following two steps: Basis Step: Prove that P (1) is true. Inductive Step: Let k 1. Assume P (k) is true, and prove that P (k + 1) is true.

3 Mathematical Induction Types of statements that can be proven by induction 1 Summation formulas Prove that n = 2 n+1 1, for all integers n 0. 2 Inequalities Prove that 2 n < n! for every positive integer n with n 4. 3 Divisibility results Prove that n 3 n is divisible by 3 for every positive integer n. 4 Results about sets Prove that if S is a set with n elements where n is a nonnegative integer, then S has 2 n subsets. 5 Creative use of mathematical induction Show that for n a positive integer, every 2 n 2 n checkerboard with one square removed can be tiled using right triominoes (L shape). 6 Results about algorithms Prove that procedure fac(n) returns n! for all nonnegative integers n 0.

4 Mathematical Induction Prove that algorithm fac(n) returns n! for all nonnegative integers n 0. procedure fac(n: nonnegative integer) if (n = 0) then return 1 else return n fac(n 1)

5 Strong Induction or Complete Induction Strong Induction Principle (of Strong Induction) Suppose you want to prove that a statement about an integer n is true for every positive integer n. Define a propositional function P (n) that describes the statement to be proven about n. To prove that P (n) is true for all n 1, do the following two steps: Basis Step: Prove that P (1) is true. Inductive Step: Let k 1. Assume P (1), P (2),..., P (k) are all true, and prove that P (k + 1) is true.

6 Strong Induction or Complete Induction Use strong induction to prove: Theorem (The Fundamental Theorem of Arithmetic) Every positive integer greater than 1 can be written uniquely as a prime or as the product of two or more primes where the prime factors are written in order of nondecreasing size. Proof: Part 1: Every positive integer greater than 1 can be written as a prime or as the product of two or more primes. Part 2: Show uniqueness, when the primes are written in nondecreasing order.

7 Strong Induction or Complete Induction Proof of Part 1: Consider P (n) the statement n can be written as a prime or as the product of two or more primes.. We will use strong induction to show that P (n) is true for every integer n 1. Basis Step: P (2) is true, since 2 can be written as a prime, itself. Induction Step: Let k 2. Assume P (1), P (2),..., P (k) are true. We will prove that P (k + 1) is true, i.e. that k + 1 can be written as a prime or the product of two or more primes. Case 1: k + 1 is prime. If k + 1 is prime, then the statement is true as k + 1 can be written as itself, a prime. Case 2: k + 1 is composite. By definition, there exist two positive integers a and b with 2 a b < k + 1, such that k + 1 = ab. Since a, b < k + 1, we know by induction hypothesis that a and b can each be written as a prime or the product of two or more primes. Thus, k + 1 = ab can be written as a product of two or more primes, namely those primes in the prime factorization of a and those in the prime factorization of b.

8 Strong Induction or Complete Induction We want to prove Part 2. The following Lemma has been proven. Lemma (A) If a, b, and c are positive integers such that gcd(a, b) = 1 and a bc, then a c. We prove the following lemma using induction. Lemma (B) If p is a prime and p a 1 a 2 a n, where each a i is an integer and n 1, then p a i for some i, 1 i n. Proof: Let P (n) be the statement If a 1, a 2,..., a n are integers and p is a prime number such that p a 1 a 2 a n, then p a i for some i, 1 i n. We will prove P (n) is true for all n 1.

9 Strong Induction or Complete Induction Let P (n) be the statement If a 1, a 2,..., a n are integers and p is a prime number such that p a 1 a 2 a n, then p a i for some i, 1 i n. We will prove P (n) is true for all n 1. Basis: Prove that P (1) is true. The statement is trivially true, since for n = 1, p a 1 already gives that p a i for some i, 1 i 1. Induction step: Let n 2. Assume P (n 1) is true. Prove P (n) is true. Let p be a prime such that p a 1 a 2 a n. In the case that p a n, we are done. So, consider the case p a n. Since p is prime, we have gcd(p, a n ) = 1, thus, by Lemma A, p a 1... a n 1. By induction hypothesis, we have that p a i for some i, 1 i n 1. Combining both cases, we get that p a i for some i, 1 i n.

10 Strong Induction or Complete Induction Proof of Part 2: (uniqueness of the prime factorization of a positive integer). Suppose by contradiction that n can be written as a product of primes in two different ways, say n = p 1 p 2... p s and n = q 1 q 2... q t, where each p i and q j are primes such that p 1 p 2 p s and q 1 q 2 q t. When we remove all common primes from the two factorizations, we have: p i1 p i2 p iu = q j1 q j2 q jv, where no primes occur on both sides of this equations and u and v are positive integers. By Lemma B, p i1 must divide q jk for some k, 1 k v. Since p i1 and q jk are primes we must have p i1 = q jk, which contradicts the fact that no primes appear on both sides of the given equation.

11 Strong Induction or Complete Induction Examples of statements that can be proven by strong induction 1 Consider a game with 2 players that take turns removing any positive number of matches they want from one of two piles of matches. The player that removes the last match wins the game. Prove that if both piles contains the same number of matches initially, the second player can always guarantee a win. 2 Prove that every amount of 12 cents or more can be formed with 4-cent and 5-cent stamps. (also try to prove it in a different way using mathematical induction) 3 Prove that algorithm gcd(a, b) (given in page 313 of the textbook) returns the gcd(a, b) for all integers a, b, a < b.

12 Strong Induction or Complete Induction Prove that procedure gcd(a, b) returns the gcd(a, b) for all integers a, b, a < b. procedure gcd(a, b: nonnegative integers with a < b) if (a = 0) then return b else return gcd(b mod a, a)

13 Recursive Definitions Recursive Definitions We can use recursion to define: functions, sequences, sets. Mathematical induction and strong induction can be used to prove results about recursively defined sequences and functions. Structural induction is used to prove results about recursively defined sets.

14 Recursive Definitions Recursively Defined Functions Examples: Defining the factorial function recursively: F (0) = 1, F (n) = n F (n 1), for n 1. Defining the maximum number of comparisons for the Mergesort algorithm (given in page 318): T (1) = 0, T (n) = T ( n/2 ) + T ( n/2 ) + n 1, for n 2. Number of moves needed to solve the Hanoi tower problem: H(1) = 1, H(n) = 2H(n 1) + 1, for n 2.

15 Recursive Definitions Recursively Defined Sequences Consider the Fibonacci numbers, recursively defined by: f 0 = 0, f 1 = 1, f n = f n 1 + f n 2, for n 2. Prove that whenever n 3, f n > α n 2 where α = (1 + 5)/2.

16 Recursive Definitions Let P (n) be the statement f n > α n 2. We will show that P (n) is true for n 3 using strong induction. Basis: We show that P (3) and P (4) are true: α = (1 + 5)/2 < (1 + 3)/2 = 2 = f 3. α 2 = ((1+ 5)/2) 2 = ( )/4 = (3+ 5)/2 < (3+3)/2 = 3 = f 4. Inductive step: Let k 4. Assume P (j) is true for all integers j with 3 j k. Prove that P (k + 1) is true. We have: f k+1 = f k + f k 1, (by the definition of the Fibonacci sequence) > α k 2 + α k 3, (by induction hypothesis) = α k 3 (α + 1) = α k 3 ((1 + 5)/2 + 1) = α k 3 ((3 + 5)/2) = α k 3 α 2 = α k 1.

17 Recursive Definitions Recursively Defined Sets and Structures Definition (Set of strings over an alphabet) The set Σ of strings over the alphabet Σ can be defined recursively by: Basis Step: λ Σ (where λ is the empty string) Recursive Step: If w Σ and x Σ, then wx Σ. Example: If Σ = {0, 1}, then Σ = {λ, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011,...}. Definition (Well-formed formulas of Operators and Operands) Basis Step: x is a well-formed formula if x is a numeral or variable. Recursive Step: If F and G are well-formed formulas, then (F + G), (F G), (F G), (F/G) and (F G) are well-formed formulas. Example: The following are well-formed formulas: (x 3), (3/0), ((x + 2) y), ((2 + 3) (x/y)), etc.

18 Structural Induction Structural Induction Structural induction is used to show results about recursively defined sets. Principle (of Structural Induction) To show that a statement holds for all elements of a recursively defined set, use the following steps: Basis Step: Prove that the statement holds for all elements specified in the basis step of the set definition. Recursive Step: Prove that if the statement is true for each of the elements used to construct elements in the recursive step of the set definition, then the result holds for these new elements. The validity of this principle comes from the validity of mathematical induction, as we can transform the above argument on an induction on n where n is the number of applications of the recursive step of the set definition needed to obtain the element we are analysing.

19 Structural Induction Example of Structural Induction I Prove that every well-formed formula of Operators and Operands contains an equal number of left and right parentheses. Proof by structural induction: Basis Step: A numeral or a variable, each contains 0 parentheses, so clearly they contain an equal number of right and left parentheses. Recursive Step: Assume F and G are well-formed formulas each containing an equal number of left and right parentheses. That is, if l F and l G are the number of left parentheses in F and G, respectively, and r F and r G are the number of right parentheses in F and G, respectively, then l F = r F and l G = r G. We need to show that (F + G), (F G), (F G), (F/G) and (F G) also contain an equal number of left and right parenthesis. For each of these well-formed formulas, the number of left parentheses is L = l F + l G + 1 and the number of right parentheses is R = r F + r G + 1. Since l F = r F and l G = r G, it follows that L = l F + l G + 1 = r F + r G + 1 = R. This concludes the inductive proof.

20 Structural Induction Example of Structural Induction II Recall the definition of a set of strings. Definition (Set of strings over an alphabet) The set Σ of strings over the alphabet Σ can be defined recursively by: Basis Step: λ Σ (where λ is the empty string) Recursive Step: If w Σ and x Σ, then wx Σ. We now give a definition of concatenation of two strings. Note how this definition is built on the definition of string. Definition (Concatenation of two strings) Basis Step: If w Σ, then w λ = w. Recursive Step: If w 1 Σ, w 2 Σ and x Σ, then w 1 (w 2 x) = (w 1 w 2 )x.

21 Structural Induction We now give a recursive definition of the reversal of a string. Definition (Reversal of a string) Basis Step: λ R = λ Recursive Step: If w Σ and x Σ, then (wx) R = x (w) R. Exercise: Use structural induction to prove that if w 1 and w 2 are strings, then (w 1 w 2 ) R = w R 2 wr 1. Note that this proof needs to use the 3 definitions given above.

22 Correctness of recursive algorithms Proving the correctness of recursive programs Mathematical induction (and strong induction) can be used to prove that a recursive algorithm is correct: to prove that the algorithm produces the desired output for all possible input values. We will see some examples next.

23 Correctness of recursive algorithms Recursive algorithm for computing a n procedure power(a: nonzero real number, n: nonnegative integer) if (n = 0) then return 1 else return a power(a, n 1) We will prove by mathematical induction on n that the algorithm above is correct. We will show P (n) is true for all n 0, for P (n): For all nonzero real numbers a, power(a, n) correctly computes a n.

24 Correctness of recursive algorithms Proving power(a, n) is correct Basis: If n = 0, the first step of the algorithm tells us that power(a,0)=1. This is correct because a 0 = 1 for every nonzero real number a, so P (0) is true. Inductive step: Let k 0. Inductive hypothesis: power(a, k) = a k, for all a 0. We must show next that power(a, k + 1) = a k+1. Since k + 1 > 0 the algorithm sets power(a, k + 1) = a power(a, k). By inductive hypotheses power(a, k) = a k, so power(a, k + 1) = a power(a, k) = a a k = a k+1.

25 Correctness of recursive algorithms Recursive algorithm for computing b n mod m procedure mpower(b, n, m: integers with m 2, n 0) if n = 0 then return 1; else if n is even then return mpower(b, n/2, m) 2 mod m else return ((mpower(b, n/2, m) 2 mod m) (b mod m)) mod m Examples: power(2, 5, 6) = = ((power(2, 2, 6) 2 mod 6) (2 mod 6)) mod 6 = (((power(2, 1, 6) 2 mod 6) 2 mod 6) (2)) mod 6 = ((((power(2, 0, 6) 2 mod 6) (2 mod 6)) mod 6) 2 mod 6) 2 mod 6) 2) mod 6 = ((((1 2 mod 6) 2) mod 6) 2 mod 6) 2 mod 6) 2) mod 6 = 2.

26 Correctness of recursive algorithms Proving mpower(a, n, m) is correct, using induction on n Basis: Let b and m be integers with m 2, and n = 0. In this case, the algorithm returns 1. This is correct because b 0 mod m = 1. Inductive step: Induction hypothesis: Let k 1. Assume power(b, j, m) = b j mod m for all integers j with 0 j k 1, whenever b is a positive integer and m is an integer with m 2. We must show next that power(b, k, m) = b k mod m. There are two cases to consider. Case 1: k is even. In this case, the algorithm returns mpower(b, k/2, m) 2 mod m = (i.h.)(b k/2 mod m) 2 mod m = b k mod m. Case 2: k is odd. In this case, the algorithm returns ((mpower(b, k/2, m) 2 mod m) (b mod m)) mod m = (i.h.)(b k/2 mod m) 2 mod m) (b mod m)) mod m = (b 2 k/2 +1 mod m) = b k mod m.

27 Program verification Program verification We want to be able to prove that a given program meets the intended specifications. This can often be done manually, or even by automated program verification tools. One example is PVS (People s Verification System). A program is correct if it produces the correct output for every possible input. A program has partial correctness if it produces the correct output for every input for which the program eventually halts. Therefore, a program is correct if and only if it has partial correctnes and terminates.

28 Program verification Hoare s triple notation A program s I/O specification can be given using initial and final assertions. The initial assertion p is the condition that the program s input (its initial state) is guaranteed (by its user) to satisfy. The final assertion q is the condition that the output produced by the program (its final state) is required to satisfy. Hoare triple notation: The notation p{s}q means that, for all inputs I such that p(i) is true, if program S (given input I) halts and produces output O = S(I), then q(o) is true. That is, S is partially correct with respect to specification p, q.

29 Program verification A simple example Let S be the program fragment y:= 2; z:= x+y Let p be the initial assertion x=1. The variable x will hold 1 in all initial states. Let q be the final assertion z= 3. The variable z must hold 3 in all final states. Prove p{s}q. Proof: If x=1 in the program s input state, then after running y:=2 and z:=x+y, then z will be = 3.

30 Program verification Rules of inference for Hoare triples The composition rule: p{s 1 }q q{s 2 }r p{s 1 ; S 2 }r It says: If program S 1 given condition p produces condition q, and S 2 given q produces r, then the program S 1 followed by S 2, if given p, yields r.

31 Program verification Inference rule for if-then statements (p cond){s}q (p cond) q p{if cond then S}q Example: Show that: T {if x > y then y := x}(y x). Proof: When initially T is true, if x > y, then the if-body is executed, setting y = x, and so afterwards y x is true. Otherwise, x y and so y x. In either case, the final assertion y x is true. So the rule applies, and so the fragment meets the specification.

32 Program verification Inference rule for if-then-else statements (p cond){s 1 }q (p cond){s 2 }q p{if cond then S 1 else S 2 }q Example: Prove that T {if x < 0 then abs := x else abs := x}(abs = x ) Proof: If the initial assertion is true and x < 0 then after the if-body, abs will be x = x. If the initial assertion is true, but (x < 0) is true, i.e., x 0, then after the else-body, abs = x, which is x. So using the above rule, we get that this segment is true with respect to the final assertion.

33 Program verification Loop Invariants For a while-loop while cond S, we say that p is a loop invariant of this loop if (p cond){s}p. If p (and the continuation condition cond) is true before executing the body, then p remains true afterwards. And so p stays true through all subsequent iterations. This leads to the inference rule: (p cond){s}p p{while cond S}( cond p)

34 Program verification Example1: loop invariant Prove that the following Hoare triple holds: T {i := 1; fact := 1; while i < n{i + +; fact = fact i}}(fact = n!) Proof: Let p be the assertion fact = i! i n. We will show tht p is a loop invariant. Assume that at the beginning of the while-loop p is true and the condition of the while-loop holds, in other words, assume that fact = i! and i < n. The new values i new and fact new of i and fact are i new = i + 1 and fact new = fact (i + 1) = (i!) (i + 1) = (i + 1)! = i new!. Since i < n, we also have i new = i + 1 n. Thus p is true at the end of the execution of the loop. This shows p is a loop invariant.

35 Program verification Final example: combining all rules procedure multiply(m, n : integers) p := (m, n Z) if n < 0 then a := n (segment S 1 ) else a := n q := (p (a = n )) k := 0; x := 0 (segment S 2 ) r := q (k = 0) (x = 0) (x = mk k a) while k < a { (segment S 3 ) x = x + m; k = k + 1; }Maintains loop invariant: (x = mk k a) (x = mk k = a) s := (x = ma) a = n ) s (n < 0 x = mn) (n 0 x = mn) if n < 0 then prod := x (segment S 4 ) else prod := x t = (prod = mn)

36 Program verification Correctness of multiply(m, n) The proof is structured as follows, by using propositions p, q, r, s, t as defined in the previous page. Prove p{s 1 }q by using if-then-else inference rule. Prove q{s 2 }r by examining this trivial segment. Prove r{s 3 }s by using while-loop inference rule. Prove s{s 4 }t by using if-then-else inference rule. Use the rule of composition to show that p{s 1 ; S 2 ; S 3 ; S 4 }t; recall that p := (m, n Z) and t = (prod = mn), which is what we wanted to show for the partial correctness. To complete the proof of correctness, given the partial correctness, we must verify that each segment terminates. Termination is trivial for segments S 1, S 2 and S 4 ; for the while-loop (S 4 ) it is easy to see that it runs for a iterations. (See general rule for proving termination of loops in the next page) We leave the details of each step above as an exercise.

37 Program verification Proving termination of a loop Associate with each iteration i a natural number k i, such that < k 0, k 1, k 2,... > is a decreasing sequence.

38 Program verification Proving termination of a loop Associate with each iteration i a natural number k i, such that < k 0, k 1, k 2,... > is a decreasing sequence. Using the well-ordering principle, every decreasing sequence of natural numbers is finite.

39 Program verification Proving termination of a loop Associate with each iteration i a natural number k i, such that < k 0, k 1, k 2,... > is a decreasing sequence. Using the well-ordering principle, every decreasing sequence of natural numbers is finite. Find a decreasing sequence of natural numbers for the while-loop in the previous example: Define k i = a k < k 0, k 1, k 2,... > is decreasing as a is constant and k increases by 1 at each iteration.

### Induction. Margaret M. Fleck. 10 October These notes cover mathematical induction and recursive definition

Induction Margaret M. Fleck 10 October 011 These notes cover mathematical induction and recursive definition 1 Introduction to induction At the start of the term, we saw the following formula for computing

### 8 Divisibility and prime numbers

8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express

### CS 103X: Discrete Structures Homework Assignment 3 Solutions

CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On well-ordering and induction: (a) Prove the induction principle from the well-ordering principle. (b) Prove the well-ordering

### Mathematical Induction. Lecture 10-11

Mathematical Induction Lecture 10-11 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach

### The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

The Prime Numbers Before starting our study of primes, we record the following important lemma. Recall that integers a, b are said to be relatively prime if gcd(a, b) = 1. Lemma (Euclid s Lemma). If gcd(a,

### Math 55: Discrete Mathematics

Math 55: Discrete Mathematics UC Berkeley, Fall 2011 Homework # 5, due Wednesday, February 22 5.1.4 Let P (n) be the statement that 1 3 + 2 3 + + n 3 = (n(n + 1)/2) 2 for the positive integer n. a) What

### 8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

### Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.

Elementary Number Theory and Methods of Proof CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 1 Number theory Properties: 2 Properties of integers (whole

### APPLICATIONS OF THE ORDER FUNCTION

APPLICATIONS OF THE ORDER FUNCTION LECTURE NOTES: MATH 432, CSUSM, SPRING 2009. PROF. WAYNE AITKEN In this lecture we will explore several applications of order functions including formulas for GCDs and

### 2. Methods of Proof Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try.

2. METHODS OF PROOF 69 2. Methods of Proof 2.1. Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try. Trivial Proof: If we know q is true then

### Page 331, 38.4 Suppose a is a positive integer and p is a prime. Prove that p a if and only if the prime factorization of a contains p.

Page 331, 38.2 Assignment #11 Solutions Factor the following positive integers into primes. a. 25 = 5 2. b. 4200 = 2 3 3 5 2 7. c. 10 10 = 2 10 5 10. d. 19 = 19. e. 1 = 1. Page 331, 38.4 Suppose a is a

### Section 4.2: The Division Algorithm and Greatest Common Divisors

Section 4.2: The Division Algorithm and Greatest Common Divisors The Division Algorithm The Division Algorithm is merely long division restated as an equation. For example, the division 29 r. 20 32 948

### 3. Mathematical Induction

3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)

### CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

CHAPTER 5 Number Theory 1. Integers and Division 1.1. Divisibility. Definition 1.1.1. Given two integers a and b we say a divides b if there is an integer c such that b = ac. If a divides b, we write a

### MATH 289 PROBLEM SET 4: NUMBER THEORY

MATH 289 PROBLEM SET 4: NUMBER THEORY 1. The greatest common divisor If d and n are integers, then we say that d divides n if and only if there exists an integer q such that n = qd. Notice that if d divides

### SECTION 10-2 Mathematical Induction

73 0 Sequences and Series 6. Approximate e 0. using the first five terms of the series. Compare this approximation with your calculator evaluation of e 0.. 6. Approximate e 0.5 using the first five terms

### MATH10040 Chapter 2: Prime and relatively prime numbers

MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive

### MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES

MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES 2016 47 4. Diophantine Equations A Diophantine Equation is simply an equation in one or more variables for which integer (or sometimes rational) solutions

### Section 6-2 Mathematical Induction

6- Mathematical Induction 457 In calculus, it can be shown that e x k0 x k k! x x x3!! 3!... xn n! where the larger n is, the better the approximation. Problems 6 and 6 refer to this series. Note that

### Section IV.1: Recursive Algorithms and Recursion Trees

Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller

### Homework 5 Solutions

Homework 5 Solutions 4.2: 2: a. 321 = 256 + 64 + 1 = (01000001) 2 b. 1023 = 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = (1111111111) 2. Note that this is 1 less than the next power of 2, 1024, which

### Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof. Harper Langston New York University

Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof Harper Langston New York University Proof and Counterexample Discovery and proof Even and odd numbers number n from Z is called

### Elementary Number Theory We begin with a bit of elementary number theory, which is concerned

CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,

### Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

MTHSC 412 Section 2.4 Prime Factors and Greatest Common Divisor Greatest Common Divisor Definition Suppose that a, b Z. Then we say that d Z is a greatest common divisor (gcd) of a and b if the following

### Appendix F: Mathematical Induction

Appendix F: Mathematical Induction Introduction In this appendix, you will study a form of mathematical proof called mathematical induction. To see the logical need for mathematical induction, take another

### I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

I GROUPS: BASIC DEFINITIONS AND EXAMPLES Definition 1: An operation on a set G is a function : G G G Definition 2: A group is a set G which is equipped with an operation and a special element e G, called

### Reading 13 : Finite State Automata and Regular Expressions

CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

### Mathematical Induction

Mathematical Induction (Handout March 8, 01) The Principle of Mathematical Induction provides a means to prove infinitely many statements all at once The principle is logical rather than strictly mathematical,

### Today s Topics. Primes & Greatest Common Divisors

Today s Topics Primes & Greatest Common Divisors Prime representations Important theorems about primality Greatest Common Divisors Least Common Multiples Euclid s algorithm Once and for all, what are prime

### TAKE-AWAY GAMES. ALLEN J. SCHWENK California Institute of Technology, Pasadena, California INTRODUCTION

TAKE-AWAY GAMES ALLEN J. SCHWENK California Institute of Technology, Pasadena, California L INTRODUCTION Several games of Tf take-away?f have become popular. The purpose of this paper is to determine the

### Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

### Mathematical induction. Niloufar Shafiei

Mathematical induction Niloufar Shafiei Mathematical induction Mathematical induction is an extremely important proof technique. Mathematical induction can be used to prove results about complexity of

### Pythagorean Triples Pythagorean triple similar primitive

Pythagorean Triples One of the most far-reaching problems to appear in Diophantus Arithmetica was his Problem II-8: To divide a given square into two squares. Namely, find integers x, y, z, so that x 2

### Lecture 3: Finding integer solutions to systems of linear equations

Lecture 3: Finding integer solutions to systems of linear equations Algorithmic Number Theory (Fall 2014) Rutgers University Swastik Kopparty Scribe: Abhishek Bhrushundi 1 Overview The goal of this lecture

### Solutions for Practice problems on proofs

Solutions for Practice problems on proofs Definition: (even) An integer n Z is even if and only if n = 2m for some number m Z. Definition: (odd) An integer n Z is odd if and only if n = 2m + 1 for some

### GROUPS SUBGROUPS. Definition 1: An operation on a set G is a function : G G G.

Definition 1: GROUPS An operation on a set G is a function : G G G. Definition 2: A group is a set G which is equipped with an operation and a special element e G, called the identity, such that (i) the

### The last three chapters introduced three major proof techniques: direct,

CHAPTER 7 Proving Non-Conditional Statements The last three chapters introduced three major proof techniques: direct, contrapositive and contradiction. These three techniques are used to prove statements

### Automata and Formal Languages

Automata and Formal Languages Winter 2009-2010 Yacov Hel-Or 1 What this course is all about This course is about mathematical models of computation We ll study different machine models (finite automata,

### MATHEMATICAL INDUCTION. Mathematical Induction. This is a powerful method to prove properties of positive integers.

MATHEMATICAL INDUCTION MIGUEL A LERMA (Last updated: February 8, 003) Mathematical Induction This is a powerful method to prove properties of positive integers Principle of Mathematical Induction Let P

### Basic Proof Techniques

Basic Proof Techniques David Ferry dsf43@truman.edu September 13, 010 1 Four Fundamental Proof Techniques When one wishes to prove the statement P Q there are four fundamental approaches. This document

### Handout NUMBER THEORY

Handout of NUMBER THEORY by Kus Prihantoso Krisnawan MATHEMATICS DEPARTMENT FACULTY OF MATHEMATICS AND NATURAL SCIENCES YOGYAKARTA STATE UNIVERSITY 2012 Contents Contents i 1 Some Preliminary Considerations

### SUM OF TWO SQUARES JAHNAVI BHASKAR

SUM OF TWO SQUARES JAHNAVI BHASKAR Abstract. I will investigate which numbers can be written as the sum of two squares and in how many ways, providing enough basic number theory so even the unacquainted

### Handout #1: Mathematical Reasoning

Math 101 Rumbos Spring 2010 1 Handout #1: Mathematical Reasoning 1 Propositional Logic A proposition is a mathematical statement that it is either true or false; that is, a statement whose certainty or

### Nim Games. There are initially n stones on the table.

Nim Games 1 One Pile Nim Games Consider the following two-person game. There are initially n stones on the table. During a move a player can remove either one, two, or three stones. If a player cannot

### (x + a) n = x n + a Z n [x]. Proof. If n is prime then the map

22. A quick primality test Prime numbers are one of the most basic objects in mathematics and one of the most basic questions is to decide which numbers are prime (a clearly related problem is to find

### STUDENT S SOLUTIONS MANUAL ELEMENTARY NUMBER THEORY. Bart Goddard. Kenneth H. Rosen AND ITS APPLICATIONS FIFTH EDITION. to accompany.

STUDENT S SOLUTIONS MANUAL to accompany ELEMENTARY NUMBER THEORY AND ITS APPLICATIONS FIFTH EDITION Bart Goddard Kenneth H. Rosen AT&T Labs Reproduced by Pearson Addison-Wesley from electronic files supplied

### Factoring & Primality

Factoring & Primality Lecturer: Dimitris Papadopoulos In this lecture we will discuss the problem of integer factorization and primality testing, two problems that have been the focus of a great amount

### MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.

MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on

### A simple criterion on degree sequences of graphs

Discrete Applied Mathematics 156 (2008) 3513 3517 Contents lists available at ScienceDirect Discrete Applied Mathematics journal homepage: www.elsevier.com/locate/dam Note A simple criterion on degree

### CLASS 3, GIVEN ON 9/27/2010, FOR MATH 25, FALL 2010

CLASS 3, GIVEN ON 9/27/2010, FOR MATH 25, FALL 2010 1. Greatest common divisor Suppose a, b are two integers. If another integer d satisfies d a, d b, we call d a common divisor of a, b. Notice that as

### Math 115 Spring 2011 Written Homework 5 Solutions

. Evaluate each series. a) 4 7 0... 55 Math 5 Spring 0 Written Homework 5 Solutions Solution: We note that the associated sequence, 4, 7, 0,..., 55 appears to be an arithmetic sequence. If the sequence

### Subsets of Euclidean domains possessing a unique division algorithm

Subsets of Euclidean domains possessing a unique division algorithm Andrew D. Lewis 2009/03/16 Abstract Subsets of a Euclidean domain are characterised with the following objectives: (1) ensuring uniqueness

### C H A P T E R Regular Expressions regular expression

7 CHAPTER Regular Expressions Most programmers and other power-users of computer systems have used tools that match text patterns. You may have used a Web search engine with a pattern like travel cancun

### 1.1 Logical Form and Logical Equivalence 1

Contents Chapter I The Logic of Compound Statements 1.1 Logical Form and Logical Equivalence 1 Identifying logical form; Statements; Logical connectives: not, and, and or; Translation to and from symbolic

### Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement

### Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics

Undergraduate Notes in Mathematics Arkansas Tech University Department of Mathematics An Introductory Single Variable Real Analysis: A Learning Approach through Problem Solving Marcel B. Finan c All Rights

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### SCORE SETS IN ORIENTED GRAPHS

Applicable Analysis and Discrete Mathematics, 2 (2008), 107 113. Available electronically at http://pefmath.etf.bg.ac.yu SCORE SETS IN ORIENTED GRAPHS S. Pirzada, T. A. Naikoo The score of a vertex v in

### Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 11

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note Conditional Probability A pharmaceutical company is marketing a new test for a certain medical condition. According

### Homework until Test #2

MATH31: Number Theory Homework until Test # Philipp BRAUN Section 3.1 page 43, 1. It has been conjectured that there are infinitely many primes of the form n. Exhibit five such primes. Solution. Five such

### Introduction. Appendix D Mathematical Induction D1

Appendix D Mathematical Induction D D Mathematical Induction Use mathematical induction to prove a formula. Find a sum of powers of integers. Find a formula for a finite sum. Use finite differences to

### RECURSIVE ENUMERATION OF PYTHAGOREAN TRIPLES

RECURSIVE ENUMERATION OF PYTHAGOREAN TRIPLES DARRYL MCCULLOUGH AND ELIZABETH WADE In [9], P. W. Wade and W. R. Wade (no relation to the second author gave a recursion formula that produces Pythagorean

### On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples

On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples Brian Hilley Boston College MT695 Honors Seminar March 3, 2006 1 Introduction 1.1 Mazur s Theorem Let C be a

### Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

### Applications of Methods of Proof

CHAPTER 4 Applications of Methods of Proof 1. Set Operations 1.1. Set Operations. The set-theoretic operations, intersection, union, and complementation, defined in Chapter 1.1 Introduction to Sets are

### k, then n = p2α 1 1 pα k

Powers of Integers An integer n is a perfect square if n = m for some integer m. Taking into account the prime factorization, if m = p α 1 1 pα k k, then n = pα 1 1 p α k k. That is, n is a perfect square

### Mathematical Induction. Mary Barnes Sue Gordon

Mathematics Learning Centre Mathematical Induction Mary Barnes Sue Gordon c 1987 University of Sydney Contents 1 Mathematical Induction 1 1.1 Why do we need proof by induction?.... 1 1. What is proof by

### PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include 2 + 5.

PUTNAM TRAINING POLYNOMIALS (Last updated: November 17, 2015) Remark. This is a list of exercises on polynomials. Miguel A. Lerma Exercises 1. Find a polynomial with integral coefficients whose zeros include

### An Interesting Way to Combine Numbers

An Interesting Way to Combine Numbers Joshua Zucker and Tom Davis November 28, 2007 Abstract This exercise can be used for middle school students and older. The original problem seems almost impossibly

### 12 Greatest Common Divisors. The Euclidean Algorithm

Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan 12 Greatest Common Divisors. The Euclidean Algorithm As mentioned at the end of the previous section, we would like to

### Pythagorean Triples. Chapter 2. a 2 + b 2 = c 2

Chapter Pythagorean Triples The Pythagorean Theorem, that beloved formula of all high school geometry students, says that the sum of the squares of the sides of a right triangle equals the square of the

### This asserts two sets are equal iff they have the same elements, that is, a set is determined by its elements.

3. Axioms of Set theory Before presenting the axioms of set theory, we first make a few basic comments about the relevant first order logic. We will give a somewhat more detailed discussion later, but

### Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Chapter 3 Cartesian Products and Relations The material in this chapter is the first real encounter with abstraction. Relations are very general thing they are a special type of subset. After introducing

### The Foundations: Logic and Proofs. Chapter 1, Part III: Proofs

The Foundations: Logic and Proofs Chapter 1, Part III: Proofs Rules of Inference Section 1.6 Section Summary Valid Arguments Inference Rules for Propositional Logic Using Rules of Inference to Build Arguments

### 1.2. Successive Differences

1. An Application of Inductive Reasoning: Number Patterns In the previous section we introduced inductive reasoning, and we showed how it can be applied in predicting what comes next in a list of numbers

### Lecture 13 - Basic Number Theory.

Lecture 13 - Basic Number Theory. Boaz Barak March 22, 2010 Divisibility and primes Unless mentioned otherwise throughout this lecture all numbers are non-negative integers. We say that A divides B, denoted

### PRINCIPLES OF PROBLEM SOLVING

PRINCIPLES OF PROBLEM SOLVING There are no hard and fast rules that will ensure success in solving problems. However, it is possible to outline some general steps in the problem-solving process and to

### Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

Breaking The Code Ryan Lowe Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and a minor in Applied Physics. As a sophomore, he took an independent study

### 3 0 + 4 + 3 1 + 1 + 3 9 + 6 + 3 0 + 1 + 3 0 + 1 + 3 2 mod 10 = 4 + 3 + 1 + 27 + 6 + 1 + 1 + 6 mod 10 = 49 mod 10 = 9.

SOLUTIONS TO HOMEWORK 2 - MATH 170, SUMMER SESSION I (2012) (1) (Exercise 11, Page 107) Which of the following is the correct UPC for Progresso minestrone soup? Show why the other numbers are not valid

### We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b

In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

### DEGREES OF ORDERS ON TORSION-FREE ABELIAN GROUPS

DEGREES OF ORDERS ON TORSION-FREE ABELIAN GROUPS ASHER M. KACH, KAREN LANGE, AND REED SOLOMON Abstract. We construct two computable presentations of computable torsion-free abelian groups, one of isomorphism

### CAs and Turing Machines. The Basis for Universal Computation

CAs and Turing Machines The Basis for Universal Computation What We Mean By Universal When we claim universal computation we mean that the CA is capable of calculating anything that could possibly be calculated*.

### Solutions to Homework 6 Mathematics 503 Foundations of Mathematics Spring 2014

Solutions to Homework 6 Mathematics 503 Foundations of Mathematics Spring 2014 3.4: 1. If m is any integer, then m(m + 1) = m 2 + m is the product of m and its successor. That it to say, m 2 + m is the

### WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?

WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT? introduction Many students seem to have trouble with the notion of a mathematical proof. People that come to a course like Math 216, who certainly

### Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2 Proofs Intuitively, the concept of proof should already be familiar We all like to assert things, and few of us

### CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

CONTINUED FRACTIONS AND PELL S EQUATION SEUNG HYUN YANG Abstract. In this REU paper, I will use some important characteristics of continued fractions to give the complete set of solutions to Pell s equation.

### Elementary Number Theory

Elementary Number Theory A revision by Jim Hefferon, St Michael s College, 2003-Dec of notes by W. Edwin Clark, University of South Florida, 2002-Dec L A TEX source compiled on January 5, 2004 by Jim Hefferon,

### Quotient Rings and Field Extensions

Chapter 5 Quotient Rings and Field Extensions In this chapter we describe a method for producing field extension of a given field. If F is a field, then a field extension is a field K that contains F.

### 11 Ideals. 11.1 Revisiting Z

11 Ideals The presentation here is somewhat different than the text. In particular, the sections do not match up. We have seen issues with the failure of unique factorization already, e.g., Z[ 5] = O Q(

### USA Mathematical Talent Search

ID#: 678 7 We shall approach the problem as follows: first, we will define a function and some of its properties; then, we will solve the problem using the function we have defined. Let f y (x) have domain

### 26 Integers: Multiplication, Division, and Order

26 Integers: Multiplication, Division, and Order Integer multiplication and division are extensions of whole number multiplication and division. In multiplying and dividing integers, the one new issue

### (IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

3130CIT: Theory of Computation Turing machines and undecidability (IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems. An undecidable problem

### Midterm Practice Problems

6.042/8.062J Mathematics for Computer Science October 2, 200 Tom Leighton, Marten van Dijk, and Brooke Cowan Midterm Practice Problems Problem. [0 points] In problem set you showed that the nand operator

### Foundations of Logic and Mathematics

Yves Nievergelt Foundations of Logic and Mathematics Applications to Computer Science and Cryptography Birkhäuser Boston Basel Berlin Contents Preface Outline xiii xv A Theory 1 0 Boolean Algebraic Logic

### 1 if 1 x 0 1 if 0 x 1

Chapter 3 Continuity In this chapter we begin by defining the fundamental notion of continuity for real valued functions of a single real variable. When trying to decide whether a given function is or

### SUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by

SUBGROUPS OF CYCLIC GROUPS KEITH CONRAD 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by g = {g k : k Z}. If G = g, then G itself is cyclic, with g as a generator. Examples

### x if x 0, x if x < 0.

Chapter 3 Sequences In this chapter, we discuss sequences. We say what it means for a sequence to converge, and define the limit of a convergent sequence. We begin with some preliminary results about the

### CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,