Skip to content

Syllabus · CS Computer Science and Information Technology

All topics in this subject
C programming foundations6
Arrays and pointers7
Recursion6
Probability and statistics foundations9
Database systems foundations15
Linear algebra foundations6
Computer networks foundations9
Calculus foundations6
Theory of computation foundations9
Compiler design foundations9
Linked lists, stacks and queues3
Trees, BSTs and heaps3
Graph foundations3
Algorithms foundations12
Discrete mathematics foundations15
Digital logic foundations22
Computer organization foundations12
Operating systems foundations15

Random variables: PMF, PDF and CDF

Lesson 108 of 1677 minFree

Objectives and prerequisites

Translate outcomes into numerical random variables; distinguish mass from density; validate a PMF or PDF; construct and read a cumulative distribution function; and handle endpoints correctly. Prerequisites: event probability, sums and elementary integration. Random variables are explicitly listed in GATE 2026 CS Engineering Mathematics. The lesson prepares for the named distributions; mixed distributions and multivariate densities are outside its scope.

1. A random variable is a function

A real-valued random variable X assigns a number X(ω) to each outcome ω. The function is fixed; randomness comes from the experiment's outcome. Several outcomes may map to the same number. The event {X=x} is the set of original outcomes mapped to x, and its probability adds their weights.

Example: on two independent fair coin tosses, define X as the number of heads. HH maps to 2, HT and TH to 1, and TT to 0. Thus P(X=0)=1/4, P(X=1)=1/2, P(X=2)=1/4. The support consists of attainable values with positive mass here: {0,1,2}. A random variable's values are not automatically equiprobable, even when the original elementary outcomes are.

A discrete variable has finite or countably infinite support. A continuous variable with a density is described by area rather than point mass. A count of requests is discrete; an idealized waiting time often uses a continuous model. Real measurements may be rounded, but the assumed mathematical model determines how to calculate.

2. Probability mass function

For discrete X, its PMF is p_X(x)=P(X=x). It must satisfy p_X(x)≥0 and Σₓp_X(x)=1 over the support. For any set S, P(X∈S)=Σₓ∈S p_X(x). Values outside the support have mass zero.

Worked example: suppose p_X(x)=kx for x=1,2,3, and zero elsewhere. Normalization gives k(1+2+3)=6k=1, so k=1/6. The masses are 1/6,1/3,1/2. P(X≥2)=1/3+1/2=5/6. A proposed k=1/3 would make total mass two, so it is invalid even though some individual entries are in [0,1]. Both nonnegativity and total mass matter.

For Y=X² with this positive support, Y takes 1,4,9 with the same respective masses. When a transformation is many-to-one, add masses: if X has probabilities 1/4,1/2,1/4 at −1,0,1, then X² has probability 1/2 at zero and 1/2 at one. Do not list the value one twice as if those were different values of Y.

3. The cumulative distribution function works for every type

F_X(t)=P(X≤t). Every CDF is nondecreasing, right-continuous, lies between zero and one, and has limits zero as t→−∞ and one as t→∞. It need not be strictly increasing or continuous. If F is constant on [a,b], then P(a<X≤b)=0; mass at the left endpoint a may still be present.

For the head-count variable, F(t)=0 for t<0; 1/4 for 0≤t<1; 3/4 for 1≤t<2; and 1 for t≥2. At t=1 the value includes X=1, so F(1)=3/4. The jump at a point equals its mass: P(X=a)=F(a)−F(a−), where F(a−)=lim_{t↑a}F(t)=P(X<a).

For a<b, P(a<X≤b)=F(b)−F(a). For an inclusive left endpoint, P(a≤X≤b)=F(b)−F(a−). For the head count, P(1≤X≤2)=1−1/4=3/4, while P(1<X≤2)=1−3/4=1/4. Writing the endpoint inequalities before substituting prevents a common discrete-case error.

4. Density is not point probability

For an absolutely continuous variable X with PDF f_X(x), probabilities are integrals: P(a≤X≤b)=∫ₐᵇ f_X(x)dx. A valid PDF is nonnegative and has integral one over the entire real line. Its CDF is F_X(t)=∫_{−∞}ᵗ f_X(x)dx, and f_X(t)=F'_X(t) wherever the derivative relation applies.

The PDF's height can exceed one. Uniform density f(x)=2 on [0,1/2], zero elsewhere, is valid because area is 2×1/2=1. The height two is not a probability. For a variable with a density, P(X=a)=0 at every individual a, even when f(a)>0. Probability comes from interval area. Consequently open or closed endpoints do not change its interval probabilities.

A probability-zero point is still an allowed value in a continuous model. Do not conclude that X cannot take any value merely because each singleton has probability zero: countable additivity does not say one can add uncountably many singleton probabilities to obtain the whole interval's probability.

5. Worked continuous model

Let f(x)=cx for 0≤x≤2 and zero elsewhere. Nonnegativity requires c≥0; normalization gives ∫₀²cx dx=2c=1, hence c=1/2. The CDF is F(t)=0 for t<0, t²/4 for 0≤t≤2, and 1 for t>2. It joins continuously at both endpoints.

P(1<X≤2)=F(2)−F(1)=1−1/4=3/4. Also P(X=1)=0, although f(1)=1/2. To find a median m, solve F(m)=1/2: m²/4=1/2 gives m=√2 in the support. The negative root is outside the support and is not a median. Medians are developed further in the next lesson.

6. Choosing the right representation

A PMF is summed; a PDF is integrated; a CDF is differenced with attention to endpoints. A CDF may represent a discrete, continuous or mixed law, so never assume its derivative alone captures all mass: jumps represent point masses. We do not develop mixed laws here, but this warning explains why a step CDF's ordinary derivative being zero between jumps does not imply zero total probability.

Checklist: identify support first; normalize using the correct operation; reject negative masses or density; write the target inequalities; use sums, areas or CDF differences; check the result is in [0,1]. When deriving a CDF, include all pieces outside support and check right-continuity and limiting values. These tests often catch a correct-looking but incomplete formula.

Original practice: six single-correct MCQs

These are original questions, not previous-year questions. Choose exactly one option.

RV01. p(x)=kx for x=1,2,3 and zero elsewhere is a PMF. Find k.

A. 1/3 B. 1/6 C. 1/2 D. 1

Answer: B

A: This gives total mass two.

B: The total mass is k(1+2+3)=6k=1.

C: This gives total mass three.

D: The values must be probabilities summing to one, not the raw labels.

RV02. X counts heads in two independent fair tosses. What is F_X(1)?

A. 1/4 B. 1/2 C. 3/4 D. 1

Answer: C

A: This is P(X<1), which excludes mass at one.

B: This is P(X=1), not the cumulative probability.

C: Include X=0 and X=1: 1/4+1/2=3/4.

D: X=2 has probability 1/4 and is excluded.

RV03. For any CDF F and a<b, which expression equals P(a<X≤b)?

A. F(b)−F(a) B. F(b)−F(a−) C. F(b)+F(a) D. F(a)−F(b)

Answer: A

A: Subtract P(X≤a) from P(X≤b).

B: This includes mass at a and gives P(a≤X≤b).

C: Cumulative events overlap; adding does not isolate the interval.

D: A CDF is nondecreasing, so this is nonpositive.

RV04. f(x)=2 on [0,1/2] and zero elsewhere. Which statement is correct?

A. It is invalid because 2>1 B. P(X=1/4)=2 C. It is a valid PDF and P(X=1/4)=0 D. Its total probability is 2

Answer: C

A: PDF height may exceed one; total area must be one.

B: Density height is not point probability.

C: Area is 2×1/2=1, and a singleton has zero probability.

D: Total area is one, not the height two.

RV05. f(x)=x/2 for 0≤x≤2 and zero elsewhere. Find P(1<X≤2).

A. 1/4 B. 1/2 C. 1 D. 3/4

Answer: D

A: This is the area from zero to one.

B: This is the density at one, not the interval area.

C: This is the area over the entire support.

D: Integrate x/2 from one to two: [x²/4]₁²=3/4.

RV06. X has masses 1/4,1/2,1/4 at −1,0,1. If Y=X², find P(Y=1).

A. 1/4 B. 1/2 C. 1 D. 0

Answer: B

A: This counts only one of X=−1 and X=1.

B: Both −1 and 1 map to one, so add 1/4+1/4.

C: The mass at X=0 maps to Y=0 and is excluded.

D: Values ±1 both produce Y=1 with positive probability.

Source and scope

Random variables are explicitly part of Section 1 Probability and Statistics, official GATE 2026 CS syllabus. PMF, PDF and CDF are the representations used to teach this topic. Original examples and questions; named distributions and summary measures continue in separate lessons.

Official GATE 2026 CS syllabus (verified 2026-10-14).

Sign in to keep your progress. Sign in