In this guide
← Maths AI guides

Statistics & probability · AI SL & HL

Discrete random variables

Build a valid probability distribution and use expectation and variance to describe its outcomes.

Course focus: AI SL & HL: use technology to support calculation, show the mathematical setup and interpret the result in its context. Additional HL methods are labelled below.

Before you start: Probability, weighted means and summation notation.

Start with a small example

Build it from the beginning

A random variable attaches a number to each outcome. A distribution pairs possible values with probabilities that add to one. Expected value is a probability-weighted average over many repetitions; it need not be a possible single outcome.

A first walkthrough

X is 0 with probability 0.7 and 10 with probability 0.3. Find E(X).

  1. Check the probabilities: \(0.7+0.3=1\).
  2. Weight each value by its probability: \(0(0.7)+10(0.3)\).
  3. The expected value is 3, even though X never takes the value 3.
Try the practice ladder after learning the methods ↓

The foundations behind the method

Understand what the symbols mean

A random variable assigns a number to each random outcome. Its probability distribution lists possible values and their probabilities. Values need not be equally likely, and expectation need not be a possible outcome. Valid probabilities are nonnegative and sum to one.

How the ideas connect

Expectation is a probability-weighted average. Variance averages squared distances from that expected value; the equivalent form \(E(X^2)-[E(X)]^2\) comes from expanding the square. For a linear transformation, the mean transforms linearly and variance scales by the coefficient squared.

01

Start with the idea

Build your understanding

A random variable attaches a numerical outcome to each trial. A distribution lists values and their probabilities. Expected value is a probability-weighted long-run average, which need not be a possible value in one trial.

Distribution validity

Probabilities must be nonnegative and sum to one. Missing outcomes or an invalid parameter can make later expectation calculations meaningless.

Second moment

Squaring outputs before averaging is different from squaring the average. Their difference measures variance at HL.

Compare the approaches

Choose by the information in the question, rather than the formula you recognise first.

Expected value

When it helpsWeight each outcome by its probability.

Check before using itDo not use an unweighted average unless probabilities are equal.

Variance at HL

When it helpsCompare the second moment with the square of the mean.

Check before using itThe result must be nonnegative and has squared units.

Your method plan

  1. Validate the probability table.
  2. Calculate the required weighted sum.
  3. Interpret the outcome, and check units and feasibility.
02

Learn the methods

Learn step by step

1. A random variable assigns numbers

X is a numerical outcome of a random process. A discrete distribution lists its possible values and their probabilities. Each probability must be nonnegative and the total must be 1. If a constant k appears, use that total to find it before computing moments.

2. Expectation

E(X) is the probability-weighted average. It need not itself be a possible observation: an expected number of successes can be noninteger. For a payoff, distinguish gross winnings from net profit after entry cost. Use a consistent sign for a loss.

Expected value need not be a possible result

0123400.250.50.751Value of XProbabilityE(X) = 1
X is 0 with probability ¾ and 4 with probability ¼. Its expectation is 1, between the outcomes but not itself an outcome. Bar heights show probabilities, not frequencies.

Moments

Why this formula works

Over many repetitions, values occur approximately in their probability proportions, so their long-run average is \(\sum_x xp(x)\). Expanding squared deviations gives variance \(E(X^2)-[E(X)]^2\). Squaring before averaging and squaring an average are different operations.

The formula

\(E(X)=\sum xp(x)\) \(E(X^2)=\sum x^2p(x)\) \(\operatorname{Var}(X)=E(X^2)-[E(X)]^2\).

Quick example

If X is 0 or 2 with equal probabilities, \(E(X)=1\) and \(E(X^{2})=2\), so \(\text{variance}=1\). The expected value 1 need not be a possible outcome.

Worked example: Net payoff

A game pays £8 with probability \(\frac{1}{4}\) and £0 otherwise, with a £3 entry fee. Find expected net profit.

  1. The net outcomes are £5 and −£3, not £8 and £0.
  2. Expectation is \(5(\frac{1}{4})-3(\frac{3}{4})=-1\).
  3. The player loses £1 per game on average over many repetitions; an individual game does not lose exactly £1.

3. Variance at HL

HL extension

Variance measures squared spread about the mean. Calculate \(E(X^{2})\) by squaring each value before weighting, then subtract the square of E(X). These are different quantities. The variance is never negative; a negative numerical value usually signals rounding or an arithmetic error.

Worked example: Normalise then calculate
HL extension

X takes \(0,1,2\) with probabilities k,2k,3k. Find k, mean and variance.

  1. The total \(6k=1\) gives \(k=\frac{1}{6}\).
  2. Mean is \(0(\frac{1}{6})+1(\frac{2}{6})+2(\frac{3}{6})=\frac{4}{3}\).
  3. \(E(X^{2})=1(\frac{2}{6})+4(\frac{3}{6})=\frac{7}{3}\). Variance is \(\frac{7}{3}-\frac{16}{9}=\frac{5}{9}\).

4. Cumulative probabilities and medians

The cumulative distribution \(F(x)=P(X\le x)\) adds probabilities through x. A median m has \(P(X\le m)\ge \frac{1}{2}\) and \(P(X\ge m)\ge \frac{1}{2}\); sometimes several values meet a median definition. For an integer inverse-CDF question, choose the first allowed value whose cumulative probability reaches the requested level.

5. Transformations and extensions

HL extension

Adding a constant shifts the mean without changing variance; multiplying by a scales variance by \(a^{2}\). For sums, expectations add even without independence, while variances require covariance unless independence is established. If a Paper 3 question defines a probability generating function G(s), read that definition first; derivatives at 1 can encode moments.

Transformations (HL)

HL extension
Why this formula works

Linearity of weighted sums gives \(E(aX+b)=aE(X)+b\). Deviations from the new mean are a times the original deviations; squaring them produces \(a^{2}\). The shift b cancels from every deviation.

The formula

\(E(aX+b)=aE(X)+b\) \(\operatorname{Var}(aX+b)=a^2\operatorname{Var}(X)\).

Quick example

If \(E(X)=3\) and \(Var(X)=2\), then \(E(2X+5)=11\) and \(Var(2X+5)=8\).

Generating function extension

HL extension
Why this formula works

Differentiate the supplied polynomial or series term by term: differentiating sˣ brings down x, then setting \(s=1\) leaves \(\sum_x xp(x)\). A second derivative brings down \(x(x-1)\), explaining why it gives a factorial moment rather than \(E(X^{2})\) directly.

The formula

If \(G(s)=\sum p(x)s^x\) for nonnegative integer X, then \(G'(1)=E(X)\) and G″\((1)=E\)[\(X(X-1)\)].

Quick example

For \(G(s)=\frac{1+s}{2}\), \(G'(1)=\frac{1}{2}\) and G″\((1)=0\). Thus \(E(X^{2})=0+\frac{1}{2}\) and \(\text{variance}=\frac{1}{2}-\frac{1}{4}=\frac{1}{4}\).

Worked example: A supplied generating function
HL extension

An investigation defines \(G(s)=(1+s)^2/4\) as the probability generating function of X. Find its probabilities, mean and variance.

  1. Expand to \(G(s)=1/4+s/2+s^2/4\). The coefficients give probabilities \(\frac{1}{4}\), \(\frac{1}{2}\), \(\frac{1}{4}\) at \(X=0,1,2\).
  2. \(G\prime(1)=1\), so the mean is 1. \(G\prime\prime(1)=1/2\) gives E[\(X(X-1)\)].
  3. \(E(X^2)=G\prime\prime(1)+G\prime(1)=3/2\). Variance is \(\frac{3}{2}-1^{2}=\frac{1}{2}\). These conclusions follow from the supplied generating-function definition.
Quick formula reference

For revision once you understand the methods above. Check the conditions before using a formula.

Moments

\(E(X)=\sum xp(x)\), \(E(X^2)=\sum x^2p(x)\), \(\operatorname{Var}(X)=E(X^2)-[E(X)]^2\).

Return to the explanation →

Transformations (HL)

HL extension

\(E(aX+b)=aE(X)+b\); \(\operatorname{Var}(aX+b)=a^2\operatorname{Var}(X)\).

Return to the explanation →

Generating function extension

HL extension

If \(G(s)=\sum p(x)s^x\) for nonnegative integer X, then \(G'(1)=E(X)\) and G″\((1)=E\)[\(X(X-1)\)].

Return to the explanation →

Learn to diagnose an error

Spot the mistake

The statement below is incorrect. Identify the missing condition or reasoning before opening the explanation.

Incorrect reasoning

A fair game's expected winnings are zero, so every player wins zero.

Explain and repair the mistake

Expectation describes the weighted average across repeated plays, not a promised individual outcome. Winning £2 or losing £2 with equal probabilities has mean zero and nonzero variance.

03

Connect and apply

Put the ideas together

A more demanding application of this guide’s methods. This is a learning stage; any additional HL content is labelled separately.

Worked application

Fair price versus a possible prize

A game pays £0, £4 or £10 with probabilities 0.5, 0.3 and 0.2 respectively. Find the expected payout and the expected net return for a £4 entry.

  1. Expected payout is \(0(0.5)+4(0.3)+10(0.2)=3.2\) pounds.
  2. Net return subtracts the fixed fee: \(E(X-4)=3.2-4=-0.8\) pounds.
  3. No individual payout equals £3.20. It describes an average over many repeated games with the specified probabilities.
  4. At HL, \(E(X^2)=24.8\), so \(\operatorname{Var}(X)=24.8-3.2^2=14.56\). Subtracting a fixed fee leaves variance unchanged.
Pause and explain

Would a fair entry fee under expected-value reasoning be £4?

Check your reasoning

No. Ignoring other costs, a fee of £3.20 makes the expected net return zero. Fairness here refers only to the expected-value model.

Common mistakes and how to avoid them

  • \(E(X^{2})\) is not [E(X)]².
  • An expected value need not be an attainable single outcome.
  • Subtract costs when asked for net profit.
  • Do not add variances of dependent variables without considering covariance.
04

Practise independently

Build confidence, then apply it

Try each question before opening its hint or solution. If a method is new, return to the walkthrough, then try again. These learning stages describe the practice sequence; additional HL content is labelled separately.

  1. 1

    Build confidence

    X is 2 with probability 0.4 and 5 with probability 0.6. Find E(X).

    Need a starting point?

    Multiply each outcome by its probability.

    Show the worked solution
    1. \(E(X)=2(0.4)+5(0.6)\).
    2. The result is 3.8.
  2. 2

    Apply and explain

    A game pays £0 or £10 as in the example, and costs £4. Find expected net gain.

    Need a starting point?

    Subtract the entry cost from the expected payment.

    Show the worked solution
    1. Expected payment is £3.
    2. Expected net gain is \(3-4=-1\), a loss of £1 per play on average.
  3. 3

    Check your understanding

    X equals 0 with probability 0.75 and 4 with probability 0.25. Find its mean.

    Show the worked solution

    \(E(X)=0(0.75)+4(0.25)=1\). The value 1 is not itself a possible outcome.

  4. 4

    Use the method

    If \(E(X)=2\), find \(E(4X-1)\).

    Show the worked solution

    Linearity gives \(4E(X)-1=7\). Expectation is a weighted average, not a promise that any individual outcome equals 7. Variance transformations are explained separately as an HL extension.

Finished? Use the linked question bank below to practise selecting the method without a guide telling you which rule to use.

Using these methods in exam questions

AI Paper 1

GDC required

Short-response questions still need mathematical setup and interpretation. Choose the correct tool, enter the model or data carefully, and check units and rounding.

AI Paper 2

GDC required

Extended-response questions connect several steps. Keep intermediate values at full precision and explain how each result answers the context.

For this topic: Define the variable or events, write the probability statement or hypotheses, then calculate. Name the distribution and its parameters; interpret the result using the original population or context.

HL only · GDC required

Paper 3: build a connected argument

Both AA HL and AI HL Paper 3 contain two extended problem-solving questions. A question develops a theme, so keep useful earlier results, test small cases and explain any proposed general rule. A calculator pattern can suggest a result; your mathematical reasoning must support it.

  1. Identify what the first part establishes and record the conditions under which it holds.
  2. When a later part introduces a new definition or model, connect it to methods you already know rather than assuming a new formula must have been memorised.
  3. Check the conclusion against an earlier numerical case and explain its meaning or limitation.

For the first-assessment-2021 courses. IB assessment reference ↗

Find a specific method or formula

Now practise the method

If you opened this guide from a question, return to that tab and try the method without looking at the example. Your answer stays in the question tab.

Practise this subtopic →

Want a broader practice session? Explore IB Maths AI SL practice questions →Explore IB Maths AI HL practice questions →Try free IB Maths exam-style questions and worked solutions →

Original Arc Practice teaching notes for Maths AI. Core and HL sections are distinguished above. These notes follow the first-assessment-2021 course and are not an official IB publication or a complete syllabus checklist. IB course reference. Report a correction.