Lecture 02 : The Stable Matching Algorithm — Transcript
Full transcript
- 0:01[Music]
- 0:22[Music]
- 0:27welcome to lecture two of artificial
- 0:29intelligence for economics in lecture
- 0:31one we looked at two examples of network
- 0:34data of interpreting network data in
- 0:37today's lecture we'll look at something
- 0:39completely different we look at what's
- 0:41called the stable matching
- 0:44algorithm now what is
- 0:47that it's basically a matching problem
- 0:51uh as the name suggests but what exactly
- 0:54do we mean by
- 0:55that uh let's say we have two
- 0:57heterogeneous populations X and Y
- 1:01okay uh it could be a set of boys and a
- 1:04set of
- 1:05girls every element in X or every member
- 1:08of set
- 1:09X has a preference ordering over the
- 1:12elements of set
- 1:15y similarly every element of set y has a
- 1:20preference ordering over the elements of
- 1:22set
- 1:23X if that's the case who should be
- 1:26matched with whom that's the kind of
- 1:29question
- 1:30which we want to answer in this
- 1:32lecture where do we see situations like
- 1:36this well in the in the marriage or
- 1:38dating Market let's say there are a
- 1:40bunch of men and a bunch of women Every
- 1:43Man Has a preference ordering over the
- 1:46set of women and every woman has a
- 1:48preference ordering over the set of
- 1:50men labor market let's say there are ex
- 1:53CEOs and X firms or Y
- 1:55firms and the CEOs have a preference
- 1:59ordering over the set of firms and every
- 2:01firm has a preference ordering over the
- 2:03set of individuals or
- 2:06CEOs credits and Banks right so there
- 2:10are firms and Banks the firms have a a
- 2:13preference ordering over which bank they
- 2:15want to borrow
- 2:17from and uh the banks also have a
- 2:19preference ordering over the set of
- 2:22firms similarly have we have buyers and
- 2:25sellers so on and so forth so these are
- 2:28typical examples of where we uh
- 2:32encounter a matching the need for
- 2:38matching there could be many to One
- 2:40problems too for example campus
- 2:43placements there are students and then
- 2:45there are firms who visit the
- 2:48campus the the students uh definitely
- 2:51have a preference ordering over the set
- 2:54of firms who have come to
- 2:57recruit the firms also have a preference
- 3:00ordering over the set of students based
- 3:02on their GPA or or other
- 3:06credentials
- 3:08great so let's think of a particular
- 3:13context let's think of marriage or the
- 3:15dating Market which is the first example
- 3:17I
- 3:19cited so we are going to make a
- 3:20simplifying assumption we'll make an
- 3:22assumption of monogamy that is one to
- 3:24one matching one boy for one girl one
- 3:27girl for one
- 3:28boy we also assume equal sized
- 3:31population that is the set of boys and
- 3:34the set of girls are they have same
- 3:38cardinality if that's the situation the
- 3:41question is how to optimally
- 3:44match right but when am I when I'm using
- 3:47the word optimal what exactly do I mean
- 3:50by that what do I mean by Optimal let's
- 3:54look at an
- 3:58example consider
- 4:01a set of two boys and two girls the two
- 4:04boys are named Rahul and Aman and the
- 4:07two girls are let's say Angeli and
- 4:10Tina now every boy remember has a
- 4:13preference ordering over the set of
- 4:15girls so Rahul prefers uh Tina the most
- 4:20and then anjeli Amon also prefers Tina
- 4:24the most and then
- 4:25aneli Tina prefers Rahul and then Amon
- 4:28aneli prefers Rahul and then then number
- 4:30okay and this can be uh represented by
- 4:33this uh easy graph or network whatever
- 4:37you might call
- 4:39it now the question of this if this is
- 4:42the preference orders of the different
- 4:45individuals how to optimally
- 4:48match what are the possible
- 4:51matchings well these are my two possible
- 4:54matchings Rahul matched with aneli Aman
- 4:57matched with Tina or Rahul matched with
- 5:00Tina and Ammon matched with aneli
- 5:03correct
- 5:04F let's look at matching one the first
- 5:09matching Rahul analii and am amantina
- 5:13let's look at this
- 5:15matching is there any problem with this
- 5:17matching let's understand let's look at
- 5:20the preference
- 5:23relationships preference
- 5:25orderings Rahul and aneli and Amon and
- 5:28Tina these are my two pairs
- 5:31who does Rahul prefer the most Rahul
- 5:34prefers Tina the
- 5:35most who does Tina prefer the most Tina
- 5:38prefers Rahul the most so in matching
- 5:42one Rahul is paired with anjeli but
- 5:46Rahul likes Tina more Tina is paired
- 5:49with Ammon and Tina likes Rahul more
- 5:51than
- 5:52Ammon so in this case both Rahul and
- 5:58Tina uh uh prefer each other over their
- 6:03current mates or current
- 6:06Partners which means they will break out
- 6:09of their current
- 6:10Partnerships right Rahul is paired with
- 6:13anjeli Rahul has all the incentive to
- 6:16break out from that Partnership if Tina
- 6:19says
- 6:20yes because why because Rahul prefers
- 6:22Tina more than
- 6:23anjeli Tina on the other hand uh has an
- 6:27incentive to break out of her her
- 6:30partnership with Amon because Tina
- 6:32prefers Rahul more than Amon so Tina
- 6:36would be more than eager to break out if
- 6:37Rahul says yes now both Rahul and Tina
- 6:40are eager to break out so both of them
- 6:42will say yes and they will break out of
- 6:44their current Partnerships so matching
- 6:47one is
- 6:50unstable
- 6:53okay we
- 6:56say that uh given a matching M two
- 7:01individuals X and Y form a rogue couple
- 7:05if they prefer each other over their
- 7:08mates so in this case Rahul and Tina in
- 7:12matching one Rahul and Tina former Rog
- 7:18couple okay matching two by the way has
- 7:21no Rog
- 7:25couples great now that we know what a
- 7:28Rog couple means here's the definition
- 7:31so what is a stable
- 7:34matching a stable a perfect matching is
- 7:36where all individuals are paired
- 7:39okay a stable matching is a perfect
- 7:42matching such that there are no row
- 7:46couples so matching one is not a stable
- 7:50matching matching two on the other hand
- 7:53is a stable
- 7:56matching great let's move on
- 8:01let's look at one more
- 8:03example let's take a let's take a movie
- 8:06example let's say we have these four
- 8:08movie stars Akshay Salman amitab and
- 8:12John and uh let's say there are two
- 8:16movies which are being
- 8:17made and in each movie there will be two
- 8:20stars okay now who will be paired with
- 8:25whom now what is their preference
- 8:27relation preference ordering
- 8:30well akshai prefers amitab the most then
- 8:32Salman then John as you can see from
- 8:35here right Akshay prefers amitab the
- 8:38most this is one I'm sorry
- 8:44uh so AKA prefers amitab the most then
- 8:48Salman and then
- 8:50John right similarly uh Salman prefers
- 8:57Akay then amitab then John am prefers
- 9:00Salman then AK then John well John's
- 9:03preferences are inconsequential because
- 9:04he's everybody's last
- 9:07choice I mean no no offenses against uh
- 9:10John but then
- 9:11yeah uh this is just
- 9:15hypothetical okay let's move
- 9:19on the theorem is there does not exist a
- 9:22stable
- 9:23match if this is the preference
- 9:26ordering and if we want to pair if we
- 9:28want to form two
- 9:30pairs there we can't we can't do it we
- 9:33can't form a stable
- 9:35match okay let's
- 9:40see assume that there exists a stable
- 9:42match n so we are going to prove by
- 9:44contradiction
- 9:46here assume that there exists a stable
- 9:50match so without loss of generality JN
- 9:54will be matched with somebody in that
- 9:56stable matching let us say John has been
- 9:59matched with AA without loss of
- 10:02generality wlog is without loss of
- 10:06generality now if Jon is matched with
- 10:11AKA then by default Salman is matched
- 10:14with
- 10:16amitab
- 10:21great but then look at the look at the
- 10:23preference relations preference
- 10:26orderings so Salman is matched with
- 10:28amitab AKA is is matched with John let's
- 10:30go back to our preference
- 10:37ordering uh Salman is matched with
- 10:39amitab and aksha is matched with John
- 10:42but aksha prefers amitab
- 10:46more uh Salman
- 10:50prefers uh sorry AA is matched with John
- 10:54so AKA prefers John the least so AKA
- 10:57will definitely want to move out
- 11:00right Salman on the other hand prefers
- 11:03aka the
- 11:05most okay so aksha and Salman will form
- 11:10a rogue
- 11:13couple
- 11:15right AKA has been matched with JN let's
- 11:18say without loss of generality then aka
- 11:20prefers John the least so aksha wants to
- 11:22break
- 11:23out and Salman prefers a aka the most so
- 11:28Salman and Akay will form a Rog couple
- 11:31Salman also would want to break out
- 11:34because he prefers Akshay more than
- 11:37amitab
- 11:38great so this is not there can't be a
- 11:41stable match so m is not
- 11:44stable and we can prove
- 11:46this uh for if I if I match John with
- 11:51this is an exercise for all of
- 11:52you if you match John with Salman and
- 11:56then see if you can find a rogue couple
- 11:58you will be able to find one
- 12:00no matter whom you match John with there
- 12:03will be a Rog
- 12:05couple great so the this was my
- 12:07preference
- 12:09orderings I can't find a stable
- 12:12match well this just gives you an
- 12:15inkling towards a more General result
- 12:17which I'm going to talk about
- 12:20now this is the more important theorem
- 12:22this theorem states
- 12:25that a stable match will necessarily
- 12:28exist
- 12:29if the preference list can be
- 12:31represented by a bipartite graph what is
- 12:33a bipartite
- 12:35graph that is if we have two mutually
- 12:38exclusive sets
- 12:41and any member of set one has a
- 12:45preference ordering over the individuals
- 12:47of set two and any individual of set two
- 12:51has a preference ordering over the
- 12:52individuals of set one in such a
- 12:55setting a stable match necessarily
- 12:58exists
- 13:01okay if this case which we just talked
- 13:05about it was not a bipartite scenario
- 13:09right we can't find two distinct two
- 13:12mutually exclusive sets such that every
- 13:15individual in that set has a preference
- 13:17ordering over others it's not the case
- 13:19here this is not a bipartite
- 13:23graph okay so now this is theorem two
- 13:29now we have seen that if it if it is not
- 13:32bipartite we have found an example where
- 13:35a stable match does not exist but does
- 13:39it tell us for sure that if the if the
- 13:43if there is a bipartite graph
- 13:44representing the preference
- 13:47orderings uh then we will necessarily
- 13:51have a stable
- 13:52match the answer is yes and we are going
- 13:54to prove
- 13:55that okay so in the next part of the
- 13:59lecture what we'll do is the following
- 14:01we'll try to prove that in such a
- 14:04scenario a stable match necessarily
- 14:07exists and we'll also propose an
- 14:10algorithm to find that stable
- 14:14match okay but we'll go the other way
- 14:17around we'll first propose the
- 14:20algorithm and then claim that the
- 14:23algorithm works we'll first propose an
- 14:26algorithm to find the stable match and
- 14:29then prove the existence of the stable
- 14:31match by proving that the algorithm
- 14:33necessarily Works under all
- 14:36scenarios okay great so first uh I'll
- 14:41try to propose an algorithm for
- 14:43finding a stable
- 14:46matching but while proposing the
- 14:48algorithm I will take help of an
- 14:51example so let's say we have five girls
- 14:54and five boys the girls are named a b c
- 14:57d e and the boys are named 1 2 3 4
- 15:035 these are my preference
- 15:07orderings every boy has a preference
- 15:09ordering over the girls so this is boy
- 15:12one's preference ordering let's say so
- 15:14boy one prefers girl C the most and then
- 15:19B and then e and then a and then D okay
- 15:22similarly every boy has a preference
- 15:23ordering similarly girl every girl also
- 15:26has a preference ordering over the set
- 15:29of
- 15:30boys girl a for example
- 15:33prefers boy three the most and boy four
- 15:37the
- 15:38least
- 15:41okay fine let's move on so if this is
- 15:44the
- 15:45situation can we find a stable matching
- 15:49that is a matching where there will be
- 15:52no Rog
- 15:55couples so
- 15:57first which is what usually uh we try to
- 16:01do we'll try to propose a greedy
- 16:03algorithm a greedy algorithm is the most
- 16:05intuitively obvious algorithm what is a
- 16:08greedy algorithm a greedy algorithm is
- 16:10where we optimize stepwise and we don't
- 16:13go
- 16:14back okay so we'll propose a greedy
- 16:17algorithm and we'll we'll try to guess
- 16:19or we'll try to see if this greedy
- 16:21algorithm works or
- 16:23not great let's begin start with boy one
- 16:27so this is the algorithm we start with
- 16:29boy one and allocate the best possible
- 16:33girl that is what is best possible girl
- 16:36the highest in his preference
- 16:38list allocate him that
- 16:42girl
- 16:45next look at boy two and match him with
- 16:48the best available girl again what what
- 16:51do what do I mean by best according to
- 16:54his preference list remember these are
- 16:56the preference lists so what's going to
- 16:59happen so who does boy one
- 17:04prefer by the way and we are going to
- 17:06carry on like this so let's see what the
- 17:09what outcome the greedy algorithm gives
- 17:12us so who does boy one prefer the most C
- 17:16so I'm going to match one with C that's
- 17:19what I do one likes C the most one with
- 17:22C then I'll come to boy two who does boy
- 17:27two like the most a a is a available
- 17:30that is is a already matched no a is
- 17:33available so I'm going to
- 17:35match two with
- 17:39a okay so C and A have been taken now I
- 17:43come to three boy 3 who does boy 3 whom
- 17:47does boy 3 like the most D girl
- 17:51D is girl D
- 17:53available yes only C and A have been
- 17:56already matched girl D is available so
- 17:59I'm going to match three with
- 18:01d great so c a d have been
- 18:04taken now I come to boy
- 18:07four who does boy four like the most a
- 18:10but a has already been matched with two
- 18:13so I can't do
- 18:14that next C well C has already been
- 18:17matched with one so I can't do that then
- 18:20comes D well D has already been matched
- 18:22with three I can't do that either so
- 18:25four will be matched with the best
- 18:27available girl which is
- 18:31B right and coming to five five will be
- 18:35matched with the only girl who is left
- 18:37which is
- 18:40e okay so that's it that's the match
- 18:44which we
- 18:45get uh by using the greedy
- 18:48algorithm but now the question is is
- 18:51this matching which we have got is this
- 18:53a stable
- 18:55match how do we inspect that we try to
- 18:58look at these couples and see if any of
- 19:01these
- 19:03couples form or is a rogue
- 19:08couple okay so let's let's
- 19:12inspect and it turns
- 19:15out that boy four and girl C form a
- 19:19rogue
- 19:20couple let's understand
- 19:23why let's look at boy four and girl C
- 19:27who four matched with four is matched
- 19:30with b and one is matched with
- 19:34C
- 19:36fine
- 19:38now who does four prefer the
- 19:42most four prefers four is now hitched
- 19:46with
- 19:48B right but four prefers C more than
- 19:53b four prefers C more than
- 19:56b c right now
- 20:00is matched with
- 20:04one but C prefers four the most see look
- 20:09at C's preference ordering C prefers
- 20:12four the
- 20:14most and four prefers C more than his
- 20:18own partner which is
- 20:21B so c will definitely want to break out
- 20:24because C prefers four the most and four
- 20:26will also break out because four refers
- 20:28C more than the current partner which
- 20:31four has which is
- 20:32B so which means boy four and girl c
- 20:36will form a Rog couple so we see that
- 20:39the greedy algorithm gives us a a
- 20:43matching which is not
- 20:46stable okay so the greedy algorithm has
- 20:49failed so what do we do we naturally
- 20:53we'll have to propose an alternative
- 20:56algorithm so here we are proposing
- 20:59are stable matching
- 21:02algorithm please understand this
- 21:04algorithm carefully you can pause the
- 21:06video and read the slide or listen to
- 21:08this uh once more so this is how the
- 21:12algorithm
- 21:14goes every day a boy will go and stand
- 21:17in front of the balcony of the
- 21:19girl he likes the
- 21:22most okay every day the boy every boy
- 21:27any boy will go and stand in front of
- 21:30the balcony of the girl he likes the
- 21:32most
- 21:34okay the girl the each day a
- 21:38girl can
- 21:40either uh tell a boy standing in front
- 21:43of the balcony there could be more than
- 21:44one boy standing in front of a girl's
- 21:46balcony the girl can tell the boy come
- 21:50back next day or
- 21:53reject okay once the girl says reject to
- 21:57a boy the boy crosses that girl off from
- 22:01his list of
- 22:02possibilities and never goes back to
- 22:05that balcony ever okay this
- 22:09continues until every girl has exactly
- 22:13one boy standing in front of the
- 22:17balcony
- 22:19okay when there is exactly one boy
- 22:22standing in front of each girl's balcony
- 22:25then the algorithm terminates
- 22:28this is the stable matching
- 22:31algorithm and let's see if this
- 22:34works and initially all girls are in the
- 22:37boy's
- 22:38list he'll keep the boy will keep
- 22:41crossing a girl out once the girl says
- 22:44reject okay fine let's look at the
- 22:47iterations now let's apply this
- 22:49algorithm on the example which we have
- 22:53got so this is our preference lists
- 22:56remember so let's see this is day one
- 22:59what's going to
- 23:02happen uh every boy will go and stand in
- 23:05front
- 23:06of uh the balcony of the girl he likes
- 23:09the most
- 23:11okay
- 23:13so one whom does one like the most boy
- 23:17one boy one likes C so boy one goes and
- 23:21stands in front of C's
- 23:23balcony whom does two like the most a so
- 23:27two goes and stands in front of A's
- 23:29balcony whom does three like the most
- 23:32D where does d go d goes and stand in
- 23:36front
- 23:37of uh sorry three goes and stand in
- 23:39stands in front of D's
- 23:41balcony what about boy four boy four
- 23:45likes a the most and boy five also likes
- 23:48a the most so both of them again go and
- 23:50stand in front of A's
- 23:53balcony okay so this is how it's
- 23:56operating great
- 23:59now two knows that both two four and
- 24:03five prefer her the
- 24:06most right girl girl a knows that boys 2
- 24:114 and five prefer her the
- 24:15most okay now look at girl A's
- 24:18preference preference ordering whom does
- 24:21girl a prefer the most amongst these
- 24:23boys 2 4 and five well clearly girl a
- 24:28prefers five the
- 24:30most
- 24:32okay so girl a knows that five is
- 24:35available to her then why should she
- 24:38bother about boys 2 and four so what
- 24:42will she say she will say reject to 2
- 24:44and
- 24:45four okay she will say reject to 2 and
- 24:50four so two and four will now what will
- 24:54what will two and four do boys two and
- 24:56four what will they do
- 24:58well two and four will cross a out of
- 25:01their list so like this a is out of
- 25:04their list now Mark Mark a
- 25:07red
- 25:08h fine now day two comes in day two
- 25:12again every boy goes and stands in front
- 25:15of the balcony of the girl he likes the
- 25:18most in his
- 25:20list in his
- 25:22list so again one goes in front of C's
- 25:26balcony right two will now go in front
- 25:29of B's balcony three will now go in
- 25:32front of C's balcony four will now go in
- 25:35front of C's balcony right five in front
- 25:38of a so this is what happens
- 25:43now
- 25:46right now C is having two two boys
- 25:51standing in front of her balcony one and
- 25:54four now whom does she like more well C
- 25:58like four the most so she she and she
- 26:02knows that
- 26:05uh right now she is the most preferred
- 26:09girl in boy Four's list so why should C
- 26:13bother about boy one why should girl C
- 26:17bother about boy one so girl C rejects
- 26:21boy
- 26:22one
- 26:24okay so boy one now crosses out see from
- 26:29his list so these are my cross outs
- 26:33now
- 26:35right
- 26:37fine now again now day three comes
- 26:40everybody goes every boy goes and stands
- 26:43in front of the balcony of the girl he
- 26:45likes the most in his
- 26:48list okay remember if you look at boy
- 26:52one's list C is not there anymore so
- 26:55where will he go he will go and stand in
- 26:57front of B B's balcony two again will go
- 27:00and stand in front of B's balcony
- 27:04right so 1 and two both go and stand in
- 27:07front of B's
- 27:08balcony right you can you can see that
- 27:11three will go in front of D's balcony
- 27:13four will go and stand in front of C's
- 27:15balcony because a is not there in Four's
- 27:18list
- 27:19anymore five again will go and stand in
- 27:21front of A's balcony so this is how the
- 27:24balconies look like
- 27:26now now B has two men standing in front
- 27:29of her balcony one and
- 27:32two look at B's ordering B's preference
- 27:35ordering between 1 and two who does B
- 27:39prefer well B clearly prefers two more
- 27:42than
- 27:43one right and B knows that right now she
- 27:48is she tops in the preference list of
- 27:53two if that's the case why should she
- 27:56bother about boy one so she rejects boy
- 28:01one so B will reject boy one and boy one
- 28:05in turn will cross out B from his
- 28:09list this is the updated list
- 28:12now great what happens next day where
- 28:14will boy one go in front of the most
- 28:17preferred girl of his list these have
- 28:19been crossed out so boy one goes in goes
- 28:23and stands in front of E's balcony two
- 28:25goes and stands in front of B's balcony
- 28:28three in front of D's balcony four in
- 28:30front of C's balcony five in front of
- 28:32A's
- 28:33balcony this is what we
- 28:36have okay now we have the terminating
- 28:39condition right we have one boy standing
- 28:43in front
- 28:44of uh or every balcony has exactly one
- 28:48boy standing in
- 28:50front and remember this was my condition
- 28:53for termination of the stable matching
- 28:55algorithm so this is where the algorithm
- 28:57terminates
- 29:00fine now is this a stable match is this
- 29:03match which we have got now is this
- 29:05stable remember we had got a similar
- 29:07match using the greedy algorithm which
- 29:08turned out to be unstable because we
- 29:10could find a rogue
- 29:12couple but this match which we have got
- 29:15let's see if this is
- 29:17stable and the answer
- 29:19is if you take a look at the preference
- 29:23of the boys and the preference of the
- 29:24girls and if you take a look at this
- 29:26matching it indeed turns out to be
- 29:29stable you will not be able to find any
- 29:32Rogue couple in this
- 29:35matching I will urge all of you to take
- 29:38a little pause and work it out to
- 29:40yourself try to find a rogue couple and
- 29:43you will see that you
- 29:44can't
- 29:48okay now the question is fine we have
- 29:50proposed an
- 29:52algorithm now uh let's look at some
- 29:54desirable properties of the stable
- 29:56matching algorithm and this in turn will
- 30:00U kind of make it clear that this
- 30:04algorithm Works generally under any
- 30:07situation for any preference orderings
- 30:10if the preference orderings can be uh if
- 30:13if it's a bipartite
- 30:16structure okay so the first first result
- 30:20the stable matching algorithm
- 30:21necessarily terminates it will terminate
- 30:23at some
- 30:24point what is the proof for that
- 30:28it's very
- 30:30simple in fact it terminates in less
- 30:33than equal to n² + 1 days that's the
- 30:35upper
- 30:36bound why what is the logic what is
- 30:40happening in this algorithm every day at
- 30:43least one boy is being crossed
- 30:47out or or in other words one boy crosses
- 30:50out a girl from his list when every day
- 30:54one girl is crossed
- 30:56out from some boys
- 30:59list so every day there is a cross out
- 31:03now there are n boys and N girls and so
- 31:07every boy has a list which which has a
- 31:09cardinality n of size n so how many
- 31:13total cross outs are possible at
- 31:16Max well at Max n Square cross outs are
- 31:20possible Right which means on the n² + 1
- 31:24at day the algorithm will necessarily
- 31:26terminate
- 31:29okay so this is the proof that the
- 31:31stable matching algorithm will
- 31:33necessarily terminate if we uh have a
- 31:36bunch of boys and girls and the
- 31:38preference orderings and if we apply the
- 31:40algorithm it will necessarily terminate
- 31:42at some point after a finite amount of
- 31:45time and the upper upper bound is n sare
- 31:48+
- 31:491 upper bound of
- 31:53time what is the next one everybody gets
- 31:56married or paired so this is the
- 31:58definition of a perfect matching
- 31:59remember in perfect matching everybody
- 32:01gets
- 32:03paired uh in our example or we have made
- 32:07a simplifying assumption at the start of
- 32:08the lecture that uh the set of the the
- 32:11the cardinality of the two sets which
- 32:13are being matched are
- 32:15equal so let's prove this let's say boy
- 32:19B has not been uh is not married at the
- 32:24end okay any boy I I'm naming him me
- 32:29which means B has been rejected by every
- 32:32girl
- 32:34right which means every girl is already
- 32:38married but if every girl is married
- 32:40every boy is
- 32:41married because the cardinality of the
- 32:44two sets are equal so if every girl is
- 32:47married every girl is married to one boy
- 32:49at least which means every boy is
- 32:51married which means B is also married so
- 32:54which which leads to a contradiction
- 32:56that b is not married okay so if the
- 32:58cardinality of the two sets are equal
- 33:00this is not
- 33:03possible and finally the last
- 33:06one which is that uh it this algorithm
- 33:10necessarily produces a stable match we
- 33:13have seen it does right we have seen it
- 33:16does in the example which we worked
- 33:20out but what is the intuitive uh
- 33:22explanation that it always does it's the
- 33:26following right it's it's a pretty
- 33:28intuitively easy proof to think about
- 33:31let us say it does not let us say we
- 33:33have applied stable matching and we
- 33:35actually end up getting a rogue couple
- 33:37let's say the Rog couple is called
- 33:38Johnny and
- 33:39Amber okay now if it is a rogue couple
- 33:42it means it is not a couple in the
- 33:44matching right now
- 33:46right okay now how come Johnny and Amber
- 33:50are not couple right now in the St in
- 33:53this in the match which we have got
- 33:55either case one is either Amber rejected
- 33:59Johnny right if Amber rejected Johnny it
- 34:03means Amber must have
- 34:06had a boy more preferred than Johnny
- 34:11standing in front of her balcony only
- 34:13then Amber would have rejected
- 34:17journy and the final Choice which Amber
- 34:20got was definitely
- 34:23somebody who was preferred to
- 34:26Journey which which means Johnny and
- 34:29Amber cannot be a rogue couple so it's a
- 34:33contradiction what is case two case 2 is
- 34:35Johnny never went and serated Amber that
- 34:38is Johnny never went and stood in front
- 34:39of Amber's balcony what does this
- 34:43mean now when is a boy going to a
- 34:46balcony of a
- 34:49girl when is a boy not going in front of
- 34:52balcony of a
- 34:53girl when he's not being rejected by a
- 34:56girl
- 34:58whom she whom he prefers more than the
- 35:01girl uh under whose balcony he has not
- 35:04been to right so which means if Johnny
- 35:07has not been under the balcony of Amber
- 35:10it simply means that Johnny has not been
- 35:12rejected by some girl whom he prefers
- 35:16more than
- 35:18Amber if he has not been rejected by a
- 35:20girl whom he prefers more than
- 35:23amember which means Johnny's current
- 35:25partner whom he has been matched with by
- 35:28the
- 35:30algorithm he prefers that person more
- 35:32than
- 35:33am which means Johnny does not prefer
- 35:36Amber over his current
- 35:38partner which means Johnny and Amber
- 35:40again does not form a rogue couple right
- 35:45so we see again we prove it by
- 35:47contradiction that uh formation of a
- 35:50rogue couple or occurrence of a rogue
- 35:52couple is impossible once we apply
- 35:55stable matching algorithm
- 35:59okay
- 36:00great so we have learned uh
- 36:04uh the stable matching algorithm in in
- 36:07this lecture so we have learned two
- 36:09different kinds of things we have had
- 36:10two different uh uh exposures in the
- 36:13first two lectures in the first lecture
- 36:16we talked about network data and we
- 36:18tried to interpret two different
- 36:20situations one in history one in
- 36:23finance in this lecture we have looked
- 36:26at something else we have looked at
- 36:27stable matching algorithm in the next
- 36:30two or three lectures I will deal with
- 36:33something completely
- 36:35different I will talk about modeling of
- 36:39uncertainty in artificial intelligence
- 36:41training an agent to behave optimally in
- 36:45uncertain situations is a key
- 36:48thing so is true in
- 36:51finance so in the next two lectures I
- 36:54will delve a little more in in finance
- 36:58and talk about the idea of hedging and
- 37:01risk
- 37:02management see you in the next lecture
About this transcript
This page contains the full transcript of Lecture 02 : The Stable Matching Algorithm by NPTEL IIT Kharagpur, generated from the public captions YouTube serves with the video. The transcript has 4,819 words across 772 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.