Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
Mathematics LibreTexts

5.2: Applications of Inclusion and Exclusion

5.2.1 Multisets with restricted numbers of elements

235. In how many ways may we distribute k identical apples to n children so that no child gets more than four apples? Compare your result with your result in Problem 197. Online hint. 5.2.2 The M´enage Problem

236. A group of n married couples comes to a group discussion session where they all sit around a round table. In how many ways can they sit so that no person is next to his or her spouse? (Note that two people of the same sex can sit next to each other.) Online hint. A second online hint.

1For those interested in logic and set theory, given a family of subsets Ai of a set A, we define T i:i∈S Ai to be the set of all members x of A that are in Ai for all i ∈ S. (Note that this allows x to be in some other Aj s as well.) Then if S = ∅, our intersection consists of all members x of A that satisfy the statement “if i ∈ ∅, then x ∈ Ai.” But since the hypothesis of the ‘if-then’ statement is false, the statement itself is true for all x ∈ A. Therefore T i:i∈∅ Ai = A.

∗237. A group of n married couples comes to a group discussion session where they all sit around a round table. In how many ways can they sit so that no person is next to his or her spouse or a person of the same sex? This problem is called the m´enage problem. (Hint: Reason somewhat as you did in Problem 236, noting that if the set of couples who do sit side-by-side is nonempty, then the sex of the person at each place at the table is determined once we seat one couple in that set, or, for that matter, once we seat one person.) Online hint.

5.2.3 Counting onto functions

•238. Given a function f from the k-element set K to the n-element set [n], we say f is in the set Ai if f(x) 6= i for every x in K. How many of these sets does an onto function belong to? What is the number of functions from a k-element set onto an n-element set?

239. Find a formula for the Stirling number (of the second kind) S(k, n). Online hint.

240. If we roll a die eight times, we get a sequence of 8 numbers, the number of dots on top on the first roll, the number on the second roll, and so on.

  1. What is the number of ways of rolling the die eight times so that each of the numbers one through six appears at least once in our sequence? To get a numerical answer, you will likely need a computer algebra package.
  2. What is the probability that we get a sequence in which all six numbers between one and six appear? To get a numerical answer, you will likely need a computer algebra package, programmable calculator, or spreadsheet.
  3. How many times do we have to roll the die to have probability at least one half that all six numbers appear in our sequence. To answer this question, you will likely need a computer algebra package, programmable calculator, or spreadsheet.

5.2.4 The chromatic polynomial of a graph We defined a graph to consist of set V of elements called vertices and a set E of elements called edges such that each edge joins two vertices. A coloring of a graph by the elements of a set C (of colors) is an assignment of an element of C to each vertex of the graph; that is, a function from the vertex set V of the graph to C. A coloring is called proper if for each edge joining two distinct vertices2 , the two vertices it joins have different colors. You may have heard of the famous four color theorem of graph theory that says if a graph may be drawn in the plane so that no two edges cross (though they may touch at a vertex), then the graph has a proper coloring with four colors. Here we are interested in a different, though related, problem: namely, in how many ways may we properly color a graph (regardless of whether it can be drawn in the plane or not) using k or fewer colors? When we studied trees, we restricted ourselves to connected graphs. (Recall that a graph is connected if, for each pair of vertices, there is a walk between them.) Here, disconnected graphs will also be important to us. Given a graph which might or might not be connected, we partition its vertices into blocks called connected components as follows. For each vertex v we put all vertices connected to it by a walk into a block together. Clearly each vertex is in at least one block, because vertex v is connected to vertex v by the trivial walk consisting of the single vertex v and no edges. To have a partition, each vertex must be in one and only one block. To prove that we have defined a partition, suppose that vertex v is in the blocks B1 and B2. Then B1 is the set of all vertices connected by walks to some vertex v1 and B2 is the set of all vertices connected by walks to some vertex v2.

·241. (Relevant in Appendix C as well as this section.) Show that B1 = B2. Since B1 = B2, these two sets are the same block, and thus all blocks containing v are identical, so v is in only one block. Thus we have a partition of the vertex set, and the blocks of the partition are the connected components of the graph. Notice that the connected components depend on the edge set of the graph. If we have a graph on the vertex set V with edge set E and another graph on the vertex set V with edge set E0 , then these two graphs could have different connected components. It is traditional to use the Greek letter γ (gamma)3 to stand for the number of connected components of a graph; in particular, γ(V, E) stands for the number of connected components of the graph with vertex set V and edge set E. We are going to show how the principle of inclusion and exclusion may be used to compute the number of ways to color a graph properly using colors from a set C of c colors. 2 If a graph had a loop connecting a vertex to itself, that loop would connect a vertex to a vertex of the same color. It is because of this that we only consider edges with two distinct vertices in our definition. 3The Greek letter gamma is pronounced gam-uh, where gam rhymes with ham.

·242. Suppose we have a graph G with vertex set V and edge set E = {e1, e2, . . . e|E|}. Suppose F is a subset of E. Suppose we have a set C of c colors with which to color the vertices.

  1. In terms of γ(V, F), in how many ways may we color the vertices of G so that each edge in F connects two vertices of the same color? Online hint.
  2. Given a coloring of G, for each edge ei in E, let us consider the set Ai of colorings that the endpoints of e are colored the same color. In which sets Ai does a proper coloring lie?
  3. Find a formula (which may involve summing over all subsets F of the edge set of the graph and using the number γ(V, F) of connected components of the graph with vertex set V and edge set F) for the number of proper colorings of G using colors in the set C. Online hint.

The formula you found in Problem 242c is a formula that involves powers of c, and so it is a polynomial function of c. Thus it is called the “chromatic polynomial of the graph G.” Since we like to think about polynomials as having a variable x and we like to think of c as standing for some constant, people often use x as the notation for the number of colors we are using to color G. Frequently people will use χG(x) to stand for the number of ways to color G with x colors, and call χG(x) the chromatic polynomial of G.

Contributors