Random variables: turning outcomes into numbers
A random variable is a rule that gives a number to every outcome of a random experiment. We write it with a capital letter, like X.
- Discrete random variable: it takes separate values you can list, like 0, 1, 2, 3 (number of heads, number of defective bulbs, goals in a match).
- Continuous random variable: it can take any value in a range, like height, time or mass.
Example: toss two coins. X = number of heads. HH → 2, HT → 1, TH → 1, TT → 0.
The probability distribution table
The probability distribution of X lists each value x with its probability P(X = x). For two coins:
| x | 0 | 1 | 2 |
|---|---|---|---|
| P(X = x) | 1/4 | 1/2 | 1/4 |
Two rules must always hold:
- 0 ≤ P(X = x) ≤ 1 for every x.
- ΣP(X = x) = 1.
We can show it as a table, a formula or a bar chart. The cumulative distribution F(x) = P(X ≤ x) adds the bars from the left.
Expected value, variance and standard deviation
Expected value (mean): μ = E(X) = Σ x·P(X = x). It is the long-run average if you repeat the experiment many times, and the balance point of the bar chart.
Variance: Var(X) = Σ (x − μ)²·P(X = x) = E(X²) − [E(X)]², where E(X²) = Σ x²·P(X = x).
Standard deviation: σ = √Var(X). It has the same unit as X.
Useful rules: E(aX + b) = aE(X) + b and Var(aX + b) = a²Var(X).
Fair game: a game is fair when the expected gain is 0.
Special distributions: uniform, binomial, Poisson
Discrete uniform
Every value is equally likely. A fair die: P(X = k) = 1/6 for k = 1 to 6, mean 3.5.
Binomial B(n, p)
Use it when: a fixed number n of trials, each trial has two results (success / failure), the chance of success p is the same each time, and trials are independent (Bernoulli trials).
P(X = k) = ⁿCₖ pᵏ (1 − p)ⁿ⁻ᵏ, k = 0, 1, …, n. Mean = np, variance = np(1 − p).
Poisson Po(λ)
Counts random events in a fixed time or space when they happen independently at an average rate λ (calls per hour, typing errors per page). P(X = k) = e^(−λ) λᵏ / k!, k = 0, 1, 2, … Mean = variance = λ. It approximates B(n, p) when n is large and p is small, with λ = np.
Continuous distributions and waiting times
For a continuous X we use a probability density curve f(x). Probability = area under the curve, so P(X = one exact value) = 0 and the total area is 1.
- Uniform on [a, b]: f(x) = 1/(b − a); mean (a + b)/2.
- Exponential (waiting time until the next event): P(T > t) = e^(−λt), mean 1/λ. It has no memory: having waited already does not change the chance of the rest of the wait.
- Normal: the bell curve, mean μ, standard deviation σ. About 68% of values lie within 1σ of μ and 95% within 2σ. A binomial with large n looks like a normal curve.
Try it
Roll a die 30 times and tally the faces. Draw the bar chart. Is it flat like the uniform bars in step 6? Then work out the average of your 30 rolls. Is it near 3.5? Repeat with 60 rolls: it gets closer. That is expected value in action.
Key formulas and definitions
- ΣP(X = x) = 1, 0 ≤ P(X = x) ≤ 1
- E(X) = Σ x·P(X = x)
- Var(X) = Σ (x − μ)²P(X = x) = E(X²) − μ²; σ = √Var(X)
- E(aX + b) = aE(X) + b; Var(aX + b) = a²Var(X)
- Binomial: P(X = k) = ⁿCₖ pᵏ(1 − p)ⁿ⁻ᵏ; mean np; variance np(1 − p)
- Poisson: P(X = k) = e^(−λ)λᵏ/k!; mean = variance = λ
- Exponential waiting time: P(T > t) = e^(−λt); mean 1/λ
Worked examples
1. X is the number shown on a fair die. Find E(X).
Each value 1–6 has P = 1/6. E(X) = (1 + 2 + 3 + 4 + 5 + 6)/6 = 21/6 = 3.5.
2. P(X = 0) = 0.2, P(X = 1) = k, P(X = 2) = 0.5. Find k.
Probabilities add to 1: 0.2 + k + 0.5 = 1, so k = 0.3.
3. X takes 0, 1, 2, 3 with probabilities 0.1, 0.2, 0.3, 0.4. Find E(X) and Var(X).
E(X) = 0 + 0.2 + 0.6 + 1.2 = 2.0. E(X²) = 0 + 0.2 + 1.2 + 3.6 = 5.0. Var(X) = 5.0 − 2.0² = 1.0, so σ = 1.
4. A game: pay ₹10, roll a die; get ₹30 for a six, nothing otherwise. Is it fair?
Gain = 20 with P = 1/6, −10 with P = 5/6. E(gain) = 20/6 − 50/6 = −30/6 = −5. You lose ₹5 per game on average, so it is not fair.
5. A coin is tossed 5 times. Find P(exactly 3 heads).
B(5, 0.5). P(X = 3) = ⁵C₃ (0.5)³(0.5)² = 10 × 1/32 = 10/32 = 0.3125.
6. 10% of bulbs are faulty. In a pack of 8, find the mean and variance of the number of faulty bulbs, and P(none faulty).
B(8, 0.1). Mean = 8 × 0.1 = 0.8. Variance = 8 × 0.1 × 0.9 = 0.72. P(X = 0) = 0.9⁸ ≈ 0.430.
7. A help desk gets on average 3 calls per minute (Poisson). Find P(no calls in a minute) and P(at most 1 call).
λ = 3. P(0) = e⁻³ ≈ 0.0498. P(1) = 3e⁻³ ≈ 0.1494. P(X ≤ 1) ≈ 0.199.
8. If E(X) = 4 and Var(X) = 2, find E(3X − 1) and Var(3X − 1).
E(3X − 1) = 3 × 4 − 1 = 11. Var(3X − 1) = 3² × 2 = 18 (adding a constant does not change spread).
Common mistakes
- Forgetting to check that the probabilities add to 1 before finding the mean.
- Writing Var(X) = E(X²) − E(X) instead of E(X²) − [E(X)]².
- Using the binomial when the chance changes each trial (for example drawing without replacement).
- Saying Var(aX + b) = aVar(X) + b. The constant b disappears and a is squared.