Free access until 31 December 2026 · Physics and Maths questions and notes, updated continuously · Build a test

ExaminerPrep › IB Maths AA › Notes

IB Maths AA · Topic 4 · 4.7 · SL and HL

Discrete random variables

This note covers discrete random variables: how a probability distribution is written down, how to find missing probabilities, and how to calculate the expected value (mean). Expected value turns a spread of possible outcomes into one useful number, which is how insurers, casinos and engineers make decisions under uncertainty.

Key ideas

A random variable is a quantity whose value depends on chance. We use a capital letter, such as \(X\), for the variable and a lowercase letter, such as \(x\), for a particular value it can take. A random variable is discrete if it can only take separate values, usually whole numbers: the number of goals in a match, the score on a die, the number of faulty items in a box.

The probability distribution of \(X\) lists every possible value \(x\) with its probability \(P(X=x)\). It can be shown as a table, as a formula, or as a bar chart. Two facts must always hold:

  • every probability is between 0 and 1, so \(0 \le P(X=x) \le 1\);
  • the probabilities add up to 1, so \(\sum P(X=x) = 1\).

The second fact is the main tool for finding an unknown constant. Write an equation that makes the total equal 1, then solve it.

Probabilities of several values are found by adding. For example, \(P(X \ge 3)\) means the sum of the probabilities of every value that is 3 or more. For a discrete variable, \(P(X \gt 3)\) and \(P(X \ge 3)\) are different, because the value 3 itself carries probability.

The expected value \(E(X)\) is the long-run average of \(X\) if the situation were repeated a very large number of times. It is a weighted mean, where each value is weighted by its probability. It does not have to be a possible value of \(X\). An average of 2.4 goals per match is perfectly sensible even though no match has 2.4 goals.

If you carry out \(n\) independent trials, the expected total is \(n \times E(X)\). This is how we turn a single-game average into a prediction over many games.

Fair games. A game costs an amount to play and pays out prizes. Its expected gain for the player is (expected winnings) minus (cost to play). The game is fair when the expected gain is zero. If the expected gain is negative, the organiser expects to profit in the long run.

Definitions and formulae

Term or formulaMeaning / when to use
\(P(X=x)\)Probability that the variable takes the value \(x\).
\(\sum P(X=x) = 1\)The probabilities of all possible values add to 1. Use it to find unknown constants.
\(E(X) = \sum x\,P(X=x)\)Expected value (mean) of a discrete random variable: multiply each value by its probability, then add.
\(n \times E(X)\)Expected total over \(n\) repeats of the same situation.
Expected gainExpected winnings minus the cost to play. A fair game has expected gain \(0\).

Worked examples

Example 1 A robotics club records the number of sensor faults, \(X\), in one run of a robot. The probabilities are \(P(X=x) = k(6-x)\) for \(x = 1, 2, 3, 4\). Find \(k\), then find \(P(X \ge 3)\) and \(E(X)\).

Write the four probabilities: \(5k,\ 4k,\ 3k,\ 2k\).

They must add to 1: \(5k + 4k + 3k + 2k = 14k = 1\), so \(k = \dfrac{1}{14}\).

\(P(X \ge 3) = P(X=3) + P(X=4) = \dfrac{3}{14} + \dfrac{2}{14} = \dfrac{5}{14} \approx 0.357\).

\(E(X) = 1\times\dfrac{5}{14} + 2\times\dfrac{4}{14} + 3\times\dfrac{3}{14} + 4\times\dfrac{2}{14} = \dfrac{5+8+9+8}{14} = \dfrac{30}{14} = \dfrac{15}{7}\).

Answer: \(k = \dfrac{1}{14}\), \(P(X \ge 3) = \dfrac{5}{14}\), \(E(X) = \dfrac{15}{7} \approx 2.14\) faults.

Example 2 At a school fair a stall charges £3 to play. A fair six-sided die is rolled. A six wins £10, a four or a five wins £2, and any other result wins nothing. (a) Find the expected winnings per game. (b) Find the expected profit for the stall over 300 games. (c) What entry fee would make the game fair?

Let \(W\) be the winnings in pounds. \(P(W=10) = \dfrac{1}{6}\), \(P(W=2) = \dfrac{2}{6}\), \(P(W=0) = \dfrac{3}{6}\).

(a) \(E(W) = 10\times\dfrac{1}{6} + 2\times\dfrac{2}{6} + 0\times\dfrac{3}{6} = \dfrac{10+4}{6} = \dfrac{14}{6} \approx 2.33\).

(b) The stall receives £3 and expects to pay out £2.33 per game, so its expected profit per game is \(3 - \dfrac{14}{6} = \dfrac{2}{3}\). Over 300 games: \(300 \times \dfrac{2}{3} = 200\).

(c) A fair game has zero expected gain, so the fee equals the expected winnings: \(\dfrac{14}{6} = \dfrac{7}{3}\), about £2.33.

Answer: (a) £2.33 per game; (b) £200 expected profit; (c) £2.33.

Example 3 The table shows the distribution of \(X\), the number of text alerts an app sends in an hour. It is given that \(E(X) = 2.5\). Find \(p\) and \(q\).

Table: \(x = 1, 2, 3, 4\) with probabilities \(0.1,\ p,\ q,\ 0.2\).

Total probability: \(0.1 + p + q + 0.2 = 1\), so \(p + q = 0.7\).

Expected value: \(1(0.1) + 2p + 3q + 4(0.2) = 2.5\), so \(2p + 3q = 2.5 - 0.1 - 0.8 = 1.6\).

Substitute \(p = 0.7 - q\): \(2(0.7 - q) + 3q = 1.6\), so \(1.4 + q = 1.6\), giving \(q = 0.2\).

Then \(p = 0.7 - 0.2 = 0.5\).

Check: \(0.1 + 0.5 + 0.2 + 0.2 = 1\) and \(0.1 + 1.0 + 0.6 + 0.8 = 2.5\). Both conditions hold.

Answer: \(p = 0.5\), \(q = 0.2\).

Common errors

  • Common error: forgetting to check that the probabilities add to 1, or finding a "probability" that is negative or greater than 1 and not noticing.
  • Common error: dividing by the number of values when finding \(E(X)\). The probabilities already act as weights, so you add \(x\,P(X=x)\) and do not divide.
  • Common error: rounding \(E(X)\) to a whole number because "you cannot have 2.4 goals". The expected value is an average and need not be a possible outcome.
  • Common error: calling a game fair because the expected winnings look large, without subtracting the cost to play. A game is fair only when expected winnings equal the fee.
  • Common error: confusing \(P(X \gt 3)\) with \(P(X \ge 3)\) for a discrete variable.

Exam tip: When a question gives an unknown constant, your first line should be "probabilities sum to 1". If a second unknown appears, look for a given expected value to build a second equation, and always substitute back to check both.

Check yourself

  1. \(X\) takes the values 1, 2, 3 with probabilities 0.5, 0.3, 0.2. Find \(E(X)\).
    Answer\(E(X) = 1(0.5) + 2(0.3) + 3(0.2) = 0.5 + 0.6 + 0.6 = 1.7\).
  2. \(X\) takes the values 0, 1, 2, 3 with probabilities \(k, 2k, 3k, 4k\). Find \(k\), \(P(X \ge 2)\) and \(E(X)\).
    Answer\(10k = 1\), so \(k = 0.1\). \(P(X \ge 2) = 0.3 + 0.4 = 0.7\). \(E(X) = 0 + 0.2 + 0.6 + 1.2 = 2.0\).
  3. A raffle sells 500 tickets at £2 each. There is one prize of £300 and five prizes of £20. Find the expected prize value per ticket and the organiser's expected profit per ticket.
    AnswerTotal prize money \(= 300 + 5\times20 = 400\). Expected prize per ticket \(= \dfrac{400}{500} = £0.80\). Expected profit per ticket \(= 2 - 0.80 = £1.20\).
  4. A player pays £\(c\) to roll a fair die and receives the number rolled in pounds. Find \(c\) so that the game is fair.
    Answer\(E = \dfrac{1+2+3+4+5+6}{6} = 3.5\). A fair game has fee equal to expected winnings, so \(c = 3.50\).