Direct proof technique

Slides:



Advertisements
Similar presentations
Lecture 3 – February 17, 2003.
Advertisements

With examples from Number Theory
Introduction to Proofs
Mathematical Induction II Lecture 14: Nov
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Induction and Recursion. Odd Powers Are Odd Fact: If m is odd and n is odd, then nm is odd. Proposition: for an odd number m, m k is odd for all non-negative.
Induction Lecture 5: Sep 21 (chapter of the book and chapter of the notes)
Induction and recursion
Discrete Structures Chapter 2 Part B Mathematical Induction
Copyright © Zeph Grunschlag,
1 Section 3.3 Mathematical Induction. 2 Technique used extensively to prove results about large variety of discrete objects Can only be used to prove.
Properties of the Integers: Mathematical Induction
Induction and recursion
C OURSE : D ISCRETE STRUCTURE CODE : ICS 252 Lecturer: Shamiel Hashim 1 lecturer:Shamiel Hashim second semester Prepared by: amani Omer.
Definitions from the Text, sections 1.1 – 1.4
Methods of Proof & Proof Strategies
Copyright © 2010 Pearson Education, Inc
Number Sequences Lecture 7: Sep 29 ? overhang. This Lecture We will study some simple number sequences and their properties. The topics include: Representation.
MATH 224 – Discrete Mathematics
Sequences Informally, a sequence is a set of elements written in a row. – This concept is represented in CS using one- dimensional arrays The goal of mathematics.
Induction and recursion
Introduction to Proofs
Reading and Writing Mathematical Proofs
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
MATH 224 – Discrete Mathematics
Section 1.8. Section Summary Proof by Cases Existence Proofs Constructive Nonconstructive Disproof by Counterexample Nonexistence Proofs Uniqueness Proofs.
Analysis of Algorithms
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
Methods of Proof Lecture 3: Sep 9. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical.
Equations, Inequalities, and Mathematical Models 1.2 Linear Equations
In section 11.9, we were able to find power series representations for a certain restricted class of functions. Here, we investigate more general problems.
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
Section 3.3: Mathematical Induction Mathematical induction is a proof technique that can be used to prove theorems of the form:  n  Z +,P(n) We have.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Foundations of Discrete Mathematics Chapters 5 By Dr. Dalia M. Gil, Ph.D.
1 INFO 2950 Prof. Carla Gomes Module Induction Rosen, Chapter 4.
ADVANCED ALGORITHMS REVIEW OF ANALYSIS TECHNIQUES (UNIT-1)
Changing Bases. Base 10: example number ³ 10² 10¹ 10 ⁰ ₁₀ 10³∙2 + 10²∙1 + 10¹∙ ⁰ ∙0 = 2120 ₁₀ Implied base 10 Base 8: 4110 ₈ 8³ 8².
Year 9 Proof Dr J Frost Last modified: 19 th February 2015 Objectives: Understand what is meant by a proof, and examples.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
CS104:Discrete Structures Chapter 2: Proof Techniques.
1 2/21/2016 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Section 1.7. Definitions A theorem is a statement that can be shown to be true using: definitions other theorems axioms (statements which are given as.
Real Zeros of Polynomial Functions
Chapter 15 Running Time Analysis. Topics Orders of Magnitude and Big-Oh Notation Running Time Analysis of Algorithms –Counting Statements –Evaluating.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
CS151: Mathematical Foundations of Computing Mathematical Induction.
Chapter 1 Logic and Proof.
Chapter 1 Logic and Proof.
The Foundations: Logic and Proofs
MODULE – 1 The Number System
Mathematical Induction II
Induction and recursion
Mathematical Induction Recursion
Chapter 5 Induction and Recursion
The Foundations: Logic and Proofs
CS201: Data Structures and Discrete Mathematics I
Induction and recursion
Applied Discrete Mathematics Week 9: Integer Properties
Induction Chapter
Foundations of Discrete Mathematics
Agenda Proofs (Konsep Pembuktian) Direct Proofs & Counterexamples
Presentation transcript:

Direct proof technique The goal is to explain why some assertion is true. Formal proof: Sequence of statements Starts with some axiom (universally agreed-upon premise). Remaining statements are further axioms, or derived statements based on earlier statements in the proof according to rules of valid argument/inference. (You may also use results of theorems proved elsewhere.) Last statement is the theorem to be proved. Our proofs will not be quite this formal. Nevertheless: we need to begin by looking at relevant definitions, axioms and given information.

Technique Follow advice in book Steps: Begin with given information Apply definitions Compare what you have with what you want. Experiment by manipulating this information, use related facts, with the goal in mind. End with satisfying the desired property. Let’s first look at some simple definitions Odd and even numbers Hint: if something looks hard to prove, maybe it’s false!

Example direct proof “If the sum of 2 integers is even, then their difference is even.” Incidentally, in symbols, the statement looks like this: x y (even(x + y)  even(x – y)) Here we go! Let x and y be integers such that x + y is even. By the definition of even, k such that x + y = 2k. Then, x – y = x + y – 2y = 2k – 2y = 2(k – y) and observe that k – y is an integer too. So, by definition, x – y is even because it’s 2 * (integer). Try more examples

Divisibility The symbol “|” means “divides”. We say that a | b if there exists some integer k such that ak = b. Or we can say: b is a multiple of a. Let’s use the direct proof technique for divisibility problems. It will sound like how we worked with even numbers, but more general. Prove or disprove: 3 divides the sum of any 3 consecutive integers If a | b and b | c, then a | c. If a | b and a | c, then a | (b + c). If a | bc, then a | b or a | c. If x and y are odd, then 6 | (3x + 3y).

Rational A number is rational if it can be written of the form a / b, where a and b are integers a and b have no common factors b is not 0 Example: 7.5 is rational because we can let a = 15 and b = 2.

Rational opposite Let’s show that: if x is rational, then –x is rational. Since x is rational, x = a/b where a and b are integers with no common factors, and b is not 0. By arithmetic, –x = –a/b. We have to explain why –x satisfies the definition of rational. Notice that both –a and b are integers. If a and b have no common factors, then –a and b couldn’t have any common factors either. b is still not zero. We conclude that –x is rational.

Rational addition If x and y are rational, then x+y is rational According to the definition, let x = a/b and y = c/d. x+y = (ad + bc) / bd Since a, b, c and d are all integers, we can add and multiply integers to obtain more integers. Thus, (ad +bc) and bd are integers. There is no common factor between (ad+bc) and bd. Neither b nor d is zero. Thus, bd is not 0. Conclusion: x+y satisfies the definition of rational number.

Proof practice Floor and ceiling functions Proof by contradiction Iterative algorithms What is the termination condition? Application: Sequences and series

Floor and ceiling Used to calculate phone bill, postage, and loop iterations floor(x) = round down to the next lower integer ceil(x) = round up to the next higher integer Examples floor() = 3, floor(–) = –4, floor(17) = 17 ceil() = 4, ceil(–) = –3, ceil(17) = 17 For which real numbers x is floor(x) equal to 2? For which real numbers x is ceil(x) equal to 6?

Fractions Often we need to take floor/ceil of a fraction. Can we derive formulas for floor(a/b) and ceil(a/b) ? A B Floor Ceiling 12 5 2 3 13 14 15 16 4 17 18 19 20 21 Floor(a/b) = (a – a % b) / b Ceil(a/b) = (a + (b – a) % b) / b

Loop iteration formula A for-loop (in C, C++ or Java) often has this general format: for (i = a; i <= b; i += s) The number of loop iterations is floor((b – a)/s) + 1 Example: for (i = 3; i <= 18; i += 5) // We execute when i = 3, 8, 13, 18.

Indirect proof Common proof technique Essentially, we show that the negation of the given statement is false. Begin the proof by saying, “Suppose not.” The negation of the given statement gives us 1 extra piece of information. During the proof, we arrive at a contradiction. Thus, we conclude that ~P is false; thus P must be true. Example: If I give 100 marbles to 23 people, then somebody must get at least 5.

Another example “For all integers n, if n2 is even, then n is even.” Proof by contradiction. Assume the statement is false. Then there exists an integer n such that n2 is even and n is odd. Since n is odd, it may be written as n = (2k+1). Then n2 = (2k+1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1. Since 2k2 + 2k is an integer, then n2 satisfies the definition of an odd number. We have reached a contradiction, since earlier we said n2 is even. Thus the original statement must be true. Alternatively, can prove by contrapositive. The equivalent statement is: “… if n is odd, then n2 is odd.”

Irrational addition If x is rational and y is irrational, then x+y is irrational. Suppose not! Then, we have that: x is rational, y is irrational, AND x+y is rational. We already know that the sum of two rationals is rational, and that the opposite of a rational is rational. Subtraction means adding the opposite. Thus, the difference of two rationals must be rational. Notice that y = (x+y) – x. The two numbers (x+y) and x are rational. Therefore the difference, y, is rational. But this contradicts our earlier assumption that y is irrational! Conclusion: The original statement must be correct.

Algorithm Heart of any computer program 2 kinds Explicit formula: area of triangle, compute loan payment Iterative computation: many examples! sorting an array listing prime numbers factorial GCF Square root Fibonacci

Closer look Euclidean algorithm to compute GCF Square root of “a” Start with 2 numbers Loop: Divide the smaller into the larger if remainder = 0, answer is the smaller else, continue with the smaller number and remainder Square root of “a” Start with an initial guess x0 xn+1 = average of xn and a/xn Stop when difference between 2 consecutive xi are sufficiently small. Square root: not exactly clear when to stop: based on tolerance for error

Sequence and series A sequence is essentially a list or array of values A series is the sum of these values Terms separated by “+” instead of “,” Application: an operating system often needs to know the execution time of a computer program in order to best schedule that task. A program’s execution time is largely dependent on loops! Especially nested loops. We’ll use series formulas to calculate the number of iterations.

Essentially means this: Notation Sequence notation (like an array) Can be explicit formula, as in: an = 4 + 3n Or can be recursively defined, as in: a1 = 5 an+1 = 2an, n  1 Series notation a1 + a2 + a3 + a4  Too inefficient Better to use Sigma notation Sigma notation Essentially means this: for (i = 1; i <= n; ++i) sum += a[i]

Applications Sequence vs. series Meaning of sigma notation Common series formulas Mathematical induction

Bernoulli formulas Help us evaluate series, e.g. to count loop iterations Nested loop can give rise to nested sigma expression

Example Use Bernoulli formulas to determine the first hundred terms of (3)(7) + (5)(12) + (7)(17) + (9)(22) + … First, write each term in terms of the term number, i Term formula = (2i + 1)(5i + 2) = 10i2 + 9i + 2 Apply Bernoulli formulas.

How to check If we say: sum(f(i)) = S(n), then we can check our sum answer this way: S(n) – S(n – 1) = f(n) For example, consider f(i) = 6i. The Bernoulli formula tells us that sum(f(i)) = 3n(n+1). So, S(n) = 3n(n+1) Work out S(n) – S(n – 1) = 3n(n+1) – 3(n – 1)n = 3n(n+1-(n – 1)) = 6n The answer checks because f(n) = 6n equivalently means f(i) = 6i. What would it look like if our summation formula is wrong? The f(n) would not match the original term formula. For example, we might have f(n) = 15n, but we originally wanted the summation of 6i, not 15i.

Inverse Bernoulli Review: Bernoulli formulas are used to help us convert from a term formula to a summation formula for a series. The way of checking summation formulas gives us an elegant way to calculate a term formula if we are given the summation formula. Ex. Finding the sum of i32i is not easy. Ex. But it is easy to find the term formula if we know if a series sum formula is n32n. Just plug in n and n – 1 and subtract! In fact, doing S(n) – S(n – 1) can be used to guess an unknown summation formula.

Nested loop Let’s count the operations in this nested loop. for (i = 1; i <= n; ++i) for (j = 1; j <= n; ++j) // assume 3 stmts in body Outer loop: We do the i=1 once We do the i<=n (n+1) times We do the ++i n times. Inner loop: We enter the inner loop n times. Each time we have: (1 + (n+1) + n + 3n). Total = 5n2 + 4n + 2 operations.

Nested loop #2 Let’s change the inner loop bound to i for (i = 1; i <= n; ++i) for (j = 1; j <= i; ++j) // assume 3 stmts in body Outer loop is still: 1 + (n+1) + n operations Inner loop: We enter the inner loop i times, where i could be 1 to n. For each i, we have: (1 + (i+1) + i + 3i). So, we have to sum: 5i + 2. Total = (5/2)n2 + (13/2)n + 2 operations.

Loop correctness Eventually, we want to be able to show that our loops are correct Powerful technique: Principle of Mathematical Induction Useful for proving many assertions Sum formulas Linear-combination formulas Divisibility questions Inequalities Correctness of loops

Induction P(n) is a statement that should be true for all positive integers n, or more generally for integer values  (some integer). How to prove: Show that P(1) is true. This is the “base case.” Show that if P(k) is true for some k  1, then P(k+1) must also be true. This is the “inductive step.” If you can do these two steps, then you can say: “Since P(1) is true and P(k)  P(k+1) for an arbitrary k  1, then P(n) is true for all n  1.” “domino effect”

Type I: Summations Let’s first apply induction to verifying summation formulas. The key is to add the next term to both sides of the equation. We’ll work out these examples: n  1, 1 + 3 + 5 + 7 + … + (2n – 1) = n2 n  1, 12 + 22 + 32 + … + n2 = n(n+1)(2n+1)/6 n  1, 1(1!) + 2(2!) + 3(3!) + … n(n!) = (n+1)! – 1 In general, the base case doesn’t have to be 1.

Induction Types of statements you’ll often see Summations  Linear combination Divisibility Inequalities Loop correctness

Type II: Linear formulas n  24, x, y  0 such that n = 5x + 7y. “Any integer n  24 can be expressed …” Base case: if n = 24, then choose x = 2 and y = 2. Next, assume P(k) is true. That is, k = 5x + 7y. Now we need a similar formula for k+1. A table of values may help. We see that if y  2, then k + 1 = 5(x + 3) + 7(y – 2) else k + 1 = 5(x – 4) + 7(y + 3) n x y 24 2 25 5 26 1 3 Two ways to add a penny: Trade away two 7’s for three 5’s, or Trade away four 5’s for three 7’s.

Try another n  14, x, y  0 such that n = 3x + 8y. “Any amount of postage 14 cents or higher can be achieved by using some combination of 3 and 8 cent stamps.” The goal of the inductive step is to write alternate formulas for k+1: k + 1 = a(x + ___) + b(y – ___) k + 1 = a(x – ___) + b(y + ___) We have to give two formulas. Choose the appropriate formula to avoid a negative.

Type III: Divisibility We want to show that: a | f(n) Recall what our goal is: to go from P(k) to P(k+1) One way to bridge the gap is to “subtract” P(k) from P(k+1) and verify that what results is true. Then add this residual to P(k) to conclude P(k+1). For example, we may need to show that 5 | 6n – 1. The crux of the proof centers on f(n) = 6n – 1. Then: f(k) = 6k – 1 and f(k+1) = 6k+1 – 1, so that: f(k+1) – f(k) = (6k+1 – 1) – (6k – 1) = 6k+1 – 6k = 6k (6 – 1) = 5 * 6k. Note that this is divisible by 5. *** see handout

Alt approach Alternative approach: write P(k+1) of the form: P(k+1) = x P(k) + y, where x and y are clearly multiples of a. Often handy for multiple exponential terms. Ex. For all positive integers, 4 | 3n + 7n – 2. In inductive step, we can write 3k+1 +7k+1 – 2 = 3*3k + (3+4)7k – 2 = 3*3k + 3*7k + 4*7k – 6 + 4 = 3(3k + 7k – 2) + 4(7k + 1) Is it also divisible by 8?

Examples For all positive integers n, 3n is odd. Sometimes we have a formula, and we want to be sure that it always evaluates to an integer. This turns out to be a divisibility problem in disguise.  For all positive integers n, (2/5)4n +(3/5)(–1)n is an integer.

Type IV: Inequalities Purpose: Sometimes we want to know if one algorithm is more efficient than another. The statement P(n) is of the form f(n) < g(n). The “<“ could be some other relational operator, e.g. “”. During the inductive step, to leap from P(k) to P(k+1), we need to verify either: f(k+1) – f(k) < g(k+1) – g(k) or f(k+1) / f(k) < g(k+1) / g(k) whichever is easier Once you have established that inequality, then add or multiply to f(k) < g(k), as appropriate to conclude with f(k+1) < g(k+1). Be careful to structure the proof so that you are not assuming what you are trying to prove.

Type V: loop correctness Given a loop, and certain information about the loop: Precondition Invariant Postcondition For a loop to be correct, verify the following: The precondition is true when the loop starts. The invariant is true as we go from iter k to iter k+1. The loop terminates. The postcondition is true when the loop is done. ***e.g. See handout (adding x 10 times yields 10x) e.g. a loop that computes a summation of i2