Strategic Considerations for the Gale-Shapley algorithm Part 1

Abstract: In post we look at the Gale-Shapley algorithm from a strategic prospective. We start by introducing the algorithm and give an proof for that individual men can not misrepresent there intent to end up with a more desirable outcome. Then, we look at two ways to “game” the algorithm, one in which a group of men work together, and another where women are able to mispresent their intent to end up with a better outcome.

Before beginning the discussion, two quick comments. First, although this falls out of the standard game centric posts I cover in this blog, there are strategic considerations that can be made during the process, which is what we will be covering. Second, this problem is often referred to as the stable marriage problem, and most references provided will refer to it as such. Finally, my original intent was to include this as one post, but while writing, I realized it would much longer than any other post (3000+ words). As such, I have decided to break it up into two posts, with the second one picking up were the first left off.

The Gale-Shapley algorithm is an algorithmic solution to the stable matching (marriage) problem. The problem is as follows. Given n students and n internships, where each group has ranked all members of the opposite group in order of preference. The goal, is to then find a matching, or bijection that maps students and internships, such that there does not exists any match (A,B) which both prefer each other to their current partner under the current matching. A natural question that one may ask is if such an ordering is guaranteed to exists? The answer is yes, as the Gale-Shapley algorithm will always find such an ordering. The algorithm proceeds through iterations in the following way:

  • During the first iteration, each unassigned student proposes to the internship that they prefer most, with each school replying with a tentative yes to the student that is most preferred by that institution. All other students are told “no” and are left unmatched.
  • We then loop the following process until all students have been matched. First, each unmatched student proposes to the most-preferred internship to which they have not yet proposed. Then if the position is not currently filled, or they prefer this candidate over the current provisional candidate, the internship will then reply with a tentative yes. It is important to note that this process may result in previously matched students becoming unmatched, at which point they reenter the unmated pool and propose next iteration.
Animated Example of the Gale-Shapley Algorithm taken from [1]

Using this process ensures that every student finds an internship, and that all matchings are stable. We can see that this is true through the following argument, for student A and internship B. If A prefers B to their current position, before they proposed to their current position. If B accepted the proposal but switched later on, then they must have received a proposal from a student they liked more. If B rejected A‘s proposal, then they already had a student they liked more than A. Thus, this algorithm will always produce a stable matching.

We will now look at this from the standpoint of a “game”, or look at possible strategic considerations. That is to say, is it possible for a participant to game the system and be untruthful (misrepresent their actual rankings) but achieve a better outcome?

The first case we will consider is that of the individual student, who does not list the universities in accordance with their true rank ordering. In other words, the student lies, in attempt to achieve a result that is better in terms of their “true” rank ordering. Can this student achieve a better result by engaging in fowl play? The answer is no, and for a full proof see [2]. We will however work through the proof with the critical lemma being handwaved.

We will call our student M, for Machiavelli. Without loss of generality, we will assume the M is the last student to propose, leaving only one internship not paired. The Theorem proved by Dubins and Freedman in [2] states that if M can not get a better internship -measured by M‘s true rank ordering – than the one M would get by fair play. The main way they prove this is through what they call The Scenario Lemma. To state this lemma we first need two definitions. First, we define a Scenario to be a sequence of proposals for M that function as a segment of a rank ordering. Next we define a scenario 1 to be smaller than scenario 2, if all internships mentioned in 1 occur in 2. As an example we could say C, D, E is smaller than E, D, F, G, C. From this, we can now state the Lemma:

Suppose scenario 1 is smaller than scenario 2, then M makes every proposal indicated in the larger scenario, and every rejection and proposal that would occur in scenario 1 occurs in 2. For a full proof of this lemma see [2].

With this lemma, we can now prove that Machiavelli can do no better by falsifying his list. To do so, we use a proof by contradiction, where some scenario say A, B, C, ..., U gets M a internship that ranks ahead i, where i is the internship M would get under fair play. We assume i \geq 2, as otherwise M can not do any better. In order for M to get an internship at U, the algorithm must terminate with another student being matched with the last internship. We now show that for all cases of the true ranking, M getting matched to U results in a contradiction.

Case 1: Lets assume that M prefers all other internship in the scenario over U. In other words U is the true worst internship out of the internships in this scenario. To show the contradiction, lets look at what would happen if M were to play fair. Because M ends up with internship i, the algorithm must terminated when M is rejected by their (i - 1)th choice, and then applies and is accepted to their ith choice. However we can use the Scenario Lemma here, as we assume that the foul play scenario is smaller than the fair play one, as U ranks ahead of i. As mentioned earlier, this scenario includes an application to internship W which would cause the algorithm to terminate, but we know that the fair play sequence terminates with M ending up at i, thus we have reached a contradiction.

Case 2: Lets assume that M prefers U to at least one of the other universities in our scenario. To created a contradiction here, we create a smaller foul play scenario by deleting all universities that are truly preferred over U. This is equivalent to case 1, for which we have already shown that M, must be rejected by U (otherwise we have a contradiction). As per the Scenario Lemma, this rejection must also occur in the original sequence, which is a contradiction, as we assumed that the scenario must get M, paired with internship U.

Final Thoughts and Conclusion: With both cases considered, we have now shown that it is impossible for any individual student to perform better by engaging in foul play. However, this does not extend to coalitions of students. (Un)fortunately, the same result given in paper [2] extends this theorem to show that several students can not collude, with each using a false ordering, and all get a better internship. The critical word being all, as in the next post, we will go over a situation in which students can collude such that some subset of colluding students will get a better internship. We will also look at how the internships can lie to achieve a better result, and discuss truthful and non-truthful mechanisms.

[1] – By No machine-readable author provided. User A1 assumed (based on copyright claims). – No machine-readable source provided. Own work assumed (based on copyright claims)., CC BY-SA 3.0,
[2] – Dubins, L., & Freedman, D. (1981). Machiavelli and the Gale-Shapley Algorithm. The American Mathematical Monthly, 88(7), 485-494. doi:10.2307/2321753

Published by Freddy_Reiber

Undergrad student at UCI. Running a blog on how to use Computer Science to win in modern board games.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: