Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "מתמטיקה בדידה Discrete Math Lecture 12 1 TexPoint fonts used in EMF."— Presentation transcript:

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

2 Bipartite Matching

3 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 זיווג

4 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.

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

6 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)

7 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 משפט החתונה של

8 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.

9 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)

10 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.

11 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)|

12 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

13 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)

14 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’

15 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

16 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

17 Stable Matching

18 Stable Marriage A Marriage Problem: Boys: Girls: A B C D E

19 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

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

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

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

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

24 Stable Marriage Final “boy greedy” marriages 1 C A D 4 B E

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

26 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.

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

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

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

30 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)).

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

32 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. נינט

33 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.

34 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.

35 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

36 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

37 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

38 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.

39 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.”)

40 So What Did We Learn?

41 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.

42 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.


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

Similar presentations


Ads by Google