Transcript for:
Understanding Variance in Random Variables

And continuing with chapter four. In the last video, we talked about mean. So this time, we're going to talk about variance of a random variable. So we're down here in this section for variance. Just like we talked in the very first set of videos about mean, that was sample mean based on our data. And now we're talking about our theoretical mean, our population mean using our probability distribution. We're going to do the same here with variance. We started off with sample variance in our first set of videos, which helped us understand our measure of variability. So now we're talking about our theoretical variance using our probability distribution. So we have a couple different formulas here. These are the technical formulas, and then there's a theorem in the book that gets us to this equation. Either set of these equations work, whether you break it up like this. We'll do an example here directly that shows both sets of equations so that you can kind of decide which one you like. I generally use this one. I think this one is much easier, but up to you to play around and see what you like. This is a standard rule. This is important to never forget this. And then we also have a formula for variance when we're working with g of x instead of just x. So as a reminder, here's a. graph, picture, visual representation of how, of what variance represents. So here we have a smaller variance because the distance, so this line here represents our mean, the distance from the mean in either direction is relatively small. So we're going to have a small variance versus here we're going to have a large variance, larger variance because our mean is here, but we vary all the way out to here. We can also see we have this weird high bar versus this low bar here, so we can understand a little bit about our variance of the two data sets here. All right, and then just to throw a curveball at you, take a second and think, is this continuous or discrete, and how do you know? Pause the video, think about it, and come back to me. All right. This is going to be discrete data. And we know this because all of our probabilities are in buckets for each value. And we have like a histogram style. If it were continuous, we would have a more smooth style curve to go with it. All right. Let's get started with our first example. Let the random variable X represent the number of defective parts for a machine when three parts are sampled from a production line and tested. The following is the probability distribution of X. So it gives us our X and F of X, and it wants us to calculate the variance and standard deviation. I'm going to do this first using our first equation, which was sigma squared equal to the sum of X of X minus mu squared. Oh. I lied. Squared goes on the outside times f of x. So to do that, I'm going to start at my first x. So our x's go from zero to three. And I'm also using the summation here because this is discrete data. We have whole numbers. So we have a discrete probability distribution. So I'm using the summation, not the integral. So first x is going to be. Well, first we need to find our mean. So let me back up here. So. our mean is equal to our expected value of x, which we just talked about in the last video, which is equal to x times f of x for the sum of that. So that's going to be zero times 0.51 plus one times 0.38 plus two times 0.10 plus three times zero. 0.01, which is equal to 0.61. So now I have my mean, now I can actually start to use my formula. So sigma squared is equal to the sum across, let's do x equal to zero to three of x minus our mu, which is 0.61 squared times f of x. So now when x is equal to zero, we have zero minus zero. 0.61 squared times f of 0. So that's 0.51 plus. 1 minus 0.61, because that's our next x value, squared times f of 1, which is 0.38. Same thing for 2. And then our last one is 3 minus 0.61 squared times 0.01. That is equal to 0.87. So then our sigma is equal to the square root of sigma squared, or our standard deviation is equal to the square root of variance, is equal to, oh, I lied. This is not 0.87. This is 0.4979. So then our standard deviation is the square root of that, which is 0.7056. So that's using this formula here. Now if we want to do it again using the formula that I said I like, the other formula I'm going to write up here for space reasons is sigma squared equal to the expected value of x squared minus mu squared. So now I have to find my expected value of x squared first. And this is going to be like doing the expected value of g of x function that we talked about in the last video. So instead of doing mu equal to expected value of x, we're going to do the expected value of x squared. And so in place of the x here, we plug in our g of x function, which for us is going to be x squared. So this is going to be the sum. from x equal to 0 to 3 of x squared times f of x. So that's going to be 0 squared times 0.51 plus 1 squared times 0.38 plus 2 squared times 0.10 plus 3 squared times 0.01. And that is equal to 0.87. So now to find my sigma squared, I take my expected value of x squared minus mu squared, which is equal to 0.87 minus 0.61 squared. That gives me the same sigma squared value of 4979. And then I would just square root that again to get sigma of 0.7056. So up to you to use either function, they both work. It also kind of depends on how your data is given to you. Sometimes I tend to prefer the second path down here, but up to you. Either formula works. Next problem. The weekly demand for a drinking water product in thousands of liters from a local chain of efficiency stores is a continuous random variable x having the probability density f of x of 2 times x minus 1 from 1 to 2 and 0 elsewhere. And it asks... us to find the mean and variance of x. So because it's continuous, we know that we are using our integral function. So we have to do this for both mean and variance. So mean of a continuous variable is the integral from technically negative infinity to infinity. But like we've talked about, we can replace that with our given bounds. So for us, that's 1 to 2 of x times f of x. So we're times 2 times x minus 1. So that's our f of x dx. And that equals 5 thirds when you do the math on that integral. Then we're going to use the formula that I like, which is the sigma squared equal to expected value of x squared minus mu squared. So now my expected value of x squared function. is going to be equal to just like that g of x function is going to be the integral from 1 to 2 of g of x times f of x, which is equal to if we pull that 2 out as a constant to 1 to 2 x squared times x minus 1 dx. When you evaluate that, you get 17 over 6. Then you should take the time and work these integrals just to get your brain working back with integrals. I know that they can take a little thought. We don't want to spend too much time on those. when we're taking a test, doing problems in class. So we want to get really comfortable doing our intervals again so that we can fly through them. So then finally, to finish out our math here, we have sigma squared is equal to 17 sixths minus five thirds squared. Make sure you don't forget this squared. I don't know if it's just me, but I always forget to add the squared on the mu here. So word of caution, don't forget this little buddy right here. And when you do that math, you get 1 18th. So I have my mu here, my mean, and my variance that it asks for here. Next problem, calculate the variance of g of x equal to 2x plus 3, where x is a random variable with the following probability distribution. So we have whole numbers, so we know it's discrete. So we're using our summation. So to do that, first we need to find our mean. So our mean of g of x is going to be the expected value of 2x plus 3. So that's equal to, whoops, the sum from x is equal to 0 to 3, because that's what x values we have. And then we plug in our g of x function. So that's 2x plus 3 times f of x. So that's going to be 2 times 0 plus 3 is going to be 3 times F0, which is 1 fourth, plus 2 times 1 is 2 plus 3 is 5 times 1 eighth, plus 4 plus 3 is 7 times 1 half, plus 6 plus 3 is 9 times 1 eighth. That gives our mu as 6. So then for sigma squared, for g of x, this formula is the expected value of the square of g of x minus mu g of x. So if we plug in our values here, that gives us the expected value of g of x, which is our function. So we have 2x plus 3 minus 6 squared. Then we can FOIL that out. So that turns into be 2x minus 3 squared. So then we can do 2x minus 3 times 2x minus 3 and we get 4x squared. minus 12x plus nine. So now that's our interior function. Whoops, didn't mean to do that. There we go. So then we have the expected value of four x squared minus 12x plus nine. So now we're back to a pretty simple expected value of g of x function. And so we know how to do that. So now we're going to take... the expected value of g of x times f of x. And we can do that. So for us, that's going to be the sum from x equal to zero to three of four x squared minus 12x plus nine times f of x. So our first number is going to be plugging in zero. So we'll have zero minus zero plus nine, which is just nine times one fourth, then we have 4 minus 12 is negative 8 plus 9 is 1 times 1 eighth and so on. So then you would plug in 2 and plug in 3 for x. And ultimately, you get that your sigma squared g of x is equal to 4.