Introduction to COMBINATORICS In how many ways (permutations) can we arrange n distinct objects in a row?answer: n (n ) (n )... def. = n! EXAMPLE (permuting objects): What is the number of different permutations of n + n +... + n k objects, n (n,...n k ) of them being indistinguishable, e.g. aabb abab abba baab baba bbaa Another EXAMPLE: aaabbc. First consider them distinguishable: a a a b b c. There is 6! permutations of these. But, there is a lot of duplicity in this list, each distinct word (such as babaac) appears!!! times: b a b a a c, b a b a a c, b a b a a c, b a b a a c, b a b a a c, b a b a a c, b a b a a c, b a b a a c, b a b a a c, b a b a a c, b a b a a c, b a b a a c. Dividing 6! by this multiplicity factor yields 6!!!! =60 for the number of distinct words one can create by permuting aaabbc. A shorthand notation ³ 6! for is 6, called multinomial coefficient.!!!,, In general, the answer is (n + n + n +... + n k )! n!n!n!...n k! Selecting out of letters (say a, b, c). There are 4 different answers, depending on:
. The order is important, duplication is not allowed: ab, ac, ba, bc, ca, cb. Order irrelevant: ab, ac, bc. Order important again, but now each letter can be used any number of times: aa, ab, ac, ba, bb, bc, ca, cb, cc 4. Order irrelevant: aa, ab ba, ac ca, bb, bc cb, cc Selecting r out of n distinct objects. n (n ) (n )... (n r +)= n! (n r)! P n r. Each unordered selection of r letters will appear, in the previous list, exactly r! times. The answer: n! ³ n (n r)!r! Cn r r called binomial coefficient. Note the symmetry.. When we can use each letter repeatedly, for ordered selection we get n n n... n = n r 4. The last formula is more difficult to derive. Note the each possible result can be represented by... with r dots and n bars. For example, selecting 5 letters from a, b, c, d
represents a s and c s. The answer: (n + r )! r!(n )! µ n + r = r Note that the last formula also counts the number of ways to write r as a sum of n non-negative integers, order relevant! Binomial expansion (x + y) n =(x + y)(x + y)...(x + y) =xxx...x + yxx...x +... + yyy...y. Thisisthesum of all possible n-letter words, using a -letter alphabet. How many of them have exactly i x s and n iy s? Well, there is exactly n i such words and, algebraically, they have the same value of x i y n i. Answer: (x + y) n = nx i=0 ³ n i x i y n i Example: ( x ) 4 =+4 x +6 x +4 x + x 4 Extension: ( + x) n =+ ³ n ³ n ³ n x + x + x +... remains true (as a Taylor expansion) even when n is negative and/or non-integer, with the understanding that n i n (n )... (n i+). For example i! ( + x) = x +6x 0x +5x 4... ( + x) = + x + 8 x 6 x + 8 x4 +... Multinomial expansion
(x + y + z) n =(x + y + z)(x + y + z)...(x + y + z) =xxx...x + yxx...x +... + zzz...z (complete dictionary of all n-letter words composed of x, y and z). How many of them have ix s, jy s and kz s? Well, we know that there are of these, and each of them will be there, exactly once. Thus (x + y + z) n = X i,j,k 0 i+j+k=n ³ n i,j,k µ n x i y j z k i, j, k How many terms does this formula have? We have to choose n symbols from x, y and z, repetition allowed, orderless, i.e. n+. EXAMPLES: (x + y + z) = x + y + z +x y +x z +xy +xz +y z +yz +6xyz (0 terms) Find the coefficient of ut in the expansion of (u + 4t) 5. Solution: The only term containing ut is: ( 5,, )(u) () ( 4t) = 560ut. ( + x 5x ) 7 is a 4-degree polynomial in x. When expressed as such (i.e. when expanded, and terms with like powers of x are combined), what will be the coefficient of x 4? Solution: ( 7 i,j,k )()i (x) j ( 5x ) k is the general term of this expansion. Let us make i j k a table of the exponents which contribute to x 4 : 4 0 4. This translates to: ( 7 4 )(x)4 +( 7 4,, )(x) ( 5x )+( 7 )( 5x ) = 680x 4. 5 0 Partitioning 4
n distinct objects are to be divided into several groups of a given size each, e.g. 9 people into teams of size 4, and. Answer: 9 4 5 ³ = 9 = 60 -sameasthenumber 4,, of permutations of aaaabbbcc. What is some of the groups are of the same size, and we consider them interchangeable, e.g. divide 9 people into groups of size each, considering 456 789 and 456 789 as thesame partitioning.theanswer: ³ 9,, = 80.! Another example: 0 people into groups of 4, groupsof and groups of : ³ 0 4,4,,,,,!!! =6, 08, 047, 000 Circular arrangement When arranging n people around a (circular) table (instead of a row), and we care only about who are the left and right neighbors of each person, the amount of duplicity in the list of the original n! (row) arrangements is n. So, in this sense, there are only n! n distinct circular arrangements of n people. END-OF-CHAPTER EXAMPLES: =(n )!. A team plays a series of 0 games which they can either win (W ), lose (L) or tie (T ). (a) How many possible outcomes (order is important). Answer: 0 = 59049. (b) How many of these have exactly 5 wins, 4 losses and tie? Answer: 0 5,4, =60. (c) Sameas(a) ifwedon t care about the order of wins, losses and ties? Answer: =66(only one of these will have 5 wins, 4 losses and tie). 5
. A student has to answer 0 true-false questions. (a) In how many distinct ways can this be done? Answer: 0 = 048576. (b) How many of these will have exactly 7 correct answers? Answer: 0 7 = 7750. (c) At least 7 correct answers? 0 7 + 0 8 + 0 9 + 0 (d) Fewer than? (excludes ): 0 0 + 0 + 0 =. 0 = 0 + 0 + 0 + 0 0 =5.. In how many ways can A s, 4 F s, 4 D s and C s be arranged (a) in a row. Answer:,4,4, = 0 4 6 4 = 900900. (b) In how many of these will like letters stay together? Answer: 4! = 4. (c) Repeat (a) with circular arrangement: Answer: 900900 = 6900. (d) Repeat (b) with circular arrangement: Answer:! = 6. 4. Four couples (Mr&Mrs A, Mr&Mrs B,...) are to be seated at a round table. (a) In how many ways can this be done? Answer: 7! = 5040. (b) How many of these have all spouses sit next to each other? Answer:! 4 =96. (Pr =.905%). (c) How many of these have the men and women alternate? Answer: 4 =44(.86%). (d) How many of these have the men (and women) sit together? Answer: (4!) =576 (.4%). 5. In how many ways can we put books onto shelves? 6
(a) It the books are treated as identical: Answer: 4 =9 (b) Books as distinct, their order important. Answer: 9! = 4, 589, 45, 600. (c) Books distinct, order irrelevant. Answer: =5, 44. 6. Twelve men can be seated in a row in! = 479, 00, 600 number of ways (trivial). (a) How many of these will have Mr A and Mr B sit next to each other? Answer:! = 79, 8, 600. (b) How many of the original arrangements will have Mr A and Mr B sit apart? Answer:!! = 99, 68, 000. (c) How many of the original arrangements will have exactly 4peoplesitbetween Mr A and Mr B? Answer: 7 0! = 50, 80, 00. 7. Consider 5 distinct letters, U, R, G, F among them. These can be arranged in a row in 5! possible ways. How many of these have F and G next to each other but (at the same time) U and R apart? Answer: 4!! = 49, 448, 499, 00. 8. Consider the standard deck of 5 cards. Deal 5 cards from this deck. This can be done in 5 5 = 598960 distinct ways. (a) How many of these will have exactly diamonds? Answer: 9 =, 96. (b) Exactly aces? Answer: 4 48 = 0776. (c) Exactly aces and diamonds? Answer: 6 + 0 6 =9, 808. 9. In how many ways can we deal 5 cards each to 4 players? (a) Answer: 5 5 47 5 4 5 7 5 =.478 0 4 7
(b) So that each gets exactly one ace? Answer: 4 48 44 40 6 4 4 4 4 =.47 0 (c) None gets any ace: Answer: 48 4 8 5 5 5 5 =.966 0 (d) Mr A gets exactly aces, the rest get none. Answer: 4 48 45 40 5 5 5 5 =.7084 0 (e) (Any) one player gets aces, the other players get none. Answer: 4.7084 0 =.084 0 (f) Mr. A gets aces. Answer: 4 48 47 4 7 5 5 5 =5.907 0. (g) Mr. C gets aces. Clumsy answer: 48 4 5 5 8 4 7 4 44 4 5 9 7 4 4 5 4 9 7 4 44 4 4 40 7 4 45 5 40 7 4 4 5 40 7 5 =5.907 0, or be smart and argue that... (h) At least one player gets aces (regardless of what the others get). More difficult. 0. Roll a die five times. The number of possible (ordered) outcomes is 6 5 =7776. How many of these will have: (a) One pair of identical values(and no other duplicates). Answer: 6 5 5,,, = 600. (b) Two pairs. Answer: 6 4 5,, =800. (c) A triplet: 6 5 5,, =00. (d) Full house (a triplet and a pair): 6 5 5, =00. (e) Four of a kind : 6 5 5 4, =50. (f) Five of a kind : 6 5 5 =6. 8
(g) Nothing. 6 5 4 =70. Note that all these answers properly add up to 7776 (check).. Let us try the same thing with 5 rolls of a die (6 5 =4.7080 outcomes in total). How many of these will have: (a) A quadruplet, triplets, pairs and singlet: 6 5 5 4,,,,, =6.808 0 0 (b) triplets and pairs: 6 5,,,,, =.55 0 0. We will not try to complete this exercise; the full list would consist of 0 possibilities. 9