Density functions and exponential models

Work with probability density and cumulative distribution functions, medians and modes, and uniform and exponential models.

More
Reading settings

Read offline with Premium

Save lessons and figures on this device with Premium.

Connect at least once every 30 days to confirm Premium. Topic checks, coaching and sync need a connection.

On this page

Reading settings

Appearance and reading tools for your lessons.

Live preview

Take a moment to read at your own pace. Choose the font and spacing that feel comfortable for you.

Pause after each idea, then explain it in your own words before moving on.

Narrower lines take effect when the screen has room.

Colour theme
Reading font
Line spacing
Reading width
Section links
Worked examples

Open example banners when a lesson starts. Hints and solutions stay closed until you open them.

Checking Premium access…

Explore Premium
Revision Mode

Hide questions, activities and worked examples to read the notes. Turn off to show the full lesson.

Checking Premium access…

Explore Premium

Enlarged diagram

Heights, waiting times and component lifetimes can take any value in an interval, so listing the probability of each value, as you do for a discrete variable, no longer works: there are too many values for each to have positive probability. Instead, probability is spread along the number line by a density, and probabilities are areas under it. This lesson builds that model, computes the mean, variance, median and mode from a density, handles densities defined in pieces, and then derives the exponential distribution from a Poisson process.

Probability is area under a density

A continuous random variable X has a probability density function (pdf) f with f(x) ≥ 0 for all x and total area 1. Probabilities are areas:

P(a ≤ X ≤ b) = ∫ₐ^b f(x) dx, ∫_(-∞)^∞f(x) dx = 1.

A single value has zero width, so P(X = a) = 0, and ≤ and < give the same probabilities. A pdf may be defined piecewise, with f(x) = 0 outside the stated intervals.

Probability is the area under the density

A symmetric arch rises from 0 at x = 0 to a maximum density of 0.75 at x = 1 and returns to 0 at x = 2. The region under the curve between x = 0 and x = 0.5 is shaded; its area is 5/32. The height of the curve at a point is a density, not a probability.

A symmetric arch rises from 0 at x = 0 to a maximum density of 0.75 at x = 1 and returns to 0 at x = 2. The region under the curve between x = 0 and x = 0.5 is shaded; its area is 5/32. The height of the curve at a point is a density, not a probability.A symmetric arch rises from 0 at x = 0 to a maximum density of 0.75 at x = 1 and returns to 0 at x = 2. The region under the curve between x = 0 and x = 0.5 is shaded; its area is 5/32. The height of the curve at a point is a density, not a probability.
The density f(x) = ¾x(2 − x) on 0 ≤ x ≤ 2. The shaded area from x = 0 to x = ½ is P(X ≤ ½) = 5/32 ≈ 0.156. The whole area under the curve is 1.
Open full-size graphOpen full-size graph
What to noticeThe curve is drawn from sampled values joined by short straight segments. Outside 0 ≤ x ≤ 2 the density is zero.
Figure data

This table is included in print while it is open.

Figure data: Probability is the area under the density
Seriesxf(x)
f(x) = ¾x(2 − x)0.000.000000
f(x) = ¾x(2 − x)0.050.073125
f(x) = ¾x(2 − x)0.100.142500
f(x) = ¾x(2 − x)0.150.208125
f(x) = ¾x(2 − x)0.200.270000
f(x) = ¾x(2 − x)0.250.328125
f(x) = ¾x(2 − x)0.300.382500
f(x) = ¾x(2 − x)0.350.433125
f(x) = ¾x(2 − x)0.400.480000
f(x) = ¾x(2 − x)0.450.523125
f(x) = ¾x(2 − x)0.500.562500
f(x) = ¾x(2 − x)0.550.598125
f(x) = ¾x(2 − x)0.600.630000
f(x) = ¾x(2 − x)0.650.658125
f(x) = ¾x(2 − x)0.700.682500
f(x) = ¾x(2 − x)0.750.703125
f(x) = ¾x(2 − x)0.800.720000
f(x) = ¾x(2 − x)0.850.733125
f(x) = ¾x(2 − x)0.900.742500
f(x) = ¾x(2 − x)0.950.748125
f(x) = ¾x(2 − x)1.000.750000
f(x) = ¾x(2 − x)1.050.748125
f(x) = ¾x(2 − x)1.100.742500
f(x) = ¾x(2 − x)1.150.733125
f(x) = ¾x(2 − x)1.200.720000
f(x) = ¾x(2 − x)1.250.703125
f(x) = ¾x(2 − x)1.300.682500
f(x) = ¾x(2 − x)1.350.658125
f(x) = ¾x(2 − x)1.400.630000
f(x) = ¾x(2 − x)1.450.598125
f(x) = ¾x(2 − x)1.500.562500
f(x) = ¾x(2 − x)1.550.523125
f(x) = ¾x(2 − x)1.600.480000
f(x) = ¾x(2 − x)1.650.433125
f(x) = ¾x(2 − x)1.700.382500
f(x) = ¾x(2 − x)1.750.328125
f(x) = ¾x(2 − x)1.800.270000
f(x) = ¾x(2 − x)1.850.208125
f(x) = ¾x(2 − x)1.900.142500
f(x) = ¾x(2 − x)1.950.073125
f(x) = ¾x(2 − x)2.000.000000
P(X ≤ ½)0.000.000000
P(X ≤ ½)0.050.073125
P(X ≤ ½)0.100.142500
P(X ≤ ½)0.150.208125
P(X ≤ ½)0.200.270000
P(X ≤ ½)0.250.328125
P(X ≤ ½)0.300.382500
P(X ≤ ½)0.350.433125
P(X ≤ ½)0.400.480000
P(X ≤ ½)0.450.523125
P(X ≤ ½)0.500.562500

The height f(x) is not itself a probability. It is probability per unit length: over a short interval of width δ x near x, P ≈ f(x) δ x.

Summaries of a continuous distribution

Replace the sums of the discrete case with integrals over the region where f is non-zero:

QuantityDefinition
Mean
E(X) = ∫ x f(x) dx
Expectation of a function
E(g(X)) = ∫ g(x) f(x) dx
Variance
Var(X) = E(X²)-[E(X)]²
Cumulative distribution function
F(x) = P(X ≤ x) = ∫_(-∞)^xf(t) dt, so f(x) = F'(x) where F is differentiable
Median m
F(m) = 1/2
Mode
The value of x where f(x) is greatest

E(g(X)) is generally not g(E(X)). If the side X of a square is uniform on [0,2], the mean side is 1, but the mean area is E(X²) = ∫₀²(1/2)x² dx = 4/3, not 1².

Worked example 1

A complete density calculation

X has pdf f(x) = kx(2-x) for 0 ≤ x ≤ 2, and 0 otherwise. Find k, E(X), Var(X), the cumulative distribution function F, the median and P(X ≤ 1/2).

Show full solutionHide solution
  1. Make the total probability one

    Method

    Integrate x(2-x) over [0,2] and set k times it equal to 1.

    Reason

    A pdf must enclose total area 1; this is the only condition that fixes k.

    Working

    Answer

    ∫₀²x(2-x) dx = [x²-x³/3]₀² = 4/3,; k = 3/4.
  2. Mean and variance

    Method

    The graph is symmetric about x = 1, so E(X) = 1. Find E(X²) by integration.

    Reason

    Symmetry saves one integral, but the variance still needs E(X²).

    Working

    Answer

    E(X²) = 3/4∫₀²(2x³-x⁴)dx = (3/4)(8-32/5) = 6/5,; Var(X) = 6/5-1² = 1/5.
  3. Cumulative distribution and median

    Method

    Integrate the pdf from 0 to x, and state F for every real x.

    Reason

    F answers every “at most” question directly, and the median is where F reaches 1/2.

    Working

    Answer

    F(x) = { 0, x < 0,; (3/4)x²-(1/4)x³, 0 ≤ x ≤ 2,; 1, x > 2.

    F(1) = 3/4-1/4 = 1/2, so the median is 1, and

    P(X ≤ 1/2) = F(1/2) = 3/16-1/32 = 5/32.

Densities defined in pieces

When f has different formulas on different intervals, integrate each piece over its own interval and add. The cumulative distribution function then has one formula per piece, and the median lies in whichever piece F crosses 1/2.

Guided practice 1

A skewed density in two pieces

About 10 min

X has pdf

f(x) = { (1/3)x, 0 ≤ x ≤ 2,; (2/3)(3-x), 2 < x ≤ 3,; 0, otherwise.

Find the median and the mean of X, and state the mode.

Try this before viewing the solution

Hint 1

Which piece holds the median?

Find the area of the first piece, ∫₀²(1/3)x dx, and compare it with 1/2.

Hint 2

Two integrals for the mean

E(X) = ∫₀²(1/3)x² dx + ∫₂³(2/3)x(3-x) dx.

Show full solutionHide solution
  1. Locate and find the median

    Method

    On [0,2], F(x) = (1/6)x², so F(2) = 2/3.

    Reason

    Since 2/3 > 1/2, half the probability is reached inside the first piece.

    Working

    Answer

    (1/6)m² = 1/2 ⇒ m = square root of 3 ≈ 1.73,

    taking the positive root because m lies in [0,2].

  2. Integrate each piece for the mean

    Method

    Add ∫ x f(x) dx over both intervals.

    Reason

    Each piece contributes its own share of the balance point.

    Working

    Answer

    E(X) = ∫₀²x²/3 dx + 2/3∫₂³(3x-x²)dx; = 8/9 + (2/3)[3x²/2-x³/3]₂³; = 8/9 + 2/3 · 7/6 = 8/9 + 7/9 = 5/3 ≈ 1.67.
  3. Mode

    Working

    Answer

    f increases to 2/3 at x = 2 and then decreases, so the mode is 2.

Spot the mistake 1

A density bigger than one

About 4 min

Y is uniform on [0,1/2], so its pdf is 2 there. A student says this is impossible because “a probability cannot be 2”, and also that P(Y = 0.25) = 2. Correct both claims.

Write your answer, then compare it with the solution

Show full solutionHide solution
  1. Separate density from probability

    Method

    A density is probability per unit length; only areas are probabilities.

    Reason

    The total area is 2 × 1/2 = 1, as required.

    Working

    Answer

    So a density of 2 is allowed. A single value has zero width, so P(Y = 0.25) = 0; for example P(0.2 ≤ Y ≤ 0.3) = 2 × 0.1 = 0.2.

Waiting times and the exponential distribution

Suppose events occur as a Poisson process at an average rate of λ per unit time, so the number of events in time t is Po(λ t). The waiting time T until the first event is longer than t exactly when there are no events in [0,t]:

P(T > t) = P(Po(λ t) = 0) = e^(-λ t).

Differentiating F(t) = 1-e^(-λ t) gives the density. This is the exponential distribution T∼Exp(λ):

f(t) = λ e^(-λ t), F(t) = 1-e^(-λ t) (t ≥ 0),; E(T) = 1/λ, Var(T) = 1/λ².

Solving 1-e^(-λ m) = 1/2 gives the median m = (ln 2)/λ, about 69% of the mean.

An exponential waiting time: median below mean

The density starts at 1 when t = 0 and decreases steadily towards zero, reaching about 0.018 at t = 4. Labels mark the curve at the median t = ln 2 ≈ 0.693, where the density is 0.5, and at the mean t = 1, where the density is about 0.368.

The density starts at 1 when t = 0 and decreases steadily towards zero, reaching about 0.018 at t = 4. Labels mark the curve at the median t = ln 2 ≈ 0.693, where the density is 0.5, and at the mean t = 1, where the density is about 0.368.The density starts at 1 when t = 0 and decreases steadily towards zero, reaching about 0.018 at t = 4. Labels mark the curve at the median t = ln 2 ≈ 0.693, where the density is 0.5, and at the mean t = 1, where the density is about 0.368.
The density of T ~ Exp(1). The shaded half of the probability lies to the left of the median ln 2 ≈ 0.693; the long right tail pulls the mean out to 1.
Open full-size graphOpen full-size graph
What to noticeThe curve is drawn from sampled values joined by short straight segments and continues beyond t = 4.
Figure data

This table is included in print while it is open.

Figure data: An exponential waiting time: median below mean
Seriestf(t)
f(t) = e^(−t)0.0000001.000000
f(t) = e^(−t)0.0500000.951229
f(t) = e^(−t)0.1000000.904837
f(t) = e^(−t)0.1500000.860708
f(t) = e^(−t)0.2000000.818731
f(t) = e^(−t)0.2500000.778801
f(t) = e^(−t)0.3000000.740818
f(t) = e^(−t)0.3500000.704688
f(t) = e^(−t)0.4000000.670320
f(t) = e^(−t)0.4500000.637628
f(t) = e^(−t)0.5000000.606531
f(t) = e^(−t)0.5500000.576950
f(t) = e^(−t)0.6000000.548812
f(t) = e^(−t)0.6500000.522046
f(t) = e^(−t)0.7000000.496585
f(t) = e^(−t)0.7500000.472367
f(t) = e^(−t)0.8000000.449329
f(t) = e^(−t)0.8500000.427415
f(t) = e^(−t)0.9000000.406570
f(t) = e^(−t)0.9500000.386741
f(t) = e^(−t)1.0000000.367879
f(t) = e^(−t)1.0500000.349938
f(t) = e^(−t)1.1000000.332871
f(t) = e^(−t)1.1500000.316637
f(t) = e^(−t)1.2000000.301194
f(t) = e^(−t)1.2500000.286505
f(t) = e^(−t)1.3000000.272532
f(t) = e^(−t)1.3500000.259240
f(t) = e^(−t)1.4000000.246597
f(t) = e^(−t)1.4500000.234570
f(t) = e^(−t)1.5000000.223130
f(t) = e^(−t)1.5500000.212248
f(t) = e^(−t)1.6000000.201897
f(t) = e^(−t)1.6500000.192050
f(t) = e^(−t)1.7000000.182684
f(t) = e^(−t)1.7500000.173774
f(t) = e^(−t)1.8000000.165299
f(t) = e^(−t)1.8500000.157237
f(t) = e^(−t)1.9000000.149569
f(t) = e^(−t)1.9500000.142274
f(t) = e^(−t)2.0000000.135335
f(t) = e^(−t)2.0500000.128735
f(t) = e^(−t)2.1000000.122456
f(t) = e^(−t)2.1500000.116484
f(t) = e^(−t)2.2000000.110803
f(t) = e^(−t)2.2500000.105399
f(t) = e^(−t)2.3000000.100259
f(t) = e^(−t)2.3500000.095369
f(t) = e^(−t)2.4000000.090718
f(t) = e^(−t)2.4500000.086294
f(t) = e^(−t)2.5000000.082085
f(t) = e^(−t)2.5500000.078082
f(t) = e^(−t)2.6000000.074274
f(t) = e^(−t)2.6500000.070651
f(t) = e^(−t)2.7000000.067206
f(t) = e^(−t)2.7500000.063928
f(t) = e^(−t)2.8000000.060810
f(t) = e^(−t)2.8500000.057844
f(t) = e^(−t)2.9000000.055023
f(t) = e^(−t)2.9500000.052340
f(t) = e^(−t)3.0000000.049787
f(t) = e^(−t)3.0500000.047359
f(t) = e^(−t)3.1000000.045049
f(t) = e^(−t)3.1500000.042852
f(t) = e^(−t)3.2000000.040762
f(t) = e^(−t)3.2500000.038774
f(t) = e^(−t)3.3000000.036883
f(t) = e^(−t)3.3500000.035084
f(t) = e^(−t)3.4000000.033373
f(t) = e^(−t)3.4500000.031746
f(t) = e^(−t)3.5000000.030197
f(t) = e^(−t)3.5500000.028725
f(t) = e^(−t)3.6000000.027324
f(t) = e^(−t)3.6500000.025991
f(t) = e^(−t)3.7000000.024724
f(t) = e^(−t)3.7500000.023518
f(t) = e^(−t)3.8000000.022371
f(t) = e^(−t)3.8500000.021280
f(t) = e^(−t)3.9000000.020242
f(t) = e^(−t)3.9500000.019255
f(t) = e^(−t)4.0000000.018316
Area 0.5 below the median0.0000001.000000
Area 0.5 below the median0.0500000.951229
Area 0.5 below the median0.1000000.904837
Area 0.5 below the median0.1500000.860708
Area 0.5 below the median0.2000000.818731
Area 0.5 below the median0.2500000.778801
Area 0.5 below the median0.3000000.740818
Area 0.5 below the median0.3500000.704688
Area 0.5 below the median0.4000000.670320
Area 0.5 below the median0.4500000.637628
Area 0.5 below the median0.5000000.606531
Area 0.5 below the median0.5500000.576950
Area 0.5 below the median0.6000000.548812
Area 0.5 below the median0.6500000.522046
Area 0.5 below the median0.6931470.500000

The exponential distribution is memoryless: having already waited s, the chance of waiting at least t more is the same as at the start,

P(T > s + t ∣ T > s) = (e^(-λ(s + t)))/(e^(-λ s)) = e^(-λ t) = P(T > t).

This suits events that occur at random, such as radioactive decays or calls to a help line. It does not suit lifetimes of parts that wear out, where an old part is more likely to fail soon than a new one.

Check your understanding 1

Waiting for a call

Calls arrive as a Poisson process at an average of 3 per hour. Find the probability of waiting more than 30 minutes for the next call, the mean wait, and the median wait in minutes.

Show answerHide answer

With t in hours, T∼Exp(3). Then

P(T > 1/2) = e^(-1.5) ≈ 0.223,

which equals the Poisson probability of no calls in 30 minutes. The mean wait is 1/3 hour, 20 minutes, and the median is (ln 2)/3 hour, about 13.9 minutes. The median is less than the mean because the distribution has a long right tail.

Common mistakes

  • Reading f(x) as a probability, or writing P(X = a) = f(a).
  • Forgetting to state f(x) = 0 or F(x) = 0 and 1 outside the interval.
  • Integrating only one piece of a piecewise density, or solving for the median in the wrong piece.
  • Writing E(X²) as [E(X)]², or E(g(X)) as g(E(X)).
  • Taking the mode as the point where f'(x) = 0 when the greatest density is at an end point.
  • Mixing time units: a rate per hour needs times in hours.

Before you move on

Try it yourself 1

How long will the sensor last?

Minimal support

The time to failure of an electronic sensor is modelled by an exponential distribution with mean 1500 hours.

  1. Find the probability that a new sensor lasts more than 2000 hours.
  2. A sensor has already worked for 1000 hours. Find the probability that it lasts at least another 500 hours.
  3. Find the median lifetime.

Try this before viewing the solution

Unit: h

Show full solutionHide solution
  1. Find the rate

    Method

    The mean is 1/λ = 1500, so λ = 1/1500 per hour.

    Reason

    The question gives the mean, not the rate; the two are reciprocals.

    Working

    Answer

    P(T > 2000) = e^(-2000/1500) = e^(-4/3) ≈ 0.264.
  2. Use the memoryless property

    Method

    P(T > 1500 ∣ T > 1000) = P(T > 500).

    Reason

    The model has no wear: a working sensor is “as good as new”.

    Working

    Answer

    P(T > 500) = e^(-500/1500) = e^(-1/3) ≈ 0.717.
  3. Median

    Working

    Answer

    m = 1500 ln 2 ≈ 1040 hours.

Questions

Open the discussion

Syllabus and review details

Last reviewed:

Back to top