Let and be sets of people. A “matching” is a collection of pairs with and such that everyone in belongs to exactly one pair. For example, if and are sets of men and women then a matching could define a collection of monogamous, heterosexual marriages.
Suppose the people in each set have (complete, strict) preferences over potential matches in the other set. A matching is “stable” if there are no unmatched pairs who prefer each other to their match. Gale and Shapley (1962) show that a stable matching always exists and describe an algorithm for finding it: Let each person without a match “propose” to their most preferred person in to whom they haven’t already proposed. If is unmatched then they tentatively accept the proposal; if is matched to but prefers then they tentatively accept the proposal and reject ; otherwise, rejects the proposal. Repeat this process until everyone is matched.
Optimality and strategy-proofness
The Gale-Shapley (GS) algorithm always delivers a stable matching that is best for everyone in among all stable matchings. To see why, suppose is matched to but prefers . Then must have received a proposal from some whom they prefer to . Consequently, cannot form a “blocking pair” with (and thereby break the stable matching) because would rather be matched to . Thus is the best match can get if the matching is stable.
On the other hand, the GS algorithm always delivers a stable matching that is worst for everyone in among all stable matchings. To see why, suppose is matched to in some matching obtained using the GS algorithm. Suppose further that prefers to some and assume towards a contradiction that there is a stable matching in which is matched to . Then is matched to some in . Now was obtained using the GS algorithm, so it gives their top preference among all stable matchings. Consequently, must prefer to . But then and form a blocking pair in , contradicting its stability. Thus cannot exist; that is, is the worst match can get among all stable matchings.
The GS algorithm is strategy-proof for everyone in : no-one in can do better by misreporting their preferences (Roth, 1982), nor can any subset of coordinate to do (strictly) better (Dubins and Freedman, 1981). However, people in may be able to do better. For example, suppose the preferences among people in and are given by where means that prefers to . Applying the GS algorithm to these preferences delivers the stable matching . But if misreported their preferences as then the algorithm would deliver , which prefers.
Convergence
Since everyone in proposes to everyone in at most once, the GS algorithm never requires more than proposals. However, the algorithm typically requires fewer proposals. For example, suppose the utility derives from being matched to is where and are iid uniformly distributed on the unit interval , and where indexes the correlation of match utilities. Similarly, suppose the utility derives from being matched to is where and are also iid uniform on . The utilities and determine peoples’ preferences over matches, and increasing makes those preferences more homogeneous. The chart below shows how the number of proposals required by the GS algorithm covaries with when .
On average, more proposals are required when preferences are more homogeneous. Intuitively, increasing makes it more likely that an early tentative acceptance will become a rejection, forcing the rejected person to make another proposal. If then the GS algorithm always requires proposals. To see why, notice that if then everyone in has the same preferences over everyone in and vice versa. Consequently, the person in most preferred by the people in always gets their first choice, the person in second-most preferred by the people in always gets their second choice, and so on. But since everyone in has the same preferences, each has to make as many proposals as is their position on the (common) preference ordering among the people in .
Limitations
One limitation of the GS algorithm is that it assumes everyone has strict, complete preferences over potential matches. This assumption may not hold in practice: could be indifferent between and , or may not even know who is in let alone the utilities derived from being matched to them. Irving (1994) generalizes the GS algorithm to handle situations with indifferences, while Manlove et al. (2002) describe the computational complexity generated by allowing for incomplete preferences.
Another limitation of the GS algorithm is that it always delivers a stable matching that is best for people in and worst for people in . This “extremal” property of the algorithm’s output motivates alternative algorithms (e.g., those by Roth and Vande Vate (1990) and Romero-Medina (2005), and more recently Dworczak (2021) and Kuvalekar and Romero-Medina (2021)) that deliver ex ante fairer matchings by randomizing whose preferences (i.e., people in or people in ) are used to form matches.
A third limitation is that the GS algorithm assumes match utilities do not depend on the sequence of proposals. In particular, the algorithm assumes that derives the same utility from being matched to regardless of how much wants to be matched to . This assumption seems unrealistic: if I proposed to someone but later learned I was the last person they wanted to marry then that lesson would surely affect my comfort with the proposal. One way to resolve this issue could be to run the algorithm many times, allowing people to revise their preferences at each run based on the matching obtained in the previous run. However, this approach could be expensive—computationally, cognitively, and emotionally—and might not converge if peoples’ preference revisions aren’t well-behaved.