Skip to main content
Loading Explore guides…
Probability distributions bernoulli binomial · Acedra
Home
Explore
Mathematics
Probability distributions bernoulli binomial
Sign in to save
Chat
If YouTube asks you to sign in, open the video on YouTube.
Watch on YouTube
Reload player
Transcript
40 segments
Copy
Hide video
0:00
welcome back so we're talking about probability distributions uh and random variables X and today I'm going to introduce two of the most useful random variables uh the beri distributed random variable and the binomial distributed random variable and from binomial we're going to get uh the normal distribution Pon processes lots of really really really useful uh models of real world phenomena come out of these two basic basic uh random variables so let's get started um we've talked a lot about um
0:36
we we've talked kind of fast and loose about a lot of probabilities we've computed the probability of coin flips uh We've computed the probability of getting five heads in a row or getting at least five heads out of 10 coin flips we've talked about dice rolls and poker hands and all kinds of stuff we've made some kind of assumptions that um right now we're going to formalize so for examp example I've been assuming that my coin has an equal probability of flipping heads or tails so I've been
1:06
assuming that each of these has one into two or 50% probability um I'm going to start with the bernui random variable so a beri random variable x a beri uh random variable X can only take two values zero or one can take uh two values so we say that uh the range uh is either zero or one it can either be zero or one and I could pick I could say heads is one tails is zero or vice versa it's just about how you define it I could also Define my dice roll as a random variable if my random
1:54
variable is did I get a six on that dice roll if my random variable is whether or not I got a six on that dice roll the range would be a zero or a one zero means I did not get it one means I did get it okay so uh the range is either 0 to one this means uh my event does happen um and this zero means my event did not happen uh did not happen so I essentially have to Define what I mean by a successful event I got a six or I flipped ahead or whatever you know something like that so this I'm
2:35
just going to write down some examples this could be a coin flip um it could be you know getting heads it could be dice uh roll getting a six it could be if I have if I'm manufacturing a part let's say I'm manufacturing you know a composite panel or um some widget then it could be you know is my part a good part you know as opposed to a bad part one could be a good part zero could be a bad part okay and when I'm dealing with coin flips the probability of zero and
3:09
one are equal each one is equally likely if I have a fair unweighted coin but in general my probability um of X being zero my probability of X equaling 0 and my probability of X equaling 1 do not have to be equal my probability of x equaling zero uh we're going to call that P so in the case of a coin flip p is 1/ 12 but in the case of my dice rolling a six P would only be 1 and six and then the probability of uh oh I'm sorry I did this wrong the probability of X equaling
3:45
one of a success is p we're going to define the probability of X equaling one to be P um in that case rolling a six would be a one and six probability P would be 1 and six the probability of my event not happening x equals 0 is 1 minus p and sometimes we're going to Define that to be equal to a variable called Q so P plus Q equals 1 okay um and so with this this is a very very simple formalization of an idea we've been kind of dancing around a lot with coin flips and
4:20
defective parts and uh dice rolls and all kinds of things you know how likely it is to get a you know Ace of Spades things like that um but here we're just formalizing that this random variable has exactly two Val values um an event does or does not happen and those do not have to be equally likely um I can have a very likely or a very unlikely or an equally likely kind of split between these that's totally fine so lots of things can be measured by bernly random
4:50
variables um and you know these uh are pretty useful I actually use bernly random variables like when I'm uh programmed I will often create um a matrix of brly random variables because essentially it's a binary mask um I might take an image and I might you know with some probability P black out some proportion of those pixels um kind of randomly that would be a beri random mask um and then from the beri random variable you can get the binomial distributed random variable and this is
5:28
probably one of the most useful core foundational random variables and distributions in all of probability um a binomial distribution it's going to eventually limit uh to the normal distribution we'll see that in a minute but a a binomial distribution is what happens if you add up a bunch of beri random variables so if I do one coin flip that's a bernly random variable but if I flip my coin 10 times in a row and I add up how many heads I got that is a binomial random variable if I roll a
6:01
single dice that's a bernly random variable if you know if x is getting a six but if I roll that dice 20 times and I count how many sixes I got that's a binomial distributed random variable so let me write this down and Define it so uh if n independent beri random trials are performed beri uh beri random trials are performed and uh I'm going to call each of these beri random variables let's call them B1 B2 dot dot dot all the way up to BN these are independent so basically it's
6:49
NCoin flips or n dice rolls and each of these you know could be between zero and one with some probability either zero or one with some probability then the sum of these beri random trials is a binomial distributed random variable X so um let x equal the total number of successes of this being one total number of successes uh of successes and we're going to say that this is you know B1 plus B2 plus dot dot dot plus BN this sum of independent bernui random events is going to be binomial
7:35
distributed a binomial uh random variable so we're going to say formally the way we write this is we say x Tilda binomial and there are two parameters you need you need to know the number n and you need to know the probability P so you say it's a binomial distributed random variable with parameters n and p and with those two numbers that's all you need to determine all of the probabilities of X equaling 5 or of X equaling 3 and things like that okay so this is really really useful you'll get
8:10
used to the notation here we say x Tilda binomial we don't say x equals or X in we say x is distributed as a binomial binomial random variable with these parameters and specifically that gives us our probabilities of X that gives us the probability of x equaling some specific value K it's going to be and you can kind of rewind a few lectures when we actually computed this for you know coin flips and and card hands and things like that the probability if I have n coin flips um of
8:47
getting you know exactly K heads was n choose K okay this is like the the you know this is the number of ways I can get k a successes out of n bernui random variables now the probability because the probability of a success is p and not 1/2 I have to multiply this by the probabilities here of uh P to the K time Q to the N minus k um and this is it this is the probability of getting K successes out of n independent bernui trials with probability of success P um and the way you
9:30
intuitively understand this I'm just going to reason through this so there is a counting this is a combinatorial factor we are counting how many ways I can get K successes out of N and this is the probability of each of those successes it means K of them had to be a success so there's P to the power K and N minus K of them had to be failures non-success so that's Q to the N minus K so there's n choose K ways like ordered you know if I get uh heads Heads Tails Tails that's the
10:02
same as Tails Tails heads Heads if I'm just counting successes and there's n choose K ways of getting K successes out of n independent trials but now because we're not talking about coin flips if I was dealing with coin flips p and Q would both be 1/2 okay these would be equal but if I'm talking about dice rolls then p is 1 six and Q is 56s okay so you have to actually keep track of the probability of each of these ways you can get P successes or k successes good and so this is one of the most
10:38
useful probability distributions um around and we're going to see very quickly that as n becomes large this is really well approximated by a normal distribution or a Pon distribution okay so that's going to be super super useful for um you know what if I what if I roll a dice a fair ice 100 times what's the probability that I you know get 10 sixes you'd never want to write out the combinatorial problem but this is easy to compute and the normal distribution which this limits to is even easier to
11:14
compute okay good um so let's talk through some like really really simple examples here and then I'll write down some uh some summaries again um and actually maybe I'll write down maybe I'll do an example first and then I'll write down the normal distribution uh at the end so really simple example um we're essentially counting successes we're counting how many of these bernly random variables ended up being one meaning we got the thing we were looking for heads or sixes or good
11:44
parts or whatever so let's just uh do some examples of how to compute this thing uh for small n for nals 2 for n equals 3 okay so um I think I'm just going to do an example here um example uh let let's say n equal 2 so let's just compute the probability um and we're going to assume that you know our berly random variable has probability P of success and Q of failure and we're just going to do n equals 2 so the probability of X equaling zero zero successes essentially means I'm
12:22
going to use shorthand here it essentially means I'm doing two trials I'm I'm flipping two coins or I'm rolling two dice or I'm testing two parts it means that for zero successes for zero bernes equaling one for zero successes then I have to have a failure on my first trial and I have to have a failure on my second trial that's the only way I can get zero successes out of two trials and the probability of failure on my first trial and failure on my second trial they're independent so this equals
12:57
probability of fail on my first trial times probability of failure on my second trial and the probability of a failure for a brly random variable is Q so this just equals q^2 I can do the same thing for the probability that x uh equals 1 that uh is the only there there's two ways I can do that I can have one success either my first trial can be a success and my second can be a failure so so I can have success and failure or I can have failure followed by success and again
13:37
because each of these are independent random trials the probability of these two things happening is just the probability of each of them happening uh and this is so this is p success one time P failure 2 success of my first trial failure my second trial plus the probability of my first trial failing the probability of my second trial succeeding and I'm just using shorthand here I could be much more careful and I could say the probability of B1 equaling 1 times the
14:10
probability of B2 equaling 0 plus the probability of B1 equaling 0 times the probability of B2 equaling 1 if I wanted to be really careful that's what I would do but this I don't have enough board space so I'm using shorthand and you'll get good at using Shand too and these probabilities are easy probability of success is p * probability of failure is Q Plus Q * P this equals 2 p q finally the probability of X equaling two the only way I can have two successes is if
14:48
both of my berly variables were a success so this is the probability of success on trial 1 time success on trial 2 that's the probability of success on trial 1 times the probab ility of success on trial 2 and that's equal to p^ S okay I'm really heavily using this property of Independence here this is really really important because that's allowing me to take these these events and multiply their probabilities here and you'll notice that this is exactly what we have here this is the binomial
15:18
coefficients 1 2 1 time uh p² * p ^ 1 Q ^ 1 * Q to ^ 2 you can actually write out for Nal 2 and K = 0 1 and 2 and you'll verify that you get exactly these coefficients now remember um you could have gotten this using Pascal's triangle if I do like one one one one 2 one these are the coefficients from Pascal's triangle um the third row 1 2 1 if I wanted to do an example where n equals 3 this is actually a homework problem so you should do this you should like pause
15:58
the video and do this or do this after the video do this same exact procedure for nals 3 and the the coefficients will be again the coefficients from Pascal's triangle um three choose zero three choose one three choose two three choose three are going to be 1 3 3 1 and you can keep uh kind of writing this down and reading this off of Pascal's triangle eventually this is going to limit to a normal distribution so that's what we're talking about is in the limit
16:30
of large n we're going to start getting a normally distributed uh number of successes but you can verify and kind of confirm that this all works out and is tidy so if you wanted to do this do this for n equals 3 and then let's say the probability of you know X equaling one let's say I'll do one example for you so for n equals 3 the probability of X equaling one would be the probability of the only way you can get a single success is either success on the first one followed by two failures or
17:06
um a s a failure on the first one a success on the second one and a failure on the third one or a failure on the first one a failure on the second one and a success on the third one this is the only way you can get a single success a single successful bernly trial out of three and if you compute these probabilities I'm guessing you'll get something like 3 * P * Q ^2 3 * P * Q ^2 this is going to equal 3 p q^2 which is exactly what this formula would predict okay and you can fill out
17:43
the rest for xal 0 2 uh and three okay good um this is another exercise I think would be really good for you to do verify that these probabilities add up to one the sum of all of these probabilities over all the values X can take always has to add up to one that's one of the most fundamental properties of all of probability is that probabilities add up to one so convince yourself that these probabilities add up to one now the way I would do this is I would essentially say well Q
18:18
^2+ 2 PQ + p^2 Q ^2 + 2 PQ + p^ 2 is equal to Q + p quantity squared and Q + P adds up to one Q Plus p is 1 this is just 1 SAR so the probability of adding all of these up the total probability adds up to one in this case now you should verify for the N equals 3 case that the probability still adds up to one and generalize to the N you know arbitrary end case that the probabilities still add up to one and you get this really nice connection to the binomial coefficients and to
18:57
these polinomial P plus Q to the^ n um okay good I'm almost done I'm going to write out um in the limit of large n what these binomial uh distributions look like I'm just going to write out a couple more examples for you um how you would actually write this this was just some like you know checking details and doing some some basic calculations um but let's say like you know example uh what's the probability of getting what's the probability of getting three sixes on 12
19:30
dice rolls of getting three sixes on 12 dice roles so a success means getting uh six so we're going to add up 12 berly variables where the probability of success is one6 in each case so that means um that my random variable X which is the number of sixes on 12 dice rolls X is going to be binomial with 12 trials with Nal 12 and a probability P of success of each of the trials is 16 so X is a binomial variable the number of sixes on 12 di rals is a binomial variable uh
20:16
with parameters 12 comma 1 16 and so I could compute the probability that xal 3 probability that xal 3 um is a essentially I just plug in this formula that is just uh 12 chose 3 * 1 6 to the^ 3 * 5 6 to the^ 9 and you can crunch through this on you know your calculator type it into Google do it in Python it doesn't matter uh you know you'll find some number I don't know I don't know what the actual probability is but you can compute this and it's a number it's a probability ility of three sixes
20:59
in in 12 dice rolles it's a very simple formula you can type this out and get the answer okay good um last thing I want to show you so zoom out a single trial of a random variable that could have a success or a failure so you define U what that means so even if my dice roll there's six things that can happen I can Define what I mean by success to be I roll a six or I roll a one and then that establishes a brely random variable where it can only be success or failure with some probability
21:35
and then if I add up a bunch of those bernly random variables I get a binomial distribution which has a very simple compact formula that I can use to compute these probabilities if I actually wanted to enumerate this to count this the oldfashioned way it would be a god- awful mess like it would be pages and pages of of terms this is way simpler to compute because you know it's a binomial distribution and in the limit of large n these binomial coefficients this binomial
22:03
distribution is going to start looking a lot like a smooth normal distribution like a gausian bell curve kind of distribution and so that's the last thing I'm going to show you is that for large n uh essentially as n goes to infinity or n gets large what we have is we have our binomial uh our binomial distribution starts to become so our binomial which is with parameters n and p so I'm just going to draw this really really carefully if x is binomial uh with parameters n and p then for n large
22:46
this starts to look a lot like a normal distribution a gausian distribution with um the mean equal to NP this is the expected number of successes is the number of Trials times the probability of success and it's going to have a standard deviation which is root n PQ this is going to be the spread in the distribution okay so for large n this starts to look like a normal distribution which is really really convenient to calculate with we're really good at doing math on normal
23:19
distributions and we know a lot about these they're really wellb behaved uh distributions so that's if n if p ah this is if n * P * Q is not too small so success and failure are not too rare then this is absolutely going to be true if n * P or n * Q is small then this would limit to a pan distribution then X would become a pan random variable with parameter Lambda where Lambda equals n * P if uh NP or NQ is small so these are two of the most important useful distributions in all of
24:10
probability and statistics are the normal distributed random variable and a pan distributed random variable there what happens when you have um kind of these binomial distributions with either rare events or really really large n um and not to rare events and we're going to the next two lectures we're going to talk about each of these two distributions how to use them and examples of real world phenomena that are actually distributed like normal and Pon random variables okay thank you
Here to help you learn
Sign in to keep a private conversation with your course tutor.
Ask me anything about the material…
Sign in to chat