Skip to main content

Section 1.3 Counting with Equivalence

So far we have been able to solve our counting problems simply by use of the sum and product principles, together with the fact that the number of \(k\)-element subsets of an \(n\)-element set is \(\binom{n}{k}\) (the values of which can be found in Pascal's triangle). This means that we have always built up the set of outcomes by combining smaller sets of outcomes combined in various ways.

It is often useful to go the other way. We could purposely over count the number of outcomes, but in a way that we can recover the correct set.

Subsection 1.3.1 The Quotient Principle

In Exercise 29, you proved the algebraic formula \(\binom{n}{k} = \frac{n!}{(n-k)!k!}\text{.}\) However, this was done rather indirectly. First you proved the identity \(P(n,k) = \binom{n}{k}k!\text{,}\) then wrote \(P(n,k) = \frac{n!}{(n-k)!}\text{,}\) and finally solved for \(\binom{n}{k}\text{.}\)

This approach has the advantage of illustrating the connection between combinations and permutations, but the combinatorial argument that both sides of the identity are equal asked you to count the number of permutations in two ways. It is instructive to think of this equation in terms of combinations instead. Let's start with a concrete example.

Activity 42.

Let's count the number of subsets of \(\{a,b,c,d,e\}\) of size 3. Of course we already know the answer should be \(\binom{5}{3}\text{,}\) which we can see in Pascal's triangle is equal to 10. What might you try if you didn't already know this?

(a)

You might first guess that the answer is \(5\cdot 4 \cdot 3\) since there are 5 choices for which element you put in your subset first, then 4 choices for the next element, and 3 choices for the last element. Write down all 60 of the outcomes you get by counting the “subsets” this way. 1 

This might seem like a lot of busy work, but your efforts will be rewarded.
(b)

One of the subsets we are actually interested in is \(\{a,c,d\}\text{.}\) How many of the outcomes you listed above correspond to this set? How many outcomes correspond to the set \(\{c,d,e\}\text{?}\)

(c)

Explain why every subset corresponds to the same number of permutations. Then use this to count the total number of subsets correctly.

Let's look carefully at what we did above. We had a set of permutations (all 60 of the 3-permutations of the set \(\{a,b,c,d,e\}\)). Then we noticed that some of these permutations corresponded the the same subset. Saying that these permutations were related like this feels like defining a equivalence relation.

Activity 43.

Refer back to your list of 60 3-permutations of \(\{a,b,c,d,e\}\text{.}\)

(a)

Define an equivalence relation on the permutations you listed so that permutations that “correspond” to the same subset are equivalent. That is, give a rule that specifies when two permutations are “equivalent”.

Hint

One rule of this type would be, two permutations are equivalent if they start with the same letter. This is not the one you want though.

(b)

In any set \(S\text{,}\) if you have an equivalence relation \(\sim\text{,}\) you can partition \(S\) into equivalence classes: sets of elements that are equivalent under \(\sim\) (i.e., sets of the form \(\{x \in S \st x \sim a\} \) for a particular element \(a\)).

Write out the equivalence classes generated by the equivalence relation you gave above. Explain why these all have the same size. How many equivalence classes do you have (and how does this relate to the fact that they all have the same size)?

(c)

Find a bijection between the set of equivalence classes and the set of subsets of \(\{a,b,c,d,e\}\text{.}\) Why is this important?

Hint

You might think about the usual way you would write a subset. Essentially what this question is asking is for you to pick a representative for each equivalence class.

This suggests a general approach to solving a counting problem. Say we want to count the number of elements in a set \(S\text{.}\) Suppose we can count the size of some set \(T\text{,}\) perhaps containing many more elements than we are actually interested in counting. Then define an equivalence relation \(\sim\) on \(T\) so that there is a bijection between \(S\) and the set of equivalence classes \(T/\sim\text{.}\) Then if we know the size of \(T/\sim\text{,}\) we have the size of \(S\text{.}\)

Look at the notation \(T/\sim\) that we used to denote the set of equivalence classes of \(T\) under \(\sim\text{.}\) This set is sometimes called the quotient set or quotient space of \(T\) by \(\sim\text{.}\) This is a good name, as you are dividing up a set into parts. It is also a good name because sometimes we can conclude

\begin{equation*} |T/\sim| = |T|/|A| \end{equation*}

where \(A\) is one of the equivalence classes under \(\sim\text{.}\) When can you do this?

Note this is exactly what we did when we counted subsets: we divided the number of permutations by the number of permutations equivalent to each other. That worked precisely because all the equivalence classes had the same size!

This justifies the quotient principle we now state.

The Quotient Principle.

If we partition a set of size \(p\) into \(q\) blocks, each of size \(r\text{,}\) then \(q = p/r\text{.}\)

Like the product principle, the quotient principle is really just a statement about how division works. Here are a few examples of how you can use it in counting. In each of the following activities, make sure you can say exactly how the quotient principle could be used.

Exercise 44.

In how many ways may \(n\) people sit around a round table? (Assume that when people are sitting around a round table, all that really matters is who is to each person's right. For example, if we can get one arrangement of people around the table from another by having everyone get up and move to the right one place and sit back down, we get an equivalent arrangement of people. Notice that you can get a list from a seating arrangement by marking a place at the table, and then listing the people at the table, starting at that place and moving around to the right.) There are at least two different ways of doing this problem. Try to find them both, especially the one that uses the quotient principle.

Hint 1

The problem suggests that you think about how to get a list from a seating arrangement. Could every list of n distinct people come from a seating chart? How many lists of n distinct people are there? How many lists could we get from a given seating chart by taking different starting places?

Hint 2

For a different way of doing the problem, suppose that you have chosen one person, say the first one in a list of the people in alphabetical order by name. Now seat that person. Does it matter where they sit? In how many ways can you seat the remaining people? Does it matter where the second person in alphabetical order sits?

Exercise 45.

In how many ways may we string \(n\) distinct beads on a necklace without a clasp? (Perhaps we make the necklace by stringing the beads on a string, and then carefully gluing the two ends of the string together so that the joint can't be seen. Assume someone can pick up the necklace, move it around in space and put it back down, giving an apparently different way of stringing the beads that is equivalent to the first.)

Hint 1

How could we get a list of beads from a necklace?

Hint 2

When we cut the necklace and string it out on a table, there are \(2n\) lists of beads we could get. Why is it \(2n\) rather than \(n\text{?}\)

Exercise 46.

We first gave this problem as Exercise 25. Now we have several ways to approach the problem. A tennis club has \(2n\) members. We want to pair up the members by twos for singles matches.

(a)

In how many ways may we pair up all the members of the club? Give at least two solutions different from the one you gave in Exercise 25. (You may not have done Exercise 25. In that case, see if you can find three solutions.)

Hint

You might first choose the pairs of people. You might also choose to make a list of all the people and then take them by twos from the list.

(b)

Suppose that in addition to specifying who plays whom, for each pairing we say who serves first. Now in how many ways may we specify our pairs? Try to find as many solutions as you can.

Hint

You might first choose ordered pairs of people, and have the first person in each pair serve first. You might also choose to make a list of all the people and then take them by twos from the list in order.

Exercise 47.

In how many ways may we attach two identical red beads and two identical blue beads to the corners of a square (with one bead per corner) free to move around in (three-dimensional) space?

Hint

It might be helpful to just draw some pictures of the possible configurations. There aren't that many.

Example 1.3.2.

We have used the quotient principle to explain the formula \(\binom{n}{k} = \frac{n!}{(n-k)!k!}\) by thinking of this as \(\binom{n}{k} = \frac{P(n,k)}{k!}\text{.}\) What if we don't involve \(P(n,k)\) at all?

Describe a set of outcomes that has size \(n!\) that can be partitioned into blocks of size \((n-k)!k!\) so that each block corresponds to something \(\binom{n}{k}\) counts.

Solution

Suppose you have \(k\) red balls and \(n-k\) blue balls. Each ball has a different number printed on it. Thus there are \(n!\) different ways to arrange the \(n\) balls in a line. But what if we only care about the color pattern the balls make (perhaps the numbers have been printed in invisible ink and have now vanished). We can arrange these permutations of all \(n\) balls into blocks, where two permutations are in the same block if and only if they have the same sequence of colors (RRBRB
). There are \((n-k)!k!\) permutations in each block, since the red balls can be arranged in \(k!\) ways and the blue balls can be arranged in \((n-k)!\) ways.

All this says that the number of two-color patterns of length \(n\) including \(k\) red balls is \(\frac{n!}{(n-k)!k!}\text{.}\) But of course the answer is also \(\binom{n}{k}\) because of the \(n\) positions, we must choose \(k\) positions to put the identical red balls.

Exercise 48.

How many anagrams of the word “anagram” are there? (An anagram is a rearrangement of all of the letters of a word.)

Hint

A much easier question would be, how many anagrams of the word “anbgrcm”? Then use the quotient principle.

Subsection 1.3.2 When does Order Matter?

One way to distinguish combinations from permutations is by asking whether “order matters”. Both \(\binom{n}{k}\) and \(P(n,k)\) count the number of ways to select \(k\) objects from \(n\) objects without repeats, but you use the combination \(\binom{n}{k}\) when “order doesn't matter” and the permutation \(P(n,k)\) when “order matters”. Despite the presence of the scare quotes, this is not a false statement, but we must understand what we mean when we say “order matters”.

Activity 49.

Each counting question below asks for two answers. Decide which answer is a combination and which is a permutation, and why that makes sense.

(a)

An ice-cream shop offers 31 flavors. How many 3-scoop ice-cream cones are possible, assuming each scoop must be a different flavor? How many 3-scoop milkshakes are possible, assuming each scoop must be a different flavor?

Hint

This is not intended to be a trick question. In fact, this example would be a good one for thinking about how permutations and combinations are related in general.

(b)

How many 5-digit numbers are there with distinct, non-zero digits for which the digits must be increasing? How many are there for which the digits can come in any order?

Hint

The point of this question is to push back against your conception of what “order matters” means. Since you know the answers must be \(\binom{9}{5}\) or \(P(9,5)\text{,}\) you should be able to answer correctly by deciding which set is bigger.

(c)

How many injective functions \(f:[k] \to [n]\) are there all together? How many injective functions \(f:[k] \to [n]\) are there that are (strictly) increasing?

Hint

You might as well assume that \(k \le n\) (otherwise the answers would both be 0). If you are stuck, write out some examples of each using two-line notation for the functions. What decisions do you need to make?

Exercise 50.

The number of \(n\)-bit strings of weight \(k\) is \(\binom{n}{k}\text{,}\) so a combination. But in determining one bit string from another, all that matters is the order in which the \(k\) 1's and \(n-k\) 0's appear. So does order matter? In what sense does it not?

Hint

Think about what \(P(n,k)\) would count when building a bit string. Why does it make sense to quotient out by \(k!\text{?}\)

Exercise 51.

Write a clear sentence or two saying specifically what we mean when we say “order matters” to distinguish between combinations and permutations.

Hint

They key here is to think about the set of outcomes that we are counting. Ask yourself, the order of what?

Understanding the role of order in distinguishing outcomes often suggests the use of the quotient principle. You might say we arrive at combinations by counting permutations and “modding” out by the order. Each block that corresponds to a single combination is a group of permutations that are only different because of their order. Let's see if we can apply this to other counting questions.

Activity 52.

The ice cream shop is down to only 3 flavors. If you wanted a 3-scoop cone or a 3-scoop shake, made without repeated flavors, there would only be 6 cones possible and only 1 shake. But what if you allowed repeated flavors?

(a)

How many 3-scoop cones are possible?

Hint

You should be able to use the multiplicative principle and nothing else here.

(b)

How many 3-scoop shakes are there? Write all of them down.

Hint

Maybe the flavors are chocolate, vanilla, and strawberry. Some of the outcomes are \(ccv\) and \(csv\text{,}\) but notice that we would not also include \(cvc\) or \(vcs\) because in the blender, order doesn't matter.

(c)

Why doesn't the quotient principle apply here? What goes wrong?

List out all 3-scoop cones and form the equivalence classes of shakes to see the issue.

The previous activity illustrates that you cannot always simply apply the quotient principle to eliminate order mattering. What we are after in the 3-scoop shakes with possibly repeated flavors is a multiset, which is just like a set only we allow for elements to be in the set multiple times, but we still do not care in what order the elements are listed. So an example of an \(4\)-element multiset of \([7]\) is \(\{1,3,3,6\}\text{,}\) which is the same multiset as \(\{1,6,3,3\}\) but different from the multiset \(\{1,3,6\}\) (in particular, this multiset only has three elements).

What we tried to do above was to count multisets by first counting sequences with possibly repeated elements, and then divide out by the number of sequences that just differ by the arrangement of a particular multiset. But this didn't work, because the size of each block was not the same.

However, we would still like to be able to count the number of multisets. How can we do this? Is it an application of the quotient principle after all? To start, let's establish some notation. The number of \(k\)-element subsets of \([n]\) was given by \(n\) choose \(k\) (written \(\binom{n}{k}\)), so we will say that the number of \(k\)-element multisets of \([n]\) will be \(n\) multichoose \(k\), and write \(\mchoose{n}{k}\text{.}\) From what we have seen above, we can say,

\begin{equation*} \mchoose{n}{k} \ne \frac{n^k}{k!} \end{equation*}

despite the obvious allure of this possibility.

Our question now is, what should be in the numerator if not \(n^k\text{?}\) First let's get more comfortable with thinking of multisets as a model for counting questions.

Activity 53.

Explain why each of the following counting problems have an answer in the form \(\mchoose{n}{k}\) (say what \(n\) and \(k\) should be). That is, show how each of them is counting the number of \(k\)-element multisets of \([n]\) (or a different set of size \(n\)).

(a)

If you have an unlimited supply of pennies, nickels, dimes and quarters, how many handfuls of 7 coins can you grab?

(b)

You roll 10 regular 6-sided dice (because you enjoy playing two games of Yahtzee at once). Assuming the dice are indistinguishable, how many different outcomes are possible?

(c)

How many functions \(f:[5] \to [7]\) are non-decreasing? For example, one such function is \(f = \twoline{1 \amp 2 \amp 3 \amp 4 \amp 5}{2 \amp 5 \amp 5 \amp 6 \amp 7}\text{.}\)

Activity 54.

Explain why each of the following counting problems are also answered in the form \(\mchoose{n}{k}\) (and say what \(n\) and \(k\) are). You should be able to explain why all of these are equivalent to each other, and then find a bijection from any of them to the set of \(k\)-element multisets of \([n]\text{.}\)

(a)

How many non-negative integer solutions are there to the equation \(x_1 + x_2 + x_3 + x_4 = 10\text{?}\)

(b)

How many ways are there to distribute 7 identical cookies to 5 kids? Some kids might not get any cookies, but you should distribute all 7 cookies.

(c)

How many ways can you put 10 identical books on the 4 shelves of a bookcase? Assume each shelf could hold up to 10 books, and that all the books are always shoved all the way to the left (so we are not worried about where the books are on an individual shelf, just which shelf they go on).

The problems in Activity 54 are sometimes referred to as “distribution problems”, since we are asking for the number of ways to distribute some objects to some recipients. This is a useful model for the other counting techniques we have seen as well. For example, a permutation \(P(n,k)\) gives the number of ways to distribute \(k\) distinct objects to \(n\) distinct recipients, so that each recipient gets at most one object.

The claim implicit in Activity 54 is that the number of ways to distribute \(k\) identical objects to \(n\) distinct recipients (now allowing each recipient to receive any number of objects, including zero) is \(\mchoose{n}{k}\text{.}\) If this is the case, then we should be able to think of the set of \(k\)-element multisets of \([n]\) as a distribution.

Activity 55.

Consider \(3\)-element multisets of \([5]\text{.}\) One of these is \(\{1,1,1\}\text{,}\) and another is \(\{2,4,5\}\text{.}\) How are these two multisets like distributing three objects among 5 recipients? What are the objects that you are distributing?

Now let's consider a related distribution problem, where in some way, order now matters. In fact, how is it that saying the distribution problems as in Activity 54 are ones for which order doesn't matter? Look back at our standard example of order mattering or not:

Activity 56.
(a)

If \(P(n,k)\) counts the number of ways to distribute \(k\) distinct objects to \(n\) distinct recipients in which each recipient receives at most one object (do you see why this is?), then what distribution does \(\binom{n}{k}\) count? Explain what is playing the role of “order mattering” in a distribution problem.

(b)

We claim that counting the number of ways to distribute \(k\) identical books to \(n\) distinct shelves is counted by \(\mchoose{n}{k}\text{,}\) and this is a situation in which order does not matter (since we are counting multisets). What would the distribution question be if order did matter? Explain why the answer to that question is NOT \(n^k\text{.}\) (What distribution does that expression count?)

Consider the case where the books are distinct instead of identical.

Activity 57.

Suppose we wish to place \(k\) distinct books onto the shelves of a bookcase with \(n\) shelves. For simplicity, assume for now that all of the books would fit on any of the shelves. Also, let's imagine pushing the books on a shelf as far to the left as we can, so that we are only thinking about how the books sit relative to each other, not about the exact places where we put the books. Since the books are distinct, we can think of the first book, the second book and so on.

(a)

How many places are there where we can place the first book?

(b)

When we place the second book, if we decide to place it on the shelf that already has a book, does it matter if we place it to the left or right of the book that is already there?

(c)

How many places are there where we can place the second book?

Hint

If you decide to put it on a shelf that already has a book, you have two choices of where to put it on that shelf.

(d)

Once we have \(i-1\) books placed, if we want to place book \(i\) on a shelf that already has some books, is sliding it in to the left of all the books already there different from placing it to the right of all the books already or between two books already there?

(e)

In how many ways may we place the \(i\)th book into the bookcase?

Hint

Among all the places you could put books, on all the shelves, how many are to the immediate left of some book? How many other places are there?

(f)

In how many ways may we place all the books?

The assignment of which books go to which shelves of a bookcase is simply a function from the books to the shelves. But a function does not determine which book sits to the left of which others on the shelf, and this information is part of how the books are arranged on the shelves. In other words, the order in which the shelves receive their books matters. Our function must thus assign an ordered list of books to each shelf. We will call such a function an ordered function. More precisely, an ordered function from a set \(S\) to a set \(T\) is a function that assigns an (ordered) list of elements of \(S\) to some, but not necessarily all, elements of \(T\) in such a way that each element of \(S\) appears on one and only one of the lists. 2 

The phrase ordered function is not a standard one, because there is as yet no standard name for the result of an ordered distribution problem.

We often think of functions as a rule that assigns an output to each input. However, we could equally well specify a function by giving the complete inverse image of each element of the codomain. That is, to define a (non-ordered) function \(f:S \to T\text{,}\) we could give the set \(f\inv(t) = \{s \in S \st f(s) = t\}\) for each \(t \in T\text{.}\) The set of elements sent to \(t\) is a set for a function, but for an ordered function, it is a sequence.

Activity 58.
(a)

In some sort of manufacturing mishap, your set of magnetic letters contains only the first 7 letters of the alphabet, and for some reason 5 identical exclamation marks. How many ways can you arrange all 12 magnets in a single line? (one such line is BG!AD!!!FEC!).

(b)

What does this question have to do with placing \(7\) distinct books on \(6\) shelves?

Hint

Note, there are 5 exclamation marks, but 6 shelves.

(c)

Oh no! Your 5 year old left the 7 magnetic letters in the oven too long and now they are all identical blobs of plastic. How many strings of the 12 magnets can you make now?

Hint

One such string is *!!***!*!*!, which looks a lot like 01100010101.

(d)

What sort of distribution problem does the previous task correspond to? Write a question about books and shelves that has the same answer.

AHA! The previous activity suggests that to count multisets, which is the same as counting distributions of identical objects to distinct recipients, we should apply the quotient principle to ordered functions.

What should the equivalence relation be? Think about bookshelves. An ordered function is a distribution of distinct books to distinct shelves. A multiset is a distribution of identical books to distinct shelves. So we want two ordered functions to be equivalent if their corresponding shelves contain the same number of books (we no longer care what those books are, just how many there are).

Now, given any ordered function, how many ordered functions are in its equivalence class? We can get any other element in the class by permuting the books (but keeping the numbers in each shelf constant). There are \(k\) books, so there are \(k!\) ways to permute them. This is the same for every ordered function, so the equivalence classes all have the same size.

Applying the quotient principle, we arrive at the following.

It is interesting that the number of \(k\)-element multisets of \([n]\) can be expressed as a binomial coefficient. This suggests there should be a way to describe a multiset as choosing \(k\) things from a collection of \(n-1+k\) things. Or perhaps thinking about each multiset as a \((n-1+k)\)-bit string of weight \(k\text{.}\)

There is a standard interpretation for this. We call this approach stars and bars (others use balls and wall or dashes and slashes; the important thing is that it rhymes). The idea is that we represent each multiset as a string of \(k\) “stars” and \(n-1\) “bars”. These are really just bit strings in disguise, so the binomial coefficient becomes clear. The only question is how do multisets correspond to the strings?

Activity 59.

Consider \(4\)-element multisets of \([3]\text{.}\) Using the formula above, there are \(\binom{6}{4} = 15\) of these. There are also \(\binom{6}{4}\) stars and bars strings using \(4\) stars and \(2\) bars.

(a)

Write out all 15 multisets and all 15 stars and bars strings. Find a bijection between these that makes sense.

Hint

The multiset \(\{1,2, 2, 3\}\) should correspond to the string \(*|**|*\text{.}\)

(b)

Why does it make sense that there are only 2 bars in these diagrams, but 3 elements that can go into the multiset?

(c)

What would go wrong if we used 3 bars and 3 stars (that is, confused \(n\) and \(k\))? Why does \(*||**|\) not make sense as a multiset here?

Thinking of these distribution problems as “stars and bars problems” can make solving them very quick. The key step is deciding what part of the problem the stars correspond to, and what the bars correspond do. The remaining exercises here should give you some practice with this.

Exercise 60.

Each of the counting problems below can be solved with stars and bars. For each, say what outcome the string

\begin{equation*} ***|*||**| \end{equation*}

represents, if there are the correct number of stars and bars for the problem. Otherwise, say why the diagram does not represent any outcome, and what a correct diagram would look like.

  1. How many ways are there to select a handful of 6 jellybeans from a jar that contains 5 different flavors?

  2. How many ways can you distribute 5 identical lollipops to 6 kids?

  3. How many 6-letter words can you make using the 5 vowels in increasing order?

  4. How many solutions are there to the equation \(x_1 + x_2 + x_3 + x_4 = 6\text{.}\)

Exercise 61.

In Activity 53 and Activity 54 you considered some counting questions we claimed could be expressed as multisets. Now solve each of these using stars and bars and the formula in Theorem 1.3.4. Be sure to clearly state which part of the problem corresponds to the stars and which to the bars, and why this makes sense.

(a)

If you have an unlimited supply of pennies, nickels, dimes and quarters, how many handfuls of 7 coins can you grab?

(b)

How many non-negative integer solutions are there to the equation \(x_1 + x_2 + x_3 + x_4 = 10\text{?}\)

(c)

You roll 10 regular 6-sided dice (because you enjoy playing two games of Yahtzee at once). Assuming the dice are indistinguishable, how many different outcomes are possible?

(d)

How many ways are there to distribute 7 identical cookies to 5 kids? Some kids might not get any cookies, but you should distribute all 7 cookies.

(e)

How many functions \(f:[5] \to [7]\) are non-decreasing? For example, one such function is \(f = \twoline{1 \amp 2 \amp 3 \amp 4 \amp 5}{2 \amp 5 \amp 5 \amp 6 \amp 7}\text{.}\)

(f)

How many ways can you put 10 identical books on the 4 shelves of a bookcase? Assume each shelf could hold up to 10 books, and that all the books are always shoved all the way to the left (so we are not worried about where the books are on an individual shelf, just which shelf they go on).

Subsection 1.3.3 More Distribution Problems

Both multisets and ordered functions allowed some of the recipients to receive nothing (or for some elements of \([n]\) to not be included in the multiset). What if we didn't want to allow this?

Activity 62.

Suppose we wish to place the books in Activity 57 (satisfying the assumptions we made there) so that each shelf gets at least one book. Now in how many ways may we place the books? (Hint: how can you make sure that each shelf gets at least one book before you start the process described in Activity 57?)

Hint

How can you make sure that each shelf gets at least one book before you start the process described in Activity 57?

The previous activity is an example of what we might call an ordered surjection. Just like we did with ordered functions, we can apply the quotient principle to count distributions where the objects being distributed are no longer distinct.

Exercise 63.

In how many ways may we put \(k\) identical books onto \(n\) shelves if each shelf must get at least one book?

Hint

We already know how to place \(k\) distinct books onto \(n\) distinct shelves so that each shelf gets at least one. Suppose we replace the distinct books with identical ones. If we permute the distinct books before replacement, does that affect the final outcome? There are other ways to solve this problem.

Example 1.3.5.

A composition of the integer \(k\) into \(n\) parts is a list of \(n\) positive integers that add to \(k\text{.}\) How many compositions are there of an integer \(k\) into \(n\) parts?

Solution

There is a bijection between compositions of \(k\) into \(n\) parts and arrangements of \(k\) identical books on \(n\) shelves so that each shelf gets a book. Namely, the number of books on shelf \(i\) is the \(i\)th element of the list. Thus the number of compositions of \(k\) into \(n\) parts is \(\binom{k-1}{n-1}\text{.}\)

Example 1.3.6.

The answer in Example 1.3.5 can be expressed as a binomial coefficient. This means it should be possible to interpret a composition as a subset of some set. Find a bijection between compositions of \(k\) into \(n\) parts and certain subsets of some set. Explain explicitly how to get the composition from the subset and the subset from the composition.

Solution

If we line up \(k\) identical books, there are \(k-1\) places in between two books. If we choose \(n-1\) of these places and slip dividers into those places, then we have a first clump of books, a second clump of books, and so on. The \(i\)th element of our list is the number of books in the \(i\)th clump. Clearly using books is irrelevant; we could line up any \(k\) identical objects and make the same argument. Our bijection is between compositions and \((n-1)\)-element subsets of the set of \(k-1\) spaces between our objects.

Exercise 64.

Explain the connection between compositions of \(k\) into \(n\) parts and the problem of distributing \(k\) identical objects to \(n\) recipients so that each recipient gets at least one.

Exercise 65.

The previous exercise suggests that you can represent compositions as stars and bars strings as well.

(a)

Consider the composition of 5 into 3 parts: \(1+3+1\text{.}\) This is like giving 1 apple to the first kid, 3 to the second, and 1 to the last. What stars and bars string would you use for this?

(b)

Explain why \(*||****\) does not represent any composition. What must be true of a stars and bars string for it to correspond to a composition?

(c)

Use your classification of valid stars and bars strings to justify that there are \(\binom{k-1}{n-1}\) compositions of \(k\) into \(n\) parts.

So far, we have only considered distribution problems in which the recipients are distinct. There are plenty of situations where we would want to consider recipients identical. For example, a problem we will take up in Chapter 2 is how many ways we can partition an integer. For example, we could partition 5 as \(4+1\) or \(3+1+1\text{,}\) but we would not want to also count \(1+4\) or \(1+3+1\) (doing so would be creating a composition, which we have already considered). We can think of the integer partition problem as distributing the 5 units that make up 5 into some number of identical bins.

Here is another example, which we already have the tools to address.

Exercise 66.

In how many ways may we stack \(k\) distinct books into \(n\) identical boxes so that there is a stack in every box? There are two distinct ways to answer this question. Find them both.

Hint 1

Imagine taking a stack of \(k\) books, and breaking it up into stacks to put into the boxes in the same order they were originally stacked. If you are going to use \(n\) boxes, in how many places will you have to break the stack up into smaller stacks, and how many ways can you do this?

Hint 2

How many different bookcase arrangements correspond to the same way of stacking \(k\) books into \(n\) boxes so that each box has at least one book?

We can think of stacking books into identical boxes as partitioning the books and then ordering the blocks of the partition. This turns out not to be a useful computational way of visualizing the problem because the number of ways to order the books in the various stacks depends on the sizes of the stacks and not just the number of stacks. However this way of thinking actually led to the first hint in Exercise 66. Instead of dividing a set up into non-overlapping parts, we may think of dividing a permutation (thought of as a list) of our \(k\) objects up into \(n\) ordered blocks. We will say that a set of ordered lists of elements of a set \(S\) is a broken permutation of \(S\) if each element of \(S\) is in one and only one of these lists. 3  The number of broken permutations of a \(k\)-element set with \(n\) blocks is denoted by \(L(k,n)\text{.}\) The number \(L(k,n)\) is called a Lah Number and, from our solution to Exercise 66, is equal to \(k!\binom{k-1}{n-1}/n!\text{.}\)

The phrase broken permutation is not standard, because there is no standard name for the solution to this kind of distribution problem.

The Lah numbers are the solution to the question “In how many ways may we distribute \(k\) distinct objects to \(n\) identical recipients if order matters and each recipient must get at least one?”