Skip to the content

Topics Covered

Random variables PMF, PDF and CDF Mathematical expectation Variance and standard deviation Moments Moment-generating function (MGF) 📝 Practice problems Exam questions from this unit Mistakes that cost marks
On this page
  1. 2.1 Random variables
  2. 2.2 PMF, PDF and CDF
  3. 2.3 Mathematical expectation
  4. 2.4 Variance and standard deviation
  5. 2.5 Moments
  6. 2.6 Moment-generating function (MGF)
  7. 📝 Practice problems
  8. Exam questions from this unit
  9. Mistakes that cost marks

Syllabus topics: Random variables — definition, types (discrete and continuous), and properties. Probability mass function (PMF) and probability density function (PDF). Cumulative distribution function (CDF). Mathematical expectation (mean), variance and standard deviation. Moments and moment-generating functions.


2.1 Random variables

THE BIG IDEA

A random variable is a rule that attaches a number to each outcome of a random experiment. It turns "heads, heads, tails" into "2 heads", so you can do arithmetic with chance.

IN DEPTH

You toss a coin three times. The outcomes are things like HHT and THH — not numbers, so you cannot average them. But if you count the heads, every outcome becomes a number: 0, 1, 2 or 3. Now you can ask "on average, how many heads?" That counting rule is a random variable, and it is what makes probability computable.

FORMULA

Formally

A random variable X is a function from the sample space to the real numbers.

Sample space for three coin tosses (8 outcomes):

Outcome HHH HHT HTH THH HTT THT TTH TTT
X = heads 3 2 2 2 1 1 1 0

Collecting the values:

x 0 1 2 3
P(X = x) 1/8 3/8 3/8 1/8

That table is the probability distribution of X. Notice the probabilities sum to 1 — always check this first; if they do not, something is wrong.

Discrete vs continuous

Discrete Continuous
Values Countable — 0, 1, 2, … Any value in an interval
Examples Number of heads, defects, customers Height, weight, time, temperature
Described by PMF — P(X = x) PDF — f(x)
P(X = a exactly) Can be positive Always zero
Total probability Σ P(x) = 1 ∫ f(x) dx = 1

WHY IT MATTERS

Why is P(X = a) zero for a continuous variable? Ask for the probability that someone is exactly 170.000000… cm tall, to infinite precision. There are infinitely many possible heights, so any single one has probability zero. Only intervals have positive probability: P(169.5 < X < 170.5) is a sensible question.

A useful consequence: for continuous variables P(X ≤ a) = P(X < a), because the endpoint contributes nothing. For discrete variables they differ, and mixing them up is a common error.

2.2 PMF, PDF and CDF

Probability mass function (PMF) — discrete

FORMULA

p(x) = P(X = x)

Properties: p(x) ≥ 0 for all x, and Σ p(x) = 1.

Probability density function (PDF) — continuous

FORMULA

P(a ≤ X ≤ b) = ∫ₐᵇ f(x) dx

Properties: f(x) ≥ 0, and ∫ over all x of f(x) dx = 1.

f(x) is not a probability. It is a density — probability per unit of x — and it can exceed 1. Probability is the area under the curve, not the height of it. This is worth stating explicitly in an exam answer.

Cumulative distribution function (CDF)

FORMULA

F(x) = P(X ≤ x)

The CDF works for both kinds of variable, which is why it matters.

Properties of any CDF:

  1. F(−∞) = 0 and F(+∞) = 1
  2. Non-decreasing — it never goes down
  3. P(a < X ≤ b) = F(b) − F(a)
  4. For continuous X, f(x) = dF(x)/dx — the PDF is the derivative of the CDF

WORKED EXAMPLE

For the coin-toss variable above:

x 0 1 2 3
p(x) 1/8 3/8 3/8 1/8
F(x) 1/8 4/8 7/8 8/8 = 1

So P(X ≤ 2) = 7/8, and P(1 < X ≤ 3) = F(3) − F(1) = 1 − 4/8 = 4/8.

2.3 Mathematical expectation

THE BIG IDEA

The expected value is the long-run average — what you would get per trial if you repeated the experiment an enormous number of times.

IN DEPTH

A carnival game costs ₹10 to play. You roll a die and win ₹60 if you get a six, nothing otherwise. Is it worth playing?

Your expected winnings are 60 × (1/6) = ₹10. The game costs ₹10. So on average you break exactly even — play a thousand times and you finish roughly where you started. Now suppose the prize is ₹50: expected winnings ₹8.33 against a ₹10 cost, so you lose ₹1.67 per play on average. That is how every casino, lottery and insurance company is designed.

FORMULA

Discrete: E(X) = Σ xᵢ · p(xᵢ) Continuous: E(X) = ∫ x · f(x) dx

In plain English: multiply each value by its probability, then add everything up. It is a weighted average, where the weights are the probabilities.

Worked example. X = number of heads in three tosses.

x p(x) x·p(x)
0 1/8 0
1 3/8 3/8
2 3/8 6/8
3 1/8 3/8
Σ 1 ✓ 12/8 = 1.5

E(X) = 1.5 heads.

KEY INSIGHT

You can never actually get 1.5 heads. The expected value need not be a possible outcome at all — it is the balance point of the distribution, the place where the probability weights would sit level on a see-saw. "Expected" is a technical term, not a prediction of what will happen.

Properties of expectation

Property Statement
Constant E(c) = c
Scaling E(aX) = a·E(X)
Linearity E(aX + b) = a·E(X) + b
Additivity E(X + Y) = E(X) + E(Y) — always, even if dependent
Products E(XY) = E(X)·E(Y) only if X and Y are independent

Linearity holding regardless of independence is genuinely useful and often tested.

2.4 Variance and standard deviation

FORMULA

Var(X) = E[(X − μ)²]

Shortcut: Var(X) = E(X²) − [E(X)]²

The shortcut is faster in every exam. Use it.

FORMULA

SD(X) = σ = √Var(X)

WORKED EXAMPLE

, continuing with the coin tosses:

x p(x) x·p(x) x²·p(x)
0 1/8 0 0
1 3/8 3/8 3/8
2 3/8 6/8 12/8
3 1/8 3/8 9/8
Σ 1 1.5 24/8 = 3.0

Check against the binomial formula (Unit 3): np(1−p) = 3 × 0.5 × 0.5 = 0.75 ✓

Properties of variance

Property Statement
Constant Var(c) = 0
Adding a constant Var(X + b) = Var(X)
Scaling Var(aX) = a²·Var(X)
General Var(aX + b) = a²·Var(X)
Sum Var(X + Y) = Var(X) + Var(Y) only if independent

Two of these are examined constantly:

2.5 Moments

THE BIG IDEA

Moments are a family of numbers that describe a distribution's shape — successively capturing where it sits, how wide it is, how lopsided, and how heavy-tailed.

The rth moment

About the origin: μ′ᵣ = E(Xʳ) About the mean (central): μᵣ = E[(X − μ)ʳ]

Moment Formula What it describes
1st about origin μ′₁ = E(X) Mean — location
2nd central μ₂ = E[(X−μ)²] Variance — spread
3rd central μ₃ Skewness — asymmetry
4th central μ₄ Kurtosis — tail weight and peakedness

Relationships worth memorising:

Interpreting skewness and kurtosis

Skewness Shape
= 0 Symmetric
> 0 Positively skewed — tail to the right, mean > median
< 0 Negatively skewed — tail to the left, mean < median
Kurtosis β₂ Name Shape
= 3 Mesokurtic Like the normal distribution
> 3 Leptokurtic Sharper peak, heavier tails
< 3 Platykurtic Flatter, thinner tails

A memory aid: leptokurtic leaps up (tall and peaked); platykurtic is plateau-like (flat).

2.6 Moment-generating function (MGF)

FORMULA

Mₓ(t) = E(e^tX)

The trick that makes it useful: differentiate and set t = 0 to extract each moment.

FORMULA

μ′ᵣ = d^r Mₓ(t)/dt^r evaluated at t = 0

So:

WORKED EXAMPLE

For X ~ Binomial(n, p), Mₓ(t) = (q + peᵗ)ⁿ where q = 1−p.

That is the binomial mean, obtained without working out the sum Σ x·C(n, x)·pˣqⁿ⁻ˣ directly.

Why the MGF matters

  1. It generates all moments by differentiation — no messy summation
  2. It uniquely determines the distribution — if two variables have the same MGF, they have the same distribution

  3. Sums become products: if X and Y are independent, M_{X+Y}(t) = Mₓ(t) · M_y(t). This is how you prove that the sum of two independent Poisson variables is Poisson.

The MGF does not always exist (the Cauchy distribution has none), which is why the characteristic function E(e^{itX}) is used in more advanced work.


📝 Practice problems

PROBLEM 1

A random variable X has the distribution:

x 1 2 3 4
p(x) 0.1 0.3 0.4 k

Find k, then E(X), E(X²), Var(X) and SD(X).

Solution.

x p(x) x·p(x) x²·p(x)
1 0.1 0.1 0.1
2 0.3 0.6 1.2
3 0.4 1.2 3.6
4 0.2 0.8 3.2
Σ 1.0 ✓ 2.7 8.1

PROBLEM 2

If E(X) = 5 and Var(X) = 4, find E(3X + 2) and Var(3X + 2).

Solution.

The constant vanishes from the variance because adding 2 to every value moves the whole distribution without changing its width.

PROBLEM 3

A continuous random variable has PDF f(x) = 3x² for 0 ≤ x ≤ 1, and 0 elsewhere. Verify it is a valid PDF, then find E(X) and P(X ≤ 0.5).

Solution.

Note the mean is 0.75, well right of the midpoint 0.5 — the density 3x² puts far more weight near 1 than near 0.


Exam questions from this unit

Two marks

  1. Define a random variable and state its two types.
  2. Why is P(X = a) = 0 for a continuous random variable?
  3. State two properties of a CDF.
  4. What is the relationship between a PDF and a CDF?
  5. State the shortcut formula for variance.

Five marks

  1. Explain PMF, PDF and CDF with examples of each.
  2. State and explain the properties of expectation and variance.
  3. Find the mean and variance of a given discrete distribution.
  4. Explain moments and what the first four describe.

Ten marks

  1. Explain random variables in full — types, PMF/PDF, CDF, expectation and variance — with worked examples.

  2. Explain the moment-generating function, its properties, and use it to derive the mean and variance of the binomial distribution.

Mistakes that cost marks

COMMON ERRORS