Mathematics for Computer Science MIT 6.042J/18.062J More Counting Albert R Meyer, April 16, 2009 lec 10R.1 Sum Rule |A B| = |A| + |B| A B for disjoint sets A, B Albert R Meyer, April 16, 2009 lec 10R.2 Sum Rule |A B| = ? A B What if not disjoint? Albert R Meyer, April 16, 2009 lec 10R.3 Inclusion-Exclusion |A B| =|A|+|B|-|A B| A B What if not disjoint? Albert R Meyer, April 16, 2009 lec 10R.4 Inclusion-Exclusion (3 Sets) |A B C| = |A|+|B|+|C| – |A B| – |A C| – |B C| + |A B C| A B C Albert R Meyer, April 16, 2009 lec 10R.8 Incl-Excl Formula: Proof A town has n clubs. Each club Ai has a secretary Si who knows if person x is a club member: Si(x) = 1 if x in Ai, = 0 if x not in Ai. Albert R Meyer, April 16, 2009 lec 10R.10 Incl-Excl Formula: Proof Fact: |A| = sum of SA(x) over all x. Now Si(x)Sj(x) is sec’y for AiAj so |AiAj| = sum of Si(x)Sj(x) over all x, |AiAjAk| = x Si(x)Sj(x)Sk(x) etc. Albert R Meyer, April 16, 2009 lec 10R.11 Incl-Excl Formula: Proof Let U ::= A1A2 An sec’y SU(x)=0 iff Si(x)=0 for all n clubs. So 1-SU(x) = (1-S1(x))(1-S2(x)) (1-Sn(x)) Albert R Meyer, April 16, 2009 lec 10R.12 Incl-Excl Formula: Proof 1-SU(x) = (1-S1(x))(1-S2(x)) (1-Sn(x)) so... SU(x) = i Si(x) - i<jSi(x)Sj(x) + i<j<k Si(x)Sj(x)Sk(x) + (-1)n+1 S1(x)S2(x) Albert R Meyer, April 16, 2009 Sn(x) lec 10R.13 Incl-Excl Formula: Proof 1-SU(x) = (1-S1(x))(1-S2(x)) (1-Sn(x)) now sum both sides over x SU(x) = i Si(x) - i<jSi(x)Sj(x) + i<j<k Si(x)Sj(x)Sk(x) + (-1)n+1 S1(x)S2(x) Albert R Meyer, April 16, 2009 Sn(x) lec 10R.14 Incl-Excl Formula: Proof 1-SU(x) = (1-S1(x))(1-S2(x)) (1-Sn(x)) now sum both sides over x |U| = i S |A i(x) i| - i<jSi(x)Sj(x) + i<j<k Si(x)Sj(x)Sk(x) + (-1)n+1 S1(x)S2(x) Albert R Meyer, April 16, 2009 Sn(x) lec 10R.15 Incl-Excl Formula: Proof 1-SU(x) = (1-S1(x))(1-S2(x)) (1-Sn(x)) now sum both sides over x |U| = i S |A i(x) i| |A A | - i<jSi(x)S j(x) i j + i<j<k Si(x)Sj(x)Sk(x) + (-1)n+1 S1(x)S2(x) Albert R Meyer, April 16, 2009 Sn(x) lec 10R.16 Incl-Excl Formula: Proof 1-SU(x) = (1-S1(x))(1-S2(x)) (1-Sn(x)) now sum both sides over x |U| = i S |A i(x) i| - + |A A | Si(x)S (x)S (x) A A | i<j<k |A j k i j k i<jSi(x)S j(x) i j + (-1)n+1 |A S1(x)S (x) A 2 1 2 Albert R Meyer, April 16, 2009 S A n(x) n| lec 10R.17 Incl-Excl Formula |U| = + S |A i(x) i| (x) |A A i<jS i(x)S j i j| i i<j<k Si(x)S (x)S (x) |A A A | j k i j k + (-1)n+1 |A S1(x)S (x) A 2 1 2 Albert R Meyer, April 16, 2009 S A n(x) n| lec 10R.18 bookkeeper rule 10! # permutations of the word 2!2!3! bookkeeper ? • # perms bo1o2k1k2e1e2pe3r = 10! • map perm o1be1o2k1rk2e2pe3 to o1be o2k1rk rk2e2pe pe3 obeokrkepe 1o • 2 o’s, 2 k’s, 3 e’s: map is 2!·2!·3!-to-1 Albert R Meyer, April 16, 2009 lec 10R.19 bookkeeper rule # permutations of a word with n1 a’s, n2 b’s, …, nk z’s is n! n ::= n ,n , ,n n !n ! n ! k 1 2 1 2 k multinomial coefficient Albert R Meyer, April 16, 2009 lec 10R.20 Team Problems Problems 1—3 (& maybe 4) Albert R Meyer, April 16, 2009 lec 10R.21
© Copyright 2026 Paperzz