Lesson 3 of 8 · 18 min
Cumulative distribution functions and the median
Build the cumulative distribution function from a density, use it to find probabilities, and solve for the median and other quantiles.
What you will be able to do
- Define and find it by integrating the pdf from the left end of the support.
- Write piecewise, including where it is 0 and where it is 1.
- Use and .
- Find the median and other quantiles by solving a given proportion.
Every probability so far has needed a fresh integral. If you will be asked many questions of the form "what is the chance is at most …?", it is quicker to do the integral once with a variable upper limit. The result is a function that keeps a running total of the area from the left: the cumulative distribution function.
Definition
Cumulative distribution function
The cumulative distribution function (cdf) of is
If the support of starts at , this is for in the support. The variable of integration is renamed because is now a limit.
is 0 to the left of the support, rises (never falls) through it, and equals 1 to the right of it. Because is an integral of , the fundamental theorem of calculus gives .
Worked example
Find the cdf and median of
has pdf for , and elsewhere.
(a) Find the cumulative distribution function .
(b) Use to find .
(c) Find the exact median of .
Step 1: Integrate from the left end of the support
For :
Below 0 there is no area, so the running total starts at 0 when .
Step 2: Write F piecewise
Check: and .
Step 3: Subtract cdf values for (b)
Step 4: Solve F(m) = 0.5 for (c)
Step 5: Keep the solution in the support
is outside , so the median is .
Try it yourself first, then check the working one step at a time.
Answer
(a) for , for , for (b) (c)
Method
from the left end of the support.
Write all three pieces and check and at the ends.
Probabilities: . Median: solve inside the support.
Watch out for
Giving the median as 2, the middle of the interval: that only works for a symmetric density.
Keeping the negative square root.
The cdf of on , written piecewise. The median is where reaches 0.5.
A random variable has cumulative distribution function for , with for and for . Find .
Key idea
The median and other quantiles
The median splits the area under the pdf in half:
In the same way the lower quartile solves , the upper quartile solves , and the 90th percentile solves . Always keep the solution that lies inside the support.
The density on with its cdf . Move the shading boundary: the shaded area is at that point. Where does the area reach one half?
For on , the cdf is on that interval. Find the exact median.
Common mistake
The cdf needs the right starting point
is the integral from the left end of the support, not just any antiderivative. For on , an antiderivative is , but . Check: must equal 0 at the left end and 1 at the right end.
A random variable has cdf for (and 0 for ). Which is its probability density function for ?
Worked example
Setting a warranty for an appliance
The lifetime years of a brand of dishwasher motor is modelled by
(a) Show that is a probability density function.
(b) Find the cumulative distribution function for .
(c) Find the probability that a motor lasts more than 10 years, correct to 4 decimal places.
(d) Find the median lifetime, correct to 2 decimal places.
(e) The company wants to replace free of charge no more than 10% of motors. How long, in months, should the warranty be?
Step 1: Check the density is never negative
for every , because an exponential is always positive. And for .
Step 2: Show the total area is 1
As , , so the total area is 1. Both conditions hold.
The support has no upper end, so integrate to a large and let grow.
Step 3: Integrate from 0 to t for the cdf
for .
Step 4: Use the complement for (c)
Step 5: Solve F(m) = 0.5 for (d)
years.
Step 6: Solve F(w) = 0.1 for (e)
years, which is about months.
Motors that fail within the warranty are those with . Making means exactly 10% fail in that time.
Step 7: Interpret
A 6-month warranty keeps free replacements just under 10%. This is a short warranty; the mean lifetime of this model is years, but the density is highest at , so early failures are the most common.
Try it yourself first, then check the working one step at a time.
Answer
(b) , (c) (d) years (e) 6 months (at most about 6.3 months)
Method
For a valid pdf, show and total area 1 (use a large upper limit for an unbounded support).
; upper tails are .
For any quantile, solve with logarithms.
Watch out for
Writing : dividing by gives .
Rounding the warranty up to 7 months, which lets more than 10% fail.
Exam tip
Write F piecewise
When asked to "find the cumulative distribution function", give all three pieces: for below the support, the formula on the support, and above it. Then check is 0 and 1 at the two ends.
Summary
: the area to the left of .
is 0 below the support, non-decreasing, and 1 above it; .
and .
The median solves ; quartiles and percentiles solve
Start the integral at the left end of the support so that starts at 0.
Finished the lesson?
Try the 3 quick checks above and the lesson completes itself, or mark it complete now.