Problem Set 4


Due Friday, October 28 at 2:30 pm Pacific


Solutions are available!

🔑 Solutions


This fourth problem set explores graph theory and the pigeonhole principle. It’s designed to take you on a tour of the beauty of finite structures and some of their amazing properties. Plus, you’ll get to see some pretty pictures and learn about why all this matters in the first place. 😃

Good luck, and have fun!

$\LaTeX$ Template

If you would like to type your solutions in $\LaTeX$, you may want to download this template file where you can place your answers:

🖋 PS4 $\LaTeX$ Template

This problem set does not have a coding component.

Problem One: Independent and Dominating Sets

As a refresher from lecture, an independent set in a graph $G = (V, E)$ is a set $I \subseteq V$ with the following property:

\[\forall u \in I. \forall v \in I. \Set{u, v} \not\in E \text.\]

Now, a new definition. A dominating set in $G$ is a set $D \subseteq V$ with the following property:

\[\forall v \in V. (v \not\in D \to \exists u \in D. \Set{u, v} \in E)\text.\]

In general, whenever you find a new definition or new mathematical term, it’s good to play around with the definition a bit to get a feel for what it looks like.

  1. Give two different examples of dominating sets of the graph shown below, each of which has cardinality four or less. No justification is necessary.

    A graph with eight nodes: a, b, c, d, e, f, g, and h. Node a is adjacent to nodes b and e. Node b is adjacent to nodes a, c, e, and f. Node c is adjacent to nodes b, d, and g. Node d is adjacent to node c. Node e is adjacent to nodes a and b. Node f is adjacent to nodes b and g. Node g is adjacent to nodes c, f, and h. Node h is adjacent to node f.

  1. Let $G = (V, E)$ be an arbitrary graph with the following property: every node in $G$ is adjacent to at least one other node in $G$. Prove that if $I$ is an independent set in $G$, then $V - I$ is a dominating set in $G$.

    Notice that we're asking you to show that $V - I$ is a dominating set, not that $I$ is a dominating set. Also, we recommend drawing some pictures here to get a sense of how this works.

    Use the formal definitions to guide your proofs. If you proceed via a direct proof or via contrapositive, what, exactly, will you be assuming, and what will you be proving? If you write this as a proof by contradiction, what specifically is it that you’re assuming for the sake of contradiction?

An independent set $I$ in a graph $G$ is a maximal independent set in $G$ if there is no independent set $I'$ in $G$ where $I \subsetneq I'$. (Here, $I \subsetneq I'$ denotes that $I$ is a strict subset of $I'$, meaning that $I \subseteq I'$ and $I \ne I'$).

  1. Find independent sets $I$ and $J$ of the graph from part (i) of this problem such that $I$ is maximal but $\abs{I} \lt \abs{J}$. No justification is necessary.

    Yes, this is possible. The definition of a maximal independent set is meant to be taken literally.

  1. Prove that if $I$ is a maximal independent set in $G = (V, E)$, then $I$ is a dominating set of $G\text.$

    You can build a great intuition for this result by drawing some pictures and thinking about what has to happen for a set of nodes to be an independent set and for a set of nodes to be a dominating set. When it comes time to write out your proof, however, you’ll need to use the formal first-order definitions of independent sets, maximal independent sets, and dominating sets.

Independent and dominating sets have applications in complexity theory, error-correcting codes, and resource allocation. Take CS154 and CS250 to learn more!

Problem Two: Carpool Conundrums

You are at home babysitting three children (we'll call them Calvin, Hobbes, and Susie). Hobbes and Susie are well-behaved, but Calvin has a tendency to pick fights with the other kids. However, Calvin won't get into a fight with either of the others if you're around.

You need to drive Calvin, Hobbes, and Susie to the park. If your car has three passenger seats, this is easy: just drive everyone to the park and drop them off. If your car has two passenger seats, this is also easy: drive Hobbes and Susie to the park, drop them off, then drive home, pick up Calvin, and drive back to the park and drop Calvin off.

However, your car only has one passenger seat.

  1. Describe how to shuttle Calvin, Hobbes, and Susie to the park without leaving Calvin unsupervised with one of the other kids. Every kid must, at each point in time, either be in the car, at home, or at the park.

    No, you can't have one of the kids drive. :-)

Suppose there's a fourth kid, Moe. As before, Calvin can't be left alone with any of the other children unless you're around. In addition, Moe will get into a fight with Hobbes if the two are together and you aren't there. Now, how do you get everyone to the park?

If your car has four passenger seats, you can bring everyone to the park without any problems. If your car as three passenger seats, you can also do this: bring Hobbes, Susie, and Moe in the car to the park. Bring Moe back with you as you drive back home to get Calvin. Then pick up Calvin and Moe and drop them off at the park.

  1. Is it possible to transport everyone to the park if your car has just two passenger seats? If so, explain how. If not, prove why not.

In the first problem, you had three children and two pairs of kids who could not be left unattended. In the second problem, you have four children and four pairs of kids who cannot be left unattended. More generally, we can imagine that you have any number of children with any number of kids who cannot be left unattended. We can represent these constraints as a graph - each node is a child, and each edge represents a pair of children who cannot be left together. For example, the two problems from above would be represented as the following graphs:

Two graphs. The first graph has nodes H, C, and S. There is an edge from H to C and from C to S. The second graph has nodes H, C, S, and M. There are edges from H to M, from M to C, from C to H, and from C to S.

Once you have the graph $G = (V, E)$ of children and disallowed pairs, you can start thinking about how many passenger seats you'll need to transport them from your home to the park. If your car has $\abs{V}$ passenger seats, this is easy - just bring everyone over at once. As we start reducing the number of seats in the car, though, this gets harder and harder to do. And at some point it becomes impossible to transport everyone without a fight breaking out.

Let $G = (V, E)$ be a graph. The vertex cover number of $G\text,$ denoted $\mathbf{\tau(G)}$ using the Greek letter tau, is the size of the smallest vertex cover in $G\text.$

  1. What are the vertex cover numbers of the two graphs shown above? No justification is necessary.

There is a close connection between $\tau(G)$ and the number of passenger seats needed to drive the kids from your home to the park.

  1. Let $G = (V, E)$ be a graph where $V$ is a set of kids and $E$ represents pairs of kids who cannot be left together unsupervised. Prove that if your car has fewer than $\tau(G)$ passenger seats, it is not possible to transport the kids from your home to the park.

    As a hint, let $C$ be the set of kids in the car with you after the very first trip you make. Think about what you know about the kids in $C$ and the kids not in $C\text.$

  1. Suppose your car has $\tau(G) + 1$ passenger seats. Describe a strategy that will enable you to transport all the kids to the park. No justification is necessary.

Your results from parts (iv) and (v) of this problem show that the minimum number of passenger seats needed to transport all the kids is either $\tau(G)$ or $\tau(G)+1\text.$ (Why? Because from part (iv) you know that anything below $\tau(G)$ won't work, and from part (v) you know that $\tau(G) + 1$ always works.) Surprisingly, given an arbitrary graph, there is no known efficient algorithm for determining whether that graph requires $\tau(G)$ or $\tau(G)+1$ passenger seats! In terms of computational complexity theory, this problem is known to be NP-hard. We'll talk about NP-hardness at the end of the quarter.

Problem Three: Friends, Strangers, Enemies, and Hats

In lecture, we proved the Theorem on Friends and Strangers, which says that if you have a group of six people where, for each pair of people, those people either know one another (they’re friends) or they don’t know each other (they’re strangers), you can always find three mutual friends or three mutual strangers. Here, “three mutual friends” means “three people where each two of them are friends,” and “three mutual strangers” means “three people where each two of them are strangers.”

This is one of many different results about what must happen when you get a sufficiently large number of people together. The rest of this problem explores some other results in that vein.

  1. There’s a party with 36 attendees. Each person is wearing a hat, and there are seven possible hat colors: aureolin, bole, chartreuse, drab, ecru, fulvous, and gamboge. (Yes, those are all colors.) As in the Theorem on Friends and Strangers, for any pair of people at the party, either the pair are friends or the pair are strangers.

    Prove that you can always find three mutual friends all wearing the same color hat or three mutual strangers all wearing the same color hat.

    In the course of solving this problem, you will likely need to make sure of the Theorem on Friends and Strangers from lecture. If you do, you should just cite the result from lecture rather than reproving it from scratch. For example, you could say something like "by the Theorem on Friends and Strangers, we know that … ." As usual, though, don't repeat the theorem in the abstract. Instead, apply it to some specific scenario to state some new fact you learn as a result.

  1. There’s a party with 17 attendees. This time, things are a bit more complicated. For each pair of people at the party, either those people are strangers, those people are friends, or those people are enemies. Fortunately, none of them are wearing hats. 😃

    Prove that you can always find three mutual friends, or three mutual strangers, or three mutual enemies.

Find problems like these interesting? Take Math 107 (Graph Theory) or Math 108 (Combinatorics)!

Problem Four: Bipartite Graphs

The bipartite graphs are an important and common family of graphs. They appear in a huge number of settings – error-correcting codes, computational social choice theory, and algorithm design, to name a few.

Let’s begin with a formal definition. An undirected graph $G = (V, E)$ is called bipartite if there exist two sets $V_1$ and $V_2$ such that

  • every node $v \in V$ belongs to at least one of $V_1$ and $V_2$;
  • no node $v \in V$ belongs to both $V_1$ and $V_2$; and
  • every edge $e \in E$ has one endpoint in $V_1$ and the other in $V_2$.

The sets $V_1$ and $V_2$ here are called bipartite classes of $G$.

  1. Suppose you have an $8 \times 8$ chessboard. We form a graph from the board as follows: there's a node for each square on the board, and an edge between any pair of squares that are immediately adjacent in one of the four cardinal directions (up, down, left, and right).

    Explain why this is a bipartite graph by telling us what the bipartite classes are and briefly explaining why all the edges have one endpoint in each bipartite class.

    Don’t do this in your head – draw lots of pictures!

Bipartite graphs have many interesting properties. One of the most fundamental is this one:

Theorem: An undirected graph $G$ is bipartite if and only if it contains no closed walks of odd length.

The forward direction of this implication has a nice intuition.

  1. Explain, intuitively, why if $G$ is bipartite, then it has no closed walks of odd length. Specifically, give us a brief, informal explanation as to why every closed walk in $G$ has to have even length.

    It might help to draw some pictures.

The reverse direction of this implication – that if $G$ has no closed walks of odd length, then $G$ is bipartite – requires a different sort of argument.

Let’s pick some arbitrary graph $G = (V, E)$ that has no closed walks of odd length. For simplicity’s sake, we’ll assume that $G$ has just one connected component. If $G$ has two or more connected components, we can essentially treat each one of them as independent graphs. (Do you see why?)

Now, choose any node $x \in V$. Using node $x$ as an “anchor point,” we can define two sets $V_1$ and $V_2$ that we’ll need for the remainder of this argument:

\[V_1 = \Set{v \in V \suchthat \text{there is an odd-length walk from } x \text{ to } v }\] \[V_2 = \Set{v \in V \suchthat \text{there is an even-length walk from } x \text{ to } v }\]

This turns out to be a really useful way to group the nodes of $G$.

  1. Given the choices of $G$ and $x$ from above, prove that $V_1$ and $V_2$ have no nodes in common.

    Remember that there might be multiple different walks of different lengths from $v$ to some other node $x$, so be careful not to talk about “the” walk between $v$ and $x$. Also note that these walks are not necessarily paths.

  1. Using your result from part (iii), prove that $G$ is bipartite.

    The most common mistake on this problem is to not address all the parts of the definition of a bipartite graph. So start off by writing down a list of what you need to prove, then address each part in turn.

Want to learn more about bipartite graphs and their applications? Take CS161 (algorithms), CS224W (social network analysis), or CS250 (error-correcting codes)!

Problem Five: Iterated Injections

Let $f : A \to A$ be an injection from a finite set $A$ to itself. (A finite set is one whose size is a natural number.) Your goal in this problem is to prove the following result:

Theorem: For each $a \in A$, there is an $n \in \naturals$ where $f^{n+1}(a) = a$.

In other words, if you take any element $a \in A$ and repeatedly apply $f$ to $a$, you will eventually get back what you started with.

Here’s how we’re going to prove this. Pick any $a \in A$, and let $k = \abs{A}$. Now, look at the sequence

\[f^0(a), f^1(a), f^2(a), f^3(a), \dots, f^k(a)\text.\]

This is what you get if you start at $a$ and keep applying $f$ over and over again.

  1. Prove that this sequence must contain at least one duplicate value.

Now, take the sequence above and consider the largest value of $n$ such that the sequence

\[f^0(a), f^1(a), \dots, f^n(a)\]

contains no repeated values. Since this is the longest such sequence, we know that the next term in the sequence, $f^{n+1}(a)$, must be equal to some term of the sequence shown above.

  1. Using your result from part (i), prove that $f^{n+1}(a) = a$. (This proves the above theorem.)

This theorem has a bunch of surprising applications.

  1. Let $f : A \to A$ be an injection from a finite set to itself. Using your result from part (ii), prove that $f$ is also a bijection.

One consequence of your result from part (iii) is that if an injective function from a set $A$ to itself is not a bijection, then $A$ must not be finite. And indeed, this is one possible way to define what it means for a set to be infinite!

Optional Fun Problem: Forced Triangles

Let $G = (V, E)$ be a graph where each node has been given one of three different colors (ecru, puce, and zomp - and yes, those are all colors) such that no two nodes of the same color are adjacent to one another. Furthermore, suppose there are exactly $n$ nodes of each color.

Prove that if every node $v \in V$ has degree at least $n+1\text,$ then $G$ contains a triangle (a copy of $K_3\text{).}$