Random Variables
Define a numerical outcome and distinguish mass, density and cumulative probability. Calculate expected value and variance from a simple distribution.
On This Page
A random variable assigns a number to an outcome
A random variable X maps outcomes of a random process to numerical values. It is not the list of numbers already observed. For three coin tosses, X might count heads; different toss sequences can give the same X.
A discrete variable has a finite or countably infinite set of possible values. A continuous model assigns probability through a density over intervals. Choose the model for the measurement and process, not simply because the spreadsheet contains decimals.
Worked example: a hypothetical reward
Suppose a random reward X in credits has this stated distribution:
| x | P(X = x) | xP(X = x) | x²P(X = x) |
|---|---|---|---|
| 0 | 0.50 | 0 | 0 |
| 2 | 0.30 | 0.60 | 1.20 |
| 5 | 0.20 | 1.00 | 5.00 |
| Total | 1.00 | 1.60 | 6.20 |
The probability mass function gives the probability at each discrete value. Its entries are nonnegative and sum to 1.
The standard deviation is √3.64 ≈ 1.9079 credits. The expected value 1.6 is a probability-weighted average, not a possible reward on one trial and not a guaranteed result. Under suitable independent repeated trials, the average reward tends toward it.
The CDF answers “at most” questions
The cumulative distribution function F(x) = P(X ≤ x) works for both discrete and continuous variables. For the reward distribution, F(2) = 0.50 + 0.30 = 0.80. Between 2 and 5 it stays at 0.80; at 5 it jumps to 1.
For an interval with an open lower bound:
For discrete outcomes, changing < to ≤ can change the answer. Here P(X < 2) = 0.50, whereas P(X ≤ 2) = 0.80.
Density is not probability at a point
For a continuous model with density f, interval probability is the area under f over that interval. A density value may exceed 1 because it has units of inverse measurement; only total probability must be 1. Under an absolutely continuous model, an exact value has probability 0.
For a uniform variable on [0, 0.5], the density is 2 on its support. The probability between 0.1 and 0.2 is 2 × 0.1 = 0.2. Density 2 is valid and does not mean a 200% probability.
Practice
Using the reward distribution, find P(X > 0) and E[2X + 3].
Show the explanation
P(X > 0) = 0.30 + 0.20 = 0.50. By linearity, E[2X + 3] = 2E[X] + 3 = 6.2. Linearity of expectation does not require independent variables; multiplying probabilities usually does require a condition such as independence.
Continue
Explore discrete and continuous models. NIST defines probability distributions and their functions.
Did this explanation help?
Your response helps us identify lessons that need more work.