[User] Please transcribe this text

[Assistant] Uh, for Facebook, we were actually, we actually continued to be students, uh, at Harvard until, uh, the site had over 100,000 monthly active users. So we had cognitive dissonance for kind of an embarrassing long period of time that we could just, like, be students and have this little side project on the, on the side. Uhm, but eventually, uh, it pulled us out because we, we couldn't bear the idea of it not living up to its full potential.


[User] Please transcribe this text

[Assistant] And then similarly at Asana, Justin and I were both reluctant entrepreneurs, uhm, but we thought the, the problem of work tracking was really important, uh, and that the other people working on it were gonna develop incremental solutions, leave a lot of value on the table. Uhm, so we couldn't stop working on it. Eventually we decided to leave, uh, Facebook and focus on it full time.


[User] Please transcribe this text

[Assistant] So when I meet entrepreneurs that really seem set up for success, this is usually the reason I'm hearing from them. Uh, they're starting a company because it felt like really the only thing that they could do next.


[User] Please transcribe this text

[Assistant] So, that's it. Short and sweet. Left time for questions. And I know what my, uh, cutoff time is.


[User] Please transcribe this text

[Assistant] Few minutes, alright, cool. So feel free to just raise your hands and I'll call on you and repeat the question for the mic.


[User] Please transcribe this text

[Assistant] Uhm, yeaah, so two, two things, like one is just the sort of like, uhm, you know, feature not company distinction that like Mark Andreessen has talked about. So, uh.


[User] Please transcribe this text

[Assistant] I don't know how to like make that concrete, but it's just sort of like thinking about the idea. Is this like a separate product that it feels like somebody's going to sign up for, can have its own monetization model? Uh, are people really going to invest in like learning a new system or does it really feel like the add-on on top of some existing model?


[User] Please transcribe this text

[Assistant] Uhm, and very related to that I think are just gonna be the uhm, the competitive nature. So if you're, if you have to introduce like a whole new photo sharing app, right, and then you have to compete with the distribution and network effects of the existing ones, that's a huge barrier to entry and there's sort of similar metaphors in other, other products. Does that make sense?


[User] Please transcribe this text

[Assistant] Yeah, uh, so I sort of briefly outlined them when I was talking about the funnel. Oh, so, yeah, sorry. The, the question was about the difference in challenges between starting a company basically in 2004 for starting a company today, or the second time in 2009.


[User] Please transcribe this text

[Assistant] Uhm, so I sort of outlined them when I was talking about the funnel, uhm, but I definitely think, uh, it's just a lot more competitive in terms of the exit, the other businesses out there, so there's just like,


[User] Please transcribe this text

[Assistant] There's also a bunch of other ways, including uhm, just like real estate in the Bay Area is really expensive right now. Uhm, some other costs have come down like data center costs, uhm, but in general, uh, it just feels higher friction and harder to get going.


[User] Please transcribe this text

[Assistant] Yeah, it's just somewhere on that spectrum. Uhm, so the original, so sorry, the question is what's the difference between being a sort of late stage or a later employee at a established company versus being like an early employee? Is that the question?


[User] Please transcribe this text

[Assistant] Uhm, so I think of it as just a spectrum on the risk scale between like founder and like 1,000th employee. So if you're in the first 10, you have a little bit more information, you know who the founders are, you know who the leaders are, uh, you can meet some of the investors, hopefully they've already done a seed round or an A round.


[User] Please transcribe this text

[Assistant] Uhm, you know, the lower your salary is going to be, the lower the sort of, uh, probability of a positive outcome is going to be, but you also have, uhm, a possibility of a really big outcome because you're, you might have, you know, 50 basis points or 100 basis points if you're one of the first employees. Does that make sense?


[User] Please transcribe this text

[Assistant] Uhm, again, it's on the spectrum, right? So maybe the second employee, uh, so the question was, isn't the probability of success basically equal? Yeah, for the second employee, yes. For the tenth employee, no. They've got a lot more information. For like the twentieth employee, they've got even more information. So it's just gonna be a continuous spectrum. Question over here?


[User] Please transcribe this text

[Assistant] Sure, so how did you go about finding the core team? Uhm, at Facebook, uh, pretty organic, so really, uhm, a lot of people were just like the people on our network at Harvard that we moved out to Palo Alto with.


[User] Please transcribe this text

[Assistant] Uhm, and then, uh, very early on we hired Matt Kohler, uh, and he sort of took over recruiting and helped us get into, network into Stanford actually, and a lot of the people we hired were recent graduates here.


[User] Please transcribe this text

[Assistant] Uhm, and we really focused on the product team first, but yeaah, a lot of it was very path-dependent and organic working networks. Uhm, things are a little different now. As a small company, you can work with, uhm, you know, contractor recruiters and, uhm, even with some of the, the services that, that help connect people and I think those are pretty good.


[User] Please transcribe this text

[Assistant] You know, again, it's a spectrum, but probably more towards the pathological obsession. Like when I say like you can't not do it, it's like one of these things where you'll look back 20 years from now and be like, man, I really should have like gone after that idea. It was really important to me.


[User] Please transcribe this text

[Assistant] Whereas like interests, I have a lot of interests in the world, they're not all necessarily important and they're not all, they're not all gonna keep my attention for like the 10 or 20 years that you need to focus. How are we doing on time? One more? Okay.


[User] Please transcribe this text

[Assistant] Uhm, this is a really tough one. I happen to have a pretty strong opinion that like, co-founders are super important. Uhm, again, cause like, this is really hard and that's like, your buddy that you get to lean on.


[User] Please transcribe this text

[Assistant] Uhm, and they're kind of like in the trenches with you, uh, but if you don't have someone who's sort of like the obvious person you want to work with,


[User] Please transcribe this text

[Assistant] I don't have good advice on how to do that in both of my cases.


[User] Please transcribe this text

[Assistant] We were starting a company together and like discussing it together the whole time. The sort of like founder dating thing doesn't make as much sense to me. Uhm, I actually think starting a company is like, uh, an even more important relationship than like getting married or something because like financial issues enter the conversation even more often.


[User] Please transcribe this text

[Assistant] Uhm, and founder breakups are really bad. Uh, so I highly recommend, uhm, you know, working with someone that you've, you've known a long time and, like, really, uh, just discussing as many of the details as possible to make sure you're on the same page, because those conversations get a lot harder later. Alright, so I'm gonna wrap up.


[User] Please transcribe this text

[Assistant] Peppa, did you put the chocolate cake in the trolley? No Mummy. George, did you put the chocolate cake in the trolley? No. Well, I didn't put it in. Then who did?


[User] Please transcribe this text

[Assistant] But I've been thinking about what you said and... I'm sorry.


[User] Please transcribe this text

[Assistant] Come on! Time to robot! I am very clever, king! I am super genus! I am robot king of the monkey ping! Compute! Compute! So!


[User] Please transcribe this text

[Assistant] I'll take 300 orders. To go! Yes, yes. But before you leave, I have an announcement to make. So shut up everyone. Thank you.


[User] Please transcribe this text

[Assistant] After much deep and profound brain things inside my head, I have decided to thank you for bringing peace to our home. And to make you feel good, I'm gonna give you this lovely parting gift.


[User] Please transcribe this text

[Assistant] No, I couldn't. Really, I can't take your crown. That's okay, I've got a bigger crown. It's got a gecko on it. Look at them shakes! Go, Steve, go!


[User] Please transcribe this text

[Assistant] It seems so simple, but the magnitude of the project is gigantic. We have a thousand feet of truss, thousands of feet of cable. To create natural lighting, it takes a lot of lights. We are lighting day into night, 24 hours a day. I have 45 cameras probably, rolling in the house.


[User] Please transcribe this text

[Assistant] Where is she? Is she in the kitchen? Oh, she's in the kitchen. Good as well.


[User] Please transcribe this text

[Assistant] I, uh, once taught with a professor who was lamenting the fact that as the term progresses, attendance at lecture tends to drop off and gets pretty dramatic by the end of the term when you're lecturing and nobody's there. And I asked him what he did about it. And he thought about it and he said,


[User] Please transcribe this text

[Assistant] There's only two things that can get students to come to lecture. Candy and sex. Now, we've already tried candy, so today we're gonna talk about sex.


[User] Please transcribe this text

[Assistant] In fact, we're gonna use graph theory to address a decades old debate concerning the relative promiscuity of men versus women.


[User] Please transcribe this text

[Assistant] Now, graphs are incredibly useful structures in computer science and we're gonna be studying them for the next five or six lectures. They come up in all sorts of applications. Scheduling,


[User] Please transcribe this text

[Assistant] Optimization, communications, the design and analysis of algorithms. In fact, next week you're gonna see how two Stanford graduate students became gazillionaires because they use graph theory in a clever way. But, let's talk about sex.


[User] Please transcribe this text

[Assistant] The issue that we're going to address today is one of the most talked about and most well studied questions in all of human sociology.


[User] Please transcribe this text

[Assistant] On average, who has more opposite gender partners, men or women?


[User] Please transcribe this text

[Assistant] Now, opposite gender is going to be important, and by this I mean one boy and one girl.


[User] Please transcribe this text

[Assistant] Alright, I'm not making a political statement, it's just that the math is a lot easier that way, as you'll see.


[User] Please transcribe this text

[Assistant] Now I'd like to start by taking a poll here to see what you think about that.


[User] Please transcribe this text

[Assistant] So raise your hand if you think men, on average, have more opposite gender partners than women do.


[User] Please transcribe this text

[Assistant] Yeah, one on one. Okay, so let's say over the course of their lives, let's say, or over the course of 2010, that men in America have more opposite gender partners than women in America, say in 2010. Raise your hand if you think men have more going on.


[User] Please transcribe this text

[Assistant] Maybe even more voter for women, but it's close. Raise your hand if you think it's equal.


[User] Please transcribe this text

[Assistant] Alright, about the same. Raise your hand if you think there's no way to know. That it's just, it's hopeless to really figure it out. Alright, nobody goes for that. Yeah, alright, good.


[User] Please transcribe this text

[Assistant] Alright, well now in the popular literature, I think the feelings are different than expressed here. Pretty much universally in the literature, it's believed that men have more opposite gender partners than women.


[User] Please transcribe this text

[Assistant] And in fact you can even think about that if you think about literature, you know, the leader of the harem is always a man, and he's got lots of women.


[User] Please transcribe this text

[Assistant] You know, in polygamous cultures, it's always the man that has multiple wives, not the reverse.


[User] Please transcribe this text

[Assistant] Now, not surprisingly, this issue has been studied, scientifically, I'll put in quotes, uh, extensively, in one of the largest studies ever done.


[User] Please transcribe this text

[Assistant] Researchers from the University of Chicago interviewed 2,500 people at random over several years. They brought them in on many occasions to try to get the answer for the question once and for all.


[User] Please transcribe this text

[Assistant] And they wrote this 700 page book called The Social Organization of Sexuality, Sexual Practices in the U.S.


[User] Please transcribe this text

[Assistant] Actually walking around with this book has proved to be a little embarrassing. Uh, last week my 11 year old daughter saw it and she goes, Dad, why do you have this sex book? And uh, well I grabbed it back and I said, that's for the course I'm teaching.


[User] Please transcribe this text

[Assistant] Uh, and uh, I thought I'd gotten away with it, and everything was fine. And then later that day, she texted all of her friends about the new news that, what do you know, her dad teaches sex ed at MIT. Anyway, this study concludes


[User] Please transcribe this text

[Assistant] That on average men have 74% more opposite gender partners than women.


[User] Please transcribe this text

[Assistant] Okay, now, when you think about it, that sounds maybe reasonable. You know, it might be okay. But, uh, not according to ABC News.


[User] Please transcribe this text

[Assistant] They did a poll of 1500 people in the country in 2004.


[User] Please transcribe this text

[Assistant] And concluded that the average disparity is much greater.


[User] Please transcribe this text

[Assistant] In particular, in this study, they said that the average man has 20 partners, I'm assuming over their lifetime, and the average woman has 6.


[User] Please transcribe this text

[Assistant] And this gives a disparity of 233%.


[User] Please transcribe this text

[Assistant] So ABC News did a smaller survey.


[User] Please transcribe this text

[Assistant] Says that it's 233% here.


[User] Please transcribe this text

[Assistant] Now ABC News claimed this is one of the most scientific studies ever done and that there was a two and a half percent margin of error.


[User] Please transcribe this text

[Assistant] Now we'll actually talk about what that means mathematically later in the term when we do probability and do study polling.


[User] Please transcribe this text

[Assistant] Now, of course I should also mention that ABC News is the one that said Al Gore won the presidential election in 2004. 2000, I mean.


[User] Please transcribe this text

[Assistant] Now, uh, the study is called American Sex Survey, A Peak Between the Sheets.


[User] Please transcribe this text

[Assistant] That doesn't sound so scientific. And it was on TV on Primetime Live in 2004. The promo for this is really good.


[User] Please transcribe this text

[Assistant] It says, a groundbreaking ABC News primetime live survey finds a range of eye-popping sexual activities, fantasies, and attitudes in this country, confirming some conventional wisdom, exploding some myths, and venturing where few scientific surveys have gone before. By the end of today, we're gonna agree with that last statement. Uh, okay. Now who do you think's right? University of Chicago?


[User] Please transcribe this text

[Assistant] Who votes for 74% is being pretty close? A few of you?


[User] Please transcribe this text

[Assistant] I've already sort of slammed these guys. Who votes for ABC News as being more accurate? Yeah, nobody. Uhm, who votes for No Way to Tell?


[User] Please transcribe this text

[Assistant] I got some votes there, alright. So how do you tackle this problem? You know, in theory we could do our own 6042 survey.


[User] Please transcribe this text

[Assistant] I don't know how much we'd really learn and for sure I'd get fired. Uh, so, I don't think we're gonna do that.


[User] Please transcribe this text

[Assistant] But fortunately, this is the kind of question that can be handled and actually answered by graph theory.


[User] Please transcribe this text

[Assistant] Even though it might be more interesting to interview thousands of people and find out what's going on, uh, that's not as efficient as using graphs. So let me start by defining what a graph is.


[User] Please transcribe this text

[Assistant] Informally, a graph is just a bunch of dots and lines connecting the dots. It's actually very simple. So here's a graph.


[User] Please transcribe this text

[Assistant] These are the nodes and they're connected with these lines that are called edges.


[User] Please transcribe this text

[Assistant] And often the nodes and sometimes the edges are labeled. For example, we might call this X1, X2,


[User] Please transcribe this text

[Assistant] x4, x5, x6, and x7. Alright, that's an example of a graph.


[User] Please transcribe this text

[Assistant] Now this being a math class, we gotta give a formal definition of a graph. And we'll usually use the formal definition.


[User] Please transcribe this text

[Assistant] Where V is a set of elements called vertices or nodes, and it has to be non-empty here in this class.


[User] Please transcribe this text

[Assistant] And we'll go back and forth between vertices and nodes, even in the text, we use both words interchangeably.


[User] Please transcribe this text

[Assistant] And it's the same as the set X2, X1. Doesn't matter the order here. Later in a week or so we'll talk about directed graphs where the order matters. X1, X3 is also an edge. Here. And so on.


[User] Please transcribe this text

[Assistant] Edges are also sometimes written with this notation. X1 line, X2 is another notation.


[User] Please transcribe this text

[Assistant] And then later when you talk about directed edges, we'll put a little arrowhead on one end of this.


[User] Please transcribe this text

[Assistant] Now the definition of a graph is really pretty simple, just think of it as dots and lines if you want.


[User] Please transcribe this text

[Assistant] Uh, but there's often differences in how people define graphs.


[User] Please transcribe this text

[Assistant] For example, uh, in this class, we don't allow the empty graph, i.e. the graph with no nodes. So we're gonna insist that every graph has to have at least one node in it.


[User] Please transcribe this text

[Assistant] And that's just to make the theorems we're going to prove be true. Otherwise there are some theorems that are false for the special case of the empty graph.


[User] Please transcribe this text

[Assistant] But we don't require the graph to have any edges. In fact, it's possible you have a graph with nodes but no edges.


[User] Please transcribe this text

[Assistant] For example, this graph.


[User] Please transcribe this text

[Assistant] Now for a general graph, when you do have edges, we say that two nodes


[User] Please transcribe this text

[Assistant] If they're connected by an edge, namely if xi xj is an edge. Alright, so, for example, x5 is adjacent to x7, but it's not adjacent to x4. There's no edge there.


[User] Please transcribe this text

[Assistant] Closely related is a definition of incidence.


[User] Please transcribe this text

[Assistant] E is the edge x1, x2, and it's incident to x1, and incident to x2.


[User] Please transcribe this text

[Assistant] So for example, what's the degree of x5 over here?


[User] Please transcribe this text

[Assistant] These guys all have degree zero. There's no edges incident to them.


[User] Please transcribe this text

[Assistant] Now, in this class we're gonna look at only simple graphs, at least for a while.


[User] Please transcribe this text

[Assistant] Is an edge that only connects up one node. That's a loop and we don't allow it.


[User] Please transcribe this text

[Assistant] A multiple edge is where you've got two edges that are really the same, that connect the same end points. Also called a multi-edge.


[User] Please transcribe this text

[Assistant] And those we're not gonna have in simple grass. We don't allow this. We don't allow that.


[User] Please transcribe this text

[Assistant] So alright, how are we going to use a graph


[User] Please transcribe this text

[Assistant] To model the problem of opposite gender partners. That's the question we're after. So, any thoughts about what the nodes of the graph are gonna represent?


[User] Please transcribe this text

[Assistant] What is it? People. Yeah, so we're gonna have people, and in fact there's two kinds of people here. There's men and women.


[User] Please transcribe this text

[Assistant] Alright, we got nodes here for the men.


[User] Please transcribe this text

[Assistant] Alright, and so this might be, oh I don't know, say that's Tom Cruise and Nicole Kidman. Now what's the edge gonna represent?


[User] Please transcribe this text

[Assistant] Partners, alright, they were opposite gender partners. And there's actually more edges probably here. You know, we could have Penelope here. And Katie.


[User] Please transcribe this text

[Assistant] Here. And, uh, well probably lots more. I probably don't even know them all. And Ben's over here with Nicole. And Nicole got Jude and, uh, Keith. There's actually a website you can go to to, uh,


[User] Please transcribe this text

[Assistant] Get a lot of these things here, and Katie went with Josh.


[User] Please transcribe this text

[Assistant] It's called whosdatedwho.com and you get a big graph, you can start filling in the edges. I don't know how reliable it is.


[User] Please transcribe this text

[Assistant] Now, it's really critical that we're only looking at edges from here to here.


[User] Please transcribe this text

[Assistant] Alright, so if there's an edge between Tom and Ben, I don't want to know about it. Alright? So just opposite gender partners.


[User] Please transcribe this text

[Assistant] Okay, now in the USA, the number of nodes here is about 300 million.


[User] Please transcribe this text

[Assistant] Alright, about 300 million people. And the number of men nodes, male nodes, call these VM, and this is VW.


[User] Please transcribe this text

[Assistant] By the way, I'm using cardinality notation. When I put bars around a set, that is denoting how many are in the set. In the U.S., there's about 147.6 men out of the 300, and the number of women, got a W here,


[User] Please transcribe this text

[Assistant] He is about 152.4 million.


[User] Please transcribe this text

[Assistant] So there's a little bit more, more nodes on this side of the graph than that side in the US.


[User] Please transcribe this text

[Assistant] So, that we don't know. The card now out of the edge set we don't know.


[User] Please transcribe this text

[Assistant] And we're not likely to figure out. I don't even think these surveys really can estimate that.


[User] Please transcribe this text

[Assistant] Uhm, but what we are trying to figure out is the ratio of the average degree of the men to the average degree of the women.


[User] Please transcribe this text

[Assistant] Because the number of opposite gender partners you have is your degree here, and you're looking for the average guy degree compared to the average female degree here. That's what we're after. Nice, let's define that quantity.


[User] Please transcribe this text

[Assistant] Let's let A sub m equal the average


[User] Please transcribe this text

[Assistant] Number of opposite gender partners.


[User] Please transcribe this text

[Assistant] And we can let AW be the same thing for women.


[User] Please transcribe this text

[Assistant] Alright, now we're trying to figure out the answer to this question. What is AM?


[User] Please transcribe this text

[Assistant] And in particular, the University of Chicago says they say it's 1.74.


[User] Please transcribe this text

[Assistant] The average guy has 74% more opposite gender partners than the average woman.


[User] Please transcribe this text

[Assistant] ABC News says it's 3.33. That is 233% more for the men than the women. Now we're going to figure this out. What this ratio is.


[User] Please transcribe this text

[Assistant] Alright, just use a little bit of math here and a little bit of graph theory. So let's write a formula for AM.


[User] Please transcribe this text

[Assistant] Well, we're trying to figure out the average degree over here.


[User] Please transcribe this text

[Assistant] Well, that's pretty simple. We just add up all the degrees.


[User] Please transcribe this text

[Assistant] And divide by the number of nodes. And that'll give us the average degree.


[User] Please transcribe this text

[Assistant] So the average degree is the sum of the degrees over all men, x in the set of men, of the degree of x, divided by the number of men.


[User] Please transcribe this text

[Assistant] E, cardinality of E. I'm adding all the degrees here.


[User] Please transcribe this text

[Assistant] Well that's just another way of counting all the edges. Because every edge shows up once and only once.


[User] Please transcribe this text

[Assistant] In a degree count here. And this is where we use the fact that we have opposite gender partners. Right? Because


[User] Please transcribe this text

[Assistant] The cardinality of the number of edges divided by the number of men. Any questions about that? This is an important statement about graphs in general. When I have a graph like this.


[User] Please transcribe this text

[Assistant] Which is called a bipartite graph, we'll talk about more in a little bit. But where the edges go from the left to the right, if I sum the degrees on the left, I'm just counting the number of edges.


[User] Please transcribe this text

[Assistant] Let's figure out a formula for the average number of partners for the women. Well that's simple, that's just some x over the women.


[User] Please transcribe this text

[Assistant] Yeaah. This sum, adding the degrees of the women, is just the number of edges. Right? So that is cardinality of edges divided by the number of women. Alright. Well, now we can write, solve for our formula. Average over men over average of the women. That's


[User] Please transcribe this text

[Assistant] E over Vm divided by E over Vw. Wow, this is nice. I don't know what the number of edges is, but it just cancelled out. And this is just the number of women divided by the number of men.


[User] Please transcribe this text

[Assistant] So we just proved that on average,


[User] Please transcribe this text

[Assistant] A man has three percent or three and a quarter percent more opposite gender partners than women.


[User] Please transcribe this text

[Assistant] No need to do the interviews or spend years doing it. That is the answer.


[User] Please transcribe this text

[Assistant] And it has nothing to do with the promiscuity of men or women. Nothing at all.


[User] Please transcribe this text

[Assistant] Alright, so the Chicago study is way off and the ABC News study is completely nuts. I just can't be right. This is a proof. Alright, now, what happened here?


[User] Please transcribe this text

[Assistant] Well, what's going on? What's the reason for why this is true? Yeah?


[User] Please transcribe this text

[Assistant] And you have the number of relationships going. The average for the men is that number divided by the men.


[User] Please transcribe this text

[Assistant] Average for the women is that same number divided by the women, and so if there's more women, they're gonna have less partners on average. Has to be.


[User] Please transcribe this text

[Assistant] So it really was a stupid question. It's very, very simple to answer.


[User] Please transcribe this text

[Assistant] Now, as it turns out, there are endless studies like this in the literature.


[User] Please transcribe this text

[Assistant] In fact, a few years ago, the Boston Globe ran an explosive story about the study habits of students on Boston area campuses.


[User] Please transcribe this text

[Assistant] And their survey showed that on average, minority students


[User] Please transcribe this text

[Assistant] And they went on great length consulting the experts as to why this might be true. Why is it the minority students study with non-minority students more than the other way around? Now can anyone tell me why it is certainly true and not surprising why that's the case?


[User] Please transcribe this text

[Assistant] We're gonna see a lot of other bogus studies later. This is not unusual. Especially when we get to probability. Just every day there's a new one in probability. Uhm, any questions about this before we leave?


[User] Please transcribe this text

[Assistant] Unfortunately, that's most all we'll say about sex today.


[User] Please transcribe this text

[Assistant] Now, in this example, we used an edge in the graph to denote some kind of affinity.


[User] Please transcribe this text

[Assistant] You know, between two nodes. The two nodes liked each other in some sense if they were connected by an edge or they had a relationship of some kind.


[User] Please transcribe this text

[Assistant] There's lots of examples in computer science where you use an edge to denote just the opposite. The two nodes can't be near each other or don't like each other.


[User] Please transcribe this text

[Assistant] For example, consider the problem of scheduling final exams at MIT. Uh, and they do this after they find out all of your schedules.


[User] Please transcribe this text

[Assistant] And they try to schedule the exams so that you don't have to take two at once or there's as little of that as possible. Uh, for example, let's do an example here.


[User] Please transcribe this text

[Assistant] And this may not be totally accurate, but, but roughly.


[User] Please transcribe this text

[Assistant] So I've got five MIT classes, and I'm going to put an edge between pairs of classes that have overlapping student enrollment.


[User] Please transcribe this text

[Assistant] We've assumed in drawing this graph that you can't have our exam the same time as 6002 on the assumption there's students in both classes.


[User] Please transcribe this text

[Assistant] But you could have our exam the same time as 6.034.


[User] Please transcribe this text

[Assistant] Because there's not an overlapping student or student in both classes. So the exams could be scheduled at the same time.


[User] Please transcribe this text

[Assistant] So we've used a graph to represent which courses can't have their exam at the same time.


[User] Please transcribe this text

[Assistant] Now let's also suppose we have a set of slots for the exam.


[User] Please transcribe this text

[Assistant] And say they're all on a Wednesday, and the first slot is Wednesday from 5 to 7, and the next one is 7 to 9, and then the next one is 9 to 11, and then 11 to 1 in the morning, and then 1 to 3.


[User] Please transcribe this text

[Assistant] Pretty late. And your job is to figure out


[User] Please transcribe this text

[Assistant] How not to have to use these later exam slots? You'd like to use as few as possible so you're not...


[User] Please transcribe this text

[Assistant] You know, going too late at night or come before the holidays so you're not having exams on Christmas and New Years.


[User] Please transcribe this text

[Assistant] The goal is to assign slots to the nodes. Put every node in a slot so you don't have


[User] Please transcribe this text

[Assistant] Nodes hooked by an edge getting the same slot. Now, this is an example of what's called a graph coloring problem. So let's define that.


[User] Please transcribe this text

[Assistant] Alright, and then the minimum number of colors you need is called the chromatic number of the graph. So the minimum


[User] Please transcribe this text

[Assistant] For which such a coloring exists,


[User] Please transcribe this text

[Assistant] And it's denoted by the symbol chi of g.


[User] Please transcribe this text

[Assistant] Because usually you want to use a small number of colors. Now, what does a color represent when we're dealing with this problem? What's the meaning of a color? A time slot, okay. So let's call this time slot C1.


[User] Please transcribe this text

[Assistant] C2, C3, C4, C5. So there's five possible colors. Now of course we could color this graph with five colors. Every node could just get its own color. But then somebody's taken their exam.


[User] Please transcribe this text

[Assistant] You know, from 1 to 3 a.m., and, you know, that's a bit of a pain. Uhm, let's see if we can do less than 5. Let's say I give this color 1. Let's give this one color 1. That's okay, because they're not connected. I can't give this one color 1, so I give it color 2, say.


[User] Please transcribe this text

[Assistant] Now this one I can't give color one because this guy got it. He can't give color two because that guy got it, so I give it color three. And...


[User] Please transcribe this text

[Assistant] Well, I can't do one, two, or three here, so I gotta go to color four. Alright, so 6042 will get the 11pm to 1am slot.


[User] Please transcribe this text

[Assistant] Can we do any better? Can we get away with three colors?


[User] Please transcribe this text

[Assistant] Some say yes, some say no. How many people think you can do three colors on this graph? A bunch. How many think you can't do any better?


[User] Please transcribe this text

[Assistant] Alright, the vote is mostly for three. Well, let's, let's see. Any ideas? Anybody see how to do three?


[User] Please transcribe this text

[Assistant] Alright, these got C1, they're not adjacent. These got C2, they're not adjacent. This can now get C3.


[User] Please transcribe this text

[Assistant] So we can have our exam from 9 to 11, which is better. Alright, can anybody do it in two colors?


[User] Please transcribe this text

[Assistant] Alright. Can anybody offer a reason why two colors may not be possible?


[User] Please transcribe this text

[Assistant] So 3 is optimal. We have just shown that for this graph, the chromatic number is 3.


[User] Please transcribe this text

[Assistant] Alright, now in general, doing what we just did is very hard.


[User] Please transcribe this text

[Assistant] Uh, no one knows a fast algorithm for determining a chromatic number.


[User] Please transcribe this text

[Assistant] In fact, it's a weird kind of problem because it's easy enough to check that a coloring is okay. If somebody put a coloring on the board, you can check, oh, that works really simply. You just check every edge and make sure the colors are different. But figuring it out


[User] Please transcribe this text

[Assistant] As best we know, you gotta try an exponential number of possibilities.


[User] Please transcribe this text

[Assistant] So if I had a hundred nodes here, my running time of the algorithm to check all the possibilities would be exponential in a hundred. Yeah.


[User] Please transcribe this text

[Assistant] Even figuring out for an arbitrary graph if three colors can be done.


[User] Please transcribe this text

[Assistant] Called the three-covering problem. That's really hard. No one knows how to solve that in less than exponential time.


[User] Please transcribe this text

[Assistant] In fact, it's called, one of these NP-complete problems is what it's called. How many people here don't know about NP-completeness?


[User] Please transcribe this text

[Assistant] Alright, so a lot of you haven't seen NP-completeness. Okay, so there is a, a class of thousands of problems. In fact, there's books that list these thousand problems that are all NP-complete. Somebody's proved they belong in the class. And what that means is that if somebody gave you a solution


[User] Please transcribe this text

[Assistant] Like a coloring here. It's easy to check really quickly if it's valid.


[User] Please transcribe this text

[Assistant] But figuring it out is really hard, and if you figured out how to solve one of those thousands of problems, like suddenly you figured out how to tell if any graph could work with three colors.


[User] Please transcribe this text

[Assistant] You would solve automatically all other thousands in the book.


[User] Please transcribe this text

[Assistant] So it's this book of problems you will constantly run into in your career in computer science.


[User] Please transcribe this text

[Assistant] Uh, and it's bad when you run into one because there's no good algorithm to solve it known. But if you just solved one of them, the other thousands would suddenly be solvable quickly.


[User] Please transcribe this text

[Assistant] Even better, you win a million dollar prize. One of these millennium prizes we talked about in the first lecture.


[User] Please transcribe this text

[Assistant] Even if you show you can't find a fast algorithm for one of them, that means that none of them have fast algorithms, and you also get a million dollars.


[User] Please transcribe this text

[Assistant] Uh, so this is the central problem in computer science and theory of computing is whether or not you can solve these NP-complete problems.


[User] Please transcribe this text

[Assistant] Now actually lots of people have claimed to do it and in fact there was a lot of buzz in the community about a month ago when actually a reputable researcher at HP Labs said he'd done it.


[User] Please transcribe this text

[Assistant] He proved that you can't solve NP-complete problems. And he got people going for probably at least a week until they discovered a fatal flaw. And the proof was actually bogus.


[User] Please transcribe this text

[Assistant] Uh, so no one still knows if you can solve these NP-complete problems quickly.


[User] Please transcribe this text

[Assistant] The problem is, in practice, you run into these things all the time, like MIT really does have to schedule the exams.


[User] Please transcribe this text

[Assistant] So you gotta do something. You can't just go say, hey it's NP complete so no exams this year or, you know, whatever. That's not gonna fly. You gotta, you gotta do something.


[User] Please transcribe this text

[Assistant] So now, this is a problem, many of you when you go into careers, you're gonna be faced with this. You gotta do something. Any thoughts about an algorithm for coloring graphs that might use a small number of colors?


[User] Please transcribe this text

[Assistant] It's neighbors have to get different colors, I guess. You'd start coloring the neighbors.


[User] Please transcribe this text

[Assistant] The underlying principle you're sort of thinking about here is you've got some notion of the order in which you're going to process your graph. And you're going to start with the high degree nodes in your case.


[User] Please transcribe this text

[Assistant] And as you go along, you're gonna start coloring the nodes. And you're gonna make sure you color them legally. And it sounds like you're gonna color them with a low color. Alright, as you go along. And that is probably the most basic graph coloring approach. And almost, you could almost say it's a generic approach. So let's define that. And then see, prove some facts about it.


[User] Please transcribe this text

[Assistant] Most of the graph coloring algorithms in practice are based on this approach. And we're gonna call it the basic graph coloring algorithm.


[User] Please transcribe this text

[Assistant] And for graph G with vertices, vertices V and edges E.


[User] Please transcribe this text

[Assistant] So the first step is going to be to order the nodes.


[User] Please transcribe this text

[Assistant] Now in your case, you were suggesting an ordering where I have the high degree nodes first. Alright?


[User] Please transcribe this text

[Assistant] But for now, we're not going to specify that. We're going to make it any ordering you want. And then we're going to have a notion of an order on the colors as well.


[User] Please transcribe this text

[Assistant] And I don't know how many colors, but they're gonna be numbered one, two, and so forth. And then we're gonna process the nodes one at a time.


[User] Please transcribe this text

[Assistant] We color the nodes. So in step i, we color the ith node v sub i with the lowest legal color.


[User] Please transcribe this text

[Assistant] Alright, so let's try this. In fact,


[User] Please transcribe this text

[Assistant] This is sort of the algorithm I used initially to color the exam graph over there.


[User] Please transcribe this text

[Assistant] So let's say we, let me erase the colors here.


[User] Please transcribe this text

[Assistant] So let's say I ordered them with 6034 first. So this will be V1. Then 6041 is V2.


[User] Please transcribe this text

[Assistant] If that's my ordering, what color would I assign to 6034? 1, C1. I'd color it first to get C1. What color does 6041 get?


[User] Please transcribe this text

[Assistant] C1 as well, it's the lowest possible color that's legal, and it's not hooked to this guy, so C1 is legal. What color do I give here? C2. Then I color this one next. C... Can't do C2, can't do C1, so I pick C3.


[User] Please transcribe this text

[Assistant] And then I get the 6042 last, and I can't do one, two, or three, so I do four.


[User] Please transcribe this text

[Assistant] Alright, so this algorithm with that ordering gave four colors. However, we know there's a way to do a different ordering that gives us three colors.


[User] Please transcribe this text

[Assistant] In particular, let's see if we do this, what happens if we use this other ordering. Erase these.


[User] Please transcribe this text

[Assistant] Now I get C1, this will be C2.


[User] Please transcribe this text

[Assistant] So different orderings result in different numbers of colors. Here.


[User] Please transcribe this text

[Assistant] So the whole art now becomes finding a clever ordering, and some people have already had good ideas, pick the largest degree nodes first. And in fact,


[User] Please transcribe this text

[Assistant] You know, if you simulate the algorithm on lots of graphs, you do better.


[User] Please transcribe this text

[Assistant] On average, when you color the large degree nodes first.


[User] Please transcribe this text

[Assistant] And then if you start to use more exotic orderings, you can do even better sort of, if you take a lot of graphs that are out there and run your algorithm and see how well you do, you do, do better with more sophisticated orderings. In fact, you know, uh, this was my, uh, senior thesis back when I was an undergraduate student.


[User] Please transcribe this text

[Assistant] Was trying to figure out better and better orderings that worked for graphs. And at the time it caused a bit of a problem. Uh, I was a undergraduate at Princeton.


[User] Please transcribe this text

[Assistant] And Princeton, to this day, I think, still has exams after the holidays, the Christmas holidays, New Year's holidays.


[User] Please transcribe this text

[Assistant] And the students wanted to have the exams before Christmas because they hated going home for the holiday and then you gotta worry about your exams when you come back.


[User] Please transcribe this text

[Assistant] And the faculty said no, there's no way to get them all compressed into a small number of days.


[User] Please transcribe this text

[Assistant] Now, I didn't, wasn't aware of all that at the time, but my thesis was go figure out good orderings. So I tried lots of different orderings and I tried the largest degree first and recursive versions of that actually worked very well.


[User] Please transcribe this text

[Assistant] And then tried it on the Princeton exam graph.


[User] Please transcribe this text

[Assistant] And lo and behold, you could actually squish it down so you could give all the exams, I think it was four and a half days. Plenty of time to give them before Christmas. Which caused a fair scandal at the time because then,


[User] Please transcribe this text

[Assistant] The faculty had to come clean, they just didn't want to bother having the exams before Christmas.


[User] Please transcribe this text

[Assistant] Uh, now, this algorithm is an example of what's known as a greedy algorithm. Now in a greedy algorithm,


[User] Please transcribe this text

[Assistant] It's always simple. You just go one step after the next, taking the best you can do with each step. You never go back and try to make things better. You never do hill climbing. You know, if you're familiar with that term, you just always keep it simple. One thing after the next, very fast.


[User] Please transcribe this text

[Assistant] Sometimes works great in practice. Sometimes doesn't. But it's always where you start, some simple approach like this. Now, this algorithm actually


[User] Please transcribe this text

[Assistant] Even if you don't try to monkey with the ordering, even for a worst case ordering of the nodes, it actually does pretty good for a lot of graphs.


[User] Please transcribe this text

[Assistant] And in fact, it does really well, as somebody already asked about, if all the nodes have low degree. So let's state that as a theorem, and then we're gonna prove that.


[User] Please transcribe this text

[Assistant] At most, D. So that's the biggest degree in the graph, D. Then this basic algorithm,


[User] Please transcribe this text

[Assistant] For G. No matter what the ordering is, you'll never do worse than D plus one colors.


[User] Please transcribe this text

[Assistant] So what's the value of D for our exam graph over here?


[User] Please transcribe this text

[Assistant] D is three. Every node has degree at most three. And so it says that no matter what ordering you picked here, you'd get at most four colors. Now you might do better. In fact, we found an ordering that got three. So it's possible to do better.


[User] Please transcribe this text

[Assistant] So let's prove this fact, cause this, this makes a difference. Say you have a graph with hundreds of nodes, but every node has degree at most three.


[User] Please transcribe this text

[Assistant] Well that says you only need four colors, even if the graph has a thousand notes. And that's very useful. So in that kind of situation it does very well. So let's prove that.


[User] Please transcribe this text

[Assistant] I, you know, I'm not a, you know, if you like well, it's equivalent to well ordering. So if you like well ordering, you can do it that way. I think it's easier using induction here. So the proof is by induction.


[User] Please transcribe this text

[Assistant] Alright, so the first thing we need is an induction hypothesis.


[User] Please transcribe this text

[Assistant] But there's not an N here to start. What are most people gonna do? We used to ask this actually, we asked this once on a test, many years ago, and it was an utter disaster. Because what did everybody do? Maybe one student or two put an N into here?


[User] Please transcribe this text

[Assistant] But what's the natural thing to do to induct on here when you look at this statement? You're gonna induct on D.


[User] Please transcribe this text

[Assistant] Right, cause the first thing you do is you make this be your induction hypothesis. There's only one thing to use. So you're gonna have your predicate be P of D, and it's gonna be that.


[User] Please transcribe this text

[Assistant] Now it didn't occur to us that's what everybody was gonna do, it should have. They all did that, and it was a disaster. Because if you do this...


[User] Please transcribe this text

[Assistant] Well, you've gotta take a graph with maximum degree D, or D plus 1 in the inductive step, pull out all the nodes with degree D plus 1,


[User] Please transcribe this text

[Assistant] To get a graph with now degree D, and that's a mess, you just pulled out a lot of nodes, potentially.


[User] Please transcribe this text

[Assistant] Color that in D plus one colors, now put all that junk back in, and say you only used one more color? Nightmare. You know, and these are MIT students under pressure.


[User] Please transcribe this text

[Assistant] You know, that was a nightmare. Uh, so that does not work, and in fact,


[User] Please transcribe this text

[Assistant] We will ask an induction question on graphs on every test you take in this course. Alright, it will happen. And so usually,


[User] Please transcribe this text

[Assistant] With induction you take this as your induction hypothesis. With graphs you have to be careful.


[User] Please transcribe this text

[Assistant] And if it, the worst part about this is we tell people when this doesn't work, use a stronger induction hypothesis.


[User] Please transcribe this text

[Assistant] So students tried to make it stronger, but they're still stuck on D and it was still a disaster. Uh, with graphs you do something different.


[User] Please transcribe this text

[Assistant] And the first thing you do with a graph usually is put n in here.


[User] Please transcribe this text

[Assistant] And if it doesn't work with n, the number of nodes, you put in e, the number of edges, and induct on that. And so what you said is exactly the right thing to do.


[User] Please transcribe this text

[Assistant] Don't do this, or at least don't spend too much time on it. Pretty quickly try this.


[User] Please transcribe this text

[Assistant] If every node in an n-node graph G


[User] Please transcribe this text

[Assistant] Has degree at most e. Then the basic algorithm uses at most e plus one colors. And now you induct on n.


[User] Please transcribe this text

[Assistant] And almost always the graphs, that's the first thing to try, even if it's not in your theorem statement. Any questions about that?


[User] Please transcribe this text

[Assistant] Well, let's start with this and uh, see if we can make this one work.


[User] Please transcribe this text

[Assistant] So what's the next step in our proof? What do we gotta do? Base case.


[User] Please transcribe this text

[Assistant] And the base case will be not n equals zero, because we can't have a zero node graph, but n equals one. And how many edges do we have?


[User] Please transcribe this text

[Assistant] Zero. If there's one node, we don't allow loops, so it's zero edges.


[User] Please transcribe this text

[Assistant] Which means that the degree of our graph has to be zero. There's no edges.


[User] Please transcribe this text

[Assistant] And of course, there's only one node, so one color is gonna work, and that happens to equal D plus one.


[User] Please transcribe this text

[Assistant] Alright, so the base case is true. For one node graphs, you can always use D plus one colors.


[User] Please transcribe this text

[Assistant] So here we assume Pn is true.


[User] Please transcribe this text

[Assistant] And now we look at an n plus 1 node graph to show p n plus 1 is true. So we let g


[User] Please transcribe this text

[Assistant] We gotta show we can color it in D plus one colors.


[User] Please transcribe this text

[Assistant] Uh, well the basic algorithm, let's see, the first thing we do is we order the nodes in an arbitrary order.


[User] Please transcribe this text

[Assistant] Anyway at all. Now, how am I gonna use the induction hypothesis? I know, I can assume, that for any n-node graph, I can color it in the max degree plus one colors.


[User] Please transcribe this text

[Assistant] How am I going to use that to help me color G here, the N plus 1 node graph? Any thoughts?


[User] Please transcribe this text

[Assistant] With vertices v' and edges e'. So we create a new graph by removing that node.


[User] Please transcribe this text

[Assistant] Uh, and we remove all the edges tied to that node. So for example over here.


[User] Please transcribe this text

[Assistant] Let's see, v, the last node was 6042, so we take out 6042 and all these edges. And this is the graph that we're left with.


[User] Please transcribe this text

[Assistant] That graph has n nodes. What's the maximum degree in g prime?


[User] Please transcribe this text

[Assistant] No, I'm just taking the stuff out. So...


[User] Please transcribe this text

[Assistant] I know that G' has maximum degree at most D. The degree didn't go up of any node.


[User] Please transcribe this text

[Assistant] So G prime has max degree at most D, and it has N nodes.


[User] Please transcribe this text

[Assistant] So if, if this were the n plus first node, the last node in the ordering, take it out,


[User] Please transcribe this text

[Assistant] The basic algorithm now would take the same order here, V1, V2, V3, V4. Basic will color that in D plus 1 colors. And alls I have left is to give this guy a color. And I'll have color G. Question?


[User] Please transcribe this text

[Assistant] So by induction I've colored these guys, V1 through Vn and D plus 1 colors. All that I have left to do is color Vn plus 1.


[User] Please transcribe this text

[Assistant] And hopefully we're not gonna use color D plus two. Because then we sort of, it wouldn't work. We gotta use one of the first D plus one.


[User] Please transcribe this text

[Assistant] It has at most D neighbors because every node in G has at most degree D. A neighbor is a node you're adjacent to.


[User] Please transcribe this text

[Assistant] The n plus 1 has at most d neighbors, is adjacent to at most d other nodes.


[User] Please transcribe this text

[Assistant] Now, what does that mean about the color I can use on the n plus 1?


[User] Please transcribe this text

[Assistant] It can't be any one of these colors that were assigned here. That's true. So how many colors got ruled out? At most D. And how many am I working with? D plus one. So I got one left that I can use safely. Okay.


[User] Please transcribe this text

[Assistant] So this means there exists at least one color in my set of D plus one colors.


[User] Please transcribe this text

[Assistant] Alright, so now, I've colored every node in G, the N plus 1 node graph, safely, using a total of D plus 1 colors.


[User] Please transcribe this text

[Assistant] That means pn plus 1 is true. Whoops. And the induction is complete.


[User] Please transcribe this text

[Assistant] What do you mean by keeping all nodes connected?


[User] Please transcribe this text

[Assistant] So you've constructed a particular graph. This is actually called, for the N nodes, it's called KN. It's the N node complete graph. Also called a clique, like a clique of friends. Where everybody likes everybody. In a clique.


[User] Please transcribe this text

[Assistant] And in fact, for n here, for z nodes, what's the max degree?


[User] Please transcribe this text

[Assistant] Max degree is n minus 1. What's the chromatic number of this graph?


[User] Please transcribe this text

[Assistant] And they all have to be different, which is D plus 1. So you have built a special graph for which the optimal number of colors is D plus 1.


[User] Please transcribe this text

[Assistant] But that is not a proof that this is true for all graphs. Because you've, you've looked at a particular graph here.


[User] Please transcribe this text

[Assistant] Right, so what you've done here is you've shown that I could not make that theorem any bet stronger. I could not replace it with, uh, D here. Alright? Because you've given an example where I can't get D colors. Where the maximum degree is D.


[User] Please transcribe this text

[Assistant] But that doesn't, to get a proof for the theorem, I gotta go through all this. That wouldn't give me a proof for the theorem.


[User] Please transcribe this text

[Assistant] They're not equivalent. One's an upper bound, one's an existence of a lower bound. This shows that for any graph,


[User] Please transcribe this text

[Assistant] You use, you need at most D plus one. So any graph at most. That shows there is a graph that you need at least. And they are not equivalent. Alright, one is for all an upper bound. The other is there exists a lower bound. So different in two ways that are important.


[User] Please transcribe this text

[Assistant] Alright, this kind of proof is very typical for what you'll see with induction and graphs.


[User] Please transcribe this text

[Assistant] Uh, and you'll get a lot of, lot of practice with it. Are there any other questions on this proof?


[User] Please transcribe this text

[Assistant] Alright, so we've seen now by that example that we can't improve the theorem. In some cases though,


[User] Please transcribe this text

[Assistant] The theorem is way off for some graphs. Can anybody think of a graph where the bound we get from the theorem of d plus one colors is way off from the actual chromatic number you need? The number of colors you need? Yeaah.


[User] Please transcribe this text

[Assistant] And every node here is connected to every node over on the other side.


[User] Please transcribe this text

[Assistant] And if this is an end node graph and I've got n over 2 on each side, what's my degree here?


[User] Please transcribe this text

[Assistant] What's my max degree of this graph? N over 2. So D is N over 2.


[User] Please transcribe this text

[Assistant] Uh, what's the chromatic number? How many colors do I need for this? Two.


[User] Please transcribe this text

[Assistant] Alright, so d plus one is way off of two. There's a even worse example. Yeaah.


[User] Please transcribe this text

[Assistant] So here the maximum degree is n minus one, just like a complete graph, but how many colors do I need? Two. So it's even worse here.


[User] Please transcribe this text

[Assistant] What about the, uh, the basic algorithm? How well does the basic algorithm do on this graph?


[User] Please transcribe this text

[Assistant] What am I gonna color that one? One. Then I get to the center, what am I gonna color it? Two. And now all the arms, what do they get colored? They all get one. Whatever order you pick, you get two colors.


[User] Please transcribe this text

[Assistant] Alright, so now there's a difference between the theorem just gives you an upper bound that says that most D plus one colors, but in fact the algorithm can do a lot better than that, as on this example. So the algorithm might be a lot better. Everybody see that, what we're doing here?


[User] Please transcribe this text

[Assistant] How the algorithm is better than the bound we proved by the theorem, even though the bound was pretty good for some graphs. Now it turns out, I mean we're not gonna win a million dollars for this algorithm.


[User] Please transcribe this text

[Assistant] And in fact, this algorithm is sometimes very bad.


[User] Please transcribe this text

[Assistant] And a really bad example is very close to this.


[User] Please transcribe this text

[Assistant] In fact, actually this one, let's look at uhm, how well does basic do on this one? Here.


[User] Please transcribe this text

[Assistant] This, we'll call it a complete bipartite graph. It's what this is called. I'll define bipartite in a minute. But what's the basic algorithm do here?


[User] Please transcribe this text

[Assistant] True. So take a vertex and the first one, say V1's here, get C1.


[User] Please transcribe this text

[Assistant] As long as I keep picking vertices over on this side, they're gonna get C1.


[User] Please transcribe this text

[Assistant] As soon as I get to a vertex over here, what color does it have to get? C2 because it's touching the very first one we had here.


[User] Please transcribe this text

[Assistant] So when I get vertices over here, they're all gonna be C2. When I go back over here, they're gonna be back to C1. So actually basic does good here too. Gives you two colors. Yeaah.


[User] Please transcribe this text

[Assistant] If I've got a vertex over here, it is by definition connected to the vertex over here. Because every possible edge is here. But that's a great idea. What if they weren't all connected? That's actually a great idea.


[User] Please transcribe this text

[Assistant] Let's, uh, in fact, the nasty example for the basic algorithm is very much like that. Let's draw it.


[User] Please transcribe this text

[Assistant] Because so far the basic algorithm is pretty much done perfectly on all the graphs we looked at, even when the theorem wasn't typed.


[User] Please transcribe this text

[Assistant] And it is very close to the graph we just looked like where all the edges are there. In this case, all the edges are there except for the one straight across.


[User] Please transcribe this text

[Assistant] So if this is, the edge denotes likes, this is a world where you like everybody but your spouse.


[User] Please transcribe this text

[Assistant] Alright, so you have an edge to everyone except the one directly across from you.


[User] Please transcribe this text

[Assistant] So it has almost every edge, but it's missing these edges.


[User] Please transcribe this text

[Assistant] Now the basic algorithm might do well here. What would be a good ordering for this graph? To label these V1 through Vn.


[User] Please transcribe this text

[Assistant] Because then, color one, color one, color one, all the way down. One color for the left. What does this one get? Color two, because it's hooked up again.


[User] Please transcribe this text

[Assistant] And these all get color two, so I've used two colors. Really good. Basic albums looking great. Now here's a harder question. Can you figure out a bad ordering for this graph? Where I use a lot more than two colors.


[User] Please transcribe this text

[Assistant] Alright, what color does V1 get? C1. What color does V2 get? C1, because it's not hooked up here. What color does V3 get? C2. What about V4?


[User] Please transcribe this text

[Assistant] C2, it's not hooked up. It can't get 1, cause that's up here, and it's not the 2, so it gets 2. What color does V5 get?


[User] Please transcribe this text

[Assistant] C3, because it's hooked up to 1 and 2. B6.


[User] Please transcribe this text

[Assistant] See, three. It's hooked up to one and two but not three. And you can see what's happening here.


[User] Please transcribe this text

[Assistant] All the way down here he's hooked up to all the n over 2 minus 1 colors. So he has to take cn over 2.


[User] Please transcribe this text

[Assistant] So if you pick that ordering, not so good. You use n over two colors. So it really matters, the ordering.


[User] Please transcribe this text

[Assistant] Now I should say graphs like, actually any questions about what we did here? About this?


[User] Please transcribe this text

[Assistant] Alright, now I should say that graphs like this have a special name. They're called bipartite graphs. And that's important to remember.


[User] Please transcribe this text

[Assistant] If the vertices can be split into two sets, or partitioned,


[User] Please transcribe this text

[Assistant] So in fact a lot of today we've been looking at bipartite graphs because the nodes are here like the men and the women and the edges only go from the left to the right.


[User] Please transcribe this text

[Assistant] And then it's called bipartite and it's called bipartite because you can do it with two colors. They're in two pieces.


[User] Please transcribe this text

[Assistant] Uh, so you don't win a million dollars for deciding whether or not a graph can be colored in two colors. That's easy.


[User] Please transcribe this text

[Assistant] We'll even do it for homework one of these times. Uh, you do win the million dollars for deciding if a graph can be colored in three colors. That's really hard to do.


[User] Please transcribe this text

[Assistant] Now, covering problems come up in all sorts of applications. You know, this company Akamai that came out of MIT we talked about, we run a network of 75,000 servers.


[User] Please transcribe this text

[Assistant] On every server at the same time because you gotta take down a server to deploy new software on it. Gotta take it out of commission.


[User] Please transcribe this text

[Assistant] And so we can't just take down all 75,000 servers because then all the Facebook and Netflix and all those sites would stop. That would be bad.


[User] Please transcribe this text

[Assistant] Uh, and we can't do them one at a time. Because there's 75,000 and it takes a few hours for each one to go get the traffic off, stop it, load new software and turn it back on. And it would take us years to do one software install, which we gotta do every week.


[User] Please transcribe this text

[Assistant] So we gotta figure out a schedule for how many servers you take down at a given time and which ones. And it turns out, pairs of servers have certain critical functions.


[User] Please transcribe this text

[Assistant] So there's certain pairs of servers you can't take down at the same time.


[User] Please transcribe this text

[Assistant] So we have a gigantic 75,000 node coloring problem.


[User] Please transcribe this text

[Assistant] Where there's edges between servers, nodes or servers, and there's an edge between them if you can't install new software at the same time.


[User] Please transcribe this text

[Assistant] And so it turns out when you run one of these graph coloring algorithms on it,


[User] Please transcribe this text

[Assistant] You could do it with eight colors. It just turns out that way. So that means there's eight waves of install.


[User] Please transcribe this text

[Assistant] That go on to the network. And now eight times a few hours each means that we can do it in a day and you can manage it.


[User] Please transcribe this text

[Assistant] You know, in a much smaller scale, the same problem exists for register allocation, for variables. Here you gotta assign every variable to a register.


[User] Please transcribe this text

[Assistant] But you can't have variables that are active at the same time associated with the same register. And you want to minimize the number of registers you need. So again, you have the graph coloring problem. The number of colors is the number of registers you need.


[User] Please transcribe this text

[Assistant] And two variables can't get the same color if they're active at the same time. So you put an edge between them.


[User] Please transcribe this text

[Assistant] The most famous example of graph coloring is the matte coloring problem, the four coloring theorem. And so here, every country is a node. Adjacent countries have an edge between them.


[User] Please transcribe this text

[Assistant] Cause you don't want to color adjacent countries the same color or you can't tell they're different countries.


[User] Please transcribe this text

[Assistant] Now the last example we'll talk about is an important problem in communication theory, communication networks.


[User] Please transcribe this text

[Assistant] Where again coloring comes up. Now here you need to assign frequencies to radio stations or to cell towers. Comes up in mobile networks or just in with radio stations. And


[User] Please transcribe this text

[Assistant] If two towers have an overlapping area, they can't be given the same frequencies or you get collisions between the towers.


[User] Please transcribe this text

[Assistant] So suppose, and frequencies are very expensive. Companies pay the government a lot of money to get certain spectrum. So suppose you had this problem.


[User] Please transcribe this text

[Assistant] Here's tower A, and this is A's range where it reaches. Here's tower B. So it overlaps some with A. Here's tower C. Here's tower E.


[User] Please transcribe this text

[Assistant] What's the minimum number of frequencies you need to enable all the towers here? We can make that be a graph. There's a node for each tower and an edge between towers if they overlap.


[User] Please transcribe this text

[Assistant] C doesn't overlap with B. E does. E overlaps here. And then D overlaps here. So how many frequencies do you need? For this graph? Four would work. Three is better. Can you do two?


[User] Please transcribe this text

[Assistant] No, you can't do two because you got here. But you could do three. You could do one, two, three, two, one. Alright, this problem comes up. Did I screw up? Ooh, no I can't do that. One, two, yeaah. Much better.


[User] Please transcribe this text

[Assistant] This problem comes up all over the place. You will certainly see it sometime in your career. You'll have some problem when you're scheduling something and it's really a graph problem in disguise. Okay, that's it for today.


[User] Please transcribe this text

[Assistant] Do you want to see what Grandpa Pig has made for you in the garden?


[User] Please transcribe this text

[Assistant] Oh, yes. The butterfly's tongue is even longer than yours. She uses it to drink from the flower.


[User] Please transcribe this text

[Assistant] Yes, Pepper, you're a beautiful butterfly.


[User] Please transcribe this text

[Assistant] Looks like we have a job to do. Captain Slog, embarking into hostile environment. Kowalski!


[User] Please transcribe this text

[Assistant] We'll need to win the hearts and the minds of the natives. Rico, we'll need special tactical equipment. We're gonna face extreme peril. Private probably won't survive.


[User] Please transcribe this text

[Assistant] I defy any rescue boat within a million miles to miss this, baby.


[User] Please transcribe this text

[Assistant] Good afternoon. So today we're going to do something different. Uh, one of the things that we've learned at Y Combinator is that one of the best ways to learn about startups is to watch other startups get advice.


[User] Please transcribe this text

[Assistant] Uhm, and so we're going to do live office hours, which we've done a few times before in this class, three or four times. Uh, we'll try to do three companies each time. This is Yuri, also works at Y Combinator, uh, and going to do this with me and we're going to just.


[User] Please transcribe this text

[Assistant] Give advice to three startups. You have to be very brave to do this. So I'm very thankful for the startups that have agreed to do this. Uh, these are some of the people that are taking the course online. Uhm, and we'll just get going.


[User] Please transcribe this text

[Assistant] How did you even arrive at the first set of numbers to test?


[User] Please transcribe this text

[Assistant] Do you feel like you've gotten to the point where you have a product that some people really love, and at this point, uhm, if so, well, I guess, do you think you're at that point first?


[User] Please transcribe this text

[Assistant] Is that the biggest, is the biggest challenge you face now, just figuring out how to grow and scale this, do you think, or is there still a lot of product work?


[User] Please transcribe this text

[Assistant] Other than sort of like integrations that are meant to drive growth is there's still a lot of product work before you really want to scale.


[User] Please transcribe this text

[Assistant] That sounds like a mistake. A mistake. Almost everyone who says, oh, we have all these different values and, you know, like, there's all these different reasons people like it. It's really nice if you can figure out how that all abstracts into one message and then build all of the company's sales and marketing and PR around.


[User] Please transcribe this text

[Assistant] This is what it's about. Rather than saying, oh, there's like six different reasons to use the product. I think one of the things that like,


[User] Please transcribe this text

[Assistant] So when you say you have a problem with people integrating you, it's not that hard, it's just not high enough on their priority list. And there's a few ways to solve this. One thing that works is to send people around and say like, hey, we're gonna send an engineer to come help integrate with you. And it's not that the company can't do it, it's just that like, otherwise you'll always be at the bottom of their backlog. And that's one way. The other is if it's like,


[User] Please transcribe this text

[Assistant] One, I think back of the envelope math is always really important, and I think


[User] Please transcribe this text

[Assistant] I worry that this is the kind of business where if you're mostly selling to startups and you're selling it, let's say on average 100 bucks, is it a month or a year?


[User] Please transcribe this text

[Assistant] How big can this business actually get off of this model?


[User] Please transcribe this text

[Assistant] Again, maybe the answer is to charge a lot more. Maybe the answer is that there are 100,000 startups. Maybe the answer is you need to...


[User] Please transcribe this text

[Assistant] There's no reason for a third company to prefer A or B. There's no network effect, there's no monopoly. Uhm, now I can imagine ways that you could build one of those into the product, uh, where there are sort of cross


[User] Please transcribe this text

[Assistant] Cross company incentives to use yours, but what is your plan to be a monopoly and not another SaaS business that just gets competed down to zero margins?


[User] Please transcribe this text

[Assistant] I believe you that that's true, but here's the problem. Every startup, I'd say like one out of three startups I meet with says like, we're like this other thing except we're better designed, we're more beautiful, and we're simpler to use. And it may be true that you are, I believe that it is, but someone else can come do that same thing to you.


[User] Please transcribe this text

[Assistant] It's really good, you know, you've done, you've built a product that people love, you've got them to pay for it, and you, you have a growth channel you believe will work. That puts you in the top like.


[User] Please transcribe this text

[Assistant] How can I, how can I build something where because this company uses my product, this other company is going to be more likely to use it as well. In design and simplicity, although everyone says it and it's kind of true, is, is usually not a long-term win at some point.


[User] Please transcribe this text

[Assistant] Uhm, and it may just be that, you know, once you're integrated into a company, you're impossible to rip out and then you're gonna win the mindshare war. That could be it.


[User] Please transcribe this text

[Assistant] Better answer though would be if, if there's some way that you can like use aggregated data or learnings across all companies, uhm, or aggregate, you know, like,


[User] Please transcribe this text

[Assistant] But you want to figure out what that core is and make that


[User] Please transcribe this text

[Assistant] I don't know, I'm not, like, I would be willing to...


[User] Please transcribe this text

[Assistant] This is the place where I believe in A-B testing. I don't believe in it for everything, but in terms of messaging and communication, and what are those four words you put big on your website when people come there for the first time?


[User] Please transcribe this text

[Assistant] This is a place I believe in A-B testing. And if feature requests are really what people want, then great.


[User] Please transcribe this text

[Assistant] No one ever wants, like, you're putting, like, this product of yourself out there when you launch a startup and no one wants to do it until they feel like it's really good. Uhm, but in six months the world will look entirely different and every good idea you have someone else has. And now a lot of people are going to hear about this because we're talking about it, you know? Don't steal my idea. All of you, don't steal it. I mean, stealing the idea is not...


[User] Please transcribe this text

[Assistant] Be interested at least and there's this issue of speed and how quickly you can build and iterate and especially in a marketplace, uhm, there is a big first mover advantage. So even if it's not the version you want, my most important piece of advice to you would be to get this launched.


[User] Please transcribe this text

[Assistant] Really quickly, uhm, in an ugly first version and then you'll learn so much about how to build a better version.


[User] Please transcribe this text

[Assistant] That you can go from there. It's great that you're talking to customers. That is clearly the number one thing to go do. And getting people signed up so that you have inventory. But I would think about how you


[User] Please transcribe this text

[Assistant] I worry that those a, don't happen frequently enough, and b, those are people who are not looking for parking super regularly in the city.


[User] Please transcribe this text

[Assistant] It would be interesting if you could figure out a way to find people for who this is like truly a hair on fire problem that drive to the city every day and have to park and or live in the city and don't have a parking place like that does not strike me as the most


[User] Please transcribe this text

[Assistant] Urgent need or the mo- the best way to find people who are


[User] Please transcribe this text

[Assistant] I would think about how you find, I would think about other strategies to find a lot of people. Uhm, the festival thing, there, there, I just, I worry there aren't enough festivals, there aren't enough people at those that have this as a regular ongoing problem. You want, you want the people who are going to be daily or at least weekly users of this, and I bet you can come up with better ways.


[User] Please transcribe this text

[Assistant] I mean these people are driving today and parking today, maybe they'll do it more if it's easier, but can you put like signs in the parking lot, in the parking spaces that say to park here, download this?


[User] Please transcribe this text

[Assistant] Airbnb is a really good business because if you own a space and you're renting it out, you can only put it on basically one platform if you're gonna use the instant book feature. And if you are, uh, if you're a guest, you really care if you get this particular house or this particular house. They're not interchangeable.


[User] Please transcribe this text

[Assistant] Uhm, ride sharing, uhm, if you're a driver, you can drive for any service, you can turn the app on and off, and if you're a passenger, you don't care what...


[User] Please transcribe this text

[Assistant] Much which car you get in and it's really nice if you can somehow have the former kind of marketplace where there's not just


[User] Please transcribe this text

[Assistant] Perfect substitution and everyone is switching between each service depending on price. And so if you can do something with


[User] Please transcribe this text

[Assistant] I think this is like actually a very big and important insight about marketplaces that most people miss.


[User] Please transcribe this text

[Assistant] And if you can do something where people can only list their space on your marketplace because you're going to have around the clock instant booking or something, uh, that would be really important to figure out early and a very valuable.


[User] Please transcribe this text

[Assistant] Tweet that doesn't sound, that doesn't sound that big, but is actually a huge difference to the long-term viability of the business.


[User] Please transcribe this text

[Assistant] Uhm, this, again, this is a really good idea.


[User] Please transcribe this text

[Assistant] If you don't move fast, it won't work. So I think it's always important as a startup to know what the number one biggest problem in front of you is. For you, it's like not shipping quickly. And so just get this working in one neighborhood as quickly as you possibly can, even if it's like hacked up and doesn't look that great. Okay. Any other questions you want to discuss?


[User] Please transcribe this text

[Assistant] Other than quality, uh, given that so many peo- like, this is-


[User] Please transcribe this text

[Assistant] Clearly a good business so a lot of people want it and a lot of people are already in it. How will you get, how will you become the marketplace where everyone goes for contracted engineering help?


[User] Please transcribe this text

[Assistant] The, the inside of going after high end, like high end work and also for people who are just looking for smaller pieces is, is really good. I wonder if you could


[User] Please transcribe this text

[Assistant] In addition to figuring out how to scale it, you need to figure out how you're going to communicate it. Like, the website really has to give across the impression with testimonials from well-known customers or whatever that like,


[User] Please transcribe this text

[Assistant] These are the best people. Uhm, in terms of setting the prices, one thing we have consistently seen is when you ask a user to set their prices on the marketplace, if you give them guidance, if you say like based off what you've said, here's what we recommend or here's the range you recommend,


[User] Please transcribe this text

[Assistant] 85, 90% of users will do that. And so if you want to set, if you want to sort of,


[User] Please transcribe this text

[Assistant] And then when they do, for the first ones especially, I would...


[User] Please transcribe this text

[Assistant] Like, be super involved just to learn what the issues are. Like, it may be that people aren't sure they're allowed to do this and they need help like looking at their current employment contracts. It may be that people need training to know how to like engage with a customer and like how much they should communicate. There are all of these things, uh,


[User] Please transcribe this text

[Assistant] Many of which will surprise you, and your guesses on many will be wrong. And the way you find this out is to just, like, for the first, let's say, 20 users, like, go sit with them, or at least go talk to them all the time.


[User] Please transcribe this text

[Assistant] And then you can just start building that into the product, but uh, in our experience almost every time when people think they know like where the breakpoints are going to be or what they need to teach their users, uhm, they're almost always wrong. But you find it out really quickly. It's like you don't need a giant sample set to start hearing the common


[User] Please transcribe this text

[Assistant] Concerns people have at every stage in the process and then you just knock those off one at a time and that is a way I think you can differentiate from other


[User] Please transcribe this text

[Assistant] And we're just talking about a small handful of users. Like, you don't have to bring on... Everyone's like, well...


[User] Please transcribe this text

[Assistant] It's a war, it's a slightly warring instinct to say that like my biggest problem is that I haven't built this one piece of the software yet. Not, not that my biggest problem is how I'm gonna get those 2,000 users.


[User] Please transcribe this text

[Assistant] My answer to that question, uhm, about your biggest problem would, would, I'm not worried about


[User] Please transcribe this text

[Assistant] The fact that you'll be able to get people that need developers to build something. There's a lot of people that have an idea for an app, you know.


[User] Please transcribe this text

[Assistant] The thing that I worry about is everyone, so often we've seen the idea of, I'm gonna get these great developers to sort of, you know, build stuff for other people. And it has been so hard to actually do that because...


[User] Please transcribe this text

[Assistant] Uhm, because there's something fundamental about the model that's going to change. But.


[User] Please transcribe this text

[Assistant] Getting people you don't know, or you don't know well, to sort of build projects on the platform, I think that, that should, that's a really important step.


[User] Please transcribe this text

[Assistant] Great. That's super exciting. How did you decide about 15% as the amount to charge?


[User] Please transcribe this text

[Assistant] And this is, you know, a good problem to have in the future. What will prevent people from, once they work with someone they like, just hiring them off the platform and not paying you?


[User] Please transcribe this text

[Assistant] Uh, so format wise, that was an experiment. Is that something you'd like us to do more of in the class? Was that useful? More regular lectures?


[User] Please transcribe this text

[Assistant] Yes, yes, some little- okay, we'll do some more about that. Uh, great. Thank you very much.


[User] Please transcribe this text

[Assistant] They can't transfer me! Not me! Oh, I can't breathe. I can't breathe. Darkness creeping in. I can't breathe. I can't breathe. Walls closing in around me.


[User] Please transcribe this text

[Assistant] Melman, you're not getting an MRI. Cat scan? No! No cat scan! It's a transfer! It's a zoo transfer! Zoo transfer!


[User] Please transcribe this text

[Assistant] Mailman, shut it. Does anybody feel nauseous?


[User] Please transcribe this text

[Assistant] And this is a really different way of thinking, actually, but we will use the same concepts as you have learned before, like induction and invariance, stuff like that, to proof of theorems. So what is number theory?


[User] Please transcribe this text

[Assistant] So number theory, uh, got, uh, uh, used actually in cryptography only about 40 years ago. And, uh, at the end of the second lecture,


[User] Please transcribe this text

[Assistant] You can imagine what we are going to do right here, right?


[User] Please transcribe this text

[Assistant] You guys have to save 6042. So we have the fountain here.


[User] Please transcribe this text

[Assistant] Each tennis ball is one gallon of water. We have a big jug, five gallons and three gallons. So you all got to help me out here. So who has an idea of what we can do?


[User] Please transcribe this text

[Assistant] And luckily we are safe, right? So you're safe. Thank God, 6042. And so we can continue. Uhm, so this is actually, uh,


[User] Please transcribe this text

[Assistant] Pretty amazing though. How can we get four gallons out of a three gallon jug and a five gallon jug? And that's what we are going to talk about in more generality actually. And uhm, if you would just change it a little bit, right, then things would get more difficult. For example, if you would change the five gallon jug into a six gallon jug, can we still get four gallons? No, why not?


[User] Please transcribe this text

[Assistant] This is a multiple of three, one times three, this is two times three, so if I do combinations with those, like pouring one into the other completely, or emptying, or filling up,


[User] Please transcribe this text

[Assistant] Uh, that you would like to analyze a little bit more and...


[User] Please transcribe this text

[Assistant] To do that we're going to first of all start with the definition. Actually you can put up the screen over here.


[User] Please transcribe this text

[Assistant] Uh, can someone up there, uh, pull up the screen? Uh, maybe not. Maybe later. Alright, so let's go with the definition.


[User] Please transcribe this text

[Assistant] We say and denote by m and a bar and a, we mean m divides a. And how do we define this? Well, we say that m divides a if and only if there exists an integer k such that


[User] Please transcribe this text

[Assistant] Well, any integer will divide a. Will divide zero. Why is that? Because I can take k to be equal to zero.


[User] Please transcribe this text

[Assistant] So this is equal to zero times any integer m. So m divides zero for all integers. So this is kind of the exception, right?


[User] Please transcribe this text

[Assistant] And we are going to use this to, uh, set up a theorem and analyze this whole situation over here.


[User] Please transcribe this text

[Assistant] Now in order to do that, we will need to, uh, sort of, uh, define what we can do with all this.


[User] Please transcribe this text

[Assistant] There are states, we will define a state machine.


[User] Please transcribe this text

[Assistant] We will see what kind of possible transitions we can have. And once we have modeled all this very precisely, we can start proving stuff.


[User] Please transcribe this text

[Assistant] Now let me first of all write out what our assumptions are. So suppose


[User] Please transcribe this text

[Assistant] So in our case, A equals three. And we have also a B-Gallinger.


[User] Please transcribe this text

[Assistant] And in our case, b equals five, right? And we assume that a is at most b. That is sort of the situation that we are working with. And he would like to prove a theorem.


[User] Please transcribe this text

[Assistant] Exactly what we noticed over here, the 3 divides both the 3 gallon jug and the 6 gallon jug, we would like to prove something like this. If m divides a, and also m divides b, well,


[User] Please transcribe this text

[Assistant] With the pouring and emptying and filling those jugs.


[User] Please transcribe this text

[Assistant] So this is the theorem that you would like to prove, and you can only do that if you start to have a proper model for this. So let's go for that.


[User] Please transcribe this text

[Assistant] And uhm, well, the state machine that we're going to use here looks like this.


[User] Please transcribe this text

[Assistant] First of all, the states that we have are


[User] Please transcribe this text

[Assistant] There's x comma y, and x denotes the number of gallons in the a-gallon jump.


[User] Please transcribe this text

[Assistant] Let me abbreviate that by the A jug. And y is the number of gallons in the B jug.


[User] Please transcribe this text

[Assistant] And the start state is exactly as it is right there. We have nothing in either of the jugs.


[User] Please transcribe this text

[Assistant] So now we start to build up some mathematics here, right? So we express this thing of this whole situation by a pair of numbers. Now we need to find out what we can do with it. So what are the transitions?


[User] Please transcribe this text

[Assistant] Transitions are, as we have seen, right, you can just fill.


[User] Please transcribe this text

[Assistant] We can do MTA? Well, how does that change a state?


[User] Please transcribe this text

[Assistant] This jug and y in over, and y gallons in that one, we can transition this into, for example, emptying the a gallon jug. So, we will have zero. Or, we can empty the b jug. Well, filling is something similar.


[User] Please transcribe this text

[Assistant] But now we are actually pouring in more.


[User] Please transcribe this text

[Assistant] Uh, water from the fountain essentially, right? All those tennis balls here. And we can fill up, say, the A gallon jug up to A gallons and leave the B jug as it is or


[User] Please transcribe this text

[Assistant] We can fill up the b-gallon jar and leave the a-gallon jar as it is. So these are these two transitions. And uhm, the pouring of one


[User] Please transcribe this text

[Assistant] Yeah, of one joke into the other is actually a little bit more complex. So let's have a look.


[User] Please transcribe this text

[Assistant] So how does pooling work? Well, uh, suppose we start,


[User] Please transcribe this text

[Assistant] With x and y, so let's have a look here.


[User] Please transcribe this text

[Assistant] Uhm, I don't know, suppose we have two balls in here and two balls in here.


[User] Please transcribe this text

[Assistant] Well, in that case I can say pour all of this over in here, right? So that's easy, but there's also another possibility,


[User] Please transcribe this text

[Assistant] When I pour all of this over in here, but hey, I can only put in one ball because this is only a three gallon jug. So I'm left with only one gallon in this jug. So these are two situations that we need to explain.


[User] Please transcribe this text

[Assistant] So let's first do the first example that I just did. I put everything over into the other jug. So, we have zero gallons left in here.


[User] Please transcribe this text

[Assistant] And that can only happen if there is sufficient space, right?


[User] Please transcribe this text

[Assistant] So this can only happen if x plus y is at most b. Which is the capacity of this b gallon jug.


[User] Please transcribe this text

[Assistant] Like, eh, this one of these can go in here. So that's the other case. So, uhm, x, y will actually go to, well, let's see how that works.


[User] Please transcribe this text

[Assistant] So we can take b minus y gallons out of this one to fill up this one. So let's do it. We take b minus y gallons out of the a jug and put it all in here and that makes it completely filled up. So we have b gallons over here. So this is really equal to x plus y minus b comma b


[User] Please transcribe this text

[Assistant] And this only, uh, is possible if, uh, if we are essentially in a complementary case. So, we have that x plus y is at least b, such that there is enough gallons in, uh, the a jug to be poured over to fill up the b jug.


[User] Please transcribe this text

[Assistant] So these are the two kinds of cases and of course by symmetry we can do also the pouring.


[User] Please transcribe this text

[Assistant] From the other jump into the first, so let's write all those out as well. So x, y can actually go to


[User] Please transcribe this text

[Assistant] I put everything from here to there.


[User] Please transcribe this text

[Assistant] Uh, beam, uh, A minus X gallons over from Y.


[User] Please transcribe this text

[Assistant] into this particular jug. And then this one is completely filled up and I have a few gallons left over here. So how does that look? Well, you completely fill this up, uh, up to its capacity.


[User] Please transcribe this text

[Assistant] And what is left is y minus, how much did we have to pour in here? Well, that's a minus x. And we again have a similar formula, but it now looks a little bit different. x plus y minus a.


[User] Please transcribe this text

[Assistant] And this is only for the case where x plus y is, uhm, at least A.


[User] Please transcribe this text

[Assistant] Okay, so these are all the cases. So maybe there are some questions about this. Is this clear?


[User] Please transcribe this text

[Assistant] That we have these different possibilities, like when we look at these jugs, we can either empty them, filling them up, or we can pour say only one bowl over up to the full capacity of this jug, or we can just pour everything over into say this jug.


[User] Please transcribe this text

[Assistant] So those are the different cases that are now fully described by the state machine. So now we can start to prove this theorem over here. So how do we go ahead?


[User] Please transcribe this text

[Assistant] Well, we're going to use what you have learned like, eh, induction and invariance. So let's do it.


[User] Please transcribe this text

[Assistant] But before, uh, actually we do this, let's, uh, take this example that we had and see how we can, uh, describe all the transitions that we just did as far as I remember them. So we have that a equals three, b equals five, right? We start with empty jugs.


[User] Please transcribe this text

[Assistant] Then we started, uh, pouring the five gallon jug as much as we could into the three gallon jug. So that's one of those rules. We got three and two. Then we emptied the three gallon jug. We got zero and two.


[User] Please transcribe this text

[Assistant] Then we did, what did we do next? Oh yeaah, we put everything into this one. So we have two zero as the next state. We filled up, uhm,


[User] Please transcribe this text

[Assistant] Actually, I forgot exactly what we did next, but I think we filled up the five calendar.


[User] Please transcribe this text

[Assistant] So, we always would like to write this out if you solve your problems. Uhm, what are we going to assume? Well, we assume


[User] Please transcribe this text

[Assistant] That's the assumption of the theorem, and now we need to prove that M defines any result that we can achieve in this state machine.


[User] Please transcribe this text

[Assistant] So what's the invariant that we are thinking about?


[User] Please transcribe this text

[Assistant] Invariant is going to be, uhm, oops.


[User] Please transcribe this text

[Assistant] It's a paraket, and it says something like, if the state, uh, x, y, if this is the state after n transitions,


[User] Please transcribe this text

[Assistant] M divides both x and M divides y.


[User] Please transcribe this text

[Assistant] So this is, uh, our, uh, our invariant, and we like to use this to prove our theorem. So how do we start usually, right? So we always start with, with a base state. Great. So let's, uh, do it.


[User] Please transcribe this text

[Assistant] It's pretty, well and we also had paid a little bit of extra attention to what we mean by division over here and we said that all integers


[User] Please transcribe this text

[Assistant] So uhm, actually divide zero, some particular m, and divide zero and zero.


[User] Please transcribe this text

[Assistant] So the very initial state, 0,0, is indeed, uh,


[User] Please transcribe this text

[Assistant] Let's write it out. So we have the initial state zero zero, we know that m divides zero, and therefore we know that p zero is, uh, true. So that's great. So the inductive step,


[User] Please transcribe this text

[Assistant] How do we start the inductive step, uh, step all the time?


[User] Please transcribe this text

[Assistant] And we will assume actually p of n, right? So let's assume that. And now we would like to prove


[User] Please transcribe this text

[Assistant] P and then n plus 1. So what do we really want to do? We want to say, well,