On this page
Customers walk up to a chai stall at random, about two a minute. The exponential distribution tells you how long until the first one arrives. The gamma distribution answers the next question: how long until the third, or the tenth?
What is the gamma distribution?
With a whole-number shape k, the gamma distribution is the distribution of the time until the k-th event of a Poisson process with rate λ, a case also called the Erlang distribution. If the idea of a Poisson process is new, start with our explainer on how random arrivals form a Poisson process.
In shape-rate form, the gamma density is f(x) = λ^k x^(k−1) e^(−λx) / Γ(k) for x > 0, with shape k > 0 and rate λ > 0 (gamma distribution reference). Read it in three parts:
x^(k−1) makes the curve rise from zero when k > 1: waiting for several events rarely ends at once.
e^(−λx) makes it fall: very long waits are unlikely.
λ^k / Γ(k) is the constant that makes the total area 1. For whole-number k, Γ(k) = (k − 1)!.
The NIST e-Handbook of Statistical Methods, for example, uses a scale parameter.
What are the mean and variance of the gamma distribution?
The mean of a gamma distribution with shape k and rate λ is k/λ, and its variance is k/λ² (gamma distribution reference).
You can see why without integrating. The same reference describes the whole-number case as a sum of k independent exponential waits. Each gap between arrivals has mean 1/λ and variance 1/λ² (exponential distribution); our post on why exponential waiting times are memoryless looks at that single wait. Means always add, and variances add because the gaps are independent. So k gaps give mean k/λ and variance k/λ².
The peak of the curve, the mode, sits at (k − 1)/λ when k ≥ 1 (same gamma reference), exactly 1/λ, one average gap, before the mean.
Worked example: how long until the third customer?
Say customers arrive as a Poisson process at λ = 2 per minute (an illustrative rate, not data). The wait T for the third customer follows a gamma distribution with k = 3 and λ = 2.
Mean: k/λ = 3/2 = 1.5 minutes.
Variance: k/λ² = 3/4 square minutes, so the standard deviation is √0.75 ≈ 0.87 minutes.
Most likely wait: (k − 1)/λ = 2/2 = 1 minute.
Chance the third customer arrives within 1 minute: that means at least 3 arrivals in the minute, a Poisson count with mean 2, so P(T ≤ 1) = 1 − e^(−2)(1 + 2 + 2²/2) = 1 − 5e^(−2) ≈ 0.323.
Chance you wait more than 2 minutes: in 2 minutes the count has mean 4, and T > 2 means at most 2 arrivals, so P(T > 2) = e^(−4)(1 + 4 + 4²/2) = 13e^(−4) ≈ 0.238.
Steps 4 and 5 use the Erlang cumulative formula F(x) = 1 − Σ e^(−λx)(λx)^n / n!, summed from n = 0 to k − 1 (Erlang distribution).
Is the exponential a special case of the gamma distribution?
Yes. When the shape is 1, the gamma distribution reduces to the exponential distribution with rate λ (gamma distribution reference). Put k = 1 in the density and you get λe^(−λx): the wait for the first event.
The chi-square distribution is a gamma too. A chi-square with ν degrees of freedom is a gamma with shape ν/2 and scale 2, that is rate 1/2 (same reference). The NIST chi-square page gives its density as e^(−x/2) x^(ν/2 − 1) / (2^(ν/2) Γ(ν/2)), our formula with k = ν/2 and λ = 1/2. It arises when ν independent standard normal variables are squared and summed (same page), and it powers tests like the chi-square goodness-of-fit test for a fair die.
How does the shape parameter change the curve?
The chart at the top of this post uses rate λ = 1 and four shapes, with a dashed line at each mean.
k = 1: the curve starts at its highest point and falls. The next event is most likely to come soon.
k = 2 and 3: the curve starts at zero, rises to a peak at k − 1 and trails off with a long right tail.
k = 6: the peak moves to 5, the curve widens and looks more like a bell, since it sums six independent gaps.
k below 1: the factor x^(k−1) makes the density shoot up near zero.
The rate never changes the shape: doubling λ squeezes the same curve to half its width.
Before any gamma question, check three things: events are independent at a steady rate, you want the time to the k-th one, and you know whether the book uses rate or scale. Then write down k and λ.
If the link between counting arrivals and waiting times still feels slippery, the Fermi Concept Library covers every concept in physics, chemistry, biology, mathematics and computing. To practise, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



