Presentation is loading. Please wait.

Presentation is loading. Please wait.

Reading and Writing Mathematical Proofs Spring 2016 Lecture 1: Basic Proving Techniques I.

Similar presentations


Presentation on theme: "Reading and Writing Mathematical Proofs Spring 2016 Lecture 1: Basic Proving Techniques I."— Presentation transcript:

1 Reading and Writing Mathematical Proofs Spring 2016 Lecture 1: Basic Proving Techniques I

2 Organization The required stuff…

3 Organization Lecturer: Arthur van Goethem MSc, MF 4.144, a.i.v.goethem@tue.nl Web page:Part of Data Structures http://www.win.tue.nl/aga/teaching/2IL50/ Book:Daniel Solow. How to Read and Do Proofs (5th edition) not mandatory

4 Schedule Only 4 lectures

5 Prerequisites Not covered Logical inferences Logical derivations (flag proofs) In other words: Logic and Set Theory (2IT60) Covered Mathematical proofs in common English Common proof techniques (proof by contradiction, induction, etc.) Common errors Many proof examples

6 Reading and Writing Mathematical Proofs Today on:

7 Basic Proving Techniques I Today on: The proving cookbook…

8 Today: “How to properly slap your sidekick.” “Really poorly drawn circles!” “Proving my hamsters are strange.”

9 What is a proof? Why explanations are not proofs…

10 What is a proof? A method for establishing truth What establishes truth depends on context PhysicsSufficient experimental evidence CourtroomAdmissible evidence and witness testimony Mathematical proofNot a doubt possible!

11 What is a proof? A form of communication Proof must convince reader (not the writer!) of correctness Proofs must be:  Clearly written Should be easy to follow Very different from “proving process”  Very precise No ambiguities!  Leaving no doubts

12 What is a proof? Clearly written “We turn the solution into an array. We invert the graph and then it look like the array. Because the solution can be an inverted graph and the array is input, the solution exists.” Very precise “We use Depth-First-Search to find some nodes that are too deep and somehow form the solution.” Leaving no doubts “In most cases it is the case that this conversion works. As we only have the best cases we likely can always perform this conversion.”

13 Definition Mathematical proof A convincing argument for the reader to establish the correctness of a mathematical statement without any doubt.

14 3 + 6 3 + 6 = 9 Definition Mathematical proof A convincing argument for the reader to establish the correctness of a mathematical statement without any doubt. Statement must be true or false

15 Definition Mathematical proof A convincing argument for the reader to establish the correctness of a mathematical statement without any doubt. In what format should a proof be?

16 Logical derivation Good Very systematic Hard to make mistakes Bad Not convenient for statements not stated in logical formulas Emphasis on logical reasoning → detract from crux argument Hard to read Cumbersome

17 Common English Theorem If x is odd, then x 2 is odd Proof Since x is odd, there exists a k ℤ such that x = 2k + 1. Then, x 2 = (2k + 1) 2 = 4k 2 + 4k + 1 = 2(2k 2 + 2k) + 1 = 2m+1. As there exists a m ℤ such that x 2 = 2m + 1, x 2 is odd. □ Good Short and to the point Easy to read Bad Logical reasoning somewhat hidden Natural language can be ambiguous This is the kind of proof we expect in Data Structures!

18 Two Proof Formats This is what you should write down This should be in the back of your mind Theorem If x is odd, then x 2 is odd Proof Since x is odd, there exists a k ℤ such that x = 2k + 1. Then, x 2 = (2k + 1) 2 = 4k 2 + 4k + 1 = 2(2k 2 + 2k) + 1 = 2m+1. As there exists a m ℤ such that x 2 = 2m + 1, x 2 is odd. □

19 Two Proof Formats Must be able to translate: Logic ↔ English Theorem If x is odd, then x 2 is odd Proof Since x is odd, there exists a k ℤ such that x = 2k + 1. Then, x 2 = (2k + 1) 2 = 4k 2 + 4k + 1 = 2(2k 2 + 2k) + 1 = 2m+1. As there exists a m ℤ such that x 2 = 2m + 1, x 2 is odd. □

20 Logic and Ambiguities The stuff that is kind of doing that thing…

21 Logic?

22

23

24

25

26 Logic vs. English LogicEnglish P ⋀ Q P and Q Both P and Q P ⋁ Q P or Q careful…. ¬P ¬( P ⋁ Q) not P doesn’t hold, cannot neither P nor Q

27 Logic vs. English LogicEnglish P ⇒ Q P implies Q If P, then Q P ⇔ Q P is equivalent to Q P if and only if Q P iff Q For P ⇒ Q: ¬Q ⇒ ¬ P (equivalent) Q ⇒ P (not equivalent!) contrapositive converse

28 Ambiguities Do you want beer or water? Do you want beer or water or both? (or) OR Do you want either beer or water? (exclusive-or) If you can solve any problem we pose, then you ace the course If you can solve some problem we pose, then you ace the course OR If you can solve all problems we pose, then you ace the course Always avoid ambiguities!

29 Detail What to describe and what not

30 Definition Mathematical proof A convincing argument for the reader to establish the correctness of a mathematical statement without any doubt. How detailed should a proof be?

31 A Simple Proof Theorem Two distinct circles can have at most two intersection points.

32 A Simple Proof Theorem Two distinct circles can have at most two intersection points. Proof For the sake of contradiction, assume that two distinct circles C 1 and C 2 have (at least) three intersection points p 1, p 2, and p 3. Note that p 1, p 2, and p 3 must lie on both C 1 and C 2. But, three points on a circle uniquely define the circle. Thus, C 1 = C 2. Contradiction! □

33 A Simple Proof Theorem Two distinct circles can have at most two intersection points. Proof For the sake of contradiction, assume that two distinct circles C 1 and C 2 have (at least) three intersection points p 1, p 2, and p 3. Note that p 1, p 2, and p 3 must lie on both C 1 and C 2. But, three points on a circle uniquely define the circle. Thus, C 1 = C 2. Contradiction! □

34 A Simple Proof Theorem Two distinct circles can have at most two intersection points. Proof For the sake of contradiction, assume that two distinct circles C 1 and C 2 have (at least) three intersection points p 1, p 2, and p 3. Note that p 1, p 2, and p 3 must lie on both C 1 and C 2. But then the center of C 1 (and C 2 ) must be at the intersection of the bisector of p 1 and p 2, and the bisector of p 2 and p 3. Since the bisectors are lines, and two lines intersect only once, this uniquely defines the center (and radius) of both C 1 and C 2.Thus, C 1 = C 2. Contradiction! □

35 A Simple Proof Theorem Two distinct circles can have at most two intersection points. Proof For the sake of contradiction, assume that two distinct circles C 1 and C 2 have (at least) three intersection points p 1, p 2, and p 3. Note that p 1, p 2, and p 3 must lie on both C 1 and C 2. But then the center of C 1 (and C 2 ) must be at the intersection of the bisector of p 1 and p 2, and the bisector of p 2 and p 3. Since the bisectors are lines, and two lines intersect only once, this uniquely defines the center (and radius) of both C 1 and C 2.Thus, C 1 = C 2. Contradiction! □

36 Proof Detail When is a proof detailed enough?  What will the reader accept as true statements  More detail results in “more obvious” statements…  … but is also much longer  A good proof must find the right balance

37 Axiomatic System Axiom A simple statement assumed to be true Which axioms are you allowed to use? ‘Anything’ from high school math (middelbare school) Anything covered in class If you are unsure, just ask! Exception: If you are asked to prove a statement, the statement itself can never be used as an axiom

38 Axioms in this Course Exception : If you are asked to prove a statement, the statement itself can never be used as an axiom

39 Practice What are the axioms? Theorem If x is odd, then x 2 is odd Proof Since x is odd, there exists a k ℤ such that x = 2k + 1. Then, x 2 = (2k + 1) 2 = 4k 2 + 4k + 1 = 2(2k 2 + 2k) + 1. Thus, x 2 is odd. □

40 Analogy Proving process

41 Analogy Written proof

42 Analogy The Maze Analogy entrance/premise exit/goal Proving process Find path between entrance and exit Erratic, creative Written proof Give instructions for others to find path Stick to essentials

43 Proving Tips Tips for writing proofs 1. State the proof techniques you’re using (see next lecture) 2. Keep a linear flow Proving process different from written proof 3. Describe every step clearly in words 4. Don’t use complicated notation 5. Make sure your axioms are actually “obvious” What is obvious to you may not be obvious to the reader 6. Finish your proof Connect everything with what you were trying to prove

44 Practice

45 Practice Proofs Theorem (handshaking lemma) For any graph G=(V, E) the number of vertices with odd degree is even.

46 Practice Proofs Theorem (handshaking lemma) Consider a group of people shaking hands with each other (but not necessarily with everyone). The number of people that shook hands with an odd number of people is even.

47 Practice Proofs Theorem (handshaking lemma) For any graph G=(V, E) the number of vertices with odd degree is even. Proof Consider the sum of the degrees of all vertices: Σ v d(v). This sum counts every edge exactly twice. Thus the sum is 2*|E|, which is even. Vertices with an even degree do not affect the parity of this sum. Hence, if V’ is the set of vertices with odd degree, then Σ v V’ d(v) must also be even. Since the sum of an odd number of odd numbers is odd, the sum Σ v V’ d(v) is even if and only if |V’| is even. □

48 Practice Proofs Theorem (Pythagoras) For a right triangle T with side lengths x, y, and z (x ≤ y ≤ z ), it holds that x 2 + y 2 = z 2.

49 Practice Proofs Theorem (Pythagoras) For a right triangle T with side lengths x, y, and z (x ≤ y ≤ z ), it holds that x 2 + y 2 = z 2. Proof Seems tricky… Let’s try to prove something simpler. What if x = y? Then the area of the triangle is x 2 /2. We need to prove that 2x 2 = z 2. So 4 triangles should together have area z 2. How about this configuration? z x y z zz z

50 Practice Proofs Theorem (Pythagoras) For a right triangle T with side lengths x, y, and z (x ≤ y ≤ z ), it holds that x 2 + y 2 = z 2. Proof Let’s return to the general case. What happens if we again try to form a square with side length z? We get a hole in the middle which seems to be a square. We may have enough for a proof here… z x y z z z z

51 Practice Proofs Theorem (Pythagoras) For a right triangle T with side lengths x, y, and z (x ≤ y ≤ z ), it holds that x 2 + y 2 = z 2. Proof Consider the configuration of four copies of T shown in the figure. Note that, for a right triangle, the sum of the non-right angles is 90 °, since the sum of all angles is 180°. Hence, the outer shape is a square with side length z and has area z 2. The area of a single triangle is xy/2. Because T is a right triangle, the middle hole is also a square with side length (y - x) and area (y - x) 2. We thus obtain: z 2 = 2xy + (y - x) 2 = x 2 + y 2. □ z z z z

52 Basic Proving Techniques Proving 101…

53 Overview Basic Proving Techniques

54 Overview Basic Proving Techniques 1. Forward-backward method 2. Mathematical induction 3. Case analysis 4. Proof by contradiction

55 Forward-Backward Method How to get from A to B and B to A…

56 Forward-Backward Method The most basic approach Logically combine axioms, definitions, and earlier theorems (forward) Simplify the goal (backward) This should always be your default approach FACTS GOAL

57 When to use? Generally used for statements of the form: If P then Q Reason forward from the premise Reason backward from the goal Usage PremiseGoal

58 Basic Example Theorem If my hamsters do excessive exercise, I will be tired in the morning. Proof My hamsters do excessive exercise They are running in their exercise wheel The exercise wheel is making noise Something is keeping me awake I do not get a good night’s sleep I am tired in the morning

59 Example

60

61

62 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof What does f(n) = O(g(n)) mean again? There exist positive constants c and n 0 such that f(n) ≤ c g(n) for all n ≥ n 0.

63 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof By definition there exist positive constants c’ and n 0 ’ such that f 1 (n) ≤ c’ g 1 (n) for all n ≥ n 0 ’. Similarly, there exist positive constants c’’ and n 0 ’’ such that f 2 (n) ≤ c’’ g 2 (n) for all n ≥ n 0 ’’. We need to show that there exist positive constants c and n 0 such that f 1 (n)f 2 (n) ≤ c g 1 (n)g 2 (n) for all n ≥ n 0. We must be very careful with variables! Use different names!

64 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof By definition there exist positive constants c’ and n 0 ’ such that f 1 (n) ≤ c’ g 1 (n) for all n ≥ n 0 ’. Similarly, there exist positive constants c’’ and n 0 ’’ such that f 2 (n) ≤ c’’ g 2 (n) for all n ≥ n 0 ’’. We need to show that there exist positive constants c and n 0 such that f 1 (n)f 2 (n) ≤ c g 1 (n)g 2 (n) for all n ≥ n 0.

65 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof By definition there exist positive constants c’ and n 0 ’ such that f 1 (n) ≤ c’ g 1 (n) for all n ≥ n 0 ’. Similarly, there exist positive constants c’’ and n 0 ’’ such that f 2 (n) ≤ c’’ g 2 (n) for all n ≥ n 0 ’’. We need to show that there exist positive constants c and n 0 such that f 1 (n)f 2 (n) ≤ c g 1 (n)g 2 (n) for all n ≥ n 0. To establish this, we need to find suitable values for c and n 0.

66 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof By definition there exist positive constants c’ and n 0 ’ such that f 1 (n) ≤ c’ g 1 (n) for all n ≥ n 0 ’. Similarly, there exist positive constants c’’ and n 0 ’’ such that f 2 (n) ≤ c’’ g 2 (n) for all n ≥ n 0 ’’. We need to show that there exist positive constants c and n 0 such that f 1 (n)f 2 (n) ≤ c g 1 (n)g 2 (n) for all n ≥ n 0. To establish this, we need to find suitable values for c and n 0. We already are given constants c’, c’’, n 0 ’, and n 0 ’’.

67 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof By definition there exist positive constants c’ and n 0 ’ such that f 1 (n) ≤ c’ g 1 (n) for all n ≥ n 0 ’. Similarly, there exist positive constants c’’ and n 0 ’’ such that f 2 (n) ≤ c’’ g 2 (n) for all n ≥ n 0 ’’. We need to show that there exist positive constants c and n 0 such that f 1 (n)f 2 (n) ≤ c g 1 (n)g 2 (n) for all n ≥ n 0. To establish this, we need to find suitable values for c and n 0. We already are given constants c’, c’’, n 0 ’, and n 0 ’’. Note that f 1 (n)f 2 (n) ≤ c’g 1 (n) c’’g 2 (n) = c’ c’’ g 1 (n)g 2 (n),

68 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof By definition there exist positive constants c’ and n 0 ’ such that f 1 (n) ≤ c’ g 1 (n) for all n ≥ n 0 ’. Similarly, there exist positive constants c’’ and n 0 ’’ such that f 2 (n) ≤ c’’ g 2 (n) for all n ≥ n 0 ’’. We need to show that there exist positive constants c and n 0 such that f 1 (n)f 2 (n) ≤ c g 1 (n)g 2 (n) for all n ≥ n 0. To establish this, we need to find suitable values for c and n 0. We already are given constants c’, c’’, n 0 ’, and n 0 ’’. Note that f 1 (n)f 2 (n) ≤ c’g 1 (n) c’’g 2 (n) = c’ c’’ g 1 (n)g 2 (n), but only if n ≥ n 0 ’ and n ≥ n 0 ’’. So n ≥ n 0 should imply n ≥ n 0 ’ and n ≥ n 0 ’’.

69 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof By definition there exist positive constants c’ and n 0 ’ such that f 1 (n) ≤ c’ g 1 (n) for all n ≥ n 0 ’. Similarly, there exist positive constants c’’ and n 0 ’’ such that f 2 (n) ≤ c’’ g 2 (n) for all n ≥ n 0 ’’. We need to show that there exist positive constants c and n 0 such that f 1 (n)f 2 (n) ≤ c g 1 (n)g 2 (n) for all n ≥ n 0. Let n 0 = max(n 0 ’, n 0 ’’) and c = c’ c’’. Then, for all n ≥ n 0 (which implies n ≥ n 0 ’ and n ≥ n 0 ’’), f 1 (n)f 2 (n) ≤ c’ g 1 (n) c’’ g 2 (n) = c’ c’’ g 1 (n) g 2 (n) = c g 1 (n) g 2 (n). We have f 1 (n)f 2 (n) ≤ c g 1 (n) g 2 (n) for all n ≥ n 0. Thus, f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)). □

70 Another Example Theorem If f 1 (n) = O(g 1 (n)) and f 2 (n) = O(g 2 (n)), then f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)) Proof By definition there exist positive constants c’ and n 0 ’ such that f 1 (n) ≤ c’ g 1 (n) for all n ≥ n 0 ’. Similarly, there exist positive constants c’’ and n 0 ’’ such that f 2 (n) ≤ c’’ g 2 (n) for all n ≥ n 0 ’’. We need to show that there exist positive constants c and n 0 such that f 1 (n)f 2 (n) ≤ c g 1 (n)g 2 (n) for all n ≥ n 0. Let n 0 = max(n 0 ’, n 0 ’’) and c = c’ c’’. Then, for all n ≥ n 0 (which implies n ≥ n 0 ’ and n ≥ n 0 ’’), f 1 (n)f 2 (n) ≤ c’ g 1 (n) c’’ g 2 (n) = c’ c’’ g 1 (n) g 2 (n) = c g 1 (n) g 2 (n). We have f 1 (n)f 2 (n) ≤ c g 1 (n) g 2 (n) for all n ≥ n 0. Thus, f 1 (n)f 2 (n) = O(g 1 (n)g 2 (n)). □

71 Mathematical Induction An introduction to induction…

72

73

74

75 Recurring structures Many algorithms and (data)structures have recurrences  Loop  List  Tree sum = 0 for i = 1 to A.length do sum = sum + A[i]

76 The Idea P(1)P(2)P(3)P(2)P(n) …

77 Usage

78 Basic Example

79

80

81 Example

82 Practice 1

83

84 Practice 2

85

86 Loop Invariant An introduction to proving loops…

87 Loop Invariant What do we want? How do we prove something is true at the end? What do we really know? sum = 0 for i = 1 to A.length do sum = sum + A[i]

88 Loop Invariant What do we really know? sum = 0 for i = 1 to A.length do sum = sum + A[i]

89 Loop Invariant What do we really know? sum = 0 for i = 1 to A.length do sum = sum + A[i]

90 Loop Invariant What do we really know? sum = 0 for i = 1 to A.length do sum = sum + A[i] Not an Axiom!!

91 Loop Invariant What do we really know? sum = 0 for i = 1 to A.length do sum = sum + A[i]

92 Loop Invariant

93 Loop Invariants replicate the chain of logical derivations To prove a statement is true at the end, we need..  Invariant(What remains true)  Initialization (Starting conditions)  Maintenance (Making sure it remains true)  Termination (Ending conditions)

94 Basic Example sum = 0 for i = 1 to A.length do sum = sum + A[i]

95 Basic Example sum = 0 for i = 1 to A.length do sum = sum + A[i]

96 Basic Example sum = 0 for i = 1 to A.length do sum = sum + A[i]

97 Basic Example sum = 0 for i = 1 to A.length do sum = sum + A[i]

98 Reading and Writing Mathematical Proofs Next time on:

99 Next time! “Proving Teletubbies are unlikable!” “How to prove you are cool (and own a Ferrari).” “How to store way too many pigeons.”


Download ppt "Reading and Writing Mathematical Proofs Spring 2016 Lecture 1: Basic Proving Techniques I."

Similar presentations


Ads by Google