Discrete and continuous random variables: PMF, PDF and CDF, expectation and its linearity, variance and standard deviation, functions of a random variable, and joint distributions with independence.
A random variable is a function that gives a real number to each outcome of an experiment.
A discrete random variable takes countably many values. Its probability mass function (PMF) is , with and .
A continuous random variable has a probability density function (PDF) with and
For a continuous , for every single point, so and give the same probability. A PDF value can be greater than 1; only its total area must be 1.
The cumulative distribution function (CDF) works for both kinds. Properties:
is non-decreasing and right-continuous,
and ,
,
for continuous , ; for discrete , is a step function with a jump of at each value .
To find an unknown constant in a PMF or PDF, set the total probability equal to 1.
PMF $p(k) = \frac{k}{10}$ for $k = 1, 2, 3, 4$ (left) and its step-shaped CDF (right).
2. Expectation
The expectation (mean) of is its probability-weighted average:
For a function , use the distribution of directly (no need to find the distribution of ):
Linearity: , and always, even when and are dependent.
Indicator trick: to find the expected number of events that happen, write the count as a sum of indicators (1 if event happens, else 0). Then and
This avoids finding the full distribution. For example, the expected number of empty boxes when balls go independently and uniformly into boxes is .
In general . For instance , and in general.
For a non-negative integer-valued , .
3. Variance and standard deviation
The variance measures spread about the mean:
The second form is the one to use in calculations. The standard deviation is , in the same units as .
Rules:
, and it is only when is a constant (with probability 1).
: adding a constant does not change spread, and the sign of disappears.
.
If and are independent, and . Note the plus sign even for .
Quantity
Discrete
Continuous
same
Work in fractions where you can; rounding before squaring causes errors in the variance.
4. Joint distributions and independence
For two discrete random variables the joint PMF is . The marginal PMFs come from summing out the other variable:
For continuous variables, replace the sums by integrals of the joint PDF .
and are independent when for every pair (or ). One failing cell is enough to show dependence.
Covariance: , where .
If and are independent:
,
,
.
The converse is false: zero covariance does not imply independence. If is with equal probability and , then , so the covariance is , yet is fully determined by .
Conditional PMF: when .
Formulas to remember
Total probability
CDF
Expectation
Variance
Linear transformation
Variance of a sum
Covariance
Tail sum for expectationFor taking values
Common mistakes
Writing Var(aX + b) = a·Var(X) or keeping the b; the correct result is a² Var(X).
Using Var(X − Y) = Var(X) − Var(Y) for independent variables; the variances add.
Assuming E[g(X)] = g(E[X]) for a non-linear g such as x² or 1/x.
Treating zero covariance as independence.
Forgetting to normalise a PDF or PMF before computing the mean.
Rounding E[X] before computing E[X²] − (E[X])², which spoils the variance.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Mean and variance from a PMF
numerical
for . Find , and .
Step 1: Use total probability to find c.
Try it on paper first.
Example 2: A continuous random variable
numerical
has PDF for and elsewhere. Find , and .
Step 1: Normalise the PDF.
Try it on paper first.
Example 3: Expected number of empty boxes
numerical
Three balls are placed independently, each into one of three boxes chosen uniformly at random. Find the expected number of empty boxes.
Step 1: Write the count as a sum of indicators.
Try it on paper first.
Example 4: Is E[1/X] equal to 1/E[X]?
conceptual
is or with probability each. Compare with .
Step 1: Compute E[1/X] using the distribution of X.
Try it on paper first.
Previous year questions
12 official GATE CSE questions on this topic, newest first.
10 questions: up to 4 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 CSE syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.