Chapter 2

Random Variables

Definition

A random variable is a function from the sample space to the reals. It turns "what happened" into "how much we got".

Expectation

The expectation of a discrete random variable is its probability-weighted average:

For a continuous random variable the sum becomes an integral, , where is the density.

Linearity of expectation

Linearity

For any random variables , and constants , ,

No independence between and is required. In the language of Linear Algebra, expectation preserves every linear combination.

Aside

"aside" is not one of Obsidian's built-in callout types. The publisher still renders it, with a neutral colour.

Variance

Variance measures how far strays from its expectation. Its square root is the standard deviation.

Simulation

import random
 
rolls = [random.randint(1, 6) for _ in range(100_000)]
print(sum(rolls) / len(rolls))  # close to 3.5

The expected value of a die roll is , and the simulated mean lands close to it. Event notation is in Events › Operations on events.

Comments