Discrete Matheatics: Lectures 8 ad 9 Priciple of Iclusio ad Exclusio Istructor: Arijit Bishu Date: August ad 3, 009 As you ca observe by ow, we ca cout i various ways. Oe such ethod is the age-old priciple of iclusio ad exclusio that you have bee dealig with possibly fro your high school days. But agai, have you ever ased as to why the cubersoe forula of priciple of iclusio ad exclusio is correct? We will loo ito it ad also ito soe applicatios of the priciple. The forula for priciple of iclusio ad exclusio Priciple of iclusio ad exclusio deals with the cardiality of fiite sets. Let A ad A be two fiite sets. The, we ca easily show that A A = A + A A A. This is true because we first add up all the eleets i the set A ad A ; i doig so we have over couted those eleets that were both i A ad A. So, we subtract oce those eleets to get the above forula. Taig this forula as the basis ( = ad usig the distributive law that states for fiite sets X, Y ad Z, we have X (Y Z = (X Y (X Z, ca you prove by iductio the forula for the cardiality of the uio of fiite sets A, A,..., A? Exercise Let A, A,..., A be fiite sets. Prove the followig forula usig iductio. A A... A = A i i= + i<j i<j<... A i A j [Hits: The iductio would be o, the uber of sets.] A i A j A +( A A... A. ( We ca have a series of iequalities correspodig to the above forula of priciple of iclusio ad exclusio. A A... A A i ( i= A A... A A i i= A i A j (3 i<j
We ca have a series of such iequalities boudig A A... A fro above ad below till we iclude the last ter A A... A. These iequalities are useful whe we have partial iforatio about the sets ad their itersectios. A alterative proof for priciple of iclusio ad exclusio We loo at a proof for the priciple of iclusio ad exclusio by coutig. For this proof, we loo at a otatio that is differet fro Equatio. Observatio As earlier, let A, A,..., A be fiite sets. The, A i = ( j A i. (4 i= j= I ( {,,...,} j i I Proof: Cosider a arbitrary eleet a i= A i. a cotributes exactly to the left had side of Equatio 4. Let us ow loo ito how uch a cotributes to the expressio i the right had side of Equatio 4. Let a occur i exactly ( of the sets aog the sets A, A,..., A. Let the sets be A i, A i,..., A i where i < i <... < i. The eleet a ow appears i every j-tuple ( j of the sets aog A i, A i,..., A i ad i o other itersectios. Varyig j fro to, we loo at how ay ties the occurrece of a has bee added. Whe j =, the occurrece of a has bee added ( ties with a positive sig as ( = +. Whe j =, the occurrece of a has bee added ( ties with a egative sig as ( =. Whe j = 3, the occurrece of a has bee added ( 3 ties with a positive sig as ( 3 = +. Cotiuig thus, whe j =, the occurrece of a has bee added ( ties with a sig equal to ( = +. So, a cotributes the followig su to the right had side of the Equatio 4 ( ( + ( 3... + ( ( We ow fro bioial theore, that for ay o-egative iteger, we have ( + x = j=0 (5 ( x j (6 j Substitutig x = i Equatio 6, we have ( ( ( ( ( + +... + ( 0 3 ( ( ( + 3 = 0 +... upto ters = ( = ( 0 (7
Thus, the Expressio 5 cotributes to the right had side of Equatio 4. So, the cotributio of ay eleet a i= A i is to both sides of Equatio 4 ad hece, the forula holds. I the reaiig part, we loo ito several iterestig applicatios of the priciple of iclusio ad exclusio. 3 Coutig the uber of oto fuctios Let A ad B be two sets with A = ad B = with. We wat to cout the uber of oto fuctios fro A to B. Cosider the eleets of set A to be differet balls ad the eleets of set B to be differet boxes. The proble of fidig the uber of oto fuctios fro A to B is othig but fidig the uber of ways that differet balls ca be distributed aog differet boxes with o box epty of balls. This coditio of havig o boxes epty basically eforces the oto fuctio coditio that for each b B there exists a A satisfyig f(a = b, i.e. for each box there is at least oe ball. The uber of ways i which the differet balls ca be distributed aog the differet boxes with o restrictio is othig but the uber of fuctios fro A to B as each ball has to go ito a box. So, the uber of ways is B A =. Fro this, if we wat to fid the uber of ways i which differet balls ca be distributed aog differet boxes with o box epty of balls, the we eed to subtract the cases where ay box i, i, is epty; but i doig so we have subtracted the cases where two boxes ca be epty. If we add the cases where two boxes ca be epty, the we have added the cases where three boxes ca be epty. This ature of the proble idicates that the coutig ca be doe usig priciple of iclusio ad exclusio. Let A i be the subset of the distributios that has the box i ( i epty; i.e. the set of fuctios that do ot ap to the eleet i B. So, we eed to cout the uber of fuctios f : A B \{i}, which is (. There are ( choices of i; so i all the uber of such fuctios that do ot ap to a eleet i or the subset of the distributios that has the box i ( i epty is i A i = ( (. I coutig i A i, we icluded the case where we had two boxes epty. So, we eed to copute j<i A i A j. This is the uber of fuctios f : A B \ {i, j}, which is ( ; coupled with ( choices of i ad j, we have j<i A i A j = ( (. Cotiuig this way, we have the case where all the boxes are epty as A i A i... A i = ( (. So, to fid the total uber of oto fuctios, we have to subtract the su total of the cases where at least oe box was epty ( A i fro the total uber of fuctios (. Thus, the total uber of oto fuctios is (( ( ( A i = ( ( +... + ( ( 3
= ( ( j ( j (8 j j=0 (9 4 Derageet Figure : Distributio of balls ito boxes. O a raiy day, people, each with a ubrella, get ito a pub to have a health dri. As the pub ower would ot allow the soaed ubrellas to be tae iside, each perso deposits his or her ubrella at the couter. While goig out, the a at the couter returs the ubrellas at rado. What is the probability that oe of the persos gets bac his or her ow ubrella? We ca have a siilar proble with letters ad evelopes where each letter has its desigated evelope. Agai, what is the probability that oe of the letters goes ito its desigated evelope? This proble is also ow as the hatchec proble where ubrellas are replaced with hats! This class of probles where o ite is goig ito its correct place is ow as derageet. To fix the probability, we eed to ow the favourable cases. The possible uber of cases is!, i.e. all perutatios. 4. Coutig derageets To calculate the uber of favourable cases, we eed to fid out the uber of perutatios where oe of the i ites is goig ito the i-th positio. For this, we itroduce the cocept of a fixed poit of a perutatio. Let Π deote a perutatio, ad Π(i deote the positio of i i the perutatio. Let {4,,, 3} be a perutatio of {,, 3, 4}. Here, Π( = 3, Π( =, Π(3 = 4 ad Π(4 =. We defie a fixed poit of a perutatio as a idex i for which Π(i = i. So, to cout the uber of derageets we have to fid out those perutatios Π for which Π(i i holds i {,,..., }. Now, if we ca cout the uber of perutatios that are bad for derageet the we ca subtract it fro!. A perutatio is bad for derageet if it has at least oe fixed poit. Let Π deote the set of all 4
perutatios of {,,..., } ad for i =,,...,, we defie a set A i as the set of all perutatios that has the idex i as the fixed poit, i.e. A i = {Π Π Π(i = i}. The bad perutatios for derageet are those perutatios that belog to i A i. We have to ow fix ters lie i A i, j<i A i A j, <j<i A i A j A,..., A A... A. Each A i is of size (! ad there are ( of the. Each A i A j is of size (! ad there are ( of the. Thus, we have ( ( ( i=a i = (! (! +... + ( (! ( = ( (! (0 = Thus, the uber of derageets D( is D( =! i=a i ( =!! +!... + (! ( So, the probability of a derageet is D(!. Notice that, as, this probability coverges to e, i.e. asyptotically the probability is idepedet of. 4. Coutig derageets i aother way As we have soe idea about coutig i ters of subprobles, let us see if we ca apply it to derageet. Say, while coputig D(, we ow D( ad D(. Ca we express D( i ters of D( ad D(? Suppose, as earlier, we have eleets {,,..., }. We have choices for the eleet i which appears i the first spot. For each of these, we either choose a arrageet with i the i-th spot which we ca do i D( ways or choose a arrageet with ot i the i-th spot i D( ways. Choosig a arrageet with ot i the i-th spot is equivalet to fixig i at the positio ad as caot go to the i-th spot, we set the fixed poit of as i. Thus, we get D( ways. See Figure. Thus, with choices of i, we fially have the recurrece for D( as follows D( = ( (D( + D(, 3 =, = = 0, = ( Refereces [] Fred S. Roberts ad Barry Tesa, Applied Cobiatorics, d editio, Pearso, Pretice Hall, 005, USA. 5
i {, 3,...,} i the first place, so choices appears i the i-th spot does ot appear i the i-th spot Positios ad i are fixed, derage the rest ites i D( ways So, fix at the i-th spot ad ad derage {, 3,...,} i D( ways Figure : Explaatio of the derageet recurrece. [] J. Matouše ad J. Nešetřil, Ivitatio to Discrete Matheatics, Oxford Uiversity Press, New Yor, 998. [3] C. L. Liu, Eleets of Discrete Matheatics, Tata McGraw Hill, New Delhi, 000. [4] Roald L. Graha, Doald E. Kuth ad O. Patashi, Cocrete Matheatics, Pearso Educatio, 6