Skip to main content
Mathematics LibreTexts

5.2: Applications of Inclusion and Exclusion

  • Page ID
    6116
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\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}}\) \(\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}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    5.2.1: Multisets with Restricted Numbers of Elements

    Exercise \(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. (Hint).

    5.2.2: The Ménage Problem

    \(\rightarrow\) Exercise \(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.) (Hint).

    \(\rightarrow \; *\) Exercise \(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énage problem. (Hint).

    5.2.3: Counting Onto Functions

    \(\bullet\) Exercise \(238\)

    Given a function \(f\) from the \(k\)-element set \(K\) to the \(n\)-element set \([n]\), we say \(f\) is in the set \(A_i\) if \(f(x) \neq 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?

    \(\rightarrow\) Exercise \(239\)

    Find a formula for the Stirling number (of the second kind) \(S(k, n)\). (Hint).

    Exercise \(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.

    a. 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.

    b. 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.

    c. 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 vertices1, 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 \(B_1\) and \(B_2\). Then \(B_1\) is the set of all vertices connected by walks to some vertex \(v_1\) and \(B_2\) is the set of all vertices connected by walks to some vertex \(v_2\).

    \(\cdot\) Exercise \(241\)

    (Relevant in Appendix C as well as this section.) Show that \(B_1 = B_2\). Since \(B_1 = B_2\), 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 \(E'\), then these two graphs could have different connected components. It is traditional to use the Greek letter \(γ\) (gamma)2 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.

    \(\cdot\) Exercise \(242\)

    Suppose we have a graph \(G\) with vertex set \(V\) and edge set \(E\). Suppose \(F\) is a subset of \(E\). Suppose we have a set \(C\) of \(c\) colors with which to color the vertices.

    a. 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? (Hint).

    b. Given a coloring of \(G\), for each edge \(e\) in \(E\), let us consider the property that the endpoints of \(e\) are colored the same color. Let us call this property “property \(e\).” In this way each set of properties can be thought of as a subset of \(E\). What set of properties does a proper coloring have?

    c. 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\). (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 and Attributions


    This page titled 5.2: Applications of Inclusion and Exclusion is shared under a GNU Free Documentation License 1.3 license and was authored, remixed, and/or curated by Kenneth P. Bogart.