Exponential Distribution

Joel Sanqui (Appalachian State University)

Introduction

Let \(X\) be a continuous random variable representing the time or distance between independent events occurring at a constant average rate \(\lambda > 0\).

  • The parameter \(\lambda\) is known as the rate parameter.
  • The variable \(X\) takes non-negative real values (\(x \ge 0\)).
  • It is commonly used to model waiting times, lifetimes of electronic components, and service durations.

Finding the pdf and cdf

Unlike discrete distributions, continuous distributions use a Probability Density Function (pdf) to describe the relative likelihood of a value and a Cumulative Distribution Function (cdf) to calculate actual probabilities.

\[\begin{aligned} \text{pdf: } f(x) &= \lambda e^{-\lambda x}, \quad \text{for } x \ge 0 \\ \text{cdf: } F(x) &= P(X \le x) = 1 - e^{-\lambda x}, \quad \text{for } x \ge 0 \end{aligned}\]

We write \(X \sim \text{Exponential}(\lambda)\).

The Quantile Function

To find specific percentiles or quantiles for the Exponential distribution, we invert the cdf equation \(p = 1 - e^{-\lambda x}\) to solve for \(x\):

\[x = F^{-1}(p) = -\frac{\ln(1 - p)}{\lambda}\]

Deriving the pdf from a Poisson Process

We can derive the Exponential distribution by looking at the time we have to wait for the first event to occur in a Poisson process.

Let \(N(t)\) be the number of events that occur in the time interval \([0, t]\). By definition of a Poisson process with an average rate \(\lambda\): \[P(N(t) = k) = \frac{(\lambda t)^k e^{-\lambda t}}{k!}, \quad \text{for } k = 0, 1, 2, \dots\]

Let \(X\) be a random variable representing the waiting time until the first event.

The event \(\{X > t\}\) means that the first event occurs after time \(t\). This is logically equivalent to saying that exactly zero events occurred during the interval \([0, t]\).

Using our equivalence relationship \(\{X > t\} \iff \{N(t) = 0\}\), we can find the probability of surviving past time \(t\) by evaluating the Poisson pmf for \(k = 0\):

\[P(X > t) = P(N(t) = 0) = \frac{(\lambda t)^0 e^{-\lambda t}}{0!} = e^{-\lambda t}\]

Now, we can find the Cumulative Distribution Function (cdf), \(F(t) = P(X \le t)\), by using the complement rule:

\[F(t) = 1 - P(X > t) = 1 - e^{-\lambda t}\]

To find the Probability Density Function (pdf), \(f(t)\), we simply take the derivative of the cdf with respect to time \(t\):

\[f(t) = \frac{d}{dt} F(t) = \frac{d}{dt} \left(1 - e^{-\lambda t}\right) = \lambda e^{-\lambda t} \quad \blacksquare\]

Deriving the Mean: \(\mathbb{E}[X] = \frac{1}{\lambda}\)

To find the expected value, we integrate the product of \(x\) and the pdf across the domain \([0, \infty)\) using integration by parts: \(\int u \, dv = uv - \int v \, du\).

\[\mathbb{E}[X] = \int_{0}^{\infty} x \cdot \lambda e^{-\lambda x} \, dx\]

Let \(u = x \implies du = dx\), and let \(dv = \lambda e^{-\lambda x} \, dx \implies v = -e^{-\lambda x}\).

\[\begin{aligned} \mathbb{E}[X] &= \left[ -x e^{-\lambda x} \right]_{0}^{\infty} - \int_{0}^{\infty} \left(-e^{-\lambda x}\right) \, dx \\ &= \left( \lim_{x \to \infty} -x e^{-\lambda x} - 0 \right) + \int_{0}^{\infty} e^{-\lambda x} \, dx \\ &= 0 + \left[ -\frac{1}{\lambda} e^{-\lambda x} \right]_{0}^{\infty} \\ &= \left( \lim_{x \to \infty} -\frac{1}{\lambda} e^{-\lambda x} \right) - \left( -\frac{1}{\lambda} e^{0} \right) = 0 + \frac{1}{\lambda} = \frac{1}{\lambda} \quad \blacksquare \end{aligned}\]

Deriving the Variance:

We use the identity \(\text{Var}(X) = \mathbb{E}[X^2] - (\mathbb{E}[X])^2\). First, we compute the second raw moment \(\mathbb{E}[X^2]\) using integration by parts on the domain \([0, \infty)\):

\[\mathbb{E}[X^2] = \int_{0}^{\infty} x^2 \cdot \lambda e^{-\lambda x} \, dx\]

Let \(u = x^2 \implies du = 2x \, dx\), and let \(dv = \lambda e^{-\lambda x} \, dx \implies v = -e^{-\lambda x}\).

\[\begin{aligned} \mathbb{E}[X^2] &= \left[ -x^2 e^{-\lambda x} \right]_{0}^{\infty} - \int_{0}^{\infty} \left(-e^{-\lambda x}\right) \cdot 2x \, dx \\ &= \left( \lim_{x \to \infty} -x^2 e^{-\lambda x} - 0 \right) + 2 \int_{0}^{\infty} x e^{-\lambda x} \, dx \end{aligned}\]

The term with the limit is zero by L’Hôpital’s Rule and the integral matches the definition of the mean, scaled by a factor of \(\frac{2}{\lambda}\).

\[\begin{aligned} \mathbb{E}[X^2] &= 0 + \frac{2}{\lambda} \underbrace{\int_{0}^{\infty} x \cdot \lambda e^{-\lambda x} \, dx}_{\mathbb{E}[X]} \\ &= \frac{2}{\lambda} \left( \frac{1}{\lambda} \right) = \frac{2}{\lambda^2} \end{aligned}\]

Now, substituting \(\mathbb{E}[X^2]\) and \((\mathbb{E}[X])^2\) back into our variance formula yields:

\[\text{Var}(X) = \frac{2}{\lambda^2} - \left(\frac{1}{\lambda}\right)^2 = \frac{2}{\lambda^2} - \frac{1}{\lambda^2} = \frac{1}{\lambda^2} \quad \blacksquare\]

Application

In high-throughput environments, engineers use the Exponential distribution to design queuing systems and prevent API latency spikes.

  • Rate Parameter (\(\lambda = 0.2\)): This means the server expects an incoming request every 5 milliseconds on average (\(\mathbb{E}[X] = 1/0.2 = 5\)).

  • The Critical Window: When requests arrive close together, server memory buffers handle them seamlessly. However, extended idle gaps (\(X > 10\text{ ms}\)) can signal network throttling or erratic client behavior.

Server Wait Time Visualization

  • Visual Target: The following plot visualizes the tail probability of experiencing an unusually long delay (\(>10\text{ ms}\)) before the next transaction request strikes our system core.
library(ggplot2)

lambda_server <- 0.2
x_server <- seq(0, 30, length.out = 500)
df_ab <- data.frame(x = x_server, pdf = dexp(x_server, rate = lambda_server))

ggplot(df_ab, aes(x = x, y = pdf)) +
  geom_line(color = "black", size = 1) +
  geom_area(data = subset(df_ab, x >= 10), aes(y = pdf), fill = "firebrick", alpha = 0.7) +
  labs(title = "API Request Interarrival Time (λ = 0.2)",
       x = "Time in Milliseconds (x)", y = "Density") +
  annotate("text", x = 14, y = 0.03, label = "P(X > 10)\n~ 13.53%", color = "white", fontface = "bold") +
  theme_minimal()

Server Wait Time Visualization

Exponential Distribution in R

In the above plot, we use the function dexp to calculate the Exponential pdf. The area calculation relies on the continuous cdf function pexp:

pexp(12, rate = 0.05)
[1] 0.4511884

To find specific quantiles of the Exponential distribution, we use the qexp function.

To generate random observations following an Exponential distribution, we use rexp.

Example 1

Suppose customer service calls arrive at a call center at a rate of \(\lambda = 0.1\) calls per minute. What is the probability that the next customer calls exactly at the 5-minute mark?

Solution:

Because \(X\) is a continuous random variable, the probability of hitting an exact real number point is always zero:

# Continuous point probability is 0
dexp(5, rate = 0.1) # This returns density, not a discrete probability!
[1] 0.06065307

Example 2

What is the probability that the next customer calls in less than 5 minutes?

Solution:

\(P(X < 5) = P(X \le 5) = F(5)\) is calculated using the cdf function:

pexp(5, rate = 0.1)
[1] 0.3934693

Example 3

What is the probability that the next call arrives anywhere between 5 and 15 minutes?

Solution:

\(P(5 \le X \le 15) = F(15) - F(5)\) is calculated as:

pexp(15, rate = 0.1) - pexp(5, rate = 0.1)
[1] 0.3834005

Example 4

What is the 3rd quartile (75th percentile) of waiting times when the arrival rate is \(\lambda = 0.1\)?

Solution:

The 3rd quartile is the 0.75 quantile and is calculated as:

qexp(0.75, rate = 0.1)
[1] 13.86294

Empirical Simulation: Waiting Times

What happens if we simulate an Exponential arrival process empirically?

  • Experiment: Simulate \(1,000\) independent customer waiting times with a rate parameter of \(\lambda = 0.1\).
  • Objective: Map out the generated values and approximate the distribution’s mean and variance directly from our simulation data.

Simulation & Analysis

library(ggplot2)
set.seed(42) # Ensure reproducible results

# Generate 1000 random observations with rate = 0.1
sim_waits <- rexp(n = 1000, rate = 0.1)
df_sim <- data.frame(time = sim_waits)

sim_mean <- mean(sim_waits)
sim_var  <- var(sim_waits)

plot_title <- paste0("Empirical Customer Waiting Times (N=1000, λ=0.1)\n",
                     "Simulated Mean: ", round(sim_mean, 2), 
                     " | Simulated Variance: ", round(sim_var, 2))

ggplot(df_sim, aes(x = time)) +
  geom_histogram(aes(y = ..density..), bins = 30, fill = "purple", color = "white", alpha = 0.7) +
  stat_function(fun = dexp, args = list(rate = 0.1), color = "black", size = 1) +
  geom_vline(xintercept = sim_mean, color = "orange", linetype = "dashed", size = 1) +
  labs(title = plot_title, x = "Waiting Time in Minutes (X)", y = "Density") +
  theme_minimal()

Note that the theoretical mean is 10 and the theoretical variance is 100, so the simulation is not too bad.

Simulation & Analysis

The Memoryless Property

A unique characteristic of the Exponential distribution is that it is memoryless.

If you have already waited \(s\) units of time, the probability of waiting an additional \(t\) units is exactly the same as the initial probability of waiting \(t\) units from the very beginning. That is,

\[P(X > s + t \mid X > s) = P(X > t) \quad \text{for } s, t \ge 0\]

This implies that the component or system does not “wear out” over time; its future survival probability depends only on the remaining duration, not on its historical age.

Deriving Memorylessness

From the conditional probability formula and since the survival function \(P(X > x) = 1 - F(x) = e^{-\lambda x}\), we get

\[\begin{aligned} &P(X > s + t \mid X > s) = \frac{P(X > s + t \cap X > s)}{P(X > s)} \\ &= \frac{P(X > s + t)}{P(X > s)} \quad \text{(since } s+t > s\text{)} \\ &= \frac{e^{-\lambda(s + t)}}{e^{-\lambda s}} = \frac{e^{-\lambda s} \cdot e^{-\lambda t}}{e^{-\lambda s}} = e^{-\lambda t} = P(X > t) \quad \blacksquare \end{aligned}\]

Example 5: Electronic Lifetimes

Consider a server component whose lifespan follows an exponential distribution with a failure rate of \(\lambda = 0.1\) per year (an average lifespan of 10 years).

  • Scenario A: What is the probability that a brand-new component lasts longer than 5 years?
  • Scenario B: Given that a component has already run flawlessly for 3 years, what is the probability it survives at least another 5 years (for a total of 8 years)?

Mathematical Truth: Due to memorylessness, both probabilities must yield the exact same value: \(e^{-0.1(5)} \approx \mathbf{60.65\%}\).

Testing Memorylessness in R

We can verify this property numerically in R using conditional probability logic or by checking the survival rates directly:

lambda <- 0.1

# Scenario A: New component survives > 5 years
prob_A <- 1 - pexp(5, rate = lambda)

# Scenario B: Component survives > 8 years given it survived > 3 years
# P(X > 8 | X > 3) = P(X > 8) / P(X > 3)
prob_B <- (1 - pexp(8, rate = lambda)) / (1 - pexp(3, rate = lambda))

cat("Scenario A Probability:", round(prob_A, 4), "\n")
Scenario A Probability: 0.6065 
cat("Scenario B Probability:", round(prob_B, 4), "\n")
Scenario B Probability: 0.6065 

Continuous vs. Discrete Memorylessness

The Exponential distribution is the only continuous distribution with the memoryless property. Its discrete analog is the Geometric distribution, which is the only discrete distribution that is memoryless.

The Mathematical Connection

We can derive the Geometric distribution directly from the Exponential distribution through a process called discretization (floor function scaling). Let \(X \sim \text{Exponential}(\lambda)\). Define a new discrete random variable \(Y = \lfloor X \rfloor\), which counts the number of full time intervals completed before an event occurs.

\[\begin{aligned} P(Y = y) &= P(y \le X < y+1) \\ &= F(y+1) - F(y) \\ &= (1 - e^{-\lambda(y+1)}) - (1 - e^{-\lambda y}) \\ &= (e^{-\lambda})^y (1 - e^{-\lambda}) \end{aligned}\]

By matching parameters and setting \(p = 1 - e^{-\lambda}\) (the success probability per interval), this simplifies exactly to the Geometric pmf: \[P(Y = y) = (1-p)^y p \quad \text{for } y = 0, 1, 2, \dots \quad \blacksquare\]

References

  • More about the Distribution: Balakrishnan, N. and Basu, A. (1996). Exponential Distribution: Theory, Methods and Applications. CRC Press.

  • Computational Software: R Core Team (2026). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing.