1. Home
  2. Explore
  3. Computer Science
  4. Continuous Random Variables

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Continuous Random Variables

Transcript

good afternoon cs19 how are you guys doing today fantastic that's what I like to hear um we have a wonderful wonderful class ahead of us we're going to learn a very critical idea once again we're going to be learning about continuous random variables this is cs109 before I jump into things I this is a random photo of my baby but I was just like heart melted and I just thought I would share which is really not the important thing though maybe the important thing is it's a Friday so I like to start Fridays with just a nice story from Life um and the story I was going to tell you is actually not related to this photo um though I guess the short story is like my day starts normally at six again this morning I started at 5 45 a.m I like feed the baby I dance party with the baby this is like such we do she calls it Yoda but she means yoga into like we're gonna do our stretches it's a fun way to start I recommend it anyways but the story I was going to tell you

guys today was actually an interesting story from my own life um you guys may or may not know this but I am legally blind in one eye and the story behind that is quite interesting uh when I was 11 years old I was living in uh Kenny at the time and I I believe I was with my parents and they were like pointing something out and I was like should I look out of my good eye or my bad eye and my parents like what like you're not supposed to have a good eye in your mouth I thought everyone had one uh and so I was like yeah I can't see on my left eye and they're like we should actually probably look into that um a long story short something happened to my left eye it was a disease and not contagious don't worry but the thing that happened to my left eye was gonna happen to my right eye and eventually a doctor in Nairobi figured out exactly what it was and and they figured out how to get me the solution it was a little late for my left eye though because it'd been bad for a long

time but then at one point my vision my right eye went as well but because this doctor had figured out what had gone wrong they gave me the solution which is an injection into the eye which is not the most fun thing but you know I get to see because of it uh he was able to give me that solution exactly when I needed it so I was able to keep Vision in my right eye and I can see just 2020 out of my right eye and you know on some level in the left eye continues to be a pain because it's been so long without being treated it just like causes all it's my problem child I um and despite the fact that this has been something I've had to deal with my entire life and of course it'd probably be more fun to see out of both eyes and there's always the risk that I will go blind it has been the most wonderful silver lining in my life and I don't know how to express it but I'm going to try there is something about being a middle schooler where it's hard to appreciate

life like you just like oh middle school is hard but I had this weird experience at Middle School where I was like whoa I'm supposed to not be able to have one of these primary senses and yet I do and so I have this appreciation that was a big part of my life uh when you know I there's a lot about middle school not to appreciate and then there's other silver lines that have come from it I certainly feel like I I really do a lot of things much better and a really small Silver Lining is I came to Stanford and of course there's doctors helping me to make sure it doesn't happen to my right eye and to keep track of the left eye and there's this time when this doctor is about to do surgery on my eye he's doing like a pre-op he's talking it's like oh what'd you do I'm like oh you know I'm a uh I was a PhD student at the time so I'm a PhD student he's like oh what do you study I'm like I study um artificial intelligence like tell me more and then of course because

the Stanford we started a collaboration we've written like three scientific papers together we just like have a good time we like nerd out about eyes and and probability and it's just been the most fun Stanford experience so there's really the strange disease I have somehow been a nice little light in my life and I think one day my vision might just go and I still believe when that happens I'll still feel like okay that's the cards I've dealt and it's been such a blessing in such a lot of different ways so anyways that's my Friday story fruit of the random tree as my friend would call it and that's the only connection I have to cs109

I have a hook for you guys today this is an extension of a problem we thought about on Wednesday so on Wednesday we learned about the poisson distribution and we can ask ourselves what's the probability of certain numbers of earthquakes within a year but there's a different spin on that problem it was probably more relevant to us we want to know what the probably at Stanford of an earthquake within the next four years and as that slight difference spin will lead to a different answer it's going to force us to understand continuous uh probability uh problem probabilities over continuous space okay um oh quick question does anyone know what this is a photo of yeah at Stanford and there's like mem2 but it's got this weird tower and this is like from the front of the quad and it's got this this strange shape to it and that's what Stanford looked like before 1906 when there was a magnitude seven point Earth eight earthquake which took down this Tower and took down this

gate at the beginning of Stanford okay well we're going to want to be able to answer questions like that but of course we have to learn some new things to get there so let's learn some new things and it's going to build on some old Concepts we've had certainly we're in this part of cs109 or one of the core things for you to learn is this idea of random variables and the first random variable we learned was the binomial random variable it's a metaphor that comes from coin flips imagine if you have n independent coin flips every coin flip has the same probability of being heads the random variable is going to represent the number of heads you got in the more General story it's the number of successes within an independent trials such a useful thing that we've called it the binomial random variable as soon as you define something to be binomial random variable you inherit a probably Mass function exploitation variance we've gotten very good at this

it also has like the little sister the Bernoulli random variable which is like a binomial with just one coin flip more useful for proofs later on then on Wednesday we bumped it up a notch we said let's learn a new random variable we learned one of the most beautiful interesting natural random variables the poisson random variable which says if you think about a fixed amount of time what's the probability of getting exactly K requests and the magical story from Wednesday and if you missed Wednesday class that's an incredible one to go check out it's that if you just give me an average number of equate of requests per minute because of the poisson process and all the things that we can derive with mathematics we can know the full probability Mass function for the number of events within one fixed time frame that's so much that you get from so little if you just tell me a rate you immediately inherit this beautiful graph um and all of this is on the course

website you know we have all these random variables that we've learned about today's goal though is to change your understanding of random variables from I'm going to drive them one at a time to let's say somebody tells me about a new random variable can I learn it quickly and can I incorporate many random variables into my vocabulary So today we're going to learn not one random variable not two random variables but we're going to learn one two three four random variables in one day the learning goal really is then how can you learn a new random variable one of the points of random variables you don't have to redrive all the math to use it if somebody says this is a random variable you get to inherit all the math that they've done and I want you guys to be able to work with random variables that you haven't derived and let me give you a very real situation from your future U has gone deeper into computer science you are learning more you are thriving

having a great time and learning about servers well a big thing for servers is how long a request has to wait in a waiting area area before it gets served and if you learn about it one of the most popular algorithms is this md1q and in md1q if you learn about it they talk about how long a request is going to be in the queue and they talk about it as being distributed as a Borel with parameter mu and 0.2 and at this point you're like I took 109 and they never taught me the Borel hopefully what we

teach you at this point isn't every single distribution but rather how to learn new distributions quickly so if you looked up the Boreal Distribution on Wikipedia it would give you all this information and from this information it would give you all the most critical things and after 109 I want you to be able to read this Wikipedia page and know exactly what you need to be able to follow along the conversation about the md1 algorithm what you really need to know is the story what leads to it that's the equivalent of a binomial is n coin flips so a boreal has a story you should understand that and then you want to understand these equations too a probability Mass function that's the relationship between the values the Boreal could take on and its probability you want to know the mean and the variance and Wikipedia gives all those to you you might want to go drive them yourself but more likely than not you just want to understand this algorithm

and you might be using these equations without derivation so does that sound good there is a learning goal for you guys future you is going to be so appreciative that you uh worked on the this learning goal today okay sound fun everyone's curious about servers now aren't they okay good times so this is our goal for today we're going to flesh out all of these random variables you already know a Bernoulli and binomial but I'm now going to teach you uh or in Plus on but I'm not going to teach you a geometric and a negative binomial and then we're going to learn an exponential ready for it we're going to do two quickly and your goal is to incorporate them into your vocabulary random variables so that we can start to solve problems okay geometric random variable if I could give you a metaphor imagine a Pokeball if you don't know what a Pokeball is it's unrelated to the food it's like this little thing that you throw and you catch a Pokemon and you

throw it and you might catch a Pokemon or you might not so you might have to throw a whole bunch of pokeballs before you catch a Pokemon if that's not working for you then how about this a geometric random variable is one that's distributed as a geo with probability p and here's the narrative it's the number of independent trials until your first success p is going to be the probability of success on every single try so the one way of reading this is coin flips it's like a binomial says you have n coin flips how many heads did you get a geometric says how many times did you have to flip that coin until you got your first heads it solves a slightly different problem though related so you might say like you know how many um how many server requests do I have to send before one lands or how many pokeballs do I have to throw before I get a Pokemon it can take on the values one two three up to Infinity has to be discrete because you can't flip a coin 2.5 times and why can't it be zero

a lot of our other random variables could be zero what's wrong with making this one zero how are you going to get of heads if you flip the coin zero times come on not gonna work so very good point can't be zero I am going to point out this Pro tip if you're learning a new random variable thinking about the values it can take on is such a grounding way to get yourself oriented and think about why can't it take on 2.5 why can't it take on zero so as soon as you buy this story you could then go and drive it this is one you definitely could have derived yourself you know what's the probability that it takes you n coin flips to get ahead well that means you've got n minus 1 Tails followed by head you could have derived this probably Mass function it would have been a little bit more annoying though to derive expectation and variance maybe expectation is not so bad but variance certainly would have been quite a lot of work if you wanted to drive it from scratch

so I'm giving you a brand new random variable and anytime you feel that you can match this narrative you have these three tools you can work with does that sound good because I'm not going to stop there I wrote it down over here so you can follow along I'm going to introduce you to one more before we start solving problems you're like I don't care about catching one Pokemon I want to catch them all so the negative binomial that's awful it's how many independent trials not until one success but until our successes so it's like how many times you have to flip a coin until you get r heads and there's some problems that really nicely fit this narrative again we're gonna have the coin metaphor where p is the probability of success on each trial they're all independent every trial has the same probably P of giving you a heads in this case what's the problem that x equals n well if you say like five here you're saying what's it probably took five coin

flips in order to get our successes hopefully R is something like three less than five well you have all these different places where you can put your successes you have the probability of success the probability of failure um and you know you could go and think about driving this but the point of today's class is to be able to use something that someone else's drive for you so as soon as somebody gives you a random variable you have the valid numbers it can take on you have the probability Mass function that's the relationship between assignments and probabilities and you get expectation and variance okay now do you have to memorize all these no cs109's midterm and final will be open book anytime in the future when you need to go references they will be somewhere and for actually one of the places uh one of the places that you can find them if you go to the course reader I made this section called random variable reference and you can just go see each of your favorite random

variables and you can be like oh hey um that negative binomial here's what it looks like you can put in different values for r you can put in different values for p you can see the probably Mass function expectation variance you don't have to memorize them you need to know conceptually what all these things are you have to know what pmf is expectation variance and you need to know how to match the real world to the stories that it tells does that sound good yes subscribe again

ah so there yes let me try and tell you the story uh and talk about how they're different in a binomial you declare ahead of times how many times you'll flip a coin you say I'm going to flip it 10 times and I care about how many heads it's a different situation for the negative binomial negative binomial says you're not going to just do 10 you're going to keep going and you'll keep going until you get r this number counts number of successes this counts trials until successes so they're both talking about coins they're just counting different numbers they're representing different values uh based on those coins yes oh that is such a good question I think it has to do with the probability Mass function because it has um binomial coefficient in it but let me double check I'm pretty sure that's it but I haven't checked that I think I asked that question myself like 10 years ago I can't be positive that's exactly it uh would you mind double

checking let us know if I got it wrong cheers okay question exactly the probability that we're covering the probability of like with success so in this case you tell me the probability of a heads so the parameters are what you tell me and what I'm calculating are these things so you tell me what's the chance of getting ahead and I tell you what's the chance of a certain number of Trials until our successes so you know this probability Mass function if you see probability let's

say x is a negative binomial x equals three that's a probability question it's asking what's the chance that the trials until our successes takes on the value of three good question and it's assuming that X was defined and when you define X's you had to say two things you had to say how many successes are you looking for so I'm looking for say like two successes that's r and you have to say the probability of success on every single child if it's a coin maybe it's one half

yes it's very deep reason why the expectation and variance of the negative binomial are exactly our times the expectation experience of the geometric random variable there is a deep reason we're going to get into the derivation uh at some point but just to give you a little bit of a hint if x is a geometric let's say x i is a geometric you can think of Y which is a negative binomial you can say Y is the sum of X I's so it's like time until your first success plus time until your next

success time will tell you so it's a sum of random variables and because it has this property lots of parallels will show up but if you didn't follow along on that not that important but it would be helpful if you want to do derivation more questions I love these questions this is great yes the value of R here it takes a maximum value of anything yeah it kind of flips a little bit I would say n takes on a maximum value of R because R is how many successes you're looking for oh wait sorry sorry um no n must be larger than R sorry R is how many successes you're looking for n is your number of Trials number of Trials must be greater than number of successes second equator or greater than equal it could be greater than equal to like if you're looking for let's say R is three I'm saying how many trials until three successes n is how many trials I ran and it could be three it could be three you're just like success success success drop mic I'm out of here totally possible

okay now the interesting thing here is I'm going to give you some problems they're going to be using some combination of binomial poisson geometric negative binomial and I want you to see if you can find the story that you think matches um if that's interesting to you okay and certainly I want you to know that you can visualize these you can use these equations a little gift from the TA team to you okay let's start with dating at Stanford person you date has a 0.2 probability of

being someone you spend your life with Wow wonderful I made that number up what is the average number of people one will date and then what's the standard deviation and of course recall that the meta goal here is to think about what steps would you take to answer a question like this practicing the art form of taking a question finding the random variables and then using the proper equations associated with those random variables so talk about what the person next to you you have a point zero zero zero zero zero one probability of that person being the person you spent no I'm just joking just talk about with the person next to you something

okay now you might be at the point where you're plugging in equations and if you've gotten to that point you win right just basically you could use there's all those equations I've written are in Python you could just plug it into a calculator the goal is can you get to the point where you know the equation that you're supposed to be using as I said almost always we're going to be defining random variables when we see new problems and this time I helped us out I'm going to say there was a pretty clear random variable in this question which is the number of people that you're going to date until you find the one so that's the random variable I Define but the next step should often be tell me about that random variable it may be one we've never seen before and you have to derive the probably Mass function from scratch but ideally you can declare that it fits one of these narratives did somebody find a narrative that they thought fit nicely find the number of people you

use model as a geometric okay I very much agree what's the probability of success on every trial you must give that to define a geometric okay its number of coin flips until you get your first head and we're just going to say you have a probably 0.2 of getting heads on every coin flip now as soon as you've done this then you can answer these questions what's the average number of people one will date What's that question asking saying what's the expectation of x and at this point you know it's a

geometric and you can just look up the expectation of a geometric expectation of geometrics is going to be 1 over P so it's going to be one divided 0.25 fantastic so 1 divided by 0.2 and then the next question is what's the standard deviation so like what's the square roots of the variance of x and then again we can say you know what is the variance of a geometric random variable it's 1 minus p divided by P Squared and the standard deviation is just going to be the square root of that variance

so did you have to derive that this is the equation for people that you date no you just recognize that this is another instance of the story we've already learned so fantastic the learning goal is really this then this then Define the question and then you'll be able to look up your equations let's take this for a spin okay another one that's worth thinking about this is actually an interesting one sent to me by a student who once took cs109 Justice Breyer who is a Stanford Alum was on the Supreme Court and they had this question about whether or not a jury selection was biased and how people chose the jury selection and particularly they were thinking about whether or not a minority group was represented enough on a jury so somebody was saying this jury was selected unfairly because of it was completely white and so that was what they were discussing and it was coming from a particular Community where they knew the demographics of the community

Justice Breyer hypothesized a scenario involving um you know well a thousand balls 60 are blue and 940 are purple so that imagines the the demographics from which people were selecting a jury if you select 12 from this earn what is the probability of getting all of them being one particular color uh Justice Breyer then says something like you would expect something like a third to a half of all juries to have at least one minority person on them and they said looking at this uh particular region and looking at their history of juries they've been clearly choosing them in a biased way interesting Supreme Court involves the Stanford alumni and it involves some probability so I suppose my question for you guys is sorry he says something

he invoked sorry I I didn't okay he invokes the binomial theorem he says in his defense he actually said this can be represented as a binomial random variable so can we do that can we represent the number of people on a jury who are coming from the minority population as being a binomial random variable so it's a x equals number of people from minority and he's claiming that or this is why Y is distributed as a binomial in a binomial people number of people on a jury in a binomial have to give an n and you have to give a p in this situation set up in front of you can you guys figure out what n is and what p is I'm just going to give you guys a hot minute to think about this think about it for a second and then we'll think about together

okay hopefully thinking about this you understand that he's talking about the number of people on the jury so it's like you have 12 coin flips and he's saying every coin flip you have a certain probability of choosing somebody who's not from the white majority in this particular region so what's the probability here of getting somebody who I guess he has this story of uh a thousand and sixty are from a minority so the probability of any one person being chosen uh who is a minority is 60

over a thousand you can then ask the question what is the probability that y equals zero and I believe I wrote this up I love writing things up it's so fun when we get to do that oh my computer is being slow today not scrolling wow we're already onto machine learning that's exciting Cherry selection okay so I'm going to simulate this you know we're going to flip 12 coins and what's the probability that they all come back purple is the question that he's posing in his Supreme Court guess it's possible to come back all purple but uh it's certainly not that likely

so this was the defense's argument you're like it's just like it just happened by chance we were choosing all these juries and they just always came back all white but then you can look at the distribution of their juries and it doesn't fit the distribution it should have been now this is the answer that uh Justice buyer talked about prob it's a binomial there's 12 coin flips every probability every coin flip has a 60 over a thousand chance of coming up as in his metaphor a blue coin and he says what's the probability of X being greater than one and you can solve that as 1 minus probably that X is zero and we can just use the prime minimum pmf and it says about 52 percent of juries should have at least one person who isn't from the majority class now if you just look at two juries it'd be really hard to talk about bias but they looked at all the distribute all the juries in history and they said it's way way less than 50 okay there you go there's a jury

that's not all white and you imagine about 52 percent of juries would look like this so very interesting very interesting that he referred to the binomial distribution he was wrong with his probability he said a third to a half but really it should be over 50 which went you know like they got some bad math in a Supreme Court decision kills me okay yes question I'm so glad you asked that okay I'm gonna just pause and talk about that for a second the binomial distribution here is not a perfect story because in the binomial distribution every time you flip a coin you have exactly the same probability of getting heads and this isn't quite the case because after you've flipped a coin here you now only have 999 people to choose from this probability will change not very much because when you that dinar becomes 999 it won't be that different but it will

change over time which breaks the Assumption the binomial so the binomial distribution is wrong but if you guys were curious one thing that we don't go deep into in cs109 is there's this other random variable called A hypergeometric and A hypergeometric allows for exactly this sort of change in probability where every time you pull a ball out of an urn your probability of pulling that color decreases slightly if you're really curious to learn about hypergeometric you would make my day and then you could go learn about a hypergeometric put in all the parameters from this problem you could get the hyper geometric probably Mass function and look at the answer you get using the correct random variable you get 0.5261 and using the binomial which is a slightly wrong wrong assumption you get 0.5241 what's the takeaway from you guys there binomial does assume probably stay constant so you were right in recognizing that this was violating it

the next takeaway is if you violate that assumption just slightly you're going to do just fine um and then the third one that the world is filled to the brim with one around wonderful random variables and someone in this class may discover their own because maybe you'll be doing some research or starting a company and something interesting will come up and you're like huh no one's ever talked about this particular random variable and then you'll have your own and you can name it after me no I'm just joking you should you don't get to name it after yourself someone has to do that uh so like you would you wouldn't call it like I don't know maybe discovers one he wouldn't call it distribution someone else is like not that important geometric random variable because what is it's really it's not that related to the geometric right it seems like a hyper binomial would have been a much much better name and that I'm curious about too I'm gonna check us out

and tell us why is it called the hypergeometric it's nothing to do with the geometric hypergeometric looks a lot like a binomial and basically nothing like a geometric so I these people should just name it after themselves so okay uh long story short you can declare a random variable if you declared a binomial random variable with these particular parameters you wouldn't just know the probability of getting a jury with zero people you would know the whole distribution so here's the problem zero here's probably getting one person probably getting two people probably getting three people you can certainly look at all the juries that have zero people and say that something's wrong but you could also use all this extra information that you have to go deeper if you're interested okay we got the demo I'm going to keep throwing problems at you so we can practice taking the real world and finding the random variables my next one comes from Bitcoin mining if

you guys haven't heard of bit behind my I do not know where you've been living but maybe you don't know the algorithm for Bitcoin mining the way the Bitcoin mining works is they're going to give you this hashing algorithm called Shaw 256 and they're giving you a chunk of data and then you get to choose a bit string and when you put these two things through shot 256 it should give you a number back shot 256 is going to give you a number back that you should interpret as basically random zeros and ones but you win you mine a Bitcoin you get I don't know what that's worth twenty thousand dollars now I think you get like twenty thousand dollars if for a particular challenge you're able to produce uh assault that leads to a um a random looking series of bits that start with G zeros so if G was one you can imagine like every time you try a number you'd have a 50 chance of mining a Bitcoin but if G is larger you'll have a smaller probability and we're just going to

think about that a little bit you might be able to solve some of these problems just straight but I do want to challenge you to think a little bit about random variables but sometimes you don't need a particular random variable sometimes you can just solve it straight real problem from a midterm in case you're curious okay the first one what's the probability that the first thing you try will produce a bit string which starts with G zeros so it's basically asking if you Generate random zeros and ones what's the chance that your random zeros and ones start with G zeros lots of ways approaching this one certainly you could do this one without a random variable but but just to show you what looking at the world like is like three random variables let's give it a shot in fact I'm not going to push you to too much to think about this one because I think a lot of you guys can just think about look at this and say the probability is one half to the power of

G the chance that you produce a random bit string that starts with G zeros is a chance that you get a zero followed by a zero followed by a zero since each one's independent you can just imagine multiplying those probabilities but I did want to show you guys being super formal and finding this in terms of random variables so I'm going to say x is my number of zeros in the first G bits and in my world now every bit is a coin flip it could be a one it could be a zero

X is going to be the number of zeros in the first few bits and therefore because it's the number of heads and coins or G coin flips it's going to be a binomial where n is going to be equal to G so the number experiments is given to us as this number G and the probability of getting a zero on every experiment is 0.5 and then this question is just asking what's the probability that the number of zeros in the first G bits is equal to zero and I can just use the binomial probability Mass function which leads to this thing that people could have derived without a random variable okay just a little bit of warm up how about this one this is one where it'd be super hard if you didn't know about random variables I'm going to give you guys a moment to think about what's the problem that you'll need under a hundred attempts to mine two Bitcoins this answer we're going to call probability a that's the probability of mining one Bitcoin on any attempt

so it's like a slot machine every time you pull the slot machine this is the probability of you winning my question is what's the problem that you'll need less than 100 pulls to get two Bitcoins questions about what I'm asking every bit is going to be a zero one and you get a Bitcoin only the first G bits are all zeros why can't you just like enter here oh because you don't get to make the bit stream you get to like basically pull the shot 256 lever and it's going to give you back a bit stream

equal to oh man I was just like I made this example I brought it into slides today and that should have said the probably that x equals g because if G is the number of zeros you want to have G zeros oh man and then I have to do all my math again but guess what this is not going to be G choose G and it's going to be one half to the power of G times one half to the power of zero this only works out if G choose G is equal to one but guess what if you have G items and I say choose G items how many ways can you do that yeah good times okay so that does that one that was a great question that was a typo on the slides this should have been equal to G question for you guys what's the problem you'll need under a hundred attempts to mine two Bitcoins I'm going to give you a whole whop in two minutes to thinking about this don't try and give me the number but try and do the process Define the random variable uh tell me what the questions asked in terms of random

variable and then we'll just think what equation do we want to use okay go for it okay I want your guys's answer to start with this these three words you can choose why if you don't like X but I want to start with let X be and then I want to define something that the problem's asking about and it's asking you know um 100 attempts to mine two Bitcoins I want X to be some number that that question is referring to anyone who hasn't said anything they're like I want to share I want to tell the world yes be the number of Bitcoins behind versus 99 cents

it was probably you need under oh that would definitely solve it oh my gosh that's such a good way okay X be the number of Bitcoins mine uh in the first you say a hundred what was your 100 or 99 at any times uh okay 99 number of Bitcoins mine in the first 99 steps this is interesting okay and then what's the problem what's the question asking like now let's write the problem the probably a question like is this asking the problem that X is the number of Bitcoins minus first nine nine steps is it probably that it's asking the probably that x equals greater than or equal to two

okay you guys let's think about this for a second X is is a good answer slightly different than how I approach it but I think you might actually get to the same answer let's double check let X be the number of Bitcoins that you mine in your first 99 steps so you're saying I'm going to flip why not a hundred s under 100 okay so I'm going to flip 99 coins uh every coin has uh every coin has a probability of coming up heads of that we've got PA and you can say what's the problem that X is greater equal to so then you say x is a binomial like n equals 99 and P equals PA probably X is greater than two

Bitcoins or two or more um exactly two Bitcoins yeah but if you find more than two Bitcoins in 99 attempts and that means you get to two Bitcoins before and I think I buy that so I I agree that has to be greater than because you could get more than two Bitcoins and you want to count that I buy that that works it's a different way than I thought about it but I actually do think this will get to the same answer did somebody have a different approach for this did you have a different random variable declared yes

until two Bitcoins okay then what's the problem asking is asking the probability that X that X is less than 100. the x is less than 100 okay and then finally what is X the big reveal it's uh it is a negative two successes okay where R equals two and what does p equal I think it's one it's one half to the power G it's the thing we defined in in problem a this is how I approached it and then you can use probably that X is less than 100 you can just use the negative binomial equation

uh and I think this also answers the question of why negative binomial gets its name because I do think that is this relationship that people are referring to in the name but I think these are two different solutions to the two different good solutions to this problem yes yeah okay um and and this should say two Bitcoins so I've typed over there um so let's talk about this your question is number of attempts until you get to two Bitcoins X can't be zero good point also X can't be one you can't have one trial uh technically this this is a more elegant solution but technically the probability of zero is zero and the probability of one is zero so you'd just be adding two zeros to this which would get you the same number but I think this is a much more elegant way of writing it good good shows them Insight yes

because if the number of tries until you get two Bitcoins if you pull it once and you get two Bitcoins like what it's time to be alive just like retire from Stanford enjoy your new yacht okay why is the the why does the Sun go up to 100 instead of 99 sloppiness they let you become a professor even if you get off by once okay um and certainly I really appreciate so two different approaches totally fine and two very good ways of seeing a problem and recognizing the math behind it

for the expanded answer for the binomial would it just be the sum of that after like when X is equal to two that's such a good question how would I actually do the next step here I wouldn't do the probably two plus three plus four plus five because that feels onerous I would do one minus the probability that x equals zero plus the probability that x equals one and it says the probably that X is greater than equal to two so these are the only two cases that don't count and this seems like less work to do but good question okay I was going to give a pedagogical pause this is your chance to like summarize what we learned about we have long lectures I want you guys to have a break so take a moment if you guys have questions please do ask me otherwise try and summarize we've talked about four new four random variables at this point try and see if you can get your head around what they all mean okay yeah

okay do you guys like the pedagogical positive do you guys like having a moment just to relax in the middle lecture you're not okay yeah they're long lectures just so much probability to know uh we get to have a wonderful conversation right now we are at a beautiful point where I really think I could give you any discrete random variable and you could run with it you could probably read it use this probably Mass function and start to solve problems and you could really quickly go from knowing four

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent