Skip to content
We use only essential cookies to keep you signed in and remember your preferences. See our Cookie Policy.
TestStop
MocksPracticeResourcesIndiaBlogPricing
Sign in
Resources › Probability › 5. Random variables
Probability · Lesson 5 of 9

Random variables, expectation and variance

Most exam questions don’t ask about events. They ask about numbers: winnings, counts, scores. This lesson turns outcomes into numbers, and gives you the two summaries every question uses: the average, and how far things spread around it.

← Probability moduleLesson 5 of 9 · about 40 minutes
1Counting2Rules3Conditional4Bayes5Variables6Discrete7Continuous8Sums and bounds9Hard problems
A question to hold on to
n participants arrive at a conference, and the organisers hand out their name-tags at random. On average, how many people get their own tag?
Delhi School of Economics entrance, 2021Solved at the end ↓
In this guide
Lesson · about 40 minutes
  1. A number for every outcome
  2. The pmf and the CDF
  3. Expectation: the balance point
  4. Variance: the spread around it
  5. Shifting and scaling
  6. Adding random variables
  7. The indicator trick
  8. Chebyshev's guarantee
  9. The lesson on one screen
  10. Check yourself
  11. Past papers, by level
01
The idea

A number for every outcome

Roll two dice. The sample space has 36 outcomes, but you usually care about one number: the total. A random variable is exactly that: a rule that attaches a number to every outcome. (3, 5) gets 8, (6, 6) gets 12, and so on. The outcome is random, so the number is too.

Despite the name, a random variable is neither random nor a variable: it is a function from the sample space to the real numbers. The randomness lives in which outcome happens.

  • Discrete random variables take separate values you can list: the total on two dice, the number of phones a shop sells in a day (0 to 12), the number of heads. CUET asks this directly (2018, 2020).
  • Continuous ones can take any value in an interval: a waiting time, a height, a weight. They are the subject of Lesson 7.
Pause and predict
Assertion: a random variable is a numerical description of the outcome of an experiment. Reason: the value of a random variable does not depend on the outcome of the experiment. (CUET 2026)
02
Describing it

The pmf and the CDF

To describe a discrete random variable, list its values and the chance of each. That list is the probability mass function (pmf), written p(x) or P(X = x). For the total on two dice, 7 has probability 6/36, 2 and 12 have 1/36 each, and so on. A table, a graph or a formula all do the job; CUET 2019 asked exactly that.

What makes a valid pmf
p(x)≥0 for every x,x∑​p(x)=1
Every probability is non-negative, and together they account for everything that can happen.
JNU 2012 · standard
X takes the values 0, 1, 2, 3 with p(0) = C/2, p(1) = 2C − 3C², p(2) = 2C − 1 and p(3) = C/2. Find C.
  1. 1
    The probabilities must add to 1.
    C/2 + 2C − 3C² + 2C − 1 + C/2 = 1, which simplifies to 3C² − 5C + 2 = 0.
  2. 2
    Solve.
    (3C − 2)(C − 1) = 0, so C = 2/3 or C = 1.
  3. 3
    Check non-negativity. This is the step people skip.
    C = 1 gives p(1) = 2 − 3 = −1, which is impossible. C = 2/3 gives p = 1/3, 0, 1/3, 1/3: all fine.
Answer
C = 2/3. A quadratic usually gives two candidates; the rule p(x) ≥ 0 decides between them.

The cumulative distribution function (CDF) adds the pmf up from the left: F(x) = P(X ≤ x). For a discrete variable it is a staircase that jumps at each value by that value’s probability, and is flat in between. Switch the chart below to “CDF” to see one. Two facts follow directly:

  • F rises from 0 on the far left to 1 on the far right, and never goes down.
  • P(a < X ≤ b) = F(b) − F(a). With a jump at a, P(a ≤ X ≤ b) = F(b) − F(a⁻), where F(a⁻) is the value just before the jump.
JNU 2018 · standard
F(x) = 0 for x < 0, x/8 on [0, 1), (2 + x)/8 on [1, 2), (9 + x)/12 on [2, 3), and 1 from 3 on. Find P(1 ≤ X ≤ 2).
  1. 1
    Include the jump at 1.
    P(1 ≤ X ≤ 2) = F(2) − F(1⁻), where F(1⁻) is the value just left of 1: 1/8.
  2. 2
    Read F(2) from the piece that starts at 2.
    F(2) = (9 + 2)/12 = 11/12.
  3. 3
    Subtract.
    11/12 − 1/8 = 22/24 − 3/24 = 19/24.
Answer
19/24. Using F(1) = 3/8 instead would drop the jump at 1, of size 3/8 − 1/8 = 1/4, and give 13/24.
03
Interactive

Expectation: the balance point

Play a dice game thousands of times and your average winnings settle down to one number: the expected value E(X), also written μ. Each value counts in proportion to how often it happens:

Expectation
E(X)=x∑​xp(x)
Also called the mean of the distribution, or its first moment (JNU 2017).

Picture the bars as weights on a see-saw. E(X) is where you put the pivot so it balances. Move a probability below and watch the pivot slide towards the heavier side. The table underneath is the calculation itself: the x·p column adds up to E(X).

Win ₹20 on a 3, ₹40 on a 5, lose ₹30 on a 6, nothing otherwise. X is your winnings. (CUET 2018)

1/61/21/61/6−3002040E = 5
balance point: the mean one standard deviation either side
xpx·px²·p
−301/6−5150
01/200
201/610/3200/3
401/620/3800/3
Sum151450/3
E(X)5
E(X²)1450/3 ≈ 483.333
Var(X)1375/3 ≈ 458.333
SD(X)21.409

Var(X) = E(X²) − [E(X)]² = 1450/3 − (5)². Change a probability with the buttons below; the others are rescaled so they still add up to 1.

x = −30
x = 0
x = 20
x = 40
CUET 2018 · standard
With one fair die, you win ₹20 on a 3, ₹40 on a 5, lose ₹30 on a 6, and nothing otherwise. What are your expected winnings?
  1. 1
    List the values and their chances.
    20, 40 and −30 with probability 1/6 each; 0 with probability 3/6.
  2. 2
    Multiply and add.
    E(X)=620+40−30+0​=630​=5
Answer
₹5 per game. This is the “dice game” preset above.
The mean need not be a possible value

A fair die has E(X) = 3.5, and no die ever shows 3.5. The expectation is a long-run average, not a prediction of the next roll.

Pause and predict
X takes the values −1, 0 and 2 with probabilities 1/8, 1/2 and 3/8. What is E(X)? (CUET 2025)
04
The second summary

Variance: the spread around it

Two games can both average ₹5, one by paying ₹5 every time and one by paying ₹1,000 or losing ₹990. The mean can’t tell them apart. The variance measures how far X typically lands from its mean: the average squared distance.

Variance and standard deviation
Var(X)=E[(X−μ)2]=E(X2)−[E(X)]2
The shortcut on the right is almost always quicker. SD = √Var, in the same units as X.

E(X²) is not [E(X)]². To find the average of a function of X, apply the function to each value and weight by the same probabilities: E(g(X))=∑g(x)p(x). CUET 2024: X is −10 or 20 with probabilities 1/4 and 3/4, so E(X²) = 100/4 + 400 × 3/4 = 325, while [E(X)]² = 12.5² = 156.25. The gap between them is the variance. In the chart, switch the variable to X² to see this for any preset.

JNU 2011 · standard
X takes the values 0 to 4 with probabilities 0.24, 0.38, 0.20, 0.13 and 0.05. Find its mean and variance.
  1. 1
    Mean: add up x·p.
    0 + 0.38 + 0.40 + 0.39 + 0.20 = 1.37.
  2. 2
    E(X²): add up x²·p.
    0 + 0.38 + 0.80 + 1.17 + 0.80 = 3.15.
  3. 3
    Shortcut.
    Var(X) = 3.15 − 1.37² = 3.15 − 1.8769 = 1.2731.
Answer
Mean 1.37, variance 1.2731. The “table” preset above lays out the same columns.
  • Variance is never negative, and neither is SD. “Standard deviation = −1” is always wrong (JNU 2013).
  • Zero variance means no randomness. If X is 1 or −1, then Y = X² is 1 every time, so Var(Y) = 0 (JNU 2017).
  • Most spread for a given support: if X is 0, 1 or 2, with P(0) = P(2) = p, the variance is 2p, largest when all the weight sits at the two ends (p = 0.5; JNU 2015).
05
Linear changes

Shifting and scaling

Convert marks to a percentage, rupees to dollars, or Celsius to Fahrenheit, and you apply Y = aX + b. Adding b shifts every value, and the mean with it, but leaves the spread alone. Multiplying by a stretches everything, the distances from the mean included, so the variance is multiplied by a².

Linear transformation
E(aX+b)=aE(X)+b,Var(aX+b)=a2Var(X)
SD(aX + b) = |a| · SD(X). A constant has no variance, so the b disappears.
Hyderabad 2014 · standard
X = 5Z − 20, with mean of X 80 and standard deviation of X 55. Find the mean and SD of Z.
  1. 1
    Undo the transformation.
    Z = (X + 20)/5.
  2. 2
    Mean.
    μ_Z = (80 + 20)/5 = 20.
  3. 3
    SD: only the scale matters.
    σ_Z = 55/5 = 11.
Answer
μ_Z = 20, σ_Z = 11. Hyderabad asked the same thing in 2015 with Y = 4X + 12.
DSE 2014 · advanced
Y is the number of heads when 3 fair coins are tossed, and Z = 4 + 5Y². Find E(Z) and Var(Z).
  1. 1
    The distribution of Y², straight from Y.
    Y = 0, 1, 2, 3 with probabilities 1/8, 3/8, 3/8, 1/8, so Y² = 0, 1, 4, 9 with the same probabilities.
  2. 2
    Its mean and second moment.
    E(Y²) = (0 + 3 + 12 + 9)/8 = 3. E(Y⁴) = (0 + 3 + 48 + 81)/8 = 16.5.
  3. 3
    Variance of Y².
    Var(Y²) = 16.5 − 3² = 7.5 (DSE asked this in 2007 and 2009).
  4. 4
    Now the linear step.
    E(Z) = 4 + 5 × 3 = 19. Var(Z) = 5² × 7.5 = 187.5.
Answer
E(Z) = 19, Var(Z) = 187.5. Pick “Heads in 3 coins” above and switch to X² to check E(Y²) = 3 and Var(Y²) = 7.5.
06
The most useful fact in the lesson

Adding random variables

The mean of a sum is the sum of the means. Always: the variables don’t need to be independent, or even to have anything to do with each other. This is linearity of expectation, and it turns hard questions into easy ones.

Sums
E(X+Y)=E(X)+E(Y),Var(X±Y)=Var(X)+Var(Y) if independent
The expectation rule always holds. The variance rule needs independence (more precisely, zero covariance).
  • Two dice: E(total) = 3.5 + 3.5 = 7 (Hyderabad 2019). No need for the 36-outcome table.
  • Two chips drawn from a bowl of three $1 chips and two $4 chips (DSE 2013). Each chip drawn is, on its own, an average chip worth (3 + 8)/5 = $2.20, even though the draws are not independent. So E(sum) = 2 × 2.2 = $4.40.
  • Train or bus by a coin toss (DSE 2007): expected time (w + z)/2. None of the listed options gave it, so the answer was “none of the above”.
DSE 2006 · advanced
Two independent observations come from a normal population with variance 16. What is the variance of twice their difference, 2(X₁ − X₂)?
  1. 1
    Pull out the 2, squared.
    Var(2(X₁ − X₂)) = 4 Var(X₁ − X₂).
  2. 2
    Variances add, even for a difference.
    Var(X₁ − X₂) = Var(X₁) + Var(−X₂) = 16 + (−1)² × 16 = 32.
  3. 3
    Multiply.
    4 × 32 = 128.
Answer
128. The trap is 4 × (16 − 16) = 0: subtracting a random quantity adds uncertainty, it doesn’t cancel it.
07
Solving the opening question

The indicator trick

To count how many of something happen, give each possible occurrence its own indicator: a random variable that is 1 if it happens and 0 if not. Its expectation is just the probability: E(I) = 1 × P + 0 × (1 − P) = P. The count is the sum of the indicators, and by linearity its expectation is the sum of the probabilities. No distribution needed.

Expected count
X=I1​+I2​+⋯+In​⟹E(X)=P(A1​)+P(A2​)+⋯+P(An​)
Works even when the events are dependent, which is what makes it so strong.
The opening question · DSE 2021
n name-tags are handed out at random to n people. What is the expected number of people who get their own tag?
  1. 1
    One indicator per person.
    Iₖ = 1 if person k gets their own tag. X = I₁ + ⋯ + Iₙ counts the matches.
  2. 2
    Each person's chance.
    Person k’s tag is equally likely to be any of the n tags: P(Iₖ = 1) = 1/n.
  3. 3
    Add.
    E(X) = n × 1/n = 1.
Answer
1, whatever n is. The matches are not independent (if n − 1 people match, so does the last), and it doesn’t matter.
A↓B
B↓A
C↓C
D↓E
E↓D
F↓F

Top row: the people. Bottom row: the tag each one was given. This hand-out has 2 matches.

0
1
2
3
4
5
6
Average number of matches
–
after 0 hand-outs. Exact value: 1, for every n.
share of hand-outs exact probability
DSE 2014 · advanced
5 men and 5 women sit at random in a row of 10 chairs. What is the expected number of women sitting next to at least one man?
  1. 1
    One indicator per woman.
    E(count) = 5 × P(a given woman has a man beside her).
  2. 2
    Split by her seat.
    An end seat (probability 2/10) has one neighbour, a man with probability 5/9. A middle seat (8/10) has two, and both are women with probability 4/9 × 3/8 = 1/6, so at least one is a man with probability 5/6.
  3. 3
    Combine.
    5(102​⋅95​+108​⋅65​)=5(91​+32​)=935​
Answer
35/9. Around a circle every seat has two neighbours, so the answer is 5 × 5/6 = 25/6 (DSE 2014, the next question).
Watch out for

The mistakes examiners are fishing for

  • E(X²) is not [E(X)]². Apply the function to each value first, then average. The difference is the variance.
  • Variances of a difference add. Var(X − Y) = Var X + Var Y for independent X and Y, not Var X − Var Y.
  • The shift disappears from the variance. Var(aX + b) = a² Var X: no b, and a squared.
  • Averaging the values instead of weighting them. (−1 + 0 + 2)/3 is not the mean unless the three values are equally likely.
08
A bound from two numbers

Chebyshev's guarantee

Knowing only the mean and the variance, you can still say how likely X is to stray far. Whatever the distribution, at most 1/k² of the probability lies k or more standard deviations from the mean.

Chebyshev's inequality
P(∣X−μ∣≥kσ)≤k21​equivalentlyP(∣X−μ∣<kσ)≥1−k21​
Useful only for k > 1. For k = 2, at least 3/4 lies within two SDs; for k = 3, at least 8/9.
JNU 2020 · standard
A fair coin is tossed 400 times. The probability that the number of heads is between 150 and 250 is at least what?
  1. 1
    Mean and SD of the count.
    μ = 400 × ½ = 200. Var = 400 × ½ × ½ = 100, so σ = 10 (Lesson 6 derives these).
  2. 2
    How many SDs is the gap?
    150 and 250 are 50 = 5σ from the mean: k = 5.
  3. 3
    Apply the bound.
    P ≥ 1 − 1/25 = 24/25.
Answer
24/25.
Pause and predict
True or false: there is a random variable X with P(μ − 2σ ≤ X ≤ μ + 2σ) = 0.6. (DSE 2015)
09
Revise

The lesson on one screen

The lesson on one screen
Random variable
A function that gives each outcome a number. Discrete: listable values. Continuous: any value in an interval.
pmf
p(x) = P(X = x), with every p(x) ≥ 0 and Σ p(x) = 1. Check both when solving for a constant.
CDF
F(x) = P(X ≤ x): a non-decreasing staircase from 0 to 1. P(a < X ≤ b) = F(b) − F(a).
Expectation
E(X) = Σ x p(x), the balance point. E(g(X)) = Σ g(x) p(x).
Variance
Var X = E(X²) − [E(X)]² ≥ 0. SD = √Var. Zero only for a constant.
Linear change
E(aX + b) = aE(X) + b; Var(aX + b) = a² Var(X).
Sums
E(X + Y) = E X + E Y always. Var(X ± Y) = Var X + Var Y if independent.
Indicators
Expected count = sum of the probabilities of the individual events, dependent or not.
Chebyshev
P(|X − μ| ≥ kσ) ≤ 1/k² for any distribution.
10
Practice

Check yourself

0 of 10 correct so far

Compute

Expectation
X is 3, 6 or 9 with probabilities 0.25, 0.5 and 0.25 (CUET 2022). Find E(X).
Variance shortcut
E(X²) = 16 and E(X) = 2 (CUET 2023). Find Var(X).
A fair die
X is the score on a fair die. Find Var(X).
Linear change
Var(X) = 4. Find Var(5 − 3X).
Indicators
A fair die is rolled 12 times. What is the expected number of rolls that show a six or a one?
Chebyshev
X has mean 50 and standard deviation 5. At least what probability does Chebyshev give for 35 < X < 65?

Quick questions

1V(CX), where C is a constant, equals (JNU 2017)
2Which statement about a random variable X is always true? (DSE 2014)
3Two fair dice are rolled. The expected total is
4If Var(X) = 0, then
11
Real questions

Past papers, by level

Foundation

Definitions and one-step problems. Most CUET and UGC NET questions sit here.

19 questionsPractise →

Standard

Two or three steps, up to the hardest JAM, JNU and Hyderabad questions.

16 questionsPractise →

Delhi School level

This topic’s hardest questions, from the DSE entrance, are worked through in Lesson 9: Expectation tricks.

13 questionsLesson 9 →
All 35 past-paper questions for this lesson, easiest first: practise the full set →

✦These are questions from the TestStop bank. A free account answers 10 a day, each with its worked solution; All-Access opens every set with no daily limit.

← Lesson 4Bayes' theoremLesson 6 →Discrete distributions

Read next

All resources →
StatisticsProbability 6: discrete distributionsBernoulli, binomial, geometric, hypergeometric and Poisson: the story behind each, when to use which, their means and variances, and the approximations between them.Complete guide · 40 minStatisticsProbability 4: Bayes' theoremReversing a conditional with natural frequencies, the base-rate trap in medical tests, and the urn, witness, MCQ and three-box patterns.Complete guide · 35 minStatisticsProbability, from zero to exam levelA module of lessons that starts at "what is a sample space" and ends at the DSE's hardest questions: counting, the rules, conditional probability, Bayes' theorem, random variables, the discrete and continuous distributions, and a final lesson of hard problems, each with its own interactives and graded past-paper sets.Module · 315 min