Lesson 1 — Random variables, PMF and CDF
On this page 8 headings
1. What is a random variable?
A random variable is a function that assigns a real number to each outcome of a random experiment. It is not the experiment itself, and despite the name it is not a "variable" in the algebra sense.
Example. Toss two fair coins. The sample space is:
Define X = number of heads. X maps each outcome to a number:
Illustration description: Random variable: each of the four outcomes is mapped to a number of heads
| Outcome | Value of X |
|---|---|
| HH | 2 |
| HT | 1 |
| TH | 1 |
| TT | 0 |
Four outcomes collapse to three values, so X ∈ {0, 1, 2}. The set of values X can take is called its support. Two different outcomes (HT and TH) map to the same value — that is allowed, because a function can be many-to-one.
Discrete vs continuous. X is discrete when its support is finite or countable (heads, defects, arrivals). It is continuous when it can take any value in an interval (time, height, voltage). Discrete variables get a PMF; continuous ones get a PDF. Both have a CDF.
2. Probability Mass Function (PMF)
The PMF gives the probability that a discrete X takes each exact value: p(x) = P(X = x). For two fair, independent tosses each outcome has probability 1/4, so X = 1 (HT or TH) gets 1/2 — twice as likely as 0 or 2 heads.
Illustration description: PMF of the number of heads: 1/4, 1/2, 1/4
A function is a valid PMF only if both hold:
- p(x) ≥ 0 for every x
- The probabilities over the support add to 1:
The probability of any set A of values is the sum of p(x) over the values in A. Example: P(X is odd) = P(X = 1) = 1/2.
3. Cumulative Distribution Function (CDF)
The CDF accumulates probability up to and including x:
P(at most one head) = F(1) = P(X = 0) + P(X = 1) = 1/4 + 1/2 = 3/4.
Illustration description: CDF of the number of heads as a step function: 0, 0.25, 0.75, 1
| x | F(x) |
|---|---|
| x < 0 | 0 |
| 0 ≤ x < 1 | 0.25 |
| 1 ≤ x < 2 | 0.75 |
| x ≥ 2 | 1 |
Read the graph carefully. For a discrete X the CDF is a staircase. It is defined for every real x, not only 0, 1, 2 — e.g. F(1.7) = 0.75 and F(−3) = 0. At each jump the filled dot is on the upper step (the value includes the jump); the open dot marks the value just before it. Each jump height equals p(x) at that point.
Properties every CDF satisfies (GATE tests these):
- 0 ≤ F(x) ≤ 1
- Non-decreasing: if a < b then F(a) ≤ F(b)
- F(x) → 0 as x → −∞ and F(x) → 1 as x → +∞
- Right-continuous (that is why the filled dot sits on the upper step)
Interval probabilities from the CDF — mind the endpoints for discrete X:
Check: P(0 < X ≤ 2) = F(2) − F(0) = 1 − 0.25 = 0.75, which is P(X=1) + P(X=2). ✔
PMF vs CDF in one line: the PMF is the probability at a value; the CDF is the probability up to and including a value.
4. GATE-style numerical: find the missing constant
Question. P(X = x) = c(x + 1) for x = 0, 1, 2 and 0 otherwise. Find c, then P(X ≥ 1).
Illustration description: Worked solution: c + 2c + 3c = 1 gives c = 1/6, and P(X ≥ 1) = 5/6
- Normalise. Total probability must be 1:
- Write out the PMF. P(X=0) = 1/6, P(X=1) = 2/6, P(X=2) = 3/6.
- Check non-negativity. All three are ≥ 0, so c = 1/6 gives a valid PMF. (In harder questions — e.g. P(X=x) = c(x − 1) — this check is what rules out a candidate value of c.)
- Answer the event. Use the complement, which is faster when the event covers most of the support:
Method to memorise: normalise → list the PMF → check p(x) ≥ 0 → sum (or use the complement) for the event.
5. Practice questions
Try all five before reading the answers below.
- ☐ Q1. A fair coin is tossed three times; X = number of heads. P(X = 2) = ? (A) 1/8 (B) 2/8 (C) 3/8 (D) 1/2
- ☐ Q2. P(X = x) = kx² for x = 1, 2, 3 (0 otherwise). Find k and P(X ≤ 2).
- ☐ Q3. A discrete X has CDF F(x) = 0 for x < 1; 0.3 for 1 ≤ x < 3; 0.7 for 3 ≤ x < 5; 1 for x ≥ 5. Find P(X = 3), P(X < 3) and P(1 < X ≤ 5).
- ☐ Q4. For the two-coin X of this guide, find F(1.5) and F(−0.2).
- ☐ Q5. Two fair dice are rolled; X = the larger of the two numbers. Find P(X = 3).
Answers
- (C) 3/8. Outcomes with two heads: HHT, HTH, THH = 3 of 8.
- k = 1/14, P(X ≤ 2) = 5/14. k(1 + 4 + 9) = 1 → k = 1/14; then (1 + 4)/14.
- P(X = 3) = 0.4 (jump at 3: 0.7 − 0.3). P(X < 3) = 0.3 (strict <, so F just below 3). P(1 < X ≤ 5) = F(5) − F(1) = 1 − 0.3 = 0.7.
- F(1.5) = 0.75, F(−0.2) = 0. The CDF is flat between support points.
- 5/36. P(X ≤ 3) = (3/6)² = 9/36 and P(X ≤ 2) = 4/36, so P(X = 3) = 9/36 − 4/36. This is the CDF-difference trick: it is often easier to find F first and take the jump.
6. Revision sheet
| Concept | Definition | Must-remember |
|---|---|---|
| Random variable | Function from outcomes to real numbers | Many outcomes can map to one value |
| Support | Set of values X can take | Two-coin X: {0, 1, 2} |
| PMF | p(x) = P(X = x), discrete only | p(x) ≥ 0 and Σ p(x) = 1 |
| CDF | F(x) = P(X ≤ x), any X | Non-decreasing, 0 → 1, right-continuous |
| Jump in CDF | F(a) − F(a⁻) | Equals P(X = a) |
| Interval | P(a < X ≤ b) | F(b) − F(a) |
Common mistakes
- Treating HT and TH as one outcome — they are separate, each with probability 1/4.
- Mixing ≤ and < for discrete X: P(X < 3) ≠ P(X ≤ 3) when P(X = 3) > 0.
- Evaluating the CDF only at support points; it is defined (and flat) everywhere in between.
- Forgetting to check p(x) ≥ 0 after solving for a constant.
- Calling Poisson continuous because of the syllabus wording.
Next: Module 2 — expectation and variance, built on the same two-coin PMF.
