1 / 56

Course Summary

Course Summary. CS 202 Aaron Bloomfield. Outline. A review of the proof methods gone over in class Interspersed with the most popular demotivators from CS 101 Course summary. Demotivator winners!. Methodology 1 st place vote counted for 3 points 2 nd place vote counted for 2 points

minda
Download Presentation

Course Summary

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Course Summary CS 202 Aaron Bloomfield

  2. Outline • A review of the proof methods gone over in class • Interspersed with the most popular demotivators from CS 101 • Course summary

  3. Demotivator winners! • Methodology • 1st place vote counted for 3 points • 2nd place vote counted for 2 points • 3rd place vote counted for 1 point • Have not tallied the Toolkit ones yet • I won’t get those for a few weeks • Will then buy two demotivators and hang them in my office…

  4. Proof methods learned so far • Logical equivalences • via truth tables • via logical equivalences • Set equivalences • via membership tables • via set identities • via mutual subset proof • via set builder notation and logical equivalences • Rules of inference • for propositions • for quantified statements • Pigeonhole principle • Combinatorial proofs • Ten proof methods in section 1.5: • Direct proofs • Indirect proofs • Vacuous proofs • Trivial proofs • Proof by contradiction • Proof by cases • Proofs of equivalence • Existence proofs • Constructive • Non-constructive • Uniqueness proofs • Counterexamples • Induction • Weak mathematical induction • Strong mathematical induction • Structural induction

  5. Using Logical Equivalences Original statement Definition of implication DeMorgan’s Law Associativity of Or Re-arranging Idempotent Law

  6. In 12th place (11 votes)

  7. Set equivalences (§1.7) • Prove that A∩B=B-(B-A) Definition of difference Definition of difference DeMorgan’s law Complementation law Distributive law Complement law Identity law Commutative law

  8. Proof by set builder notation and logical equivalences 2 Original statement Definition of difference Negating “element of” Definition of difference DeMorgan’s Law Distributive Law Negating “element of” Negation Law Identity Law Definition of intersection

  9. In 11th place (1/3) (12 votes)

  10. Rules of inference (§1.5) • “It is not sunny this afternoon and it is colder than yesterday” • “We will go swimming only if it is sunny” • “If we do not go swimming, then we will take a canoe trip” • “If we take a canoe trip, then we will be home by sunset” • Does this imply that “we will be home by sunset”? • “It is not sunny this afternoon and it is colder than yesterday” • “We will go swimming only if it is sunny” • “If we do not go swimming, then we will take a canoe trip” • “If we take a canoe trip, then we will be home by sunset” • Does this imply that “we will be home by sunset”? • “It is not sunny this afternoon and it is colder than yesterday” • “We will go swimming only if it is sunny” • “If we do not go swimming, then we will take a canoe trip” • “If we take a canoe trip, then we will be home by sunset” • Does this imply that “we will be home by sunset”? • “It is not sunny this afternoon and it is colder than yesterday” • “We will go swimming only if it is sunny” • “If we do not go swimming, then we will take a canoe trip” • “If we take a canoe trip, then we will be home by sunset” • Does this imply that “we will be home by sunset”? • “It is not sunny this afternoon and it is colder than yesterday” • “We will go swimming only if it is sunny” • “If we do not go swimming, then we will take a canoe trip” • “If we take a canoe trip, then we will be home by sunset” • Does this imply that “we will be home by sunset”? • Example 6 of Rosen, section 1.5 • We have the hypotheses: • “It is not sunny this afternoon and it is colder than yesterday” • “We will go swimming only if it is sunny” • “If we do not go swimming, then we will take a canoe trip” • “If we take a canoe trip, then we will be home by sunset” • Does this imply that “we will be home by sunset”? ¬p q r → p ¬r → s s → t t p q r s t

  11. Rules of inference (§1.5) • ¬p  q 1st hypothesis • ¬p Simplification using step 1 • r → p 2nd hypothesis • ¬r Modus tollens using steps 2 & 3 • ¬r → s 3rd hypothesis • s Modus ponens using steps 4 & 5 • s → t 4th hypothesis • t Modus ponens using steps 6 & 7

  12. In 11th place (2/3) (12 votes)

  13. Rules of inference (§1.5) • Rosen, section 1.5, question 10a • Given the hypotheses: • “Linda, a student in this class, owns a red convertible.” • “Everybody who owns a red convertible has gotten at least one speeding ticket” • Can you conclude: “Somebody in this class has gotten a speeding ticket”? C(Linda) R(Linda) x (R(x)→T(x)) x (C(x)T(x))

  14. Rules of inference (§1.5) • x (R(x)→T(x)) 3rd hypothesis • R(Linda) → T(Linda) Universal instantiation using step 1 • R(Linda) 2nd hypothesis • T(Linda) Modes ponens using steps 2 & 3 • C(Linda) 1st hypothesis • C(Linda)  T(Linda) Conjunction using steps 4 & 5 • x (C(x)T(x)) Existential generalization using step 6 Thus, we have shown that “Somebody in this class has gotten a speeding ticket”

  15. In 11th place (3/3) (12 votes)

  16. Proof methods (§1.5) • Ten proof methods: • Direct proofs • Indirect proofs • Vacuous proofs • Trivial proofs • Proof by contradiction • Proof by cases • Proofs of equivalence • Existence proofs • Uniqueness proofs • Counterexamples

  17. In 10th place (1/5) (13 votes)

  18. Direct proof example • Rosen, section 1.5, question 20 • Show that the square of an even number is an even number • Rephrased: if n is even, then n2 is even • Assume n is even • Thus, n = 2k, for some k (definition of even numbers) • n2 = (2k)2 = 4k2 = 2(2k2) • As n2 is 2 times an integer, n2 is thus even

  19. Indirect proof example • If n2 is an odd integer then n is an odd integer • Prove the contrapositive: If n is an even integer, then n2 is an even integer • Proof: n=2k for some integer k (definition of even numbers) • n2 = (2k)2 = 4k2 = 2(2k2) • Since n2 is 2 times an integer, it is even

  20. In 10th place (2/5) (13 votes)

  21. Proof by contradiction • Given a statement p, assume it is false • Assume ¬p • Prove that ¬p cannot occur • A contradiction exists • Given a statement of the form p→q • To assume it’s false, you only have to consider the case where p is true and q is false

  22. Proof by contradiction • Theorem (by Euclid): There are infinitely many prime numbers. • Proof. Assume there are a finite number of primes • List them as follows: p1, p2 …, pn. • Consider the number q = p1p2 … pn + 1 • This number is not divisible by any of the listed primes • If we divided pi into q, there would result a remainder of 1 • We must conclude that q is a prime number, not among the primes listed above • This contradicts our assumption that all primes are in the list p1, p2 …, pn.

  23. Proof by contradiction example 2 • Rosen, section 1.5, question 21 (b) • Prove that if n is an integer and n3+5 is odd, then n is even • Rephrased: If n3+5 is odd, then n is even • Thus, p is “n3+5” is odd, q is “n is even” • Assume p and q • Assume that n3+5 is odd, and n is odd • Since n is odd: • n=2k+1 for some integer k (definition of odd numbers) • n3+5 = (2k+1)3+5 = 8k3+12k2+6k+6 = 2(4k3+6k2+3k+3) • As n3+5 = 2(4k3+6k2+3k+3) is 2 times an integer, n must be even • Thus, we have concluded q • Contradiction! • We assumed q was false, and showed that this assumption implies that q must be true • As q cannot be both true and false, we have reached our contradiction

  24. In 10th place (3/5) (13 votes)

  25. Vacuous proof example • When the antecedent is false • Consider the statement: • All criminology majors in CS 202 are female • Rephrased: If you are a criminology major and you are in CS 202, then you are female • Could also use quantifiers! • Since there are no criminology majors in this class, the antecedent is false, and the implication is true

  26. Trivial proof example • When the consequence is true • Consider the statement: • If you are tall and are in CS 202 then you are a student • Since all people in CS 202 are students, the implication is true regardless

  27. Proof by cases example • Prove that • Note that b ≠ 0 • Cases: • Case 1: a ≥ 0 and b > 0 • Then |a| = a, |b| = b, and • Case 2: a ≥ 0 and b < 0 • Then |a| = a, |b| = -b, and • Case 3: a < 0 and b > 0 • Then |a| = -a, |b| = b, and • Case 4: a < 0 and b < 0 • Then |a| = -a, |b| = -b, and

  28. In 10th place (4/5) (13 votes)

  29. Proofs of equivalence example • Rosen, section 1.5, question 40 • Show that m2=n2 if and only if m=n or m=-n • Rephrased: (m2=n2) ↔ [(m=n)(m=-n)] • Need to prove two parts: • [(m=n)(m=-n)] → (m2=n2) • Proof by cases! • Case 1: (m=n)→ (m2=n2) • (m)2 = m2, and (n)2 = n2, so this case is proven • Case 2: (m=-n) → (m2=n2) • (m)2 = m2, and (-n)2 = n2, so this case is proven • (m2=n2) → [(m=n)(m=-n)] • Subtract n2 from both sides to get m2-n2=0 • Factor to get (m+n)(m-n) = 0 • Since that equals zero, one of the factors must be zero • Thus, either m+n=0 (which means m=n) • Or m-n=0 (which means m=-n)

  30. In 10th place (5/5) (13 votes)

  31. Constructive existence proof example • Show that a square exists that is the sum of two other squares • Proof: 32 + 42 = 52 • Show that a cube exists that is the sum of three other cubes • Proof: 33 + 43 + 53 = 63

  32. Non-constructive existence proof example • Rosen, section 1.5, question 50 • Prove that either 2*10500+15 or 2*10500+16 is not a perfect square • A perfect square is a square of an integer • Rephrased: Show that a non-perfect square exists in the set {2*10500+15, 2*10500+16} • Proof: The only two perfect squares that differ by 1 are 0 and 1 • Thus, any other numbers that differ by 1 cannot both be perfect squares • Thus, a non-perfect square must exist in any set that contains two numbers that differ by 1 • Note that we didn’t specify which one it was!

  33. In 9th place (14 votes)

  34. Uniqueness proof example • If the real number equation 5x+3=a has a solution then it is unique • Existence • We can manipulate 5x+3=a to equal (a-3)/5 • Is this constructive or nonconstructive? • Uniqueness • If there are two such numbers, then they would fulfill the following: a = 5x+3 = 5y+3 • We can manipulate this to yield that x = y • Thus, the one solution is unique!

  35. In 8th place (15 votes)

  36. Counterexamples • Given a universally quantified statement, find a single example which it is not true • Note that this is DISPROVING a UNIVERSAL statement by a counterexample • x ¬R(x), where R(x) means “x has red hair” • Find one person (in the domain) who has red hair • Every positive integer is the square of another integer • The square root of 5 is 2.236, which is not an integer

  37. In 7th place (16 votes)

  38. Weak mathematical induction (§ 3.3) • Rosen, question 7: Show • Base case: n = 1 • Inductive hypothesis: assume

  39. Weak mathematical induction (§ 3.3) • Inductive step: show

  40. In 6th place (18 votes)

  41. Strong mathematical induction (§ 3.3) • Show that any number > 1 can be written as the product of primes • Base case: P(2) • 2 is the product of 2 (remember that 1 is not prime!) • Inductive hypothesis: P(1), P(2), P(3), …, P(k) are all true • Inductive step: Show that P(k+1) is true

  42. Strong mathematical induction (§ 3.3) • Inductive step: Show that P(k+1) is true • There are two cases: • k+1 is prime • It can then be written as the product of k+1 • k+1 is composite • It can be written as the product of two composites, a and b, where 2 ≤ a ≤ b < k+1 • By the inductive hypothesis, both P(a) and P(b) is true

  43. In 5th place (1/2) (21 votes)

  44. Structural induction (§ 3.4) • Show that n(T) ≥ 2h(T) + 1 • Inductive hypothesis: • Let T1 and T2 be full binary trees • Assume that n(T1) ≥ 2h(T1) + 1 for some tree T1 • Assume that n(T2) ≥ 2h(T2) + 1 for some tree T2 • Recursive step: • Let T = T1 ∙ T2 • Here the ∙ operator means creating a new tree with a root note r and subtrees T1 and T2 • New element is T • By the definition of height and size, we know: • n(T) = 1 + n(T1) + n(T2) • h(T) = 1 + max ( h(T1), h(T2) ) • Therefore: • n(T) = 1 + n(T1) + n(T2) • ≥ 1 + 2h(T1) + 1 + 2h(T2) + 1 • ≥ 1 + 2*max ( h(T1), h(T2) ) the sum of two non-neg #’s is at least as large as the larger of the two • = 1 + 2*h(T) • Thus, n(T) ≥ 2h(T) + 1

  45. In 5th place (2/2) (21 votes)

  46. Induction methods compared

  47. In 4th place (25 votes)

  48. Pigeonhole principle (§4.2) • Consider 5 distinct points (xi, yi) with integer values, where i = 1, 2, 3, 4, 5 • Show that the midpoint of at least one pair of these five points also has integer coordinates • Thus, we are looking for the midpoint of a segment from (a,b) to (c,d) • The midpoint is ( (a+c)/2, (b+d)/2 ) • Note that the midpoint will be integers if a and c have the same parity: are either both even or both odd • Same for b and d • There are four parity possibilities • (even, even), (even, odd), (odd, even), (odd, odd) • Since we have 5 points, by the pigeonhole principle, there must be two points that have the same parity possibility • Thus, the midpoint of those two points will have integer coordinates

  49. In 3rd place (1/2) (27 votes)

  50. Combinatorial proof (§4.3) • Let n be a non-negative integer. Then • Combinatorial proof • A set with n elements has 2n subsets • By definition of power set • Each subset has either 0 or 1 or 2 or … or n elements • There are subsets with 0 elements, subsets with 1 element, … and subsets with n elements • Thus, the total number of subsets is • Thus,

More Related