Mathematics · live now

Expectation and variance

Summarise a random variable with one number and measure its spread. Start with what an expected value means and how to compute it, then use linearity of expectation and find the expected value of a function, and finish with variance, standard deviation and indicator random variables.

No account needed to read a lesson · 30-day money-back guarantee

See the full learning path

7

lessons

64

practice questions

64

prerequisite lessons

See it taught

1 of the 7 lessons here is free to preview - the whole explanation and worked example, with no account and no email.

Live, not a screenshot

Lesson 04 · The variance of a random variable

0
1
2
3
4
0.1
0.2
0.3
0.4
0.5
0.6
μ=2
0
1
2
3
4
0.1
0.2
0.3
0.4
0.5
0.6
μ=2
X
Y

Step 1: One mean, two distributions

X takes 1,2,3 and Y takes 0,2,4, each with probabilities 0.25,0.5,0.25. Both have mean μ=2, but the values of Y lie further from it.

Step 2: The squared distance from the mean

The middle value of each lies at the mean, at distance 0. The outer values of X lie at distance 1, so their squared distance is 1. The outer values of Y lie at distance 2, so their squared distance is 4.

Step 3: Far values count most

Each value adds its squared distance times its probability. The outer bars have the same heights in both charts, but those of Y are at squared distance 4 rather than 1, so Y has the larger variance.

So probability far from μ makes the variance large, and probability at μ adds nothing.

The diagram from the lesson itself, running live.

The 7 lessons

The 7 lessons in this unit. Expand any one to see what it covers. Each unlocks when its own prerequisites are passed.

01

Expected value

8 questions

Learn what the expected value of a random variable means and how to compute it from its probability mass function.

Covers

What an expected value means

The expected value formula

02

Linearity of expectation

12 questions

Learn how to use linearity of expectation to find the mean of a combination of random variables.

Covers

Scaling and shifting

The expected value of X+YX + Y

Linearity of expectation

03

Expected value of a function of a random variable

8 questions

Learn how to find the mean of a function of a random variable from its PMF, and how to rewrite the mean of an expression as simpler means using linearity of expectation.

Covers

The expected value of g(X)g(X)

Rewriting E[g(X)]\mathbb{E}[g(X)] using linearity

04

The variance of a random variable

Preview

8 questions

Learn what the variance of a random variable measures and the key properties it has.

Covers

Spread about the mean

Properties of variance

Preview this lesson - no account needed

05

Computing variance

8 questions

Learn how to compute the variance of a random variable from its probability mass function.

Covers

Variance from the definition

Variance from E[X]\mathbb{E}[X] and E[X2]\mathbb{E}[X^2]

06

The standard deviation of a random variable

8 questions

Learn what the standard deviation of a random variable measures and how scaling and shifting change it.

Covers

Standard deviation as spread in the units of XX

Rescaling

07

Indicator random variables

12 questions

Learn how indicator random variables link probabilities to expected values, and use them to find the expected value of a count by adding probabilities.

Covers

The indicator random variable of an event

The expected value of a count

Finding an expected count with indicator random variables

Where this unit sits in the curriculum

This unit is part of our Essential Probability & Statistics for ML learning path, which contains 109 lessons. Every one of them is drawn below.

The diagnostic test lets you skip any lesson you already know, including the ones in this unit.

Every dot is a lesson and every line a prerequisite. The 7 red dots are the lessons in Expectation and variance; the 64 blue dots feeding into them are the lessons Expectation and variance depends on; the 38 pale dots are the rest of the learning path, which come after Expectation and variance or alongside it.Expectation and varianceFirst lessons on the left109 lessons

Hover any dot to name its lesson.

7 lessons in this unit

64 prerequisite lessons across the unit, counting every step back to the start

38 other lessons in the learning path - after this unit, or alongside it

Every dot is a lesson, every line a prerequisite. You can only start a lesson once you have mastered all of its prerequisites, so you are always building on solid foundations.

Start Expectation and variance

One subscription covers every learning path, and you can test out of anything you already know.

One subscription covers every learning path · 30-day money-back guarantee

More in Probability and Statistics: Sample spaces and events, Counting, Probability fundamentals, Conditional probability and independence, Bayes' theorem and evidence, Discrete random variables