Uniform and Exponential Distributions
Continuous uniform sampling, the exponential distribution, and its memoryless property.
Assumes you know
Uniform and Exponential Distributions
Intuition first
The uniform distribution is the statement that nothing in an interval is more likely than anything else. Flat density, no preference. It is the distribution of a random number generator, and the starting point for simulating everything else.
The exponential distribution answers "how long until the next event?" when events arrive at a constant rate. It is the waiting-time partner of the Poisson: Poisson counts how many arrive in a window, exponential times the gap between arrivals.
The exponential's defining oddity is memorylessness. A bus that has been overdue for 20 minutes is no more likely to arrive in the next minute than one that just missed you. The distribution has no memory of elapsed time. That is often physically wrong — machines age, patients deteriorate — and knowing when the assumption fails is most of the skill in using it.
The continuous uniform
Deriving the uniform momentsAdvanced
For the variance, first get the second moment:
using . Then
The variance depends only on the width, not on the location — as it must, since shifting a distribution cannot change its spread.
The exponential
| Symbol | Meaning | Read aloud |
|---|---|---|
| λ | Rate — events per unit time | lambda |
| 1/λ | Mean waiting time between events | one over lambda |
| S(x) = 1 − F(x) | Survival function, P(X > x) = e^{−λx} | survival function |
Memorylessness
Proof, and why the exponential is the only continuous distribution with this propertyAdvanced
Using and the definition of conditional probability:
Since , the event already implies , so the intersection is just :
The elapsed time cancels completely.
Uniqueness. Suppose a continuous distribution on is memoryless. Writing , the property says
This is Cauchy's functional equation in multiplicative form. Its only measurable solutions with and decreasing are for some . So the exponential is the unique memoryless continuous distribution — the geometric is its discrete counterpart.
Solved problem 1 · Server requests, both directions
Requests arrive at a server at 12 per minute, as a Poisson process. (a) Find the probability the next request arrives within 3 seconds. (b) Find the mean and standard deviation of the gap. (c) Given 10 seconds have passed with no request, find the probability of waiting another 3 seconds. (d) Find the probability that exactly 2 requests arrive in the next 6 seconds.
Step 1 — set up consistent units
Work in seconds. A rate of 12 per minute is
The gap between requests is .
Step 2 — part (a)
Step 3 — part (b)
Mean equals standard deviation, as always for the exponential.
Step 4 — part (c): memorylessness in action
So the probability of waiting more than another 3 seconds is , and the probability of a request arriving within 3 more seconds is — identical to part (a). The ten seconds of waiting carried no information.
Step 5 — part (d): switch to the Poisson view
Counts use the Poisson with :
Step 6 — check the two views agree
The event "no requests in 6 seconds" can be computed either way:
They must agree, because "no arrivals in " and "the first arrival is after " are the same event. That identity is the formal link between the two distributions.
Answer
(a) ; (b) mean and SD both 5 seconds; (c) — unchanged by the 10-second wait; (d) .
Inverse transform sampling
The uniform is the raw material for simulating any distribution.
Why it works, and the exponential caseAdvanced
Assume is continuous and strictly increasing, so exists. Then
The last step uses the defining property of the standard uniform: for , and always lies in .
For the exponential. Set and solve for :
Since is also uniform on , the simpler form works equally well and is what most implementations use.
This is how numpy.random.exponential works underneath, and it generalises: any distribution
with an invertible CDF can be sampled from uniform draws alone.
import numpy as np
from scipy import stats
rng = np.random.default_rng(0)
# Worked example: rate 0.2 per second.
T = stats.expon(scale=1/0.2) # NOTE: scale = 1/rate
print(f"(a) P(T <= 3) {T.cdf(3):.6f}")
print(f"(b) mean {T.mean():.1f}s sd {T.std():.1f}s")
print(f"(c) P(T>13 | T>10) {T.sf(13)/T.sf(10):.6f} = P(T>3) {T.sf(3):.6f}")
print(f"(d) P(N=2) in 6s {stats.poisson(1.2).pmf(2):.6f}")
# The Poisson/exponential identity.
print(f"\nP(no arrivals in 6s): Poisson {stats.poisson(1.2).pmf(0):.6f} "
f"Exponential {T.sf(6):.6f}")
# Inverse transform sampling, by hand.
U = rng.random(500_000)
X = -np.log(U) / 0.2
print(f"\ninverse transform: mean {X.mean():.4f} (theory 5) sd {X.std():.4f} (theory 5)")
# Memorylessness, empirically: gaps beyond 10s, minus 10, look like fresh gaps.
gaps = rng.exponential(5.0, 2_000_000)
residual = gaps[gaps > 10] - 10
print(f"residual after 10s: mean {residual.mean():.4f} <- still ~5, no ageing")Exercise 1
A bus arrives uniformly at random between 10:00 and 10:30. You arrive at 10:10. Find the probability you wait more than 10 minutes, and your expected wait.
Show solutionHide solution
Let be the arrival time in minutes after 10:00, so .
Arriving at 10:10, you catch the bus only if it has not already gone — but the question asks for the wait, so condition on :
Given , the bus time is uniform on by the flat density. Waiting more than 10 minutes means :
Expected wait, given the bus has not gone:
Note that the uniform is not memoryless: as time passes the remaining wait shrinks. At 10:10 the expected further wait is 10 minutes; at 10:20 it is 5. Contrast the exponential, where it would stay constant.
Exercise 2
A component has exponential lifetime with mean 5 years. It has already run for 4 years. A manager argues it is "due to fail soon". Assess the argument, and say when the manager would be right.
Show solutionHide solution
Under the exponential model the manager is wrong. With per year:
The expected remaining life is still 5 years, exactly as when new. The component has not aged in any statistical sense.
For example, the chance of surviving another 5 years is
whether the component is new or four years old.
When the manager would be right: if the true lifetime distribution has an increasing hazard rate, which is typical for mechanical wear. A Weibull with shape has hazard , increasing in , so an older component genuinely is closer to failure.
So the manager's intuition is sound engineering and wrong mathematics given the stated model. The correct response is to challenge the model rather than the intuition: check whether the empirical hazard rate is constant by plotting failures per unit time among survivors at each age. If it rises, the exponential is the wrong distribution and the manager is right.
Next: Gamma and Beta Distributions, which generalise the exponential and introduce the conjugate prior for probabilities.