Chapter 7. Inclusion-Exclusion a.k.a. The Sieve Formula Prof. Tesler Math 184A Winter 2017 Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 1 / 24 !"#$%&'($)*+'& Venn diagram and set sizes 5& 6& { } A = 1, 2, 3, 4, 5 B = {4, 5, 6, 7, 8, 9} /-!-0& ,-.& 1-2-3-4& { } A ∪ B = 1, . . . , 9 { } A ∩ B = 4, 5 /7-//-/!-/0-/,-/.& c { } (A ∪ B) = 10, . . . , 15 8& | | | | A + B counts everything in the union, but elements in the | | intersection are counted twice. Subtract A ∩ B to compensate: | | | | | | | | A ∪ B = A + B − A ∩ B 9 = 5 + 6 − 2 Size of outside region: | c| | | | | | | | | | | | | (A ∪ B) = S − A ∪ B = S − A − B + A ∩ B 6 = 15 − 9 = 15 − 5 − 6 + 2 Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 2 / 24 Size of a 3-way union !"!# !"!#$#!%!# !"!#$#!%!#$#!&!# "# &# "# %# "# %# $%# $%# ('# &'# ('# *(# )(# *(# $%# &'# '(# $%# ('# ('# )(# )(# -./0123# *(# ,(# '# )# &# (# *# +# | | | | | | | | | | | | A A + B A + B + C 2x means the region is counted times. Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 3 / 24 Size of a 3-way union !"!#!$!#!%!&!"∩!"$!!#'!$!#!%!&!"∩!$"!!&!#"!$∩!#%!!%'!&!"∩$!&!"∩%!&!$∩%!' "' $' "' $' "' $' *)' *)' *)' ()' ()' ()' *)' *)' *)' ()' ()' ()' ()' ()' ()' *)' *)' *)' ,-./012' *)' ,-./012' ()' +,-./01' *)' +)' +)' ()' %' %' %' 3' 3' 2' | | | | | | | | | | | | | | | | | | A + B + C A + B + C A + B + C | | | | | | − A ∩ B − A ∩ B − A ∩ B | | | | − A ∩ C − A ∩ C | | − B ∩ C Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 4 / 24 Size of a 3-way union ∩ ∩ ∩ !"!#!$!#!%!&!" $!&!" %!&!$ %! ∩ ∩ #''!" $ %!' "' $' ()' ()' ()' | | | | | | | | A ∪ B ∪ C = ( A + B + C ) ()' | | | | | | − ( A ∩ B + A ∩ C + B ∩ C ) ()' ()' | | + A ∩ B ∩ C +,-./01' ()' *)' %' 2' Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 5 / 24 ∩ ∩ ∩ !"!#!$!#!%!&!" $!&!" %!&!$ %! ∩ ∩ #''!" $ %!' Size of a 3-way union "' $' ()' ()' ()' | | | | | | | | A ∪ B ∪ C = ( A + B + C ) ()' | | | | | | − ( A ∩ B + A ∩ C + B ∩ C ) ()' ()' | | + A ∩ B ∩ C +,-./01' ()' = N − N + N *)' 1 2 3 %' 2' where N is the sum of sizes of i-way intersections: i | | | | | | N = A + B + C 1 | | | | | | N = A ∩ B + A ∩ C + B ∩ C 2 | | N = A ∩ B ∩ C 3 This is called inclusion-exclusion since we alternately include some parts, then exclude parts, then include parts, . . . Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 6 / 24 Size of complement of a 3-way union !"!#$%!&!'!(!'!)!$ ∩ ∩ ∩ $$$$$$$$$#!& (!#!& )!#!( )!'! ∩ ∩ & ( )!*$ &$ ($ | c| | | | | (A ∪ B ∪ C) = S − A ∪ B ∪ C +,$ +,$ +,$ | | = S +,$ | | | | | | − ( A + B + C ) +,$ +,$ | | | | | | + ( A ∩ B + A ∩ C + B ∩ C ) | | ./01234$ +,$ − A ∩ B ∩ C -,$ )$ "$ = N − N + N − N 0 1 2 3 | | where N = S . 0 Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 7 / 24 Inclusion-Exclusion Formula for size of union of n sets a.k.a. The Sieve Formula Inclusion-Exclusion Theorem: Let A , . . . , A be subsets of a finite set S. 1 n | | Let N = S and N be the sum of sizes of all j-way intersections 0 j (cid:88) | | N = A ∩ A ∩ · · · ∩ A for j = 1, . . . , n j i i i 1 2 j (cid:54) (cid:54) 1 i <i <···<i n 1 2 j Then (cid:88)n | | j−1 A ∪ · · · ∪ A = N − N + N − N · · · ± N = (−1) N 1 n 1 2 3 4 n j j=1 (cid:88)n | c| j (A ∪ · · · ∪ A ) = N − N + N − N + N · · · ∓ N = (−1) N 1 n 0 1 2 3 4 n j j=0 Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 8 / 24 !"#$%&'$&'('%)'*+"',"*,' Proof of Inclusion-Exclusion Formula -' .' /' 0' The yellow region is inside k = 2 sets (B and C) and outside n − k = 3 − 2 = 1 set (A). Which j-way intersections among A,B,C contain the yellow region? The ones that only involve B and/or C. None that involve A. (cid:0) (cid:1) k For each j, it’s in j-way intersections: j (cid:0) (cid:1) 2 j = 1: = 2 B alone and C alone 1 (cid:0) (cid:1) 2 j = 2: = 1 B ∩ C 2 (cid:0) (cid:1) 2 j = 3: = 0 None 3 Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 9 / 24 !"#$%#"&'%("$)*("+$,'-." Proof of Inclusion-Exclusion Formula 4" 5" /03" /02" /03" /01" /02" /02" -8%#'9$" /07" 6" /03" :" A region in exactly k of the sets A , . . . , A is counted in 1 n N − N + N − · · · this many times (shown for n = 3): 1 2 3 N − N + N 1 2 3 (cid:0) (cid:1) (cid:0) (cid:1) (cid:0) (cid:1) k k k Contribution − + = 1 2 3 (cid:0) (cid:1) (cid:0) (cid:1) (cid:0) (cid:1) 0 0 0 k = 0 : − + = 0 − 0 + 0 = 0 1 2 3 (cid:0) (cid:1) (cid:0) (cid:1) (cid:0) (cid:1) 1 1 1 k = 1 : − + = 1 − 0 + 0 = 1 1 2 3 (cid:0) (cid:1) (cid:0) (cid:1) (cid:0) (cid:1) 2 2 2 k = 2 : − + = 2 − 1 + 0 = 1 1 2 3 (cid:0) (cid:1) (cid:0) (cid:1) (cid:0) (cid:1) 3 3 3 k = 3 : − + = 3 − 3 + 1 = 1 1 2 3 Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Winter 2017 10 / 24
Description: