CS 70
Discrete Mathematics and Probability Theory
Fall 2010
Tse/Wagner
Note 4
The Stable Marriage Problem: An Application of Proof
Techniques to Analysis of Algorithms
Consider a dating agency that must match up
n
men and
n
women. Each man has an ordered
preference
list
of the
n
women, and each woman has a similar list of the
n
men (ties are not allowed). Is there a good
algorithm that the agency can use to determine a good pairing?
Example
Consider for example
n
=
3 men (represented by numbers 1, 2, and 3) and 3 women (
A
,
B
, and
C
), and the
following preference lists:
Men
Women
1
A
B
C
2
B
A
C
3
A
B
C
Women
Men
A
2
1
3
B
1
2
3
C
1
2
3
For instance, the preference lists above mean that woman A is man 1’s top choice; woman B is his second
choice; and so on.
What properties should a good pairing have? One possible criterion for a “good” pairing is one in which the
number of first ranked choices is maximized. Another possibility is to minimize the number of last ranked
choices. Or perhaps minimizing the sum of the ranks of the choices, which may be thought of as maximizing
the average happiness. In this lecture we will focus on a very basic criterion:
stability
. A pairing is unstable
if there is a man and a woman who prefer each other to their current partners. We will call such a pair a
rogue couple
. So a pairing of
n
men and
n
women is stable if it has no rogue couples.
An unstable pairing from the above example is:
{
(1,C), (2,B), (3,A)
}
. The reason is that 1 and B form a
rogue couple, since 1 would rather be with B than C (his current partner), and since B would rather be with
1 than 2 (her current partner). This is trouble: Before long, 1 and B are going to spending many late nights
doing CS70 problem sets together. Obviously, the existence of rogue couples is not a good thing if you are
a matchmaker, since they will lead to instability or customer dissatisfaction. That is why we focus on stable
pairings.
An example of a stable pairing is:
{
(2,A), (1,B), (3,C)
}
. Note that (1,A) is not a rogue couple. It is true that
man 1 would rather be with woman A than his current partner. Unfortunately for him, she would rather be
with her current partner than with him. Note also that both 3 and C are paired with their least favorite choice
in this matching. Nonetheless, it is a stable pairing, since there are no rogue couples.
The problem facing us is to find a stable pairing, given the preference lists for all
n
men and all
n
women.
CS 70, Fall 2010, Note 4
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Does a Stable Pairing Always Exist?
Before we discuss how to find a stable pairing, let us ask a more basic question: do stable pairings always
exist? Surely the answer is yes, since we could start with any pairing and make it more and more stable as
follows: if there is a rogue couple, modify the current pairing so that they are together. Repeat. Surely this
procedure must result in a stable pairing! Unfortunately this reasoning is not sound. To demonstrate this,
let us consider a slightly different scenario, the roommates problem. Here we have 2
n
people who must be
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '11
 Rau
 Algorithms, Englishlanguage films, Blackandwhite films, Stable marriage problem

Click to edit the document details