Conditional expectation $E[X \mid Y]$ as a random variable, the law of total expectation, conditional variance and the law of total variance, and random sums; GATE asks two-stage numericals and property checks.
1. Conditional expectation given an event or a value
For a discrete pair, the conditional PMF of given is . The conditional expectation is its mean:
For a continuous pair, use the conditional density and integrate: .
So is a number that depends on , say . Plugging in the random gives , which is a random variable: it is a function of and takes the value with probability .
Example: uniform on the triangle (density 2). Given , is uniform on , so and .
2. Law of total expectation (tower rule)
Averaging the conditional means, weighted by how likely each condition is, recovers the overall mean:
This is the expectation version of the law of total probability. Use it for two-stage experiments: first something random picks a case, then is drawn within that case.
Properties (all GATE favourites):
Linearity: .
Taking out what is known: ; in particular .
Independence: if and are independent, , a constant.
Best predictor: among all functions , minimises the mean squared error .
First-step analysis uses the tower rule with = the outcome of the first trial. For tosses until the first head with : , so .
3. Conditional variance and the law of total variance
The conditional variance is the variance within one condition:
Like , is a random variable (a function of ).
Law of total variance:
The first term is the average spread within groups.
The second is the spread between group means.
Consequences: and . The same split is behind ANOVA and the within-cluster / between-cluster decomposition used in clustering.
In the diagram, the within-group variances are and , so ; the group means 2 and 3 give . Total .
Two groups with their conditional means (thick ticks) and the overall mean 2.6 (dashed): total spread = within-group spread + between-group spread
4. Random sums
A random sum adds a random number of terms, where the are independent and identically distributed (i.i.d.) with mean and variance , and is independent of them. Examples: total bill of a random number of customers, total size of a random number of packets.
Condition on : and . The two laws then give
The second term is easy to forget: even if every were a constant , would still vary because does.
When to use conditioning, in short: whenever the problem says "first …, then …", "a random number of …", or "depending on which …".
Formulas to remember
Conditional expectation (discrete)
Conditional expectation (continuous)
Law of total expectation
Conditional variance
Law of total variance
Taking out what is known
Random sum mean
Random sum variance i.i.d. with mean , variance , independent of
Common mistakes
Treating as a number; it is a random variable (a function of ), and only is a number.
Using only for and forgetting the between-group term .
Writing for a random sum and dropping .
Averaging conditional means with equal weights instead of the probabilities .
Forgetting to divide by the marginal when forming a conditional density.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Two-stage experiment: mean and variance
numerical
with probability 0.4 and with probability 0.6. Given , is uniform on ; given , is uniform on . Find and .
Step 1: Find the conditional means.
Try it on paper first.
Example 2: Total bill of a random number of customers
numerical
The number of customers in an hour has mean 4 and variance 2. Each customer spends an amount with mean Rs 50 and variance 100, independently of the others and of . Find the mean and variance of the total spend.
Step 1: Write the conditional mean and variance given $N = n$.
Try it on paper first.
Example 3: First-step analysis: rolls until a six
numerical
A fair die is rolled until a six appears. Find the expected number of rolls.
Step 1: Condition on the first roll.
Try it on paper first.
Example 4: Continuous case on a triangle
numerical
has density on . Find and use it to find .
Step 1: Find the marginal of $Y$.
Try it on paper first.
Previous year questions
3 official GATE DA questions on this topic, newest first.
10 questions: up to 3 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.
Mark as mastered
Loading your progress…
My revision notes
Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.