 Hi, I'm Zor. Welcome to Unizor Education. We continue talking about random variables. As usually I recommend to watch this particular lecture from Unizor.com website rather than on YouTube or any other because the Unizor.com contains also notes for this particular lecture which is definitely a very useful text to review before or after this particular lecture. Okay, random variables. Let me first of all remind that we are talking about random variables which take certain finite number of values with certain probabilities. So generally speaking we are talking about random variable. I use the Greek letter C which has certain values, finite number of real values with certain probabilities of each value. Now there are other random variables. There are random variables which take infinite but countable number of values. There are random variables which take uncountable number of infinite and uncountable number of values. We are not talking about these right now. During this course these are the only type of random variables we will be talking about. It's simpler and it gives you a nice introduction into theory of probabilities. Now this number can be rather large I would say. In some cases it's only two like win or lose. In some other cases it might be for instance you are rolling the dice and there are six different values. Sometimes you are rolling two dice and that's six times six which is 36 different values with different probabilities. So how can we characterize the random variable if we would like to have a feel about certain values which it can take? Well the full description is basically exactly what I just wrote here. These are all the values which it can take and these are the probabilities. And the probabilities basically characterize certain frequencies. This or that particular value occurs if we conduct certain experiment again and again and again and our random variable takes certain values out of this set. But again I was saying that it might be too many of these values and still even if there are not too many you would like something which is intuitively helping you to well predict maybe the general behavior of the variable, of the random variable. Okay how can it be done? We have introduced one particular characteristic of the random variable. It's expected value. Now expected value in this particular case is a sum of, it's basically a weighted average of different values where the weights are probabilities. So this is definitely a very good characteristic which helps you to basically understand okay my values can be God knows where but this is something which they are on average will be concentrated. It's a good measure. Now is it sufficient measure to realize something like what's the risk for instance of playing the game where these are outcomes? Well let's consider two examples. We are flipping the coin. So we have either heads or tails with the probabilities of one-half each. Now let's say I'm playing for $1. So I'm betting on let's say heads. So the probability of winning $1 is one-half right? So my X1 is equal to one and my P1 is equal to one-half. Now if I lose and the probability of getting tail is also one-half I lose a dollar so it's minus one here and the probability is also one-half. So this is my full description of the random variable. But again I would like to have not these values with these probabilities because they might be numerous. I would like a single concise characteristic or two characteristics which basically describe the behavior. Alright so my average weighted average in this particular case my expectation of this particular variable is one with a weight of one-half and minus one with a value of one-half which is equal to zero. Great. So if I'm playing this game for a very very long time well I can expect that on average per game I would neither win or lose it will be around zero. So if I will take all my winning for one-thousand games and divide it by one-thousand I will get a number close to zero. Alright fine. Now let's consider exactly the same game but instead of betting one dollar I'm betting a hundred dollars. Now again I can calculate my expectation it will be one-hundred times one-half plus minus one-hundred times one-half which is also equal to zero. So it looks like my expectation is exactly the same whether I'm betting a dollar in this game or one-hundred dollars. But are these games equivalent? I mean is this expectation being zero really enough? Well it depends on how much money you have. Let's say you have a hundred dollars. Would you play the first game for a dollar? Well why not? I mean you have a hundred dollars you can bet a dollar here a dollar there. At the end of the day you will find out that okay you maybe lose or you win like ten dollars all together. Now what if you have a hundred dollars and the game is one-hundred? Well you can lose the first game and the game is over right? So the risk itself is significantly greater for you if you are playing this game. So how can you evaluate the risk? Well there are many different ways to approach this problem. What is risk in this particular case? Now analogous to this maybe you are measuring certain let's say a temperature of a group of people in a room. Let's say you have fifty people in a room you are measuring their temperature. Well obviously there is something which is considered to be normal and everybody will have more or less close to this normal temperature. But deviated left or right up or down or something like this. Now most likely if all people are considered normal they are not sick people they are all normal people. You would consider that their temperature would be something which is in medicine considered to be a normal temperature whatever it is. However temperatures will be different so my question is can you evaluate how different or how much deviation from this normal temperature you can observe? Well you will get different data obviously but again how much they divert from this normal temperature. So evaluation of this obviously needs certain other except expectation. Expectation would be like zero in this case or a normal temperature in the case of a temperature. But I would like to know what's the diversity around this particular expected value. And that depends actually on the game like in this particular case diversity can be significant right. It's either minus a hundred or plus a hundred it's a big diversity versus the previous game when the bet is only zero. So what's the measure which can help me to evaluate this diversity so it will help me to evaluate my risk. Or help me to evaluate the interval where I can expect the data actual expectation you know probability is all about predictions right. So you really should predict something like this. Alright so here is what I suggest you to do. In case of expectation you're using weighted average of the values with the weights probabilities being the probabilities. Now to evaluate the diversity around this expectation around this expected value. I can actually make the weighted average of the differences from different values from the expectation. So the difference in the first game is either one minus zero or minus one minus zero. So the difference is one or minus one. But I don't really need this science difference I need just an absolute value of the difference. So one of the ways to evaluate this would be to have an absolute value of a difference between the value and the expectation. Or since absolute value is not such a good function in mathematics, mathematicians prefer smooth curves. Now absolute value has an angle if you remember on the graph. There is a better way which is actually parabola which looks like this it's a smooth curve. So people prefer to use instead of absolute value of a difference between the value of the random variable and its expectation. They prefer to use the square of this difference that makes it positive right. So since we are talking about the deviation, well we will use a square of a difference. Now square of a difference between the first value I will put here for my game at I win one, tails I lose one, expectation is equal to zero. Now the difference are from one minus zero square that's the deviation of this first value my random variable takes. And I will use the averaging using the probability as a weight. Now in another case if my random variable takes minus one I will subtract from minus one the expectation and square it and with its own probability. And this is what is called a variance, a variance of my random variable. Now what's the variance in this particular case? It's one times one half this is one times one half so in this particular case variance equals to one. Now what if instead of one I have one hundred, well I have one hundred minus zero square which is ten thousand times one half and this is minus one hundred minus zero square which is also ten thousand divided by two. So I have ten thousand. See the difference? So the first game gives me the variance one which is actually a weighted average of squares of the distances between different values my random variable takes and the expectation. And the second case the variance is significantly greater. So variance is a good measure of the I would say average deviation of the random variable from its expected value. And average in terms of this is a weighted average with probabilities being the weights. Okay now what's good about this? It's a good measure. What's bad about this? It's a square. You see if I'm measuring for instance a temperature and I'm talking about deviation from some expected value which is the normal temperature. Well I would like the deviation to be well temperature right? Not temperature square. Same thing with in this particular case. I would like my deviation from an amount of zero to be amount in dollars not dollars square. So there is another characteristic which is very much dependent on the variance which is standard deviation which is actually a square root of variance. Now having this square root actually brings the dimension of this with this particular characteristic down to the same dimension my random variable takes. If it's dollars then the standard deviation is dollars not dollars square. If it's temperature it's temperature not temperature square. So this is actually more often used characteristic of the random variables. Variance actually does have its own advantages. Let me just very simply state it without the proof. I will prove it in some other lecture that if you have two independent random variables and we will talk about what is an independent variable. Then the variance of their sum is equal to sum of their variances which is not the case with the standard deviation. So variance has a very important advantage. It's an additive function like expectation. Remember expectation of sum of two different random variables equals to sum of their expectations. But in variances it's the same but only for independent random variables. For standard deviation it's not the same at all but since it's a very directly dependent on the variance. So first we calculate the variance of the sum and then we use the square root to get the standard deviation. Alright now I think we are completely ready for general description of what is actually a variance and deviation in a general case which is this one. This is the general case. So let's say this is equal to A. So what is my variance? Variance is basically as I was saying it's a weighted average of squares of the differences between the values and the... So it's x1 minus A square A being the expectation times the weight which is its probability. Plus x2 minus A square d2 plus etc plus xn minus A square dn. Well that's the definition. That's it and the story. So we are averaging with weights equals to probabilities the deviation of the values from the expectation squared. And from here this is square root of variance of c. Well that's it. Definition very simple. I was trying to explain this definition before on a particular example. And now this is a general definition. And now let me exemplify it in one other simple case which is rolling of a dice. So when I roll the dice I have six different values. I have 1, 2, 3, 4, 5, 6 with probabilities of 1, 6 each. Question number one. What's the expected value? Well the expectation is a weighted average of these values with weights equal to probabilities. Right? So it's 1 times 1, 6 plus 2 times 1, 6 plus 3 times 1, 6 plus 4 times 1, 6 plus 5, 1, 6 plus 6 times 1, 6 which is equal to 1 plus 2, 3 plus 3, 6 plus 4, 10 plus 5, 15 plus 6, 21, 6 which is 3 and 1 half. Okay this is my expectation. Now by the way graphically if I have this as a axis I have 1, 2, 3, 4, 5, 6. Now 3 and a half is right in the middle which is natural for equally distributed probabilities. So all these points have the same weight therefore their weighted average should be in the middle. So that's normal. Now let's talk about the variance of this particular variable. Okay the variance is equal to weighted average of squares of the distances from here to here, from here to here, from here to here. So the difference, so this is 3.5. Difference between 1 and 3.5 so it's 1 minus 3.5 square times 1, 6. Then same thing 4, 2 minus 3.5 square 1, 6 plus 3 minus 3.5 square times 1, 6 plus 4 minus 3.5 square 1, 6, 5 minus 3.5 square 1, 6 and 6 minus 3.5 square times 1, 6 equals 2. I have already calculated it beforehand it's 2.9. So this is my variance. Now what's my standard deviation of this variable, random variable, that's square root of 2.9 which is 1.7. By the way this is approximate weighted. Okay. So the standard deviation of these numbers from the middle point, from their expectation is 1.7. Which is something like from here it's 1.5 something like here. So this is average, this is expectation minus standard deviation, this is plus standard deviation. Now obviously not all of these values are exactly positioned on the standard deviation. This is just an average difference between value and. So this is some kind of a middle point weighted average of the distance between this and this. Now instead of this definition let me just repeat I can instead of squaring the distance I can use absolute value in all these cases. It would be a different number close to this one but still different. And this defined variance or standard deviation would not adhere to this nice additive property which I was talking about before. So basically that's it. I will certainly consider certain problems related to this and I do encourage you to basically read the notes for the lecture. It's always good after you listen to the lecture. It's always good to read the notes on Unisor.com. Thank you very much and good luck.