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.

## High school statistics

### Course: High school statistics>Unit 7

Lesson 4: Expected value

# Mean (expected value) of a discrete random variable

AP.STATS:
VAR‑5 (EU)
,
VAR‑5.C (LO)
,
VAR‑5.C.1 (EK)
,
VAR‑5.C.2 (EK)
,
VAR‑5.D (LO)
,
VAR‑5.D.1 (EK)
CCSS.Math:
We can calculate the mean (or expected value) of a discrete random variable as the weighted average of all the outcomes of that random variable based on their probabilities. We interpret expected value as the predicted average outcome if we looked at that random variable over an infinite number of trials.

## Want to join the conversation?

• Why didn't we divide by the number of observations when taking the mean of the random variable?
• The expected value of a random function is like its average. We see that in the calculation, the expectation is calculated by multiplying each of the values by its relative frequency. Notice, however, that the relative frequency is the frequency divided by the total number of observations. So, in reality, we did divide by the total number of expectations, it was just embedded in the relative frequency.

Hope this was helpful :)
• Hi. I don't understand why the value 0 is not important in the calcul of the mean. If the probability of 0 is .9, the mean is not impacted?
• The mean is impacted, it is driven towards 0 since 90% of your expectation IS zero.
• A confusing question , what if we have a continuous probability distribution
i mean how can we get the mean?
• Nice question!

If X is a continuous random variable and we are given its probability density function f(x), then the expected value (or mean) of X, E(X), is given by the formula

E(X) = integral from -infinity to infinity of xf(x) dx.

(Note: if f(x) is nonzero only on a bounded interval such as [a,b], then the above integral is equivalent to integrating x times the nonzero portion of f(x) just on the interval [a,b] rather than on the entire interval (-infinity, infinity). This is because the integral of x times the zero function, for x in (-infinity, infinity) but not in the interval [a,b], is zero.)

Have a blessed, wonderful day!
• Couldnt understand what Expected value of (X) means.
how is expected value equal to mean?
Does it mean that in a week ill be working out for 2.1 times on an average considering the probabilities?
• Yes, you are correct. The expected value is simply a way to describe the average of a discrete set of variables based on their associated probabilities. This is also known as a probability-weighted average. For this example, it would be estimated that you would work out 2.1 times in a week, 21 times in 10 weeks, 210 times in 100 weeks, etc.
• Where does randomness come into this? How are these random variables?
• Random variables are outcomes related to random processes. So for number of outcomes in a week to generate random variables, one has to assume that on any given day, one decides to exercise or not randomly. In reality, one decides based on his schedule that may vary systematically and hence difficult to be random. But we can imagine that it is a random process for the sake of this video
• I understood how to compute expected value, but still cannot understand intuitively why probability weighted mean becomes expected value.

Is it because a value converges to a mean after we do many trials (say 10,000 times) as we seen in the previous video (Experimental versus theoretical probability simulation)?
• Yes, think of expected value as the expected average value after 𝑛 trials.
It makes more sense that way.

For example, if we had a six-sided die with probabilities
𝑃(1) = 𝑃(2) = 𝑃(3) = 𝑃(4) = 𝑃(5) = 0.1 and 𝑃(6) = 0.5

Then after 50 trials we could expect to have rolled
five 1's, five 2's, five 3's, five 4's, five 5's and twenty-five 6's.

Thus the expected value (again, think of it as expected average value) is
(5⋅1 + 5⋅2 + 5⋅3 + 5⋅4 + 5⋅5 + 25⋅6)∕50
= 5⋅1∕50 + 5⋅2∕50 + 5⋅3∕50 + 5⋅4∕50 + 5⋅5∕50 + 25⋅6∕50
= 0.1⋅1 + 0.1⋅2 + 0.1⋅3 + 0.1⋅4 + 0.1⋅5 + 0.5⋅6
= 𝑃(1)⋅1 + 𝑃(2)⋅2 + 𝑃(3)⋅3 + 𝑃(4)⋅4 + 𝑃(5)⋅5 + 𝑃(6)⋅6,
which is the weighted probability mean.
• Wouldn't this not be fair? For example, if me doing 9999 workouts has a probability of .01, and me doing 1 workout has a probability of .99, the average amount of workouts should be closer to 1 (as that is what I am more likely to do). However, if we take the mean of this "table" (or function, or whatever you'd like to call it), the amount of workouts you would expect me to do would be 100.98.
• Hi !
I could not understand the concept of Expected values in the case of example of flood insurance, a woman has to pay for 600 dollars and insurance cost is 50,000 dollars. she estimates there are 2% chances of flooding this year. Find the expected value of buying this flood insurance this year. , The solution is 400\$ .

So , In this case what does this expected value of buying flood insurance (400\$) means ,intuitively ?
(1 vote)
• Expected value is, roughly, the average cost or payout of something. If you play a game where you toss a coin and win a dollar on heads and lose a dollar on tails, you would expect to come out with a net \$0 gain/loss in the long run. But if you win a dollar on heads and lose \$10 on tails, you would expect to lose money in the long run, so the expected value is negative.

We compute the expected value like this:
1. List out all possible outcomes
2. For each outcome, determine its probability and the payout/loss for if it occurs
3. For each outcome, multiply its probability by its payout
4. Add all of these numbers together

So for the first coin game, there is a 0.5 probability of winning \$1, and a 0.5 probability of losing \$1. So the expected value is
0.5(1)+0.5(-1)=0.

For the second coin game, the expected value is
0.5(1)+0.5(-10)=-4.5

which means that if you play the second game a lot, you will expect to lose a total of (\$4.50)·(number of plays) in the end.

For your flood insurance problem, it's not obvious whether the expected value is positive or negative, because you have a very small chance of winning a lot of money, and a high chance of losing a little (the \$600 cost).

But we can compute the expected value: there is a 98% chance that nothing happens and you just pay \$600, and a 2% chance that you earn a total of \$50,000-600=\$49,400. So the expected value of the insurance is
0.98(-600)+0.02(49400)=\$400.

This means that, if one woman buys insurance every year and another doesn't, we expect, in the long run, that the buying woman will have about \$400 per year more than the non-buyer.
• At , "weighted sum".

Is "weighted sum" the same as "weighted average"?
• What does the d stand for in the formula for the expected value? xf(x)dx

Thank you in advance
• Great Question!
Actually, the d does not stand on its own in this case. (dx) at its base level is simply notation telling you to integrate with respect to x. This becomes more important when working with multiple variables, but the notation should never be left out. I hope this helps!
(1 vote)

## Video transcript

- [Instructor] So, I'm defining the random variable x as the number of workouts that I will do in a given week. Now right over here, this table describes the probability distribution for x. And as you can see, x can take on only a finite number of values, zero, one, two, three, or four. And so, because there's a finite number of values here, we would call this a discrete random variable. And you can see that this is a valid probability distribution because the combined probability is one. .1 plus 0.15, plus 0.4, plus 0.25, plus 0.1 is one. And none of these are negative probabilities, which wouldn't have made sense. But what we care about in this video is the notion of an expected value of a discrete random variable, which we would just note this way. And one way to think about it is, once we calculate the expected value of this variable, of this random variable, that in a given week, that would give you a sense of the expected number of workouts. This is also sometimes referred to as the mean of a random variable. This, right over here, is the Greek letter mu, which is often used to denote the mean. So, this is the mean of the random variable x. But how do we actually compute it? To compute this, we essentially just take the weighted sum of the various outcomes, and we weight them by the probabilities. So, for example, this is going to be, the first outcome here is zero, and we'll weight it by its probability of 0.1. So, it's zero times 0.1. Plus, the next outcome is one, and it'd be weighted by its probability of 0.15. So, plus one times 0.15. Plus, the next outcome is two and has a probability of 0.4, plus two times 0.4. Plus, the outcome three has a probability of 0.25, plus three times 0.25. And then last but not least, we have the outcome four workouts in a week, that has a probability of 0.1, plus four times 0.1. Well, we can simplify this a little bit. Zero times anything is just zero. So, one times 0.15 is 0.15. Two times 0.4 is 0.8. Three times 0.25 is 0.75. And then four times .1 is 0.4. And so, we just have to add up these numbers. So, we get 0.15, plus .8, plus .75, plus .4, and let's say 0.4, 0.75, 0.8. Let's add 'em all together. And so, let's see, five plus five is 10. And then this is two plus eight is 10, plus seven is 17, plus four is 21. So, we get all of this is going to be equal to 2.1. So, one way to think about it is the expected value of x, the expected number of workouts for me in a week, given this probability distribution, is 2.1. Now you might be saying, wait, hold on a second. All of the outcomes here are whole numbers. How can you have 2.1 workouts in a week? What is .1 of a workout? Well, this isn't saying that in a given week, you would expect me to work out exactly 2.1 times. But this is valuable because you could say, well, in 10 weeks, you would expect me to do roughly 21 workouts. Sometimes I might do zero workouts, sometimes one, sometimes two, sometimes three, sometimes four. But in 100 weeks, you might expect me to do 210 workouts. So, even for a random variable that can only take on integer values, you can still have a non-integer expected value, and it is still useful.