Statement

Hall’s marriage theorem gives a necessary and sufficient condition for whether a bipartite graph has a perfect matching: for every , if is the neighborhood of in , then must be . Here, the neighborhood of refers to the set of all nodes in that are connected directly to a node in .

bg-white

An -perfect matching. We can verify Hall’s condition on, for instance, , whose neighborhood is the first four nodes in . , therefore the condition is satisfied.

Proof 1 (Flows)

If there exists with , then a perfect matching is obviously impossible. It remains to prove sufficiency, which can also be done fairly easily by the max-flow min-cut theorem (for more, see flow).

Set up the following flow network:

  • Connect the source node with edges of capacity 1 to every node in .
  • Direct every edge between and toward with capacity .
  • Connect every node in to the sink with edges of capacity .

Clearly, a flow in this network corresponds to a matching on the original bipartite graph. Now, consider any cut in this flow network with finite capacity. Let be the set of nodes in which are still connected to the source. Then, the smallest set we can cut on the right side is exactly the neighborhood of . The size of the resultant cut is then , but since we have for all , this quantity must then be for all possible cuts, and thus the min-cut is exactly with equality achieved when . Therefore, an -flow must exist.

Proof 2 (Constructive)

We induct, and consider 2 cases.

Case 1: For every with and its neighborhood , . In this case, we can just pair any two connected nodes and , as this decreases the RHS of the above inequality by at most 1 for all .

Case 2: There exists with and . By induction, we can perfectly match to . Every remaining subset will still satisfy Hall’s condition because is subtracted from the LHS and at most is subtracted from the RHS.

Takeaways

I think this theorem is quite beautiful as it essentially just compounds necessary conditions until their sum ends up being sufficient. What I mean is this:

When you see the problem, you’ll likely observe that trivially, must be , which is certainly necessary but definitely not sufficient. But then you simply apply this condition to all subsets of , and that turns out to be sufficient! Isn’t that elegant?

Problems

There are candies, each with a potentially different color. Determine whether it’s possible to split them into pairs such that no pair contains two candies of the same color.

The next few problems are from https://cjquines.com/files/halls.pdf. Also in solutions, will denote the neighborhood of .