Maths Olympiad Prep

Library / Brazilian Mathematical Olympiad /104 of 120

Brazilian Mathematical Olympiad

Combinatorics Difficulty 6.5 National Olympiad Prove it Brazil

There are nn boys B1,B2,…,BnB_1, B_2, \dots, B_n and nn girls G1,G2,…,GnG_1, G_2, \dots, G_n. Each boy ranks the girls in order of preference, and each girl ranks the boys in order of preference. Show that we can arrange the boys and girls into nn pairs so that we cannot find a boy and a girl who prefer each other to their partners. For example if (B1,G3)(B_1, G_3) and (B4,G7)(B_4, G_7) are two of the pairs, then it must not be the case that B4B_4 prefers G3G_3 to G7G_7 and G3G_3 prefers B4B_4 to B1B_1.

Solution

In round kk each unpaired boy BB in turn proposes to the girl GG he ranks highest amongst those he has not yet proposed to. If GG is not yet paired, or if she prefers BB to the boy she is currently paired with, then we pair BB and GG (and remove any existing pair for GG). We claim that this algorithm terminates and gives a stable pairing.

First we must establish that it terminates. Each boy can propose to at most nn girls and in each round at least one boy must make a proposal, so it must terminate in n2n^2 rounds or less.

Second we must establish that it results in every boy and girl being paired off. Once a girl is paired, she always remains paired, although not necessarily to the same boy. Suppose girl GG ends up unpaired. Since there are equal numbers of boys and girls, a boy BB must also end up unpaired. By the end BB must have proposed to every girl, including GG. Hence GG must have been paired at the end of that round. Contradiction.

Finally, we must establish that the pairing is stable. Suppose not, so that we end up with pairs (B,G)(B, G) and (B′,G′)(B', G'), where BB prefers G′G' to GG and G′G' prefers BB to B′B'. Since BB prefers G′G' to GG he must have proposed to G′G' before GG. At the end of that round either BB and G′G' were paired, or G′G' was paired to B′′B'' whom she preferred to BB. In the first case, we have a contradiction because a girl can only change her pairing in favor of someone she prefers. So if she ends up paired to B′B' having earlier been paired to BB, then she must prefer B′B' to BB. Contradiction. In the second case, G′G' must prefer B′′B'' to BB and B′B' to B′′B''. Again a contradiction. So the pairing is stable.

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.