מתמטיקה בדידה Discrete Math Lecture 12 1 TexPoint fonts used in EMF.

Slides:



Advertisements
Similar presentations
Piyush Kumar (Lecture 3: Stable Marriage) Welcome to COT5405.
Advertisements

Marriage, Honesty, & Stability N ICOLE I MMORLICA, N ORTHWESTERN U NIVERSITY.
Great Theoretical Ideas in Computer Science
Tutorial 5 of CSCI2110 Eulerian Path & Hamiltonian Cycle Tutor: Zhou Hong ( 周宏 )
Great Theoretical Ideas in Computer Science for Some.
Representing Relations Using Matrices
Social Networks 101 P ROF. J ASON H ARTLINE AND P ROF. N ICOLE I MMORLICA.
1 Discrete Structures & Algorithms Graphs and Trees: IV EECE 320.
Great Theoretical Ideas in Computer Science.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
1 Bipartite Matching Polytope, Stable Matching Polytope x1 x2 x3 Lecture 10: Feb 15.
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
Angie Rangel Jose De Jesus Melendez Carlos Aguilar Drake Jain DISCRETE MATHEMATICS MATH 170 PROJECT PART II.
Marriage Problem Your the sovereign in a small kingdom. One of your jobs is to marry off the people in kingdom. There are three rules that apply.
The Mathematics Of Dating and Marriage: Who wins the battle of the sexes? The Mathematics Of Dating and Marriage: Who wins the battle of the sexes? (adapted.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes? Adapted from a presentation by Stephen Rudich.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes? Presentation by Shuchi Chawla with some modifications.
Stable Matchings a.k.a. the Stable Marriage Problem
Great Theoretical Ideas in Computer Science.
Lecture 23: Stable Marriage ( Based on Lectures of Steven Rudich of CMU and Amit Sahai of Princeton) Shang-Hua Teng.
Stable Matching Lecture 7: Oct 3. Matching A B C DE Boys Girls Today’s goal: to “match” the boys and the girls in a “good” way.
Stable Marriages (Lecture modified from Carnegie Mellon University course Great Theoretical Ideas in Computer Science)
The Stable Marriage Problem
Great Theoretical Ideas in Computer Science for Some.
Matching Lecture 19: Nov 23.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes? CS Lecture 2.
18.1 CompSci 102 Today’s topics 1950s TV Dating1950s TV Dating.
Algorithms used by CDNs Stable Marriage Algorithm Consistent Hashing.
18.1 CompSci 102 Today’s topics Impaired wanderingImpaired wandering Instant InsanityInstant Insanity 1950s TV Dating1950s TV Dating Final Exam reviewFinal.
Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Dating Advice from Mathematics
Proof And Strategies Chapter 2. Lecturer: Amani Mahajoub Omer Department of Computer Science and Software Engineering Discrete Structures Definition Discrete.
Logic Hubert Chan [O1 Abstract Concepts] [O2 Proof Techniques]
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Matching Boys Girls A B C D E
Cybernetica AS & Tartu University
Bipartite Matching Lecture 8: Oct 7.
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes?
Advanced Algorithms Analysis and Design
Chapter 3 The Real Numbers.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Great Theoretical Ideas in Computer Science
CSE 421: Introduction to Algorithms
Explorations in Artificial Intelligence
The Mathematics Of 1950’s Dating: Who wins The Battle of The Sexes?
Discrete Mathematics for Computer Science
The Foundations: Logic and Proofs
The Mathematics Of 1950’s Dating: Who wins the battle of the sexes?
Axiomatic semantics Points to discuss: The assignment statement
CS201: Data Structures and Discrete Mathematics I
S. Raskhodnikova; based on slides by K. Wayne
CHAPTER 1: LOGICS AND PROOF
Induction and recursion
Computational Processes II
CSE 421: Introduction to Algorithms
CSE 321 Discrete Structures
Discrete Math for CS CMPSC 360 LECTURE 9 Last time: Strong induction
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Matching and Resource Allocation
Who does better, boys or girls?
Computational Processes II
Computational Processes
Advanced Analysis of Algorithms
Piyush Kumar (Lecture 3: Stable Marriage)
Foundations of Discrete Mathematics
Derived Variables A derived variable v is simply a function
Agenda Proofs (Konsep Pembuktian) Direct Proofs & Counterexamples
Presentation transcript:

מתמטיקה בדידה Discrete Math Lecture 12 1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAA 1

Bipartite Matching

The “likes” Relation G B n Girls m Boys gRb if g “likes” b. Q: Can every girl be matched with a boy that she likes? matching זיווג

Matching G B Matching: A way of assigning every girl a boy so that: Different girls are assigned to different boys. A girl is assigned to a boy she likes.

Is Matching Always Possible? G B Q: What if we remove this line? A: No match possible.

The Matching Condition G B |S| = 3 |N(S)| = 2 N(S) := {b | b is liked by an s 2 S} If |S| > |N(S)| then no matching exists. Contrapositively, if there is a matching then |S| ≤ |N(S)|. S N(S)

Every subset of girls likes at least as large a set of boys Hall’s Theorem For a matching to exist, the matching condition must hold: Every subset of girls likes at least as large a set of boys In other words, 8S µ G, |S| ≤ |N(S)| This is a necessary condition for a matching to exist. Turns out that it is also sufficient. Hall’s theorem: A matching exists if and only if the matching condition holds. Hall’s marriage theorem Hall משפט החתונה של

Hall’s Theorem: Proof Hall’s theorem: A matching exists if and only if the matching condition holds. Proof: We need to prove the following two lemmata. Lemma 1: If a matching exists then the matching condition holds. Lemma 2: If the matching condition holds then a matching exists.

Hall’s Theorem: Proof of Lemma 1 Lemma 1: If a matching exists then the matching condition holds. Proof: Suppose there exists a matching and let S µ G. Each girl in S likes the boy she is matched with. Every boy is matched with at most one girl. Therefore, |S| ≤ |N(S)|. QED S N(S)

Hall’s Theorem: Proof of Lemma 2 Lemma 2: If the matching condition holds then a matching exists. Proof: Suppose that the matching condition holds. That is, 8S µ G, |S| ≤ |N(S)| We use strong induction on n = |G| to show that a matching exists. Base case (|G|=1): The matching condition implies that the girl in G likes at least one boy, and so a matching exists.

Hall’s Theorem: Induction Step Induction step (|G| ≥ 2): Suppose that for all G’, for which |G’| < |G|, the induction hypothesis holds. That is, if the matching condition holds in G’ then a matching for G’ exists. We need to show that if the matching condition holds for G then a matching for G exists. There are two possible cases: 8S µ G, |S| < |N(S)| 9S µ G, |S| = |N(S)|

Hall’s Theorem: Case 1 N(S) S Case 1: 8S µ G, |S| < |N(S)|. B G Take g 2 G and pair it with some b 2 B she likes. Claim: Let G’ = G\{g} and B’ = B\{b}. Then, 8S’ µ G’, |S’| ≤ |N(S’)|. Proof: By contradiction. Suppose ∃S’ µ G’, |S’| > |N(S’)|. Then if we add back b to B we get that S’ satisfies |S’| ≥ |N(S’)| in G, in contradiction. QED So the matching condition still holds for G’. By induction hypothesis, we can match girls in G’ = G\{g} with boys in B’ = B\{b}. B G N(S) S

Hall’s Theorem: Case 2 S N(S) Case 2: 9S µ G, |S| = |N(S)| B G By induction, can match girls in S with boys in T = N(S). Remove the |S| girls from left and the matching |T| = |S| boys from right. Claim: Let G’ = G \ S and B’ = B \ N(S). Then, 8S’ µ G’, |S’| ≤ |N(S’)|. So the matching condition still holds for G’. By induction, can match girls in G’ = G \ S with boys in B’ = B \ N(S). B G S N(S)

Hall’s Theorem: Case 2 II Claim: Let G’ = G \ S and B’ = B \ N(S). Then, 8S’ µ G’, |S’| ≤ |N(S’)|. Proof: Let S’ µ G’, and let T’ = N(S’). We need to show that |S’| ≤ |T’| We know that G satisfies the matching condition. So |S [ S’| ≤ |T [ T’| S [ S’ S’ T [ T’ S T T’=N(S’) G’ B’

Hall’s Theorem: Case 2 III Claim: Let G’ = G \ S and B’ = B \ N(S). Then, 8S’ µ G’, |S’| ≤ |N(S’)|. Proof: Let S’ µ G’, and let T’ = N(S’). We need to show that |S’| ≤ |T’| We know that G satisfies the matching condition. So |S [ S’| ≤ |T [ T’| We know that we removed |S| girls from G, leaving |S’| |T| = |S| boys from B, leaving |T’| So it must be the case that |S’| ≤ |T’| QED

Verifying the Matching Condition Verifying the matching condition would require going over all 2n subsets of G. This is too much… A condition that implies the matching condition: Every girl g 2 G likes ≥ d boys, and every boy b 2 B likes ≤ d girls. Proof: For every set of girls S µ G, look at number of lines that come out of S (and enter N(S)). We have: d|S| ≤ #lines ≤ d|N(S)| so in particular |S| ≤ |N(S)|. QED

Stable Matching

Stable Marriage A Marriage Problem: 1 2 3 4 5 Boys: Girls: A B C D E

Stable Marriage Preferences Boys: Girls: 1: CBEAD A: 35214 2: ABECD B: 52143 3: DCBAE C: 43512 4: ACDBE D: 12345 5: ABDEC E: 23415

Stable Marriage Preferences 1: CBEAD 2: ABECD 3: DCBAE Try “greedy” strategy for boys 4: ACDBE 5: ABDEC

Stable Marriage Preferences Marry Boy 1 with Girl C (his 1st choice) 1: CBEAD 2: ABECD 3: DCBAE 1 C 4: ACDBE 5: ABDEC

Stable Marriage Preferences 2: ABED 3: DBAE 4: ADBE 5: ABDE

Stable Marriage Preferences Next: Marry Boy 2 with Girl A (best remaining choice) 2: ABED 3: DBAE 4: ADBE 5: ABDE

Stable Marriage Final “boy greedy” marriages 1 C 2 A 3 D 4 B 5 E

Stable Marriage Problem: Boy 4 likes Girl C better than his wife… 1 C and vice versa… Rogue couple

Stable Marriage Problem Definition: A matching is stable iff it has no rogue couples. Goal: Find a stable matching. That is: Marry everyone without any rogue couples! Theorem (Gale & Shapley, ’62): There is always a stable matching between boys and girls.

Not so Obvious Suppose we wanted to pair as “buddies” (regardless of gender). Rogue couple 1 2 3 1 2 3 1 2 3

Stable Marriage Problem Goal: Marry everyone without any rogue couples! Boy optimal: 5 A 2 B 4 C 3 D 1 E

Stable Marriage Problem Goal: Marry everyone without any rogue couples! All Girls get 1st choice: 3 A 5 B 4 C 1 D 2 E

Stable Marriage Problem More than a puzzle: College admissions (original Gale & Shapley paper, 1962). Matching Hospitals and new doctors. Matching dance partners. Akamai (assigning web traffic (boys) to servers (girls)).

Mating Ritual: Day by Day Morning: boy serenades favorite girl Afternoon: girl rejects all but favorite רן נינט י(ה)ודה

Mating Ritual: Day by Day Morning: boy serenades favorite girl Afternoon: girl rejects all but favorite Evening: rejected boy writes off girl רן Stop when no girl rejects. Each girls marries her favorite suitor (מחזר) – if any. נינט

Need to Prove There are 3 facts we need to prove about mating ritual: The ritual has a last day Everybody ends up married The resulting marriages are stable.

There is a Last Day Claim: There exists a final (wedding) day. Proof: Look at (total) length of the lists of all the boys. Initially list is at most n2 long (why?). Every day on which the ritual is not terminated, at least one boy will cross off a girl from his list. So after at most n2 days, there will be no girl in the list.

Girls Improve Lemma: A girl’s favorite tomorrow will be at least as desirable as today’s. This is because today’s favorite will stay until she rejects him for someone better. So favorite(g) is weakly increasing for each g favorite(g) day

Boys Get Worse Lemma: A boy’s 1st love tomorrow will be no more desirable than today’s This is because the boys work straight down the list. So serenading(b) is weakly decreasing for each b serenading(b) day

On Wedding Day On wedding day: Each girl has ≤ 1 suitors (by def. of wedding day). Each boy is married, or has no girls on his list. Claim: On wedding day everyone is married. Proof: By contradiction. If b is not married, his list is empty. Lemma: If g is not on b’s list, then she has a better current favorite. Proof: When g rejected b she had a better suitor (מחזר), and favorite(g) is weakly increasing. By lemma, all girls have favorites better than b. So all girls do have a favorite and they are all married. So all boys are married as well. QED

Marriages are Stable Boy will not be in rogue couple with: Case 1: a girl g on his final list, since he is already married to the best of them. Case 2: a girl g not on his final list, since by Lemma, g likes her spouse better.* *Lemma: If g is not on b’s list, then she has a better current favorite.

Who Does Better, Boys or Girls? Q: Girl’s suitors get better, and boy’s preferences get worse, so girls do better? A: No. Mating ritual is optimal for all boys at once. Pessimal for all girls. More questions: Other stable marriages possible (YES)? Can a boy do better by lying (NO)? Can a girl do better by lying (YES)? Can you find a stable marriage without revealing more than necessary on your list (YES)? Two-body problem a couple of doctors (golden rule of marriage: “you can only be happy as your spouse.”)

So What Did We Learn?

What Did We Learn in This Course? Basic logic: propositional logic, predicates, quantifiers. Set theory: operations on sets, identities Functions: function composition, mapping rule Relations: properties, equivalence and order relations Counting: combinations, permutations, inclusion-exclusion Hall’s theorem, stable marriage.

Learning Outcomes Following this course, you should be able to: Use logical notation to reason about fundamental mathematical concepts such as sets, relations, functions, and integers. Evaluate elementary mathematical arguments and identify fallacious reasoning (not just fallacious conclusions). Calculate numbers of possible outcomes of elementary combinatorial processes such as permutations and combinations. Problem solve and study in a small team with fellow students.