Let us now return to the marriage problem discussed in Section 6.4; we again consider a set of men, and a set of women, but this time, instead of simply specifying whether a man–woman pair finds a marriage “acceptable,” we consider how desirable each party finds each potential partner: for any pair , let denote how valuable finds , and let denote how valuable finds . We are interested in the question of whether we can find a perfect matching between men and women where everyone is “happy” with the assignment—that is, can we find a set of “stable marriages.”
14.1 Two-sided Matching Problems
To formalize this, let us first define such a matching problem and the notion of an outcome of a two-sided matching problem.
Definition 14.1. We refer to the tuple where are finite sets such that , and for , as a two-sided matching problem. An outcome of is a perfect matching in the complete bipartite graph over .
Note that a two-sided matching problem can be thought of as a variant of a matching market, but this time not only the nodes on “the left” (i.e., the buyers) have a valuation for the matching, but also the nodes on “the right” (i.e., the items in the matching market) have their own valuations—this is why these types of problems are called two-sided matching problems.
We now turn to defining a notion of stability of an outcome of a matching problem; the notion is similar to the notion of a market equilibrium, and the notion of stability for exchange networks, but this time without any prices. Roughly speaking, an outcome (i.e., a matching ) is stable if there does not exists a pair that prefer each other to their current partners—such a pair is usually called a blocking pair. See Figure 14.1 for examples of stable and unstable matchings.
We turn to the formal definition.
Definition 14.2. An outcome of a two-sided matching problem is stable if there does not exists such that and .
Figure 14.1: An example of a stable (left) and an unstable (right) matching between four men and four women, whose preferences are indicated in the illustration. Notice, in the unstable matching, Charlie and Gloria constitute a “blocking pair”—they both prefer each other to their current partners; this instability is highlighted in red.
14.2 The Stable Marriage Theorem
The following theorem—referred as the stable marriage theorem—shows that every two-sided matching problem has a stable outcome. Furthermore, this stable matching can be efficiently found.
Theorem 14.1. A stable outcome exists for every two-sided matching problem . Additionally, there exists an efficient procedure that finds this outcome in polynomial time in .
See Figure 14.2 for an illustration of the execution of the DA algorithm. Note that if the algorithm ends, every man is matched to some (unique) woman, and thus also all the women get a match, since there are as many women as men. Thus, the final matching is always a perfect matching.
Figure 14.2: The process of running the Deferred Acceptance Algorithm on the example from Figure 14.1. New proposals are indicated in green, existing engagements in black, and broken engagements in red.
Let us start by making a simple but useful observation:
Lemma 14.1. If a woman is unattainable to a man at some point in the execution of the algorithm, she will always remain so.
This lemma follows from the fact that a woman will only break an earlier engagement by “upgrading” to some man that she prefers over her current match.
We start by showing that the DA algorithm runs in polynomial time.
Claim 14.1. The DA algorithm ends within iterations.
Proof. First note that by Lemma 14.1, a man can never be engaged to the same woman twice—the only reason an engagement is broken off is if “upgrades” and thus she becomes unattainable to (and by Lemma 14.1 remains so for the rest of the execution). As a consequence, each man can get engaged at most times; since there are men, and one engagement must occur in every iteration, we conclude that the number of iterations is at most .
■
Since each iteration can be implemented in polynomial time in , it follows that the DA algorithm always terminates within a polynomial (in ) number of steps. We next show that the matching output by the DA algorithm always is a stable matching.
Claim 14.2. The matching output by the DA algorithm is stable.
Proof. Assume, for contradiction, that is not stable; that is, there exists a blocking pair for such and . That means that is attainable to , yet is matched with some woman that he likes less than . By Lemma 14.1, since is attainable to at the end of the execution, she must have been so throughout the execution. By construction of the algorithm, must thus have been engaged to at some earlier point since he would never have proposed to before trying to propose to first (and would have accepted since she is attainable to him). But this engagement could never have gotten broken, since the only way it can break is if no longer is attainable to , which is a contradiction, and thus must be stable.
■
This concludes the proof of Theorem 14.1.
■
The above-described DA algorithm is also called the “man-proposing” DA algorithm; we may also consider an alternative variant of it, called the “woman-proposing” DA algorithm, which is identically defined except that instead of having the men propose engagements (and the women accepting or rejecting them), we instead have the women propose (and men accept or reject). Subsequently, whenever we refer to the “DA algorithm,” we refer to the man-proposing DA algorithm.
14.3 Optimality of Stable Outcomes
We turn to analyzing the stable outcome computed by the DA algorithm. To simplify our treatment (and in accordance with much of the literature on matching), we restrict ourselves to the case when men and women have strict preferences over partners. Note that in this case, the DA algorithm only needs to take as input a profile of preferences over partners. More precisely, given a set of men and set of women , a partner preference profile (over ) as a profile of preferences such that is a preference ordering over if and a preference ordering over if . Let denote the DA mechanism taking a partner preference profile as input.
Note that in the case of strict preferences, to determine whether a matching between and is stable, it suffices to know the preferences of all players —we can thus refer to being a stable matching between with respect to the partner preference profile .
We start by showing a surprising phenomenon: for the case of strict preferences, there always exists a stable outcome that is “optimal” for the men in the sense that every man gets matched to his best “achievable” partner , where a partner is achievable for if there exists some stable matching where gets matched to .
Definition 14.3. Given a partner preference profile over , we say that is achievable for (with respect to ) if there exists some stable matching with respect to such that .
Definition 14.4. Given a partner preference profile over , we say that a stable matching is man-optimal with respect to if every man gets matched (with respect to ) with his most preferred (with respect to ) achievable woman (with respect to ).
Note that man-optimal outcomes are always unique since when players have strict preferences, for every man there exists only one “most preferred” achievable woman, and this man must be matched to their most preferred achievable choice; that is, we have the following useful fact.
Fact 14.1. Given a partner preference profile over , there exists at most one man-optimal stable matching with respect to .
We now turn to showing that the outcome produced by the (man-proposing) DA algorithm is (the unique) man-optimal matching.
Theorem 14.2. For every partner preference profile , outputs a man-optimal stable matching (with respect to ).
Proof. Assume not; let be the first man in the execution of the DA who is “rejected” by an achievable woman (i.e., some achievable woman is no longer available when it is ’s turn to get engaged). Since rejected , she must already be engaged to some man that she prefers to ; additionally, since was the first rejected man, must either be ’s optimal achievable choice, or preferred to it—in other words, from the point of view of , dominates every achievable choice that is distinct from .
Now, consider the stable matching where is matched with (such a matching must exist, since is achievable for ). Here, clearly prefers to switch to , and also prefers to switch to since dominated every achievable choice that is distinct from ; this contradicts stability.
■
An interesting corollary of this result is that the order in which the men get to make engagement proposals have no relevance to the outcome—we always get the unique man-optimal outcome.
Obviously, by the same token, the woman-proposing DA would instead give a “woman-optimal” outcome; see Figure 14.3 for an illustration. There is, however, an inherent asymmetry (or “unfairness”) in the outcomes generated by the algorithm. Man-optimal solutions, although stable, are not that great for the women, and vice versa.
Definition 14.5. Given partner preference profile over , we say that a stable matching is woman-pessimal with respect to if every woman gets matched (with respect to ) with her least preferred achievable man .
Theorem 14.3. Given partner preference profile over , a stable matching is man-optimal with respect to if and only if it is woman-pessimal with respect to .
Proof. We separately show each direction.
“Only-if” direction Assume for contradiction that is man-optimal, but not woman-pessimal; that is, there exists some woman that is matched with some man , but there exists some achievable man that likes less than . Consider the stable matching in which is matched with the (less desirable) (such a matching must exists since is achievable for ). Let denote the woman that (i.e., ’s original partner) is matched with in . Since was man-optimal, must strictly prefer to (by the assumption of strict preferences); and strictly prefers to , thus cannot be stable, which is a contradiction.
“If” direction The backward direction follows using a similar argument, except we now show that the original matching cannot be stable. Assume for contradiction that is woman-pessimal, but not man-optimal; that is, there exists some man that is matched with some woman , but there exists some achievable woman that likes more than . Let denote the man that is matched with in . Since is woman-pessimal, strictly prefers to (by the assumption of strict preferences); however, strictly prefers to , and so cannot be stable, which is a contradiction.
■
Thus, we see an interesting phenomenon: the order in which either the men or the women make proposals makes no difference in the final outcome, but whether the men or the women are proposers makes a big difference—the proposers get their optimal outcome, and the accepters get their pessimal outcome—it pays to be “pushy”!
Figure 14.3: The man-optimal (left) and woman-optimal (right) stable matchings for the example from Figure 14.1.
14.4 Strategy-proofness of Two-sided Matching Rules
We turn to considering whether the DA algorithm is strategy-proof. Following our treatment of voting and one-sided matchings, we can define a two-sided matching context analogously to matching context except that now (a) both the left nodes and the right nodes are associated with a valuation function, and (b) the players’ types are preferences over partners: We say that is a two-sided matching market context if
If it always holds that (i.e., we have strict inequality) when prefers their partner in , we refer to the context as a two-sided matching context with strict preferences. Furthermore, if for each player , is the full set of preferences (i.e., all orderings are possible), we refer to the context as a complete two-sided matching context.
We refer to a payment-free mechanism for a two-sided matching-market context as a two-sided matching rule ; as usual, we say that is strategy-proof if is DST. In the context of two-sided matching, we will also consider two weaker notions of strategy-proofness where DST only holds for either the men or the women:
Definition 14.6. We say that a two-sided matching rule is strategy-proof for the men for the two-sided matching market context if for every , is a dominant strategy for every in . If instead the above holds for every , we say that is strategy-proof for the women.
Clearly, a matching rule is strategy-proof if and only if is strategy-proof for both the men and the women. As we shall now see, the (man-proposing) DA algorithm is strategy-proof for the men in every complete two-sided matching context with strict preferences (and, symmetrically, the woman-proposing DA algorithm is strategy-proof for the women).
Theorem 14.4. is strategy-proof for the men for every complete two-sided matching context with strict preferences.
The theorem follows directly from Theorem 14.2 and the next proposition that shows that any voting rule that always (no matter what the preferences are) outputs man-optimal outcomes is strategy-proof for the men.
Proposition 14.1. Consider some complete two-sided matching context with strict preferences and a two-sided matching rule . Assume that for every , is a man-optimal stable matching with respect to . Then is strategy-proof for the men for .
Proof [Advanced]. We refer to a matching rule that always outputs man-optimal stable matchings as being simply man-optimal. We start by showing that man-optimal two-sided matching rules satisfy a notion of monotonicity: the voting rule continues to output exactly the same matching if we modify some men’s preferences to rank the woman they previously got matched with the highest.
Lemma 14.2. Let be a man-optimal two-sided matching rule. Let be a preference profile, let , and let be a preference profile where some of the men rank the highest (but have otherwise arbitrary preferences), and the remaining players have exactly the same preferences as in . Then, .
Proof. Consider preference profiles as in the statement of the lemma, let and . We first show that all the men are at least as well off in as in with respect to the original preferences :
We now conversely show that all the men are also least as well off in as in (with respect to ) and from this can conclude that .
We conclude that , which proves the lemma.
■
Armed with the above lemma, we turn to prove the proposition. Consider a man-optimal two-sided matching rule , and assume for contradiction that is not strategy-proof for the men. That is, there exists some preference profile , some man and some preference ordering such that strictly prefers his match in to his match in . We consider a set of “hybrid preferences”:
This concludes the proof of the proposition.
■
14.5 Strategy-proofness vs. Stability
So, if we use the man-proposing DA algorithm, none of the men will ever want to deviate, and if we use the woman-proposing DA algorithm, none of the women will want to deviate. We would obviously like to have a mechanism that is strategy-proof for both the men and the women. Unfortunately, as the next theorem shows, no mechanism that outputs stable outcomes can be strategy-proof (for both men and women):
Consider a complete two-sided matching context with strict preferences. We say that is stable for if is stable with respect to for every .
Theorem 14.5. Consider a complete two-sided matching context with strict preferences such that . There does not exists a two-sided matching rule that is both stable and strategy-proof for .
Proof. Consider some complete context with strict preferences and assume for contradiction that there exists some two-sided matching that is both stable and strategy-proof for .
We start by considering the case that ; that is, consider three men and three women (we may without loss of generality assume that those are their “names”), and consider the partner preference profile specified as follows:
That is, ’s preferences are aligned—according to them the matches , are optimal; likewise, ’s preferences are aligned but orthogonally to the men’s preferences—according to them the matches , are optimal. The third man and woman () are just “dummy” players that all the others place last. Thus, there are exactly two stable matchings with respect to :
Assume the picks the first of these matchings (it must pick one of them since is stable). If so, the men are happy with the outcome, but both the women are not. In particular, if instead had reported , then the only stable outcome is , , . This follows by simply inspecting the six possible matchings:
Thus, we conclude that is the only stable matching under these new preferences. It follows that must output it (under ’s deviation), and thus strictly gains by misreporting her preferences.
An analogous argument can be applied if the mechanism instead outputs the second matching. Finally, we remark that if , then for every , we can simply have man rank woman first, and woman rank man first. It follows that in any stable matching, for , man must be matched to woman , and we can simply disregard these extra players and repeat the argument above.
■
We end this section by noting that Theorem 14.5 has intriguing social consequences: as we cannot hope to get a mechanism that is strategy-proof for “both sides,” when running a two-sided matching mechanism, we need to decide toward what side we want robustness to manipulation. Indeed, the DA algorithm is commonly used in practice: perhaps the most famous application is for matching residents to hospitals; in this application, the residents are acting as proposers and the hospitals as accepters (which means that the mechanism is strategy-proof for the residents, but also means that the outcome is “resident-optimal”).
Notes
The two-sided matching problem and the Deferred Acceptance algorithm were introduced by Gale and Shapley [GS62]; Gale and Shapley also proved the stable marriage theorem. Dubins and Freedman [DF81] and Roth [Rot82] showed the the DA algorithm is strategy-proof of the men; the proof we present here, however, is new (although it takes some inspiration from the proof in [GS85]). Roth [Rot82] showed the impossibility of mechanisms that are both strategy-proof and stable. See [RS92] for a more extensive survey of two-sided matchings. Alvin E. Roth and Lloyd S. Shapley received the Nobel Prize in Economic Sciences (for the “theory of stable allocations”) in 2012.