Exercises — Continuous random variables — PDF, CDF, percentiles
Level 1 — Recognition
You should be able to answer these by reading a definition, not by computing.
Exercise 1.1
Which of these could be a valid PDF on ? For each, say yes/no and why.
- (a) on , else .
- (b) on , else .
- (c) on , else .
Recall Solution 1.1
A PDF needs two things: everywhere, and total area .
(a) NO. On , is negative (e.g. at , ). A density can never be negative — density is "how thickly probability is packed," and you can't pack a negative amount. Fails condition 1.
(b) NO. It is non-negative, good. But the area is a rectangle of height , width , so area . Too much total probability. Fails condition 2.
(c) YES. Non-negative ✓. Area = rectangle height , width , so ✓. Note the height is — that is allowed, because only the area must equal 1.
Exercise 1.2
is a CDF. Fill in the blanks: as , ; as , ; and is always non-______.
Recall Solution 1.2
(no area accumulated yet from the far left), (all the area collected), and is always non-decreasing — since , adding more of the number line can only add area, never remove it.
Exercise 1.3
For a continuous RV, is equal to , or to ?
Recall Solution 1.3
. A single point is an interval of width zero, and . The value is a density, not a probability — do not confuse the two.
Level 2 — Application
Turn the crank: integrate, differentiate, evaluate.
Exercise 2.1
Let on , else . (a) Verify it is a valid PDF. (b) Find the CDF (all three pieces). (c) Compute .
Recall Solution 2.1
(a) on ✓. Area: ✓. Why: those are exactly the two PDF conditions.
(b) Accumulate area from the left edge : for , Below the support nothing has accumulated; above it everything has: Why the three pieces: the parent note's "restrict to the support" rule — must be before the support and after.
(c) Use :
Exercise 2.2
Given for (and for ). Find the PDF .
Recall Solution 2.2
The PDF is the rate of accumulation of area, so by the Fundamental Theorem of Calculus, (see Fundamental Theorem of Calculus): and for . This is the Exponential distribution with rate .
Exercise 2.3
For the same , find the median.
Recall Solution 2.3
Median solves : Why: the median is the 50th percentile; we invert the CDF, never the PDF.
Level 3 — Analysis
Now you must choose the tool and mind every case: support edges, signs, degenerate widths.
Exercise 3.1
is uniform on , meaning (a constant) on and elsewhere. (a) Find . (b) Find for all . (c) Find , the median, and .
Recall Solution 3.1
(a) Area must be . The support has width , so a rectangle of height over it has area . Set .
(b) For , accumulate area from the left edge : Full definition:
Look at Figure s01. The accent-red curve is the CDF: a straight ramp rising from height at to height at . The dashed guide-lines drop from the ramp down to the -axis at the three quartile values — each is where the ramp crosses height , , respectively. A constant density gives a constant slope, hence a straight ramp.

(c) Set and solve the linear equation :
- : .
- Median: .
- : . They are evenly spaced — the signature of a uniform distribution.
Exercise 3.2
A student proposes on (else ) as a density. (This is a V-shape, so watch the two sides separately.) (a) Test whether it is a valid PDF; if not, find the constant that makes valid. (b) Using the corrected density, find on the support — you must handle and separately. (c) Compute .
Recall Solution 3.2
(a) The proposed density is NOT valid — the exercise is deliberately baited. Split at the corner since for and for : So has total area — it fails PDF condition 2. The task is to repair it, not to pretend it was correct. Write and choose so the area is : So the valid density is (height at the ends). We use this corrected for parts (b) and (c). (Symmetry lets us double the right half in every step below.)
(b) Look at Figure s02. The black V is the corrected PDF . The accent-red dot marks the corner at where the formula switches from (left) to (right); the shaded left wedge has area , so by the time we reach we have already banked . The right wedge (lighter shading) supplies the remaining .

For , accumulate from the left edge , where : Sanity: ✓, ✓ (half the area sits on the left half). For , continue from the already banked, now with : Sanity: ✓.
(c) By symmetry the middle band is :
Level 4 — Synthesis
Combine PDF, CDF, percentiles and expectation in one problem.
Exercise 4.1
for , else . (a) Find . (b) Find the median. (c) Find the 90th percentile. (d) Does the mean exist (finite)?
Recall Solution 4.1
(a) Accumulate from the left edge : and for . Why accumulating the PDF gives the CDF: by the definition — the CDF at is the total area under up to . Because the support starts at , there is no area below , so the accumulation begins at the left edge ; integrating from to literally sums up all the density collected so far, which is exactly the meaning of "probability of being at most ."
(b) Median: .
(c) 90th percentile: .
(d) See Expectation and Variance of continuous RVs: It exists and equals . (Heavy tails can make the mean diverge, but here the integrand decays fast enough.)
Exercise 4.2
is standard normal with CDF . You are told and . Using only these facts, find (a) the 90th percentile, (b) the 10th percentile, (c) the interquartile range . Use the symmetry .
Recall Solution 4.2
(a) By definition the 90th percentile solves , so .
(b) The 10th percentile solves . Using symmetry, , so . Why: the standard normal is symmetric about , so the 10th and 90th percentiles are mirror images.
(c) and . By symmetry . So
Level 5 — Mastery
Build the tool, then use it in reverse.
Exercise 5.1 — Inverse-transform sampling
You have a random-number generator that produces , uniform on . You want to produce a value with CDF (exponential, rate ). The recipe (see Quantile function and inverse-transform sampling) is: set . (a) Derive the formula explicitly. (b) If the generator outputs , what is ? (c) Explain in one sentence why feeding a uniform through gives the right distribution.
Recall Solution 5.1
(a) Why we invert : the recipe says , so we need the rule that, given a target cumulative probability , returns the whose CDF equals . That is precisely "solve for ." Set and unwind step by step: So . Each manipulation just peels back one operation of (subtract from 1, take log, divide by ) so that is expressed in terms of the desired probability — that is what "inverting the CDF" means.
(b) Why plug in : the generator's output is the cumulative probability we hand to . Feeding asks "which has half the probability below it?" — i.e. the median: As expected, the middle of maps to the median of .
(c) This step needs to be strictly increasing on its support so that exists as a genuine (single-valued, invertible) function. Here for all , so is strictly increasing on and is genuinely invertible — that is what licenses the equivalence . With that guaranteed: where the last step uses that is uniform, so . The output's CDF is exactly , as desired.
Exercise 5.2 — Design a density to a spec
Find a constant and a support upper limit so that on (else ) is a valid PDF whose median is . Give and .
Recall Solution 5.2
Two unknowns need two equations.
Equation 1 (valid PDF — total area ):
CDF: for , accumulate from the left edge and substitute : (Note: , not — the must not be dropped.)
Equation 2 (median at ): set :
Then from Equation 1,
Answer: , , i.e. on . Check: median where ✓; total area ✓.
Exercise 5.3 — Mixed / piecewise support
(a) Confirm total area . (b) Find on all pieces. (c) Find the median.
Recall Solution 5.3
(a) Two rectangles: ✓.
(b) Look at Figure s03. The left panel is the PDF — two flat levels (height then ). The right panel is the accent-red CDF: it climbs as a steep ramp (slope ) on , then bends to a gentler ramp (slope ) on ; the ramp's slope is exactly the local density. The red dot at marks the seam where has just reached — the median.

- : .
- : . At , .
- : carry the banked , then add the second rectangle: . At , ✓.
- : .
(c) We want . But reaches exactly at (end of the first ramp). So the median is . (Half the area sits in , half in — the corner is precisely the balance point.)
Connections
- Continuous random variables — PDF, CDF, percentiles (parent — the definitions used throughout)
- Fundamental Theorem of Calculus (Ex 2.2: )
- Exponential distribution (Ex 2.2–2.3, 5.1)
- Uniform distribution (Ex 3.1)
- Normal distribution (Ex 4.2: percentiles from )
- Expectation and Variance of continuous RVs (Ex 4.1d: does the mean exist?)
- Quantile function and inverse-transform sampling (Ex 5.1: )
- Discrete random variables — PMF (contrast: sums replace integrals)