If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

# Mean and variance of Bernoulli distribution example

## Video transcript

let's say that I'm able to go out and survey every single member of a population which we know is not normally practical but I'm able to do it and I ask each of them what do you think of the president and I ask them and there's only two options they can either have an unfavorable rating unfavorable unfavorable rating or they could have a favorable rating or or they could have a favorable rating and let's say after I survey every single member of this population 40% 40% have an unfavorable rating and 60% have a favorable rating so if I were to draw the probability distribution the probability distribution is going to be a discrete one because there's only two values that any person can take on they could either be have an unfavorable view or they could have a favorable view or they could have a favorable view and 40% have an unfavorable view 40% have an unfavorable view and let me color code this a little bit so this is the 40% right over here so 0.4 maybe I'll just write 40% right over there 40% right over there and then 60% and then 60% have a favorable view have a favorable view 60% let me do color code this 60% have a favorable view and notice these two numbers add up to 100% because everyone had to pick between these two options now if I were to go and ask you to pick a random member of that population and say what is the expected favorability rating of that member what would it be or another way to think about it is what is the mean of this distribution and for a discrete distribution like this your mean or your expected value is just going to be the probability weighted sum of the different values that your distribution can take on now the way I've written it right here you can't take a probability weighted sum of U and F you can't say 40% times u plus 60% times F you won't get any type of a number so what we're going to do is define U and F to be some type of values so let's say that U is zero you is zero and f is one and now the notion of taking a probability weighted sum makes some sense so the mean the mean or you could even say the you could say the mean well I'll just say the mean of this distribution is going to be 0.4 it's going to be 0.4 that's this probability right here times zero times zero plus plus 0.6 plus 0.6 times 1 plus 0.6 times 1 which is going to be equal to this is just going to be 0.6 times 1 is 0.6 0.6 so clearly no individual can take on the value of 0.6 no one will no one can tell you I 60% unfavorable and 40% M unfavorable everyone has to pick either favorable or unfavorable so you will never actually find someone who has a 0.6 favorability value it'll either be a 1 or a 0 so this is an interesting case where the mean or the expected value is not a value that the distribution can actually take on and so you know it's a value some place it's a some place it's a value some place over here that that obviously cannot happen but this is the mean this is the expected value and the reason why that makes sense is if you had if you surveyed a hundred people you'd multiply 100 times this number you would expect 60 people to say yes or if you sum them all up 60 would say yes and then 40 would say 0 you sum them all up you would get 60% saying yes and that's exactly what our population distribution told us now what is the variance what is the variance of this population right over here so the variance let me write it over here let me pick a new color the variance the variance is just you could view it as the probability weighted sum of the squared distances from the mean or the expected value of the squared distances from the mean so what's that going to be well there's two different values that anything can take on you can either have a 0 or you could either have a 1 the probability that you get a 0 is 0.4 so there's a point for probability that you get a 0 and if you get a zero what's the difference what's the distance from zero to the mean the distance from zero to the mean is zero minus 0.6 or I can even say 0.6 minus zero same thing because we're going to square it zero minus 0.6 squared remember the variance is the probability or the the weighted sum of the of the squared distances so this is the difference between 0 and the mean and then plus there's a point 6 chance there's a point 6 chance 0.6 chance that you get a 1 and the difference between 1 and point 6 1 and our mean point 6 is that and then we are also going to we are also going to we are also going to square this over here now what is this value going to be this is going to be 0.4 times 0.6 squared this is 0.4 times point because 0 minus 0.6 is negative point 6 if you square it if you square it you get positive 0.36 so this value right here I'm going to color code it this value right here is times 0.36 and then this value right here let me do this in another so then we're going to have 2 plus 0.6 Plus this point 6 times 1 minus 0.6 squared now 1 minus 0.6 is 0.4 0.4 squared or 0.4 squared is 0.16 so let me do this so this value right here it's going to be 0.16 so let me get my calculator out to actually calculate these values let me get my calculator out so this is going to be 0.4 times 0.36 plus 0.6 times times point one six which is equal to 0.2 four point two four so our standard deviation of this distribution our standard deviation of this distribution is zero point 2 4 or if you want to think about the if you want to think about the weather the variance of this distribution is 0.24 and the standard deviation of this distribution which is just the square root of this the standard deviation of this distribution is going to be the square root of zero point two four and let's calculate what that is that is going to be let's take the square root of 0.2 four which is equal to 0.4 eight well I'll just round it up point four nine so this is equal to 0.49 so if you were to look at this distribution the mean the mean of this distribution is 0.6 so 0.6 is the mean and the standard deviation is 0.5 so the standard deviation is so it's actually out here is because if you go add one standard deviations you're almost getting to one point one so this is one standard deviation above and then one standard deviation below get to right about here and that kind of makes sense it's hard to really rational to to kind of have a good intuition for a discrete distribution because you really can't take on those values but it makes sense that the distribution is skewed to the right over here anyway I did this I did this example with particulars because I wanted to I want to show you why this distribution is useful in the next video I'll do these with just general numbers where this is going to be P where this is the probability of success and this is the 1 minus P which is the probability of failure and then we'll come up with general formulas for the mean and variance and standard deviation of this distribution which is actually called the Bernoulli distribution is the simplest case of the binomial distribution