Definition · The stable matching problemn proposers and n receivers, each with a complete ranking of the other side. A matching pairs each proposer with exactly one receiver. A blocking pair is a proposer p and a receiver r, not matched to each other, such that p prefers r to their partner and r prefers p to theirs. A matching with no blocking pair is stable.
Definition · Deferred acceptanceWhile some proposer is unengaged and has not yet proposed to everyone, they propose to the highest-ranked receiver they have not yet tried. A receiver who is unengaged accepts; a receiver who is engaged accepts if they prefer the new proposer, releasing the old one, and otherwise rejects. The algorithm stops when everyone is engaged.
The greedy character is in the word deferred. Each proposer works down their own list and never goes back up, which is the commitment; each receiver holds the best offer so far and may release it, which is the part that is not committed. A version in which receivers accepted irrevocably would be fully greedy and would not produce a stable matching.
Theorem · The algorithm terminates, and its output is stableDeferred acceptance makes at most n² proposals and ends with every proposer matched, and the matching it produces has no blocking pair.
Each proposer proposes to each receiver at most once, so there are at most n² proposals and the process terminates. A receiver, once engaged, stays engaged and only ever trades up, so at the end a proposer who had been rejected by everyone would imply a receiver engaged to nobody while having received a proposal, which is impossible. Hence everyone is matched.
Suppose p and r form a blocking pair: p prefers r to their partner. Then p proposed to r at some point, before proposing to their eventual partner. Either r rejected p outright, which means r was already holding someone better, or r accepted and later released p for someone better. Either way r's partner only improved afterwards, so r ends with someone they prefer to p, and r does not prefer p to their partner. So no blocking pair exists.
□
On the opening instance the algorithm makes 4 proposals, which is well under the bound of 16, and every one of them is accepted immediately. The resulting matching pairs proposer i with receiver i for all four, and the blocking-pair list, built from all 12 ordered pairs, is empty.
Example · Six stable matchings, and the one that was chosenAll 24 matchings are tested against the blocking-pair definition and 6 of them are stable: 1234, 1243, 2134, 2143, 2341 and 4321, writing each as the partner of proposer 1, 2, 3, 4 in order. Their mean ranks for the proposers are 1, 3/2, 3/2, 2, 5/2 and 7/2. The algorithm returned 1234, the best of the six for every proposer — and 4321, the worst for them, is what the receivers get when they propose instead.
Proposer-optimality, and where the panel gets it from
The theorem is that every proposer receives the best partner they have in any stable matching, simultaneously. That is stronger than it sounds: it is not that the outcome is good on average for proposers, but that no proposer can point to another stable matching in which they personally do better. The panel verifies it by computing, for each proposer, their best achievable partner over the enumerated stable matchings, and comparing.
That is the right way round. Reading proposer-optimality off the algorithm would mean trusting the algorithm to describe its own output; reading it off the list of all stable matchings means the claim is checked against objects the algorithm never saw. On the opening instance the proposers' mean rank is 1 and the receivers' is 4, the extreme values in both directions.
Three more instances, and a caption that is wrong
When everyone on both sides agrees on the same ranking there is exactly one stable matching, both sides reach it, and proposing buys nothing: the panel reports 6 proposals, 1 stable matching, and mean rank 2 for both sides. When the two sides want opposite things there are 3 stable matchings and the algorithm reaches the one its proposers prefer, mean ranks 1 and 3.
The fourth instance is labelled as having a long chain of rejections, and its caption says one proposal displaces a partner who displaces another. The trace on the page is: 1 proposes to 2, accepted; 2 proposes to 2, rejected; 3 proposes to 1, accepted; 4 proposes to 4, accepted; 2 proposes to 3, accepted. Five proposals, one rejection, and nobody displaced at all — proposer 2 was turned away by a receiver who was already engaged to someone they preferred. The count of 5 exceeds the 4 people for that reason and not for the one the caption gives.
Measured on this page: 4 proposals, 0 blocking pairs from 12 ordered pairs, 6 stable matchings of 24, proposers' mean rank 1 and receivers' 4, and the sides swapped giving 7/2 and 1. Proved on this page: the algorithm always terminates within n² proposals with a stable matching, and that matching is best for every proposer among all stable ones. What no page here proves, because it is false, is that the outcome is fair.