The expected value is one of the most important concepts in...

@TivadarDanka
Tivadar Danka@TivadarDanka
12 views Feb 12, 2025 ~3 min read
Advertisement
1
The expected value is one of the most important concepts in probability and statistics.

For instance, all the popular loss functions in machine learning, like cross-entropy, are expected values. However, its definition is far from intuitive.

Here is what's behind the scenes.
Media image
2
It's better to start with an example. So, let's play a simple game!

The rules: I’ll toss a coin, and if it comes up heads, you win $1. However, if it is tails, you lose $2.

Should you even play this game with me? We’ll find out.
3
After n rounds, your earnings can be calculated by the number of heads times $1 minus the number of tails times $2.

If we divide total earnings by n, we obtain your average earnings per round.
Media image
4
What happens when n approaches infinity?

As you have probably guessed, the number of heads divided by the number of tosses will converge to the probability of a single toss being heads.

Similarly, tails per tosses also converge to 1/2.
Media image
5
With this in mind, we can explicitly calculate your average earnings per round.

Which is -1/2, so, you definitely shouldn't play this game with me.
Media image
6
This is the expected value! To see this, let’s formalize our little game with a random variable X, denoting your earnings.
Media image
7
By plugging this into the formula of expected value, we obtain just what we calculated before: the average earnings per round!
Media image
8
In plain English, the expected value is just the average outcome per experiment when you let it run infinitely!
Media image
9
To sum up, let’s look at the general formula.

In essence, the expected value is the average of all possible outcomes, weighted by their respected probabilities.
Media image
10
Poker is a real-life example where this is really useful.

I used to play no limit Texas hold'em all the time, and the expected value is behind one of the most important concepts: positive and negative pot odds.
11
According to the rules, each player holds two cards on their own, while five more shared cards are dealt. The shared cards are available for everyone, and the player with the strongest hand wins.

This is how the table looks before the last card (the river) is revealed.
Media image
12
There is money in the pot to be won, but to see the river, you have to call the opponent’s bet.

The question is, should you? Expected value to the rescue.

Let’s build a probabilistic model. We would win the pot with certain river cards, but lose with all the others.
Media image
13
The rule is simple: if the expected winnings are positive, we call the bet. Otherwise, we fold.

We can quantify this using the expected value.
Media image
14
With some algebra, we obtain that our expected winnings are positive if the ratio of good and bad cards is better than the ratio of the bet and the pot.

This is called "positive pot odds", and it is an essential tool in a poker player's arsenal.
Media image
15
(By the way, I was a mediocre poker player, but at least I understood the math.

However, it is far from enough to be successful. But that's a story for another day :) )
16
There is much more to the expected value. For instance, what about experiments where the set of possible outcomes is not countable?

If you are interested, check out the full post on my Substack, where I'll explain it all:

thepalindrome.substack.com/p/whats-the-me…
17
If you have enjoyed this thread, follow me and subscribe to my newsletter!

Understanding mathematics is a superpower, and I regularly post deep-dive explanations about seemingly complex concepts from math, engineering, and science.

thepalindrome.substack.com
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • Screenshot Tweet
Create Free Account

Includes 7-day Premium trial

Advertisement