53 GENERALIZED PERMUTATIONS AND COMBINATIONS 73 53 Geeralized Permutatios ad Combiatios 53 Permutatios with Repeated Elemets Assume that we have a alphabet with letters ad we wat to write all possible words cotaiig times the first letter of the alphabet, times the secod letter,, times the th letter How may words ca we write? We call this umber P (;,,,, where + + + Example: With 3 a s ad b s we ca write the followig 5-letter words: aaabb, aabab, abaab, baaab, aabba, ababa, baaba, abbaa, babaa, bbaaa We may solve this problem i the followig way, as illustrated with the example above Let us distiguish the differet copies of a letter with subscripts: a a a 3 b b Next, geerate each permutatio of this five elemets by choosig the positio of each id of letter, the the subscripts to place o the 3 a s, the 3 these subscripts to place o the b s Tas ca be performed i P (5; 3, ways, tas ca be performed i 3! ways, tas 3 ca be performed i! By the product rule we have 5! P (5; 3, 3!!, hece P (5; 3, 5!/3!! I geeral the formula is: P (;,,,!!!! 53 Combiatios with Repetitio Assume that we have a set A with elemets Ay selectio of r objects from A, where each object ca be selected more tha oce, is called a combiatio of objects tae r at a time with repetitio For istace, the combiatios of the letters a, b, c, d tae 3 at a time with repetitio are: aaa, aab, aac, aad, abb, abc, abd, acc, acd, add, bbb, bbc, bbd, bcc, bcd, bdd, ccc, ccd, cdd, ddd Two combiatios with repetitio are cosidered idetical if they have the same elemets repeated the same umber of times, regardless of their order Note that the followig are equivalet: The umber of combiatios of objects tae r at a time with repetitio
53 GENERALIZED PERMUTATIONS AND COMBINATIONS 74 The umber of ways r idetical objects ca be distributed amog distict cotaiers 3 The umber of oegative iteger solutios of the equatio: x + x + + x r Example: Assume that we have 3 differet (empty mil cotaiers ad 7 quarts of mil that we ca measure with a oe quart measurig cup I how may ways ca we distribute the mil amog the three cotaiers? We solve the problem i the followig way Let x, x, x 3 be the quarts of mil to put i cotaiers umber, ad 3 respectively The umber of possible distributios of mil equals the umber of o egative iteger solutios for the equatio x + x + x 3 7 Istead of usig umbers for writig the solutios, we will use stroes, so for istace we represet the solutio x, x, x 3 4, or + + 4, lie this: + + Now, each possible solutio is a arragemet of 7 stroes ad plus sigs, so the umber of arragemets is P (9; 7, 9!/7!! ( 9 7 The geeral solutio is: P ( + r ; r, ( + r! r! (! ( + r r
54 BINOMIAL COEFFICIENTS 75 54 Biomial Coefficiets 54 Biomial Theorem The followig idetities ca be easily checed: (x + y 0 (x + y x + y (x + y x + xy + y (x + y 3 x 3 + 3 x y + 3 xy + y 3 They ca be geeralized by the followig formula, called the Biomial Theorem: ( (x + y x y 0 ( ( ( x + x y + x y + 0 We ca fid this formula by writig (x + y (x + y (x + y + ( xy + ( factors (x + y, ( y expadig, ad groupig terms of the form x a y b Sice there are factors of the form (x + y, we have a + b, hece the terms must be of the form x y The coefficiet of x y will be equal to the umber of ways i which we ca select the y from ay of the factors (ad the x from the remaiig factors, which is C(, ( The expressio ( is ofte called biomial coefficiet Exercise: Prove ( ad 0 ( ( 0 0 Hit: Apply the biomial theorem to ( + ad ( 54 Properties of Biomial Coefficiets The biomial coefficiets have the followig properties: ( (
( + + 54 BINOMIAL COEFFICIENTS 76 ( + ( + The first property follows easily from (!!(! The secod property ca be proved by choosig a distiguished elemet a i a set A of + elemets The set A has ( + + subsets of size + Those subsets ca be partitioed ito two classes: that of the subsets cotaiig a, ad that of the subsets ot cotaiig a The umber of subsets cotaiig a equals the umber of subsets of A {a} of size, ie, ( The umber of subsets ot cotaiig a is the umber of subsets of A {a} of size +, ie, ( + Usig the sum priciple we fid that i fact ( ( + + ( + + 543 Pascal s Triagle The properties show i the previous sectio allow us to compute biomial coefficiets i a simple way Loo at the followig triagular arragemet of biomial coefficiets: ( 0 ( ( ( 3 ( 3 ( 3 ( 3 4 3 ( 4 0 3 4 We otice that each biomial coefficiet o this arragemet must be the sum of the two closest biomial coefficiets o the lie above it This together with ( ( 0, allows us to compute very quicly the values of the biomial coefficiets o the arragemet: 3 3 4 6 4 This arragemet of biomial coefficiets is called Pascal s Triagle Although it was already ow by the Chiese i the XIV cetury
55 THE PIGEONHOLE PRINCIPLE 77 55 The Pigeohole Priciple 55 The Pigeohole Priciple The pigeohole priciple is used for provig that a certai situatio must actually occur It says the followig: If pigeoholes are occupied by m pigeos ad m >, the at least oe pigeohole is occupied by more tha oe pigeo Example: I ay give set of 3 people at least two of them have their birthday durig the same moth Example: Let S be a set of eleve -digit umbers Prove that S must have two elemets whose digits have the same differece (for istace i S {0, 4, 9,, 6, 8, 49, 53, 70, 90, 93}, the digits of the umbers 8 ad 93 have the same differece: 8 6, 9 3 6 Aswer: The digits of a two-digit umber ca have 0 possible differeces (from 0 to 9 So, i a list of umbers there must be two with the same differece Example: Assume that we choose three differet digits from to 9 ad write all permutatios of those digits Prove that amog the 3-digit umbers writte that way there are two whose differece is a multiple of 500 Aswer: There are 9 8 7 504 permutatios of three digits O the other had if we divide the 504 umbers by 500 we ca get oly 500 possible remaiders, so at least two umbers give the same remaider, ad their differece must be a multiple of 500 Exercise: Prove that if we select + umbers from the set S {,, 3,, }, amog the umbers selected there are two such that oe is a multiple of the other oe The Pigeohole Priciple (Schubfachprizip was first used by Dirichlet i Number Theory The term pigeohole actually refers to oe of those old-fashioed writig dess with thi vertical woode partitios i which to file letters