[MUSIC] After we discussed the definition of expected value, let us practice that a little bit. Remember Alice, who made $100 on red in roulette game. Let us find her expected payout. Let me recall the rules. In roulette, we have 37 sectors, 37 numbers, and out of these 37 numbers, we have 18 red, 18 black, And 1 0. Zero is neither red nor black, it is actually green. So overall number of sectors is 37. And if Alice bets $100 on red, then her payouts will be as following. If the ball stops at red sector, then Alice wins her bet, so her payout is $100. If the final sector is black, then Alice lose her bet, so her bet is -$100. And finally, if zero is the result of our game, then Alice lose half of her bet, so her payout is -$50. Now let us find the expected value, expected payout. To make it possible, we have to find the probabilities of all these outcomes. So let us write down the probabilities. What is the probability to win? We have 18 sectors out of 37, so the probability is a 18 / 37. In the same way, the probability to lose $100 is the same, 18 / 37. Here the probability to get 0 is just 1 / 37. Now, if we consider this table as distribution of a random variable, which is Alice's payout, then we can find the expected value of this random variable. To do so, we have to multiply payouts by their respective probabilities and make a summation. What is the expected value of x? Now let us do the math. We have to multiply 100 x 18 / 37 + (-100) x 18/37 and + (-15), x 1 / 37. We see from this formula that these two terms, Will cancel each other, because they are equivalent up to this sign. So the expected value is given just by this formula. And if you find the value of this number, we will get approximately -1.35. Now we see that every time when Alice bets $100 on red, she loses on average $1.35. This is not so large amount of money, probably, but it is important that it is negative amount. So the more Alice plays this game, the more she lose on average. This is what makes casinos profitable. Now, let me show you another way how we can calculate this expected value. Instead of considering this table, the table of distribution of this random variable x, we can return to the definition of random variable and consider our sample space, probability of outcomes and the value that is associated with every outcome. Let me show you how to do it in this way. Let us recall that the sample space in case of roulette consists of 37 outcomes. We will denote them just by their corresponding numbers, 0, 1, 2, 3 and so on, 36. And with each value that we have here, we have the corresponding value of our random variable. For example, what is the X(0)? 0 is neither red nor black, so the value of X here equals to -50. You can find a picture of roulette and find out what is the value of X of all other numbers. What is X(1)? If you find a picture of roulette, you will find that 1 is red. So it means that X(1) = 100, Because 1 is red. In the same way, X(2) = -100, because 2 is black, And so on. Now we can write another definition for expected value, another formula. Expected value of random variable X is sum over all outcomes of our sample space of the following product, probability of this particular outcome times value of random variable at this outcome. This is an alternative way to define the notion of expected value. And it works exactly in the same way as the definition that we discussed before. Let us check it in this example. Here, to make this summation, we have to write down 37 terms that correspond to 37 outcomes here, of course most of them will be equal to each other. So let us begin, for example, with red numbers. The probability of each outcome is 1 / 37, so we have the following. Let us consider first outcomes that corresponds to winning. So we have 1 / 37, which is the probability of outcome, x 100, which is the value from the variable. And we have 18 summands like this one. In the same way, we can count outcomes that corresponds to this case. We have again 1 /37 x (-100) and so on. Again we have 18 times. And the only outcome that is remain is 0, the probability again 1/ 37, And the corresponding value is -50. Again, we see that these terms and these terms cancel each other. And what we get is this term, which equals to this term and this result. So this formula gives us a new way to define the expected value, which is equivalent to the old one. We will use this definition when we will discuss some properties of expected value, like expected value of two random variables. But now, let us discuss why expected value of random variable is so important in machine learning. [MUSIC]