Sum Rule Mathematics for Computer Science MIT 6.042J/18.062J |A B| = |A| + |B| Inclusion-exclusion Counting practice A B for disjoint sets A, B Albert R Meyer, April 16, 2010 lec 10F.1 Sum Rule Albert R Meyer, April 16, 2010 lec 10F.2 Inclusion-Exclusion |A B| = ? A B A What if not disjoint? Albert R Meyer, April 16, 2010 What if not disjoint? lec 10F.3 Inclusion-Exclusion (3 Sets) Albert R Meyer, April 16, 2010 April 16, 2010 lec 10F.4 A town has n clubs. Each club Si has a secretary Mi who knows if person x is a club member: Mi(x) = 1 if x in Si, = 0 if x not in Si. B C Albert R Meyer, Incl-Excl Formula: Proof |ABC| = |A|+|B|+|C| B| – |A C| – |B C| – |A B C| + |A A B lec 10F.8 Albert R Meyer, April 16, 2010 lec 10F.10 1 Incl-Excl Formula: Proof Incl-Excl Formula: Proof A = xpeople M A (x) So Mi(x)Mj(x) is sec’y for SiSj, so S i S j = x M i (x) M j (x) S i S j S k = x M i (x)M j (x)M k (x) Let D ::= S1S2Sn sec’y MD(x)=0 iff Mi(x)=0 for all n clubs. So 1-MD(x) = (1-M1(x))(1-M2(x))(1-Mn(x)) etc. Albert R Meyer, April 16, 2010 lec 10F.11 Incl-Excl Formula: Proof MD(x) = i Mi(x) - i<jMi(x)Mj(x) + i<j<k Mi(x)Mj(x)Mk(x) April 16, 2010 lec 10F.13 |D| = i |Si| - i<jMi(x)Mj(x) + i<j<k Mi(x)Mj(x)Mk(x) Albert R Meyer, April 16, 2010 lec 10F.14 1-MD(x) = (1-M1(x))(1-M2(x))(1-Mn(x)) now sum both sides over x |D| = i |Si| - i<j|SiSj| + i<j<k Mi(x)Mj(x)Mk(x) (-1)n+1 M1(x)M2(x)Mn(x) April 16, 2010 MD(x) = i Mi(x) - i<jMi(x)Mj(x) + i<j<k Mi(x)Mj(x)Mk(x) Incl-Excl Formula: Proof 1-MD(x) = (1-M1(x))(1-M2(x))(1-Mn(x)) now sum both sides over x Albert R Meyer, 1-MD(x) = (1-M1(x))(1-M2(x))(1-Mn(x)) now sum both sides over x + (-1)n+1 M1(x)M2(x)Mn(x) Incl-Excl Formula: Proof + lec 10F.12 (-1)n+1 M1(x)M2(x)Mn(x) Albert R Meyer, April 16, 2010 Incl-Excl Formula: Proof 1-MD(x) = (1-M1(x))(1-M2(x))(1-Mn(x)) so... + Albert R Meyer, + (-1)n+1 M1(x)M2(x)Mn(x) lec 10F.15 Albert R Meyer, April 16, 2010 lec 10F.16 2 Incl-Excl Formula: Proof Incl-Excl Formula: Proof 1-MD(x) = (1-M1(x))(1-M2(x))(1-Mn(x)) now sum both sides over x |D| = i |Si| - i<j|SiSj| + i<j<k |SiSjSk| + (-1)n+1 |S1S2 Sn| (-1)n+1 M1(x)M2(x)Mn(x) Albert R Meyer, April 16, 2010 |D| = i |Si| - i<j|SiSj| + i<j<k |SiSjSk)| + 1-MD(x) = (1-M1(x))(1-M2(x))(1-Mn(x)) now sum both sides over x lec 10F.17 Albert R Meyer, April 16, 2010 lec 10F.18 Team Problems Incl-Excl Formula: Proof Problems 1—3 |D| = i |Si| - i<j|SiSj| + i<j<k |SiSjSk| + (-1)n+1 |S1S2 Sn| Albert R Meyer, April 16, 2010 lec 10F.19 Albert R Meyer, April 16, 2010 lec 10F.22 3 MIT OpenCourseWare http://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.