H-SC MATH 262 - Lecture 17 - Direct Proof and Counterexample IV

Unformatted text preview:

Direct Proof and Counterexample IVThe Quotient-Remainder TheoremThe C Divide and Mod OperatorsSlide 4Slide 5Example: QuotientRemainder.cppExample: Proof by CasesProof continuedSlide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Example: Max(x, y)Slide 17Other FormulasDirect Proof and Counterexample IVLecture 17Section 3.4Wed, Feb 14, 2007The Quotient-Remainder TheoremTheorem: Let n and d be integers, d  0. Then there exist unique integers q and r such that n = qd + rand0  r < |d|.q is the quotient and r is the remainder.The C Divide and Mod OperatorsThe operators / and % in C are based on this theorem.If a and b are positive integers, thenq = a/band r = a % b, where 0  r < b.The C Divide and Mod OperatorsThus, a = (a/b)*b + (a % b) is true for all positive integers a and b.Therefore,a % b = a – (a/b)*bfor all positive integers a and b.The C Divide and Mod OperatorsWhat are a/b and a % b when a or b is negative?Isa = (a/b)*b + (a % b) still true when a or b is negative?Example: QuotientRemainder.cppExample: Proof by CasesTheorem: For any integer n, n3 – n is a multiple of 6.Proof:Divide n by 6 to get q and r: n = 6q + r, where 0  r < 6.That is, r = 0, 1, 2, 3, 4, or 5.Substitute: n3 – n = (6q + r)3 – (6q + r).Proof continuedExpand and rearrange: n3 – n = 6(36q3 + 18q2r + 3qr2 – q) + (r3 – r).Therefore, 6 | (n3 – n) if and only if 6 | (r3 – r).Proof continuedConsider the 6 possible cases:•Case 1: r = 0. r3 – r = 03 – 0 = 0 = 6 0.Proof continuedConsider the 6 possible cases:•Case 1: r = 0. r3 – r = 03 – 0 = 0 = 6 0.•Case 2: r = 1. r3 – r = 13 – 1 = 0 = 6 0.Proof continuedConsider the 6 possible cases:•Case 1: r = 0. r3 – r = 03 – 0 = 0 = 6 0.•Case 2: r = 1. r3 – r = 13 – 1 = 0 = 6 0.•Case 3: r = 2. r3 – r = 23 – 2 = 6 = 6 1.Proof continuedConsider the 6 possible cases:•Case 1: r = 0. r3 – r = 03 – 0 = 0 = 6 0.•Case 2: r = 1. r3 – r = 13 – 1 = 0 = 6 0.•Case 3: r = 2. r3 – r = 23 – 2 = 6 = 6 1.•Case 4: r = 3. r3 – r = 33 – 3 = 24 = 64.Proof continuedConsider the 6 possible cases:•Case 1: r = 0. r3 – r = 03 – 0 = 0 = 6 0.•Case 2: r = 1. r3 – r = 13 – 1 = 0 = 6 0.•Case 3: r = 2. r3 – r = 23 – 2 = 6 = 6 1.•Case 4: r = 3. r3 – r = 33 – 3 = 24 = 64.•Case 5: r = 4. r3 – r = 43 – 4 = 60 = 610.Proof continuedConsider the 6 possible cases:•Case 1: r = 0. r3 – r = 03 – 0 = 0 = 6 0.•Case 2: r = 1. r3 – r = 13 – 1 = 0 = 6 0.•Case 3: r = 2. r3 – r = 23 – 2 = 6 = 6 1.•Case 4: r = 3. r3 – r = 33 – 3 = 24 = 64.•Case 5: r = 4. r3 – r = 43 – 4 = 60 = 610.•Case 6: r = 5. r3 – r = 53 – 5 = 120 = 620.Proof continuedIn every case, 6 | (r3 – r).Therefore, 6 | (r3 – r) in general.Therefore, 6 | (n3 – n) for all integers n.Example: Max(x, y)Theorem: For all real numbers x and y,max(x, y) = ((x + y) + |x – y|)/2.Proof:Example: Max(x, y)Theorem: For all real numbers x and y,max(x, y) = ((x + y) + |x – y|)/2.Proof:Consider two cases…Other FormulasWhat is a similar formula for min(x, y)?What is a formula for max(x, y,


View Full Document
Download Lecture 17 - Direct Proof and Counterexample IV
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 17 - Direct Proof and Counterexample IV and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 17 - Direct Proof and Counterexample IV 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?