Any Wizard of Oz fans? Discrete Math Basics Dorothy: How does one get to the Emerald City? Glynda: It is always best to start at the beginning Outline Sets Relations Proofs Sets A set is a collection of elements. Finite set has finite number of elements A = { 1, 3, 5, 6, 9 } Infinite Set has infinite number of elements B = { x : x is an odd integer } Null (Empty) set has no elements. Sets Set Operations Membership If an element x is a member of a set A, we write: x A. If an element x is not a member of a set A, we write: x A Subsets: A is a subset of B if all elements of A are also in B. A B if x A then x B A = B is the same as saying A B and B A. Power Set A = Set of all subsets of A Union: A B = set consisting of all elements in either A or B or both. Intersection A B = set of elements that are in both A and B If A B =, A and B are disjoint. Difference A B = set of all elements of A that are not elements of B Complement (wrt a universal set U) A = All elements in U that are not in A U - A 1
Set Operations A = { 1, 3, 5, 6, 9 } B = { x : x is an odd integer } A B = { x : x = 6 or x is an odd integer} A B = { 1, 3, 5, 9 } A B = { 6 } B = { x : x is an even integer } With respect to the Universal set of Positive integers. Cartesian Product of Sets A x B = set of ordered pairs (a,b) such that a A and b B. A x B x C = set of ordered triplets (a, b, c) such that a A and b B and c C In general: A 1 x A x x A n = the set of all n- tuples (a 1, a,, a n ) such that a i A i for all i. Relations on sets Means to relate or associate a member of one set with a member of another: R : A B Relation is simply a subset of A x B If a A is related to b B then (a, b) R Can also be written arb Or R(a) contains b Functions Functions are restricted relations f: A B Every element of A is associated with exactly 1 element of B Functions f : A B A and B can themselves be Cartesian Products f: A x B C Elements of f are ((a,b), c) where a A, b B, c C f (a,b) = c Equivalence Relations If R is a relation on A (R: A A), R is an equivalence relation if: R is reflexive (a, a) R for all a in A R is symmetric if (a,b) R then (b,a) R R is transitive if (a, b) R and (b,c) R then (a,c) R
Equivalence Relations An equivalence relation on A (R: A A) partitions the elements of A into disjoint equivalence classes. For each class, elements in the class are related only to all elements in the same partition. Example: 4 : Ν Ν : x 4 y if ( x mod 4) == (y mod 4 ) [] = {, 4, 8, 1, } [1] = { 1, 5, 9, 13, } [] = {, 7, 1, 15, } [3] = { 3, 8, 11, 16, } Functions and Relations Questions? Next: proofs Mathematical Proofs An argument that something is true If X, then Y Types of proofs Direct/Constructive proofs Proof by contradiction Direct Proofs If X, then Y Assume X is true, show directly that Y is true. Direct Proofs Example: For integers a,b: If a and b are odd, then ab is odd. Given: a and b are odd integers There exists integer x such that a= x +1 There exists integer y such that b = y + 1 Must prove: a times b is also odd There exists integer z such that ab = z + 1 Direct Proofs Perform the multiplication directly ab = (x + 1)(y + 1) = 4xy + x + y + 1 = (xy + x + y) + 1 So z = xy + x + y Not only did you prove that a z exists, you constructed an algorithm for generating this z. This is an example of a constructive proof. 3
Proof by contradiction If X, then Y With proof by contraction You assume that Y is false Then derive a contradiction to a fact known to be true If we find a contradiction, then we know our initial assumption (I.e. Y is false) must be invalid and thus Y must be true. Kirk story Proof by contradiction Example A, B, and C are sets. If A B = and C B, then A C = Given: A and B have nothing in common C is a subset of B Must show: A and C have nothing in common Proof by contradiction If X, then Y -- Assume Y is false 1. Assume that A C Meaning, there is an element x which is in both A and C. Since C is a subset of B then x, being a member of C must a member of B as well. 3. However, by #1, x A. 4. x A and x B implies that A B 5. This contradicts X 6. The assumption in #1 must be invalid and as such A C = Proof by Induction Used to prove statements involving an integer that we wish to prove true for all integers greater than a given integer Example: n n( n + 1) i = + 1+ + 3+ 4 + L+ n = For all n Proof by Induction Notice there are two elements to the problem to be proven: Statement involving an integer, P(n) A specific integer n for which we are trying to show that P(n) is true for all values greater than or equal to. How : Let P(n) is some statement involving an integer, n. To prove that P(n) is true for every integer a given integer n, it is sufficient to show these two things: 1. P(n ) is true. For any k n, if P(k) is true, then P(k+1) is true. 4
Steps to an inductive proof: 1. Basis step: Show P(n) is true when n=n. Induction hypothesis Assume that P(n) is true for some k n 3. Inductive step Prove P(n) is true for n = k+1 using the induction hypothesis. Example: Show that for n n n( n + 1) i = + 1+ + 3 + 4 + L+ n = 1. Basis step: Show true for n = i = ( + 1) = Proof by Induction. Inductive Hypothesis: Assume true for n=k k i = k(k +1) 3. Inductive Step: Show true for n=k +1 k +1 i = (k +1)(k + ) k + 1 k i = i + ( k + 1) By the induction hypothesis k k(k +1) so i = k 1 k( k + 1) k( k + 1) + ( k + 1) i = + ( k + 1) = + k = + 3k + ( k + 1)( k + ) = Summary Steps to an inductive proof: 1. Basis step: Show P(n) is true when n=n. Induction hypothesis Assume that P(n) is true for some k n 3. Inductive step Prove P(n) is true for n = k+1 using the induction hypothesis. Proof Direct / constructive Proof by contradiction Any questions? 5
Reminder Next class Quiz on all this discrete math. Start to look at our 3 basic concepts Languages Grammars Automata 6