Step 8: Discrete Random Variables
- A random variable turns the outcomes of a chance process into numbers. A discrete one takes values you can count (0, 1, 2, …); its probability distribution lists each value with its probability, and those probabilities must add up to 1.
- The expected value \( E(X) = \sum x \cdot P(x) \) is the long-run average. The variance \( \sum (x-\mu)^2 P(x) \) measures spread, and its square root is the standard deviation.
- The binomial counts successes in a fixed number of independent trials with the same chance of success: \( P(X = k) = C(n,k)\,p^k(1-p)^{n-k} \), with \( \mu = np \). The Poisson counts events per interval at an average rate \( \lambda \).
- Exam point: check all four binomial conditions before using the formula, and answer “at least one” questions with \( 1 – P(X = 0) \).
What a random variable is
Think about a factory where about 3% of the units coming off the line are faulty. Nobody can say which unit will be the bad one. But the manager can still plan: she can say how many faulty units to expect in a box of 50, and how likely it is that a box has none at all. She is not predicting single units. She is modelling the pattern.
To do that, we attach numbers to chance outcomes. “The number of faulty units in a box” is a number that depends on luck. That is a random variable. We write it with a capital letter, such as \( X \), and its particular values with a small letter, such as \( x \).
There are two kinds, and telling them apart is the first skill of this step.
- A discrete random variable takes values you can list, usually counts: emails received today, customers arriving, heads in three coin flips. Between 2 and 3 there is nothing.
- A continuous random variable can take any value in a range, usually measurements: the time until your next email, a person’s height, the weight of a bag of flour. Between 2 and 3 there are endless values.
The quick test is simple: if you count it, it is discrete; if you measure it, it is continuous. This step covers discrete variables. Step 8 deals with the continuous case.
Probability distributions and expected value
A probability distribution for a discrete variable is a table of every possible value next to its probability. It must pass two checks: every probability is between 0 and 1, and all the probabilities add up to exactly 1. Always check the total first.
Suppose a shop sells a luxury item. On any day it sells 0, 1, 2, 3 or 4 of them, with probabilities 0.10, 0.25, 0.30, 0.25 and 0.10. These add to 1.00, so the distribution is valid. The chance of selling at least 2 is \( 0.30 + 0.25 + 0.10 = 0.65 \).
How many does the shop sell on an average day? Not a plain average of 0 to 4, because some values are more likely than others. Instead you weight each value by its probability.
The variance follows the same idea as the variance of data in Step 4: take each squared distance from the mean, but weight it by probability instead of dividing by \( n \). The standard deviation brings you back to the original units.
For the shop’s daily sales above, find the expected number of sales, the variance and the standard deviation.
On average the shop sells 2 items a day, and daily sales typically land about 1.1 items either side of that.
Expected value is also how you judge a bet or an investment. Enter losses as negative numbers. A carnival game costs \( 3 \) dollars and pays \( 10 \) dollars with probability 0.2. Your net result is \( +7 \) with probability 0.2 and \( -3 \) with probability 0.8, so \( E(\text{profit}) = 0.2(7) + 0.8(-3) = 1.4 – 2.4 = -1 \). You lose a dollar per game on average. That is how carnivals stay in business.
Transforming and combining random variables
Real questions often build on a basic variable. The shop earns 150 dollars per sale and pays 200 dollars a day in fixed costs, so its profit is \( P = 150X – 200 \). Multiplying stretches both the centre and the spread. Adding or subtracting a constant slides every outcome by the same amount, so it moves the centre but leaves the spread alone.
So expected profit is \( 150(2.0) – 200 = 100 \) dollars a day, and its standard deviation is \( 150 \times 1.14 \approx 171 \) dollars. The spread is bigger than the average profit, which the mean alone would hide.
When you combine two variables, means always add. Variances add too, but only if the variables are independent, and they add even when you subtract one variable from the other.
For example, assembly takes a mean of 12 minutes with \( \sigma = 3 \) and inspection a mean of 5 minutes with \( \sigma = 4 \), independently. The total has mean \( 12 + 5 = 17 \) minutes and variance \( 9 + 16 = 25 \), so its standard deviation is \( \sqrt{25} = 5 \) minutes, not 7.
The binomial distribution
Some patterns turn up so often that they have names. The most important discrete one is the binomial. It counts successes in a set number of tries: faulty units in a box of 50, heads in ten flips, correct guesses on a quiz.
A situation is binomial only when all four conditions hold:
| Condition | What it means |
|---|---|
| Fixed \( n \) | The number of trials is decided in advance |
| Two outcomes | Each trial is a “success” or a “failure” |
| Constant \( p \) | The chance of success is the same every time |
| Independence | One trial’s result does not affect another’s |
Read the formula in pieces. \( p^k \) is the chance of the \( k \) successes, \( (1-p)^{n-k} \) is the chance of the failures, and \( C(n,k) \) counts how many different orders give the same total.
A quiz has 5 multiple-choice questions. A student who guesses has a 0.3 chance of getting each one right. Find the probability of exactly 2 correct, and of at least one correct.
A guesser has about a 31% chance of exactly 2 right and about an 83% chance of at least one right. Using the complement in Step 3 replaced five separate calculations with one.
Watch the wording. “At most 2” means 0, 1 or 2, so you add \( P(0) + P(1) + P(2) = 0.16807 + 0.36015 + 0.3087 \approx 0.837 \). “Fewer than 2” stops at 1.
Now the factory question. With \( n = 50 \) and \( p = 0.03 \), the expected number of faulty units is \( 50 \times 0.03 = 1.5 \), with \( \sigma = \sqrt{50 \times 0.03 \times 0.97} \approx 1.21 \). A perfect box means \( X = 0 \): \( 0.97^{50} \approx 0.218 \). Only about 22% of boxes arrive flawless.
The shape of a binomial depends on \( p \). It is symmetric when \( p = 0.5 \), right-skewed when \( p \) is small, and left-skewed when \( p \) is large. As \( n \) grows, the bars start to look like a bell, which leads into Step 8.
The Poisson distribution
The binomial needs a fixed number of trials. But some counts have no natural \( n \): calls to a help desk in an hour, typos on a page, accidents at a junction in a month. There is only a rate over an interval. For these you use the Poisson distribution, which has one parameter, \( \lambda \) (lambda), the average number of events per interval.
A help desk gets an average of 3 calls an hour. Find the probability of exactly 2 calls in an hour, and of no calls. Use \( e^{-3} \approx 0.0498 \).
There is about a 22% chance of exactly 2 calls and only about a 5% chance of a completely quiet hour. The standard deviation is \( \sqrt{3} \approx 1.73 \) calls.
How do you choose between the two? Ask what is being counted. Successes out of a fixed number of trials means binomial. Events per hour, page or month with no fixed \( n \) means Poisson.
Practise: 6 questions
Try each one on paper first, then check the worked answer.
EasyQ1. A variable takes the values 0, 1, 2, 3 with probabilities 0.2, 0.4, 0.3 and one missing value. Find the missing probability and \( E(X) \). Show worked answer
\( E(X) = 0(0.2) + 1(0.4) + 2(0.3) + 3(0.1) = 0 + 0.4 + 0.6 + 0.3 = 1.3 \).
EasyQ2. A raffle ticket costs £2. You win £50 with probability 0.02. Find your expected profit per ticket. Show worked answer
\( E(\text{profit}) = 0.02(48) + 0.98(-2) = 0.96 – 1.96 = -1.00 \).
On average you lose £1 per ticket.
MediumQ3. For the distribution in Q1, find the variance and standard deviation. Show worked answer
\( \text{Var}(X) = 1.69(0.2) + 0.09(0.4) + 0.49(0.3) + 2.89(0.1) = 0.338 + 0.036 + 0.147 + 0.289 = 0.81 \).
\( \sigma = \sqrt{0.81} = 0.9 \).
MediumQ4. A binomial variable has \( n = 10 \) and \( p = 0.2 \). Find \( P(X = 3) \) and \( P(X \ge 1) \). Show worked answer
\( P(X = 3) = 120 \times 0.2^3 \times 0.8^7 = 120 \times 0.008 \times 0.2097 \approx 0.201 \).
\( P(X \ge 1) = 1 – 0.8^{10} = 1 – 0.1074 = 0.893 \) (to 3 d.p.).
MediumQ5. A book has an average of 4 typos per page. Using \( e^{-4} \approx 0.0183 \), find the probability that a page has exactly 2 typos, and state the standard deviation. Show worked answer
\( P(X = 2) = \dfrac{0.0183 \times 4^2}{2!} = \dfrac{0.0183 \times 16}{2} = 0.0183 \times 8 \approx 0.146 \).
\( \sigma = \sqrt{4} = 2 \) typos.
ExamQ6. A machine makes items with a 5% defect rate. A box holds 20 items. (a) Explain why the binomial model applies. [2] (b) Find the mean and standard deviation of the number of defective items. [2] (c) Find the probability a box has no defective items. [2] (d) Find the probability it has at least one. [1] Show worked answer
(b) \( \mu = 20 \times 0.05 = 1 \) defective item [1]; \( \sigma = \sqrt{20 \times 0.05 \times 0.95} = \sqrt{0.95} \approx 0.97 \) [1].
(c) \( P(X = 0) = 0.95^{20} \) [1] \( \approx 0.358 \) [1].
(d) \( P(X \ge 1) = 1 – 0.358 = 0.642 \) [1].
Check yourself
1. Which of these is a discrete random variable?
2. Two independent variables have standard deviations 6 and 8. What is the standard deviation of their sum?
3. Which situation suits the Poisson rather than the binomial?
Your score: 0 out of 3
The short version
- A random variable gives a number to each chance outcome. Counted means discrete; measured means continuous.
- A probability distribution lists every value with its probability, and the probabilities must sum to 1. \( E(X) = \sum x P(x) \) is the long-run average, and \( \text{Var}(X) = \sum (x-\mu)^2 P(x) \).
- For \( aX + b \), the mean follows the whole change but the spread ignores \( b \). For independent variables, variances add (even for a difference); standard deviations never add.
- The binomial counts successes in \( n \) independent trials with constant \( p \): \( \mu = np \), \( \sigma = \sqrt{np(1-p)} \). Use \( 1 – P(X = 0) \) for “at least one”. The Poisson counts events per interval, with mean and variance both equal to \( \lambda \).
- The full chapter in Statistics Made Simple has many more worked examples and a full set of tiered practice questions with a complete answer key.
Further reading on EconTutorials
Older in-depth articles on this topic from our blog:
