40.04.02 · combinatorics / graph-theory-core

Matchings I: König's Theorem and Hall's Marriage Theorem

shipped3 tiersLean: none

Anchor (Master): Diestel 2017 *Graph Theory* (5th ed., Springer GTM 173) §2.1; Lovász-Plummer 1986 *Matching Theory* (North-Holland) Ch. 1-2 (deficiency, the König-Egerváry circle, total unimodularity, the Birkhoff polytope); Schrijver 2003 *Combinatorial Optimization* (Springer) Vol. A, Ch. 16-18; the original sources Frobenius 1917, Kőnig 1931, Hall 1935, Birkhoff 1946, von Neumann 1953

Intuition Beginner

Imagine a room with some applicants on the left and some jobs on the right. Draw a line from an applicant to a job whenever that applicant is qualified for that job. A matching is a way of handing out jobs so that no applicant gets two jobs and no job goes to two applicants: a set of the lines with no two sharing an endpoint. The basic question of matching theory is how many people you can employ at once, and when you can employ everybody.

You quickly notice that being qualified is not enough on its own. Suppose three applicants are all qualified for the same single job and nothing else. Only one of them can be hired, no matter how clever you are, because there is just one job among them to go around. The bottleneck is not any single person; it is a group of people who collectively reach too few jobs. This is the whole secret of the subject: a matching that employs everyone on one side exists exactly when no group of applicants is starved for jobs.

Hall's marriage theorem makes this precise. Picture instead some people seeking partners to marry, each willing to marry only certain others. Everyone on one side can be married off at once exactly when every group of of them is collectively willing to marry at least different people. If some group of people are jointly willing to marry only others, someone is left at the altar. The condition is both necessary, which is plain, and sufficient, which is the theorem.

Visual Beginner

Picture two columns. On the left, four applicants ; on the right, four jobs . Draw the qualification lines , , , , , and . Applicants and between them reach only and , which is fine; but and together reach only the single job , so they form a starved pair.

The table beside the picture lists small groups of applicants and counts how many jobs each group can reach between them. The starved group reaches only one job, so the count falls below the group size .

group of applicants jobs the group reaches reaches enough?
(2) yes
(2) yes
(1) no

The instant one group reaches fewer jobs than its own size, employing everyone becomes impossible, and the table makes that failure visible at a glance.

Worked example Beginner

Take three students and three projects , with these preferences: will do or ; will do or ; will do only . We find an assignment giving every student a project, or show none exists.

Step 1. Start greedily. Give a project first, since is the pickiest: takes .

Step 2. Now place . Project is taken, so takes .

Step 3. Now place . Project is taken, but also accepts , which is free, so takes .

Step 4. Check the result. The assignment is , , . Every student has a project and no project is doubled up, so all three are placed.

Step 5. Confirm with the group test. Any single student reaches at least one project; any pair reaches at least two; all three together reach , which is three. No group is starved, so a full assignment had to exist, and we found one.

What this tells us: serving the pickiest first is a sound instinct, and the group-reach test predicts in advance whether a full assignment can exist at all. If instead all three students had accepted only , the group of three would reach one project, the test would fail, and no full assignment could be built however hard you tried.

Check your understanding Beginner

Formal definition Intermediate+

Let be a graph. A matching is a set of pairwise disjoint edges — no two edges of share an endpoint [Diestel 2017 §2.1]. A vertex incident to an edge of is -saturated (or covered), and otherwise -unsaturated (or exposed). A matching is perfect if it saturates every vertex, so . A matching is maximal if no edge can be added while keeping it a matching, and maximum if no matching has more edges; the matching number is the size of a maximum matching. Maximal and maximum differ: in a path the single middle edge is maximal but not maximum, since is larger.

Given a matching , an -alternating path is a path whose edges alternate between and . An -augmenting path is an -alternating path whose two endpoints are both -unsaturated; it necessarily begins and ends with non-matching edges and so has odd length, with one more non-matching edge than matching edge.

A graph is bipartite with parts when and every edge has one end in each part. For the neighbourhood collects all vertices adjacent to some vertex of . A vertex cover is a set meeting every edge — each has at least one endpoint in — and the vertex-cover number is the size of a smallest cover. For every graph , since a cover must spend a distinct vertex on each edge of any matching.

Definition (system of distinct representatives). Given finite sets , a system of distinct representatives (SDR), or transversal, is a choice of distinct elements with for . Modelling each as a left vertex joined to the elements of on the right, an SDR is exactly a matching saturating the left side.

Definition (doubly stochastic matrix). An matrix is doubly stochastic if its entries are non-negative and every row and every column sums to . A permutation matrix is a doubly stochastic matrix, with exactly one in each row and column.

Counterexamples to common slips

  • Maximal is not maximum. A maximal matching merely admits no enlargement by a single edge; a maximum matching has the largest possible size. The path on four vertices shows the gap, and greedy edge selection only guarantees maximality.
  • Hall's condition is about every subset, not every vertex. Checking that each individual left vertex has a neighbour is far weaker than for all . The starved pair from the Visual has both vertices with a neighbour, yet the pair reaches only one vertex.
  • König's min-max equality is special to bipartite graphs. In the triangle the matching number is while the vertex-cover number is , so . The equality can fail the moment an odd cycle appears.
  • An augmenting path must start and end exposed. An alternating path between two saturated endpoints does not enlarge the matching. Only when both endpoints are unsaturated does flipping the path along its edges gain one edge.

Key theorem with proof Intermediate+

Theorem (Berge's augmenting-path criterion and Hall's marriage theorem).

(a) Berge's lemma. A matching in any graph is maximum if and only if contains no -augmenting path.

(b) Hall's marriage theorem. A bipartite graph with parts has a matching saturating if and only if for every .

(See [Diestel 2017 §2.1], [Hall 1935], [Bondy-Murty 2008 Ch. 16].)

Proof. Part (a). Suppose admits an -augmenting path , with exposed and edges alternating non-matching, matching, …, non-matching. The symmetric difference removes the matching edges of and inserts the non-matching edges; every vertex still has at most one incident -edge, since interior vertices of trade one matched edge for another and the two endpoints gain their first, so is a matching with , and was not maximum. Conversely suppose is not maximum and let be larger. Consider : every vertex meets at most one edge of each matching, so in every vertex has degree at most two, and is a disjoint union of paths and even cycles whose edges alternate between and . Cycles use equally many edges of each; since , some component is a path with more -edges than -edges, hence a path beginning and ending with -edges. Its endpoints are exposed by , so it is an -augmenting path in .

Part (b). Necessity is immediate: if saturates , then for any the partners are distinct vertices inside , so . For sufficiency assume the neighbourhood condition holds and let be a maximum matching; suppose for contradiction some is exposed. Grow the set of vertices reachable from by -alternating paths. Let and . Every vertex of is matched: an exposed vertex of would complete an -augmenting path from , impossible at a maximum matching by part (a). Each matched vertex of has its -partner back in , and conversely each non- vertex of entered along a matching edge from ; so restricts to a bijection , giving . Every neighbour of a vertex of lies in — an edge out of extends an alternating path — so and , contradicting Hall's condition. Hence no vertex of is exposed and saturates .

Bridge. This theorem builds toward the whole min-max theory of combinatorial optimization and appears again in every later flow, transversal, and assignment argument, because the augmenting path is the universal mechanism that certifies optimality by its own absence. The foundational reason Berge's lemma and Hall's theorem belong together is that the alternating-tree search used to prove Hall is exactly the augmenting-path search of Berge run from one exposed vertex: when it fails to reach a new exposed vertex it instead exhibits the starved set , so the obstruction to a larger matching is the obstruction Hall names. This is exactly the duality made explicit in König's theorem, where the set with becomes the deficient half of a minimum vertex cover, and the alternating reachable set is the bridge between the two. Putting these together, a matching is maximum precisely when no augmenting path survives, which generalises from bipartite SDR problems to network flows, where an augmenting path in the residual graph plays the identical role. The marriage condition is dual to a covering condition, and that duality is what the next section turns into an exact equality.

Exercises Intermediate+

Advanced results Master

Theorem (König's theorem and the König-Egerváry duality). In a bipartite graph , , and dually the maximum independent set has size (the Gallai identity, since the complement of a vertex cover is an independent set). (Kőnig [König 1931]; Diestel [Diestel 2017 §2.1].) The matching polytope of a bipartite graph is exactly the set of non-negative edge weightings with at each vertex: its incidence matrix is totally unimodular because the rows split into the two colour classes and every column has one in each class, so every square submatrix has determinant in . Hence the linear-programming relaxation has integral vertices, and the LP-duality between maximum fractional matching and minimum fractional cover specialises to König's integral equality — the polyhedral proof that runs parallel to the augmenting-path proof.

Theorem (defect version of Hall). In a bipartite graph with parts , the maximum number of vertices of that can be saturated by a matching is $$ |A| - \max_{S \subseteq A}\big(|S| - |N(S)|\big). $$ (Ore's defect formula; Diestel [Diestel 2017 §2.1].) The quantity is the deficiency; Hall's theorem is the case . The formula follows by padding with universal dummy vertices to restore Hall, matching, then deleting the dummies.

Theorem (Birkhoff-von Neumann). The doubly stochastic matrices form a convex polytope whose vertices are exactly the permutation matrices; equivalently, every doubly stochastic matrix is a convex combination of permutation matrices. (Birkhoff [Birkhoff 1946].) Given a doubly stochastic , form the bipartite graph on rows and columns with an edge whenever . For any set of rows, the column-sum over is at least the total mass of those rows, so and Hall yields a perfect matching, hence a permutation with for all . Subtracting for keeps the matrix non-negative and doubly substochastic with the same row/column ratio, strictly reduces the support, and after rescaling repeats; induction on the support size writes with , .

Theorem (the Hungarian-method viewpoint and weighted matching). The maximum-weight perfect matching in a complete bipartite graph with weights is computed by the Hungarian algorithm, which maintains a feasible dual labelling and grows the equality subgraph where until admits a perfect matching, certified optimal by complementary slackness. (Schrijver [Schrijver 2003 Ch. 17-18].) The unweighted König theorem is the all-weights-equal case, the dual labelling collapses to the vertex cover, and the alternating-tree growth is precisely the augmenting-path search of Berge's lemma run inside .

Synthesis. These results are a single min-max principle seen at increasing depth, and putting these together the bipartite matching problem becomes the prototype of combinatorial duality, where a maximum packing equals a minimum cover and an obstruction set is also a certificate. The central insight is that Hall's neighbourhood deficiency, König's minimum cover, and the LP dual labelling of the Hungarian method are three readings of one inequality : the deficient set that blocks a saturating matching is exactly the deficient half of a minimum cover and exactly the tight dual constraint, so the augmenting-path search either enlarges the matching or hands back the obstruction. This is exactly the principle that total unimodularity of the bipartite incidence matrix makes the LP relaxation integral, so the fractional and integral optima coincide and König's equality is the strong-duality theorem read combinatorially. The marriage theorem is dual to a covering theorem, and the same duality generalises: it is the bipartite, cardinality-balanced shadow of the max-flow min-cut theorem, where augmenting paths in a residual network replace alternating paths, and it is the order-theoretic cousin of Dilworth's theorem, where a minimum chain cover of a poset equals a maximum antichain through König on the comparability bipartite graph. The Birkhoff-von Neumann theorem is the geometric face of the same fact, identifying the permutation matrices as the extreme points that Hall's perfect matchings supply, so the foundational reason doubly stochastic matrices average permutations is that their positive support always satisfies the marriage condition.

Full proof set Master

Proposition 1 (Berge's augmenting-path criterion). A matching in a graph is maximum if and only if has no -augmenting path.

Proof. If is an -augmenting path, then is a matching of size (Exercise 6), so is not maximum. Conversely, suppose is not maximum and fix a matching with . In the symmetric difference every vertex is incident to at most one edge of each matching, hence has degree at most two in ; therefore each connected component of is a single vertex, a path, or a cycle, and along any such path or cycle the edges alternate between and (two consecutive -edges would share a vertex). Each cycle has even length with equal numbers of - and -edges; each path has - and -edge counts differing by at most one. As , summing over components forces some path component with strictly more - than -edges, which therefore starts and ends with -edges. Its two endpoints are not met by within , and they are not met by outside either (an -edge at an endpoint would lie in ), so they are -exposed. This component is an -augmenting path.

Proposition 2 (Hall's marriage theorem). A bipartite graph with parts has a matching saturating if and only if for all .

Proof. (Necessity) If saturates , then for the -partners of the vertices of are distinct vertices lying in , so .

(Sufficiency) Assume the condition and let be a maximum matching. Suppose some is exposed. Let be all vertices reached from by -alternating paths (paths starting with a non- edge), and set , . No vertex of is exposed: an exposed would give an -augmenting path, contradicting maximality via Proposition 1. Thus each is matched, and its partner lies in (the alternating path to ends with a non- edge, so continuing along 's -edge returns to inside ). Conversely every vertex of was entered along an -edge from . Hence matches bijectively onto , giving . Finally : a neighbour of some is reached by appending the edge to an alternating path ending at , so . Therefore , contradicting the hypothesis. So has no exposed vertex and saturates .

Proposition 3 (König's theorem). For bipartite , .

Proof. The bound holds in every graph: a vertex cover contains an endpoint of each of the disjoint matching edges, and these endpoints are distinct, so . For , set , attained at some . By the defect formula (Proposition 4) the maximum matching saturates vertices of , so . Put . Every edge (, ) is covered: if then ; if then . Thus is a cover with . Hence , and equality follows.

Proposition 4 (defect form of Hall). In bipartite with parts , the maximum number of -vertices a matching can saturate equals .

Proof. Let . No matching saturates more than vertices of : if a witness set has with , at most vertices of are matched, so at least , and in particular at least are unsaturated for the maximizing giving ; precisely, the attaining leaves of its vertices exposed, so saturated -vertices number . For the achievability, adjoin new vertices to , each joined to every vertex of , forming . For any , , so Hall's condition holds in and has a matching saturating . Deleting the at most edges of meeting the dummy vertices leaves a matching in saturating at least vertices of . The two bounds coincide.

Proposition 5 (Birkhoff-von Neumann). Every doubly stochastic matrix is a convex combination of permutation matrices.

Proof. Induct on the number of strictly positive entries of . A doubly stochastic matrix has (each of the rows sums to ). Form the bipartite graph on rows and columns with edge iff . For a set of rows, the entries of in those rows total (each row sums to ) and are confined to columns in , where the total over all rows is (each column sums to ); hence . By Hall (Proposition 2) has a perfect matching, a permutation with for all . Let . If then is itself a permutation matrix. Otherwise is non-negative, has all row and column sums equal to , hence is doubly stochastic, and has strictly fewer positive entries than (the index achieving the minimum became ). By induction with , , so is the desired convex combination. The permutation matrices are extreme points because each has a that no nontrivial average of distinct doubly stochastic matrices can produce without one summand having a where has a .

Connections Master

  • Graphs, basic invariants, and the foundational lemmas 40.04.01. Matchings are subgraphs of maximum degree one, so the vertex, edge, degree, and bipartite vocabulary established there is exactly the language a matching is phrased in; the no-odd-cycle characterisation of bipartiteness from that unit is the structural hypothesis that makes König's equality hold and fail the moment an odd cycle appears. The handshake double-count reappears here as the edge-balance that forces equal parts in a regular bipartite graph, and the alternating-path search is the matching-tuned version of the walk-and-path distinction defined there.

  • Tutte's theorem and matchings in general graphs 40.04.03. This unit is the bipartite half of matching theory; the sequel removes the bipartite hypothesis and replaces Hall's neighbourhood condition with Tutte's -factor condition on odd components, with the Tutte-Berge defect formula generalising Ore's defect form proved here. The foundational reason the two theorems split is the odd cycle: the alternating-tree argument that proves Hall stalls at odd structures, and Tutte's barrier sets and the blossom contraction of Edmonds are exactly the machinery that repairs that stall, so this unit's Berge's lemma is the shared starting point both halves build on.

  • Network flows: max-flow min-cut and the integrality theorem 40.04.09. Bipartite maximum matching is the unit-capacity flow problem with a source feeding and a sink drained by , the augmenting paths of Berge's lemma are the residual augmenting paths of Ford-Fulkerson, and König's duality is the integral case of max-flow min-cut. The total unimodularity that makes the matching LP integral is the same property that makes the flow LP integral, so the min-max theorems of this unit are the cardinality-balanced specialisation of the flow duality developed there.

  • Dilworth's theorem and the structure of partial orders 40.02.01. Dilworth's theorem — a finite poset's minimum chain cover equals its maximum antichain — is König's theorem applied to the bipartite comparability graph built from the poset's strict order, where a chain cover corresponds to a matching and an antichain to an independent set. The marriage condition and the defect formula proved here are the engine of that deduction, placing matchings and order theory inside one min-max family, and the Mirsky dual (minimum antichain cover equals maximum chain) is the transpose of the same duality.

Historical & philosophical context Master

The neighbourhood condition predates its graph-theoretic form. Georg Frobenius, studying when a determinant of a structured matrix vanishes identically, proved in 1917 (Über zerlegbare Determinanten, Sitzungsberichte der Preußischen Akademie) [Frobenius 1917] a criterion equivalent to the existence of a nonzero term in a permanent, which is the existence of a system of distinct representatives — Hall's condition in determinant language. Dénes Kőnig, building the first systematic theory of graphs, proved in 1931 (Gráfok és mátrixok, Matematikai és Fizikai Lapok 38) [König 1931] that in a bipartite graph the maximum matching equals the minimum vertex cover, the min-max duality now bearing his name, with Jenő Egerváry supplying the weighted generalisation the same year.

Philip Hall stated and proved the marriage theorem in 1935 (On representatives of subsets, Journal of the London Mathematical Society 10) [Hall 1935], framed as the question of choosing distinct representatives from a family of subsets; the "marriage" interpretation, pairing each member of one set with an acceptable partner, became the standard pedagogical image. The transversal theory that grew from Hall's paper — through the work of Rado, Mirsky, and Perfect — recast SDRs as independent sets in a transversal matroid, embedding matching into matroid theory.

The doubly stochastic connection was crystallised by Garrett Birkhoff in 1946 (Tres observaciones sobre el álgebra lineal, Universidad Nacional de Tucumán Revista A 5) [Birkhoff 1946], who identified the permutation matrices as the vertices of the polytope of doubly stochastic matrices; John von Neumann gave an independent proof in 1953 in the context of the assignment problem and game theory, and the algorithmic side matured into Harold Kuhn's 1955 Hungarian method, named for its debt to Kőnig and Egerváry. Jack Edmonds's 1965 polynomial blossom algorithm for general matchings later closed the gap left by the bipartite case treated here.

Bibliography Master

@book{Diestel2017,
  author    = {Diestel, Reinhard},
  title     = {Graph Theory},
  edition   = {5th},
  series    = {Graduate Texts in Mathematics},
  volume    = {173},
  publisher = {Springer},
  year      = {2017}
}

@book{BondyMurty2008,
  author    = {Bondy, J. A. and Murty, U. S. R.},
  title     = {Graph Theory},
  series    = {Graduate Texts in Mathematics},
  volume    = {244},
  publisher = {Springer},
  year      = {2008}
}

@book{LovaszPlummer1986,
  author    = {Lov\'asz, L\'aszl\'o and Plummer, Michael D.},
  title     = {Matching Theory},
  series    = {North-Holland Mathematics Studies},
  volume    = {121},
  publisher = {North-Holland},
  year      = {1986}
}

@book{Schrijver2003,
  author    = {Schrijver, Alexander},
  title     = {Combinatorial Optimization: Polyhedra and Efficiency},
  series    = {Algorithms and Combinatorics},
  volume    = {24},
  publisher = {Springer},
  year      = {2003}
}

@article{Hall1935,
  author  = {Hall, Philip},
  title   = {On representatives of subsets},
  journal = {Journal of the London Mathematical Society},
  volume  = {10},
  year    = {1935},
  pages   = {26--30}
}

@article{Konig1931,
  author  = {K\H{o}nig, D\'enes},
  title   = {Gr\'afok \'es m\'atrixok},
  journal = {Matematikai \'es Fizikai Lapok},
  volume  = {38},
  year    = {1931},
  pages   = {116--119}
}

@article{Frobenius1917,
  author  = {Frobenius, Georg},
  title   = {\"Uber zerlegbare Determinanten},
  journal = {Sitzungsberichte der Preu{\ss}ischen Akademie der Wissenschaften},
  year    = {1917},
  pages   = {274--277}
}

@article{Birkhoff1946,
  author  = {Birkhoff, Garrett},
  title   = {Tres observaciones sobre el \'algebra lineal},
  journal = {Universidad Nacional de Tucum\'an Revista A},
  volume  = {5},
  year    = {1946},
  pages   = {147--150}
}

@article{Kuhn1955,
  author  = {Kuhn, Harold W.},
  title   = {The Hungarian method for the assignment problem},
  journal = {Naval Research Logistics Quarterly},
  volume  = {2},
  year    = {1955},
  pages   = {83--97}
}

@article{Edmonds1965,
  author  = {Edmonds, Jack},
  title   = {Paths, trees, and flowers},
  journal = {Canadian Journal of Mathematics},
  volume  = {17},
  year    = {1965},
  pages   = {449--467}
}