A random variable $X$ attaches a number to every outcome $\omega$ (one single result, like HHT) from the sample space $\Omega$ (the set of all possible results), so we can work with numbers instead of listing outcomes.
Example
Notation for the probability of getting at least two heads when flipping three coins, before and after introducing $X$.
| Without X | With X = number of heads |
|---|---|
| $P(\{HHT, HTH, THH, HHH\})$ | $P(X \ge 2)$ |
Random variables fall into two broad families, depending on what kind of values they can take.
| Type | Values | Examples |
|---|---|---|
| Discrete | countable, often integers | number of heads in 3 flips, dice rolls, number of emails per day |
| Continuous | any value in an interval | waiting time, height, temperature |
| Symbol | Meaning |
|---|---|
| $X$ | a random variable, uppercase by convention |
| $x$ | a specific value $X$ could take, lowercase by convention |
| support of $X$ | the set of values $X$ can actually take |
For a discrete random variable, the PMF gives the probability that $X$ equals a specific value $x$.
It must satisfy two conditions to make sense as a probability.
Continuing the three flip example, counting outcomes for each value of $X$ gives this PMF.
| $x$ | outcomes with this count | $p(x)$ |
|---|---|---|
| 0 | TTT | $\frac{1}{8}$ |
| 1 | HTT, THT, TTH | $\frac{3}{8}$ |
| 2 | HHT, HTH, THH | $\frac{3}{8}$ |
| 3 | HHH | $\frac{1}{8}$ |
| Symbol | Meaning |
|---|---|
| $p(x)$ | PMF, probability that $X$ equals $x$ |
The CDF works for both discrete and continuous variables. It answers "what is the chance $X$ is at most this value?".
For a discrete variable, $F(x)$ is a step function: it stays flat between possible values of $X$ and jumps up by $p(x)$ exactly at each value $X$ can take.
The CDF also gives interval probabilities directly, without needing the PMF or PDF at all.
This die is loaded, a trick die where each face has a different chance: $p(1){=}0.05$, $p(2){=}0.10$, $p(3){=}0.15$, $p(4){=}0.20$, $p(5){=}0.20$, $p(6){=}0.30$. Slide $x$ to pick a face value, the chart on the right shows the probability of rolling $x$ or less.
| Symbol | Meaning |
|---|---|
| $F(x)$ | CDF, probability that $X$ is at most $x$ |
A continuous variable can take infinitely many values in an interval, so the probability of any single exact value is zero.
Example
Let $H$ be someone's height. No matter how precisely we measure, there are infinitely many decimal digits to pin down exactly.
A probability density function $f(x)$ describes how likely values are near $x$. Probability comes from the area under $f$, not from $f(x)$ itself.
Look at heights near 170 cm. Instead of asking for exactly 170 cm, ask for a window $[170-\epsilon, 170+\epsilon]$, and shrink $\epsilon$ toward 0.
| Symbol | Meaning |
|---|---|
| $f(x)$ | PDF, density of $X$ around $x$ |
$E[X]$, also written as $\mu$, weighs every possible value of $X$ by how likely it is, giving the average outcome you would see if you repeated the experiment many times.
Discrete
Continuous
Expectation is linear, regardless of whether $X$ and $Y$ are independent.
To find the expectation of a function of $X$, weigh $g(x)$ instead of $x$, no need to derive the distribution of $g(X)$ first.
| Symbol | Meaning |
|---|---|
| $E[X]$, $\mu$ | expectation, the long run average value of $X$ |
Variance measures the average squared distance between $X$ and its own mean $\mu = E[X]$.
Expanding the square gives a version that is usually faster to compute by hand.
Standard deviation $\sigma$ is the square root of the variance, back in the same units as $X$.
Shifting $X$ by a constant does not change how spread out it is, only scaling it does, and the scale factor gets squared.
| Symbol | Meaning |
|---|---|
| $\text{Var}(X)$, $\sigma^2$ | variance, how spread out $X$ is around its mean |
| $\sigma$ | standard deviation, $\sqrt{\text{Var}(X)}$ |
For any random variable $X$ with mean $\mu$ and variance $\sigma^2$, and any $k > 0$, only a limited share of the probability can sit far from the mean, no matter the shape of the distribution.