Exercises — Cumulative distribution functions
Before starting, keep three facts from the parent note in your pocket. A cumulative distribution function ==== is the running total of probability. It never goes down. And the probability of landing in an interval is . Everything below is built from those.
Level 1 — Recognition
These test whether you can tell CDFs apart from other objects, and read basic values off them.
Exercise 1.1
Which of these could be a valid CDF? For each, say yes/no and why.
- (a) for all
- (b) for all
- (c) A function that equals at and at
Recall Solution 1.1
A valid CDF must satisfy three things (parent note): non-decreasing, limits at and at , and range inside .
(a) No. , so it blows past and never settles at a limit of . Also decreases on . Two rules broken.
(b) Yes. As , , giving . As , , giving . And is increasing, so is non-decreasing. All three rules pass — this is the standard Cauchy distribution CDF.
(c) No. It goes down from (at ) to (at ). A CDF can never decrease, because you cannot "un-accumulate" probability.
Exercise 1.2
A discrete CDF jumps from to at the point . What is ?
Recall Solution 1.2
For discrete variables, = the height of the jump at : , where is the value just to the left.
Level 2 — Application
Now we plug into the machinery: interval probabilities and evaluating CDFs.
Exercise 2.1
has CDF on . Find .
Recall Solution 2.1
Use the interval formula . Makes sense: the interval has width , and a uniform density of height puts area = width.
Exercise 2.2
with for , and . Find .
Recall Solution 2.2
Use the complement rule . This is the "survival" probability — the chance the event has not happened by time .
Exercise 2.3
For the fair die from the parent note, is a staircase with for . Find .
Recall Solution 2.3
and . Check: the outcomes strictly above and up to are — three faces, each probability , total . ✓
Level 3 — Analysis
Take the definitions apart: go between PDF and CDF, handle piecewise pieces.
Exercise 3.1
A continuous has PDF for (and elsewhere). Derive for all real , covering every case.
Recall Solution 3.1
The CDF is the accumulated area: . We split the real line into the three regions the density defines.
Case : no density yet, nothing accumulated. .
Case : integrate the triangle density from to .
Case : all the mass is already collected.
Full answer: Sanity check: differentiate the middle piece, . ✓ (Fundamental Theorem of Calculus, as the parent note showed.)
Exercise 3.2
Using the CDF from 3.1, find and verify the total probability is .
Recall Solution 3.2
Total probability: . ✓ The whole distribution is accounted for.
Exercise 3.3
Look at figure below. It shows a mixed variable: a continuous ramp with one jump. What is and what is ?

Recall Solution 3.3
Read the graph at . The curve rises smoothly up to (approaching from the left, the value ), then jumps to .
is the jump height:
is the accumulated probability strictly below , which is the value just before the jump: .
This is why right-continuity matters: itself is (the top of the jump), because includes the point.
Level 4 — Synthesis
Combine CDFs with inverses, medians, and sampling — ideas that link to Quantile Functions and Inverse Transform Sampling.
Exercise 4.1
For with , find the value such that of the distribution is below it (the third quartile). This uses the quantile / inverse CDF.
Recall Solution 4.1
We want , i.e. invert the CDF. So of events occur before .
Exercise 4.2
You have a uniform random number generator producing . Using inverse transform sampling, derive the formula that converts into a sample from , then compute the sample when , .
Recall Solution 4.2
Inverse transform sampling says: if is uniform, then has the distribution with CDF . So we invert . With , : This is exactly how libraries generate exponential samples from a uniform source.
Exercise 4.3
For the triangular variable of 3.1 ( on ), find the median.
Recall Solution 4.3
Set : Note the median sits right of centre () because this density leans toward larger values — more mass on the right.
Level 5 — Mastery
The real-work tier: expectation from the CDF, empirical CDFs, and comparing distributions.
Exercise 5.1
Prove that for a non-negative continuous , , then verify it on with .
Recall Solution 5.1
Proof sketch. . Integrate over from to and swap the order (Fubini): The inner swap works because for each fixed , the region contributes length .
Verify on . Here . And indeed the mean of is . ✓ Links to Expected Value and Variance.
Exercise 5.2
You observe five sorted data points: . The empirical CDF is the staircase . Compute and .
Recall Solution 5.2
.
: count how many of are . That's → three points.
: points are → still three (the and are above). The empirical CDF is flat between data points and jumps by at each observation (by where a value repeats, as at ).
Exercise 5.3
A Kolmogorov–Smirnov comparison uses the largest gap between two CDFs. Suppose at some point the empirical CDF reads and the theoretical CDF reads . If this is the maximum gap, what is the KS statistic ?
Recall Solution 5.3
The KS statistic is the supremum of the absolute vertical gap: Larger means the sample looks less like the theoretical model. This is a workhorse goodness-of-fit test.
Recall One-line self-check
The interval formula is equals what? ::: The inverse-transform sampling formula for a target CDF is ? ::: with for a discrete variable equals which two CDF values? ::: , the jump height