CMSC 250 Discrete Structures Exam 2 Review Summations What is next in the series … 9 16 25 4, , , , ______ 4 9 16 2 k 1 , General formula for a series Identical series Summation and product notation 2 Properties (splitting/merging, distribution) k ak , k 1 k 1 ak k2 i 1 bi , i2 i 6 k 1 k 5 2k k 1 6 7 1 1 7 1 k 0 k 1 j 1 j k 1 k Change of variables Applications (indexing, loops, algorithms) 27 June 2016 k 1 Exam 2 Review 2 Properties Merging and Splitting n n n a b a k m k k m k k m k bk n n n ak bk ak bk k m k m k m n i a a k m k k m k n a k i 1 k i n ak ak ak k m k m k i 1 n Distribution n n k m k m c ak c ak 27 June 2016 Exam 2 Review 3 Using the Properties ak k 1; bk k 1 n a k m n k 2 bk k m ak bk k m k m n 27 June 2016 n Exam 2 Review 4 Mathematical Induction Definition – Used to verify a property of a sequence – Formal definition (next slide) What proofs must have We proved: n i n(n 1) 2 – General summation/product i 1 n 1 n ar a – Inequalities r R 1 , a R, n Z 0 , ar j r 1 – Strong induction j 0 Misc – Recurrence relations – Quotient remainder theorem – Correctness of algorithms (Loop Invariant Theorem) 27 June 2016 Exam 2 Review 5 Inductive Proof Let P(n) be a property that is defined for integers n, and let a be a fixed integer. Suppose the following two statements are true. – P(a) is true. – For all integers k ≥ a, if P(k) is true then P(k+1) is true. Then the statement for all integers n ≥ a, P(n) is true. 27 June 2016 Exam 2 Review 6 Inductive Proofs Must Have Base Case (value) – Prove base case is true Inductive Hypothesis (value) – State what will be assumed in this proof Inductive Step (value) – Show State what will be proven in the next section – Proof Prove what is stated in the show portion Must use the Inductive Hypothesis sometime 27 June 2016 Exam 2 Review 7 Prove this statement: n Z 3 ,2n 1 2 n Base Case (n=3): LHS : 2(3) 1 6 1 7 3 LHS RHS RHS : 2 8 Inductive Hypothesis (n=k): Inductive Step (n=k+1): Show: 2(k 1) 1 2 2k 1 2 k k 1 Proof: 27 June 2016 Exam 2 Review 8 Prove this statement: n Z 3 ,2n 1 2 n Inductive Step (n=k+1): Show: Proof: 2k 1 1 2k 1 2k 2 1 2 k 1 2k 1 2 2 k 1 2k 1 2 2 k 2 IH 2k 1 2k Multiply by two 4k 2 2k 2 New goal: 2k 1 2 4k 2 2k 1 4k 1 2k 1 k 2 Which is true since k≥3. So 2k 1 2 4k 2 27 June 2016 2k 2 Exam 2 Review and 2k 1 1 2 9 k 1 Another Example For all integers n ≥ 1, 27 June 2016 3 2 1 Exam 2 Review 2n 10 Sets Set – – – – – – Proofs – – – – – Notation – versus Definitions – Subset, proper subset, partitions/disjoint sets Operations (, , –, ’, ) Properties and inference rules Venn diagrams Empty set properties Element argument, set equality Propositional logic / predicate calculus Inference rules Counterexample Types – generic particular, induction, contra’s, CW Russell’s Paradox (The Barber’s Puzzle) & Halting Problem 27 June 2016 Exam 2 Review 11 Set Operations Formal Definitions and Venn Diagrams Union: A B {x U | x A x B} Intersection: A B {x U | x A x B} Complement: c A A' {x U | x A} Difference: 27 June 2016 A B {x U | x A x B} A B A B' Exam 2 Review 12 Procedural Versions of Set Definitions Let X and Y be subsets of a universal set U and suppose x and y are elements of U. 1. 2. 3. 4. 5. x(XY) xX or xY x(XY) xX and xY x(X–Y) xX and xY xXc xX (x,y)(XY) xX and yY 27 June 2016 Exam 2 Review 13 Properties of Sets (Theorems 5.2.1 & 5.2.2) A B A A A B A B B B A B Inclusion Transitivity DeMorgan’s for Complement Distribution of union and intersection A BBC AC ( A B)' A' B' ( A B)' A' B' A ( B C ) ( A B) ( A C ) A ( B C ) ( A B) ( A C ) 27 June 2016 Exam 2 Review 14 Prove A=C A={nZ | pZ, n = 2p} C={mZ | qZ, m = 2q-2} 27 June 2016 Exam 2 Review 15 Does A=D A={xZ | pZ, x = 2p} D={yZ | qZ, y = 3q+1} Easy to disprove universal statements! 27 June 2016 Exam 2 Review 16 HW10, Problem 2 Did yesterday in class … 27 June 2016 Exam 2 Review 17 Counting P( E ) Counting elements in a list – How many in list are divisible by x Probability – likelihood of an event Permutations – with and without repetition n Multiplication rule c(i) i 1 – Tournament play – Rearranging letters in words – Where it doesn’t work P ( n, r ) r P n n( E ) n( S ) n! (n r )! Difference rule – If A is a finite set and BA, then n(A – B) = n(A) – n(B) Addition rule – If A1 A2 A3 … Ak=A and A1, A2 , A3,…,Ak are pairwise disjoint, then n(A) = n(A1) + n(A2) + n(A3) + … + n(Ak) n P(n, r ) n! C (n, r ) r! (n r )! r! r Inclusion/exclusion rule Combinations – with and without repetition, categories r n 1 Binomial theorem (Pascal’s Triangle) 27 June 2016 Exam 2 Review r 18 Prove: # elements in list = n – m + 1 Base case (List of size 1, x=y) – y – x + 1 = y – y + 1 (by substitution) = 1 IH (generic x, y=k [where x k]) – Assume size of list x to k, is k – x + 1 IS – Show size of list x to k + 1, is (k + 1) – x + 1 – Prove Split into two lists … 27 June 2016 Exam 2 Review 19 How many in list divisible by something How many positive three digit integers are there? – (this means only the ones that require 3 digits) – 999 – 100 + 1 = 900 How many three digit integers are divisible by 5? – think about the definition of divisible by x | y k Z, y = kx and then count the k’s that work 100, 101, 102, 103, 104, 105, 106,… 994, 995, 996, 997, 998, 999 20*5 21*5 … 199*5 – count the integers between 20 and 199 – 199 – 20 + 1 = 180 27 June 2016 Exam 2 Review 20 Multiplication Rule 1st step can be performed n1 ways 2nd step can be performed n2 ways … Kth step can be performed nk ways Operation can be performed n1* n2 *…* nk ways Cartesian product n(A)=3, n(B)=2, n(C)=4 – n(AxBxC) = 24 – n(AxB) = 6, n((AxB)xC) = 24 27 June 2016 Exam 2 Review 21 Multiplication Rule If there are n steps to a decision, each step having c(k) choices, the total number of choices is: n c ( i ) i 1 27 June 2016 Exam 2 Review 22 Permutation Example How many ways to take a picture? – – – – – With With With With With 1 2 3 4 5 person? people? people? people? people? Number of ways to arrange n objects – n! – 10n < n! 27 June 2016 Exam 2 Review 23 Difference Rule Formally If A is a finite set and BA, then n(A – B) = n(A) – n(B) One application: probability of the complement of an event P(E’) = P(Ec) = 1 - P(E) 27 June 2016 Exam 2 Review 24 Addition Rule Formally If A1 A2 A3 … Ak =A and A1, A2 , A3,…,Ak are pairwise disjoint (i.e. if these subsets form a partition of A) n(A) = n(A1) + n(A2) + n(A3) + … + n(Ak) 27 June 2016 Exam 2 Review 25 Inclusion/Exclusion Rule If there are two sets: n(A B) = n(A) + n(B) – n(A B) If there are three sets: n(A B C) = n(A) + n(B) + n(C) – n(A B) – n(A C) – n(B C) + n(A B C) 27 June 2016 Exam 2 Review 26 r-Permutations If there are n things in the set, and you want to line-up only r of them. n! P ( n, r ) r P n (n r )! Example: – Class = {Alice, Bob, Carol, Dan} – Select a president and a vice president to represent the class 27 June 2016 Exam 2 Review 27 Permutations What if just want 5-letter words from COMPUTER? =87654 8! 8 5! 27 June 2016 Exam 2 Review 28 Permutation w/ Repeated Elements What about NEEDLES NE1E2DLE3S 7! – NE1E2DLE3S, NE1E3DLE2S, – NE2E1DLE3S, NE2E3DLE1S – NE3E1DLE2S, NE3E2DLE1S 7! 7! 6 3! 27 June 2016 Exam 2 Review 29 Combinations Different ways of selecting objects – Counting subsets – Without duplication / all items distinguishable – Note: order is not taken into account 0 n, r Z where n r , n P(n, r ) n! C (n, r ) r! (n r )! r! r Examples: – Class = {Alice, Bob, Carol, Dan} Select two class representatives Select three class representatives 27 June 2016 Exam 2 Review 30 Combinations with Repitition In general – n – categories – r – items to choose from – Repetition allowed and order doesn’t count xxx ||| r n-1 r n 1 r 27 June 2016 Exam 2 Review 31 Binomial Theorem (x+y)2 (x+y)3 … (x+y)n Given any real numbers a and b and any nonnegative integer n, n n nk k n a b a b k 0 k 27 June 2016 Exam 2 Review 32