# Expected Value: From Simple to Advanced

## What is Expected Value?

Expected Value = (Probability of an outcome) × (Value of that outcome)

**Imagine a raffle where:**

- You buy 1 ticket for $1
- There is a 1 in 100 chance of winning
- The prize is $150

**To calculate the expected value:**

- Probability of winning: 1/100 = 0.01
- Value of winning: $150
**Expected Value =**0.01 × $150 = $1.50

This means that, on average, **each ticket is “worth” $1.50**.

Since the ticket costs $1, and its expected value is $1.50, it’s a good deal in the long run. However, remember that this doesn’t guarantee you’ll win – it’s an average over many tries.

This simple calculation helps you make decisions by weighing the likelihood of outcomes against their potential value. It’s a basic tool for comparing options with different risks and rewards.

## Explain It Like I’m 5

Imagine you have a big jar of different colored marbles. Some are red, some are blue, and some are green. Your friend says, “If you pick a red marble, I’ll give you a cookie. If you pick a blue one, I’ll give you two cookies. If you pick a green one, you don’t get any cookies.”

Now, let’s say there are:

- 5 red marbles
- 3 blue marbles
- 2 green marbles

If you reach into the jar without looking, what can you expect? This is what we call “expected value.” It’s like guessing how many cookies you might get on average if you played this game many, many times.

Let’s count it out. On average if you reach into the jar 10 times (assume that each time the jar resets to the original marble quantities):

Red marbles give you 5 cookies (1 cookie × 5 marbles) Blue marbles give you 6 cookies (2 cookies × 3 marbles) Green marbles give you 0 cookies (0 cookies × 2 marbles)

That’s 11 cookies in total.

So, if we divide 11 cookies by 10 marbles, we get 1.1 cookies.

This means, on average, you can expect to get about 1 cookie (and a tiny bit more) each time you pick a marble!

Imagine reaching into the jar 10 times. How many cookies do you think you’d get? Try it out and see.

Cookies:

Picks: 0

Average: 0 cookies per pick

Last picked: None

## Mathematical Explanation

Expected value is a concept in probability theory that represents the average outcome of an experiment if it is repeated many times. It’s calculated by multiplying each possible outcome by its probability of occurrence and then summing these products.

According to Wikipedia: “The expected value of a random variable with a finite number of outcomes is a weighted average of all possible outcomes”.

Mathematically, for a discrete random variable \(X\) with possible values \(x_1, x_2, ..., x_n\) and corresponding probabilities \(p_1, p_2, ..., p_n\), the expected value \(\mathbb{E}(X)\) is:

\(\mathbb{E}[X] = \sum_{i=1}^n x_i p_i = x_1 p_1 + x_2 p_2 + ... + x_k p_k\)

What is a random variable? It represents possible outcomes. A random variable is defined by its possible outcomes and the probability of each outcome.

Let’s go back to the marble example:

- Red marble (1 cookie): 5/10 probability
- Blue marble (2 cookies): 3/10 probability
- Green marble (0 cookies): 2/10 probability

\(\mathbb{E}(X) = 1 * \frac{5}{10} + 2 * \frac{3}{10} + 0 * \frac{2}{10} = 0.5 + 0.6 + 0 = 1.1\)

So, on average, you can expect to get 1.1 cookies per draw.

You can use this tool to calculate any expected value. Just put the probabilities in the left column and the values in the right column. It’s pre-set with the cookie marble experiment. Remember that probabilities must sum to 1.

Thinking about something else to try? How about a 6-sided die? Each probability is 1/6 and the values are the 6 different die values.

Expected Value: 0

## Advanced Math

In more complex scenarios, expected value becomes a powerful tool for decision-making under uncertainty. It’s particularly useful in fields like finance, economics, and data science. We give a bunch of examples on this site on the left nav menu.

For continuous random variables, the expected value is defined as an integral:

\(\mathbb{E}(X) = \int_{-\infty}^{\infty} x f(x) dx\)

where \(f(x)\) is the probability density function of \(X\).

Expected value has several important properties:

- Linearity: \(\mathbb{E}(aX + bY) = a\mathbb{E}(X) + b\mathbb{E}(Y)\) for constants \(a\) and \(b\)
- Law of the unconscious statistician: \(\mathbb{E}[g(X)] = \int_{-\infty}^{\infty} g(x) f(x) dx\)

In decision theory, we often use expected utility instead of expected value. This takes into account the decision-maker’s risk preferences:

\(\mathbb{E}[U(X)] = \sum_{i=1}^n U(x_i) p_i\)

where \(U(x)\) is the utility function.

While expected value is a useful tool, it doesn’t account for the variance or risk associated with different outcomes. In some cases, especially with non-linear utility functions or when dealing with rare, high-impact events, decisions based solely on expected value may lead to suboptimal results.