Convolution of Random Variables

The convolution of random variables gives the distribution of a sum Z = X + Y of independent random variables. For discrete variables, p_Z(z) = Σ p_X(k)p_Y(z − k); for continuous variables, f_Z(z) = ∫ f_X(x)f_Y(z − x) dx. Each term pairs a value of X with the value of Y that brings the total to exactly z.

Before this lesson: Independent Random Variables, Joint Probability Distributions and Gamma Distribution

Adding two random variables

Means of sums are easy: E(X + Y) = E(X) + E(Y). The whole distribution of a sum takes more work. To get a total of z, X can take any value x, as long as Y makes up the rest: Y = z − x. Adding (or integrating) the probability of every such pair gives the distribution of Z.

Independence makes each pair’s probability a product, p_X(x)p_Y(z − x). That sum of products is called a convolution, the same operation that appears in the convolution theorem for Laplace transforms.

Convolution formulas

If X and Y are independent and Z = X + Y, then

p_Z(z) = \sum_k p_X(k)\,p_Y(z - k) \qquad \text{(discrete)}
f_Z(z) = \int_{-\infty}^{\infty} f_X(x)\,f_Y(z - x)\,dx \qquad \text{(continuous)}

The integrand is 0 unless both x and z − x are in the ranges where the densities are positive. Finding those limits is the main work.

Steps

  1. Write the ranges of X and Y. The sum Z ranges from the smallest total to the largest.
  2. Fix z. Find the values of x for which both f_X(x) and f_Y(z − x) are positive; these are the limits.
  3. If the limits change form at some value of z, split into cases.
  4. Add or integrate f_X(x)f_Y(z − x) over those limits.
  5. Check that the result adds or integrates to 1.

Convolution of random variables examples

Example 1: The sum of two dice (word problem)

Two fair dice are rolled. Find P(Z = 4) and P(Z = 7) for the total Z, using the convolution sum.

P(Z = 4) = \sum_{k=1}^{3} P(X = k)\,P(Y = 4 - k)

X can be 1, 2 or 3; then Y is 3, 2 or 1.

P(Z = 4) = 3 \cdot \dfrac{1}{6} \cdot \dfrac{1}{6} = \dfrac{3}{36} = \dfrac{1}{12}

Each pair has probability 1/36.

P(Z = 7) = \sum_{k=1}^{6} \dfrac{1}{6} \cdot \dfrac{1}{6} = \dfrac{6}{36} = \dfrac{1}{6}

Every k from 1 to 6 works, since Y = 7 − k is between 1 and 6.

Answer: P(Z = 4) = 1/12 and P(Z = 7) = 1/6. Seven is the most likely total because it has the most pairs.

Example 2: Sum of independent Poisson variables

X is Poisson with mean 2 and Y is Poisson with mean 3, independent. Find the distribution of Z = X + Y and P(Z = 2).

p_Z(z) = \sum_{k=0}^{z} \dfrac{e^{-2}2^k}{k!} \cdot \dfrac{e^{-3}3^{z-k}}{(z-k)!}

Convolution sum; k runs from 0 to z because both counts are nonnegative.

p_Z(z) = \dfrac{e^{-5}}{z!} \sum_{k=0}^{z} \dfrac{z!}{k!(z-k)!}\,2^k\,3^{z-k}

Factor out e^(−5) and multiply and divide by z!.

p_Z(z) = \dfrac{e^{-5}(2 + 3)^z}{z!} = \dfrac{e^{-5}5^z}{z!}

The sum is (2 + 3)^z by the binomial theorem.

P(Z = 2) = \dfrac{e^{-5}5^2}{2!} = 12.5e^{-5} \approx 0.0842

Substitute z = 2.

Answer: Z is Poisson with mean 5, and P(Z = 2) ≈ 0.0842. Independent Poisson counts add to a Poisson count with the means added.

Example 3: Sum of two uniform variables

X and Y are independent and each uniform on [0, 1]. Find the density of Z = X + Y and P(Z ≤ 1.5).

f_Y(z - x) = 1 \iff 0 \le z - x \le 1 \iff z - 1 \le x \le z

Find where the second factor is positive; f_X(x) = 1 needs 0 ≤ x ≤ 1.

f_Z(z) = \int_0^z 1\,dx = z, \quad 0 \le z \le 1

For z ≤ 1, the overlap of [0, 1] and [z − 1, z] is [0, z].

f_Z(z) = \int_{z-1}^1 1\,dx = 2 - z, \quad 1 \le z \le 2

For z ≥ 1, the overlap is [z − 1, 1].

\int_0^1 z\,dz + \int_1^2 (2 - z)\,dz = \dfrac{1}{2} + \dfrac{1}{2} = 1

Check: total area 1.

P(Z \le 1.5) = 1 - \int_{1.5}^2 (2 - z)\,dz = 1 - \dfrac{(0.5)^2}{2} = 0.875

The right tail is a triangle with base and height 0.5.

Answer: f_Z(z) = z on [0, 1] and 2 − z on [1, 2], a triangular density; P(Z ≤ 1.5) = 0.875. Adding two flat densities gives a peak in the middle.

Graph of the density of the sum of two independent uniform variables on [0, 1]. It rises in a straight line from (0, 0) to a peak at (1, 1), then falls in a straight line to (2, 0). The area under the graph from z = 0 to z = 1.5 is shaded blue and labeled 0.875; the unshaded right tail from 1.5 to 2 is a small triangle labeled 0.125.
The sum of two uniform variables has a triangular density; the shaded area P(Z ≤ 1.5) is 0.875.

Example 4: Two service steps (word problem)

A repair takes two steps. Each step’s time is exponential with mean 2 minutes (rate λ = 0.5 per minute), and the steps are independent. Find the density of the total time Z and P(Z ≤ 4).

f_Z(z) = \int_0^z 0.5e^{-0.5x} \cdot 0.5e^{-0.5(z - x)}\,dx

Both times are nonnegative, so x runs from 0 to z.

f_Z(z) = 0.25e^{-0.5z}\int_0^z 1\,dx = 0.25z\,e^{-0.5z}, \quad z \ge 0

The exponents add to −0.5z, which does not depend on x.

P(Z \le 4) = 1 - e^{-0.5(4)}\big(1 + 0.5(4)\big)

CDF of this gamma density: 1 − e^(−λz)(1 + λz), from integration by parts.

P(Z \le 4) = 1 - 3e^{-2} \approx 0.5940

Evaluate.

Answer: f_Z(z) = 0.25z e^(−0.5z), the gamma density with shape 2 and rate 0.5, and P(Z ≤ 4) ≈ 0.594. This proves the claim in the gamma distribution lesson for two exponentials; repeating the convolution gives shape k for k exponentials.

Example 5: Exponentials with different rates

X is exponential with rate 1 and Y is exponential with rate 2, independent. Find the density of Z = X + Y.

f_Z(z) = \int_0^z e^{-x} \cdot 2e^{-2(z - x)}\,dx

Convolution with limits 0 to z.

f_Z(z) = 2e^{-2z}\int_0^z e^{x}\,dx

Combine: e^(−x) e^(2x) = e^x (see exponent rules).

f_Z(z) = 2e^{-2z}(e^{z} - 1) = 2\left(e^{-z} - e^{-2z}\right), \quad z \ge 0

Integrate and distribute.

\int_0^\infty 2\left(e^{-z} - e^{-2z}\right)dz = 2\left(1 - \dfrac{1}{2}\right) = 1

Check: it integrates to 1.

Answer: f_Z(z) = 2(e^(−z) − e^(−2z)) for z ≥ 0. With unequal rates the sum is not gamma, but its mean is still 1 + 1/2 = 1.5.

Common mistakes

MistakeExample of the errorFix
Using limits from −∞ to ∞ literallyIntegrating 1 dx from 0 to 1 for every z in Example 3Keep only the x where both f_X(x) and f_Y(z − x) are positive.
Missing the case splitWriting f_Z(z) = z on all of [0, 2]The overlap changes at z = 1, so the formula changes there too.
Adding densitiesf_Z(z) = f_X(z) + f_Y(z)The density of a sum is a convolution, not a sum of densities.
Using convolution without independenceConvolving the marginals of dependent X and YFor dependent variables, integrate the joint density f(x, z − x) instead.
Forgetting that X and Y can’t be negativeRunning k past z in Example 2If z − k is negative, p_Y(z − k) = 0, so stop at k = z.

Related ideas

Sums that stay in the family

Some families are closed under independent sums: Poisson means add, binomial counts with the same p add their n, gamma shapes with the same rate add, and normal means and variances add. Practice problems 3, 4 and 10 use these facts.

Means and variances only

If you need only the mean and variance of a sum, you don’t need a convolution. Use the rules from combining random variables.

A faster tool for sums

Convolutions get messy for many terms. Moment generating functions turn a convolution into a product, which is much simpler. That is the last lesson of this unit, Moment Generating Functions.

Practice problems

  1. Two fair dice are rolled. Use the convolution sum to find P(Z = 10).
  2. X and Y are independent, and each takes the values 0, 1, 2 with probabilities 0.2, 0.5, 0.3. Find P(X + Y = 2).
  3. X is Poisson with mean 1.5 and Y is Poisson with mean 2.5, independent. Name the distribution of X + Y and find P(X + Y = 0).
  4. X is binomial with n = 3, p = 0.4, and Y is binomial with n = 2, p = 0.4, independent. Find P(X + Y = 5).
  5. In Example 3, find P(Z ≤ 0.5).
  6. In Example 3, find f_Z(1.2).
  7. X and Y are independent exponential variables with rate 3. Find f_Z(z) for Z = X + Y and f_Z(0.5).
  8. In Example 5, find P(Z ≤ 1).
  9. X is uniform on [0, 1] and Y is uniform on [0, 2], independent. Find f_Z(z) for 0 ≤ z ≤ 1.
  10. X is normal with mean 10 and SD 3; Y is normal with mean 20 and SD 4; they are independent. Find P(X + Y > 35).
Show answers

1.

P(Z = 10) = P(4, 6) + P(5, 5) + P(6, 4) = \dfrac{3}{36} = \dfrac{1}{12}

k = 4, 5, 6 give Y = 6, 5, 4.

Answer: 1/12

2.

P(Z = 2) = p(0)p(2) + p(1)p(1) + p(2)p(0)

Convolution sum with k = 0, 1, 2.

P(Z = 2) = 0.2(0.3) + 0.5(0.5) + 0.3(0.2) = 0.06 + 0.25 + 0.06 = 0.37

Multiply and add.

Answer: 0.37

3.

X + Y \sim \text{Poisson}(1.5 + 2.5) = \text{Poisson}(4)

Poisson means add (Example 2).

P(X + Y = 0) = e^{-4} \approx 0.0183

Poisson formula at 0.

Answer: Poisson with mean 4; about 0.0183

4.

X + Y \sim \text{Binomial}(5, 0.4)

Same p, so the trial counts add.

P(X + Y = 5) = 0.4^5 = 0.01024

All five trials succeed.

Answer: 0.01024

5.

P(Z \le 0.5) = \int_0^{0.5} z\,dz = \dfrac{(0.5)^2}{2} = 0.125

Use f_Z(z) = z on [0, 1].

Answer: 0.125

6.

f_Z(1.2) = 2 - 1.2 = 0.8

1.2 is in [1, 2], so use 2 − z.

Answer: 0.8

7.

f_Z(z) = \int_0^z 3e^{-3x} \cdot 3e^{-3(z - x)}\,dx = 9z\,e^{-3z}

The exponents add to −3z.

f_Z(0.5) = 4.5e^{-1.5} \approx 1.0041

Substitute z = 0.5.

Answer: 9z e^(−3z); about 1.004

8.

P(Z \le 1) = \int_0^1 2\left(e^{-z} - e^{-2z}\right)dz = 2(1 - e^{-1}) - (1 - e^{-2})

Integrate each term.

P(Z \le 1) = 1 - 2e^{-1} + e^{-2} = (1 - e^{-1})^2 \approx 0.3996

Simplify; it is a perfect square.

Answer: about 0.3996

9.

f_Z(z) = \int_0^z 1 \cdot \dfrac{1}{2}\,dx = \dfrac{z}{2}, \quad 0 \le z \le 1

f_Y = 1/2 on [0, 2]; for z ≤ 1, x runs from 0 to z.

Answer: z/2

10.

X + Y \sim N\left(30, \sqrt{3^2 + 4^2}\right) = N(30, 5)

Means add and variances add: 9 + 16 = 25, so the standard deviation is 5.

P(X + Y \gt 35) = P\left(\dfrac{X + Y - 30}{5} \gt \dfrac{35 - 30}{5}\right) = P(Z \gt 1) \approx 0.1587

Standardize (see standard normal distribution).

Answer: about 0.1587

Convolution of random variables FAQ

What is the convolution of two random variables?

It is the distribution of their sum when they are independent: f_Z(z) = ∫ f_X(x)f_Y(z − x) dx, or the matching sum for discrete variables.

How do you find the limits in a convolution integral?

Keep the x values where both f_X(x) and f_Y(z − x) are positive. Write each condition as an inequality in x, then take the overlap. If the overlap changes form, split into cases of z.

Is the sum of two uniform random variables uniform?

No. The sum of two independent uniform [0, 1] variables has a triangular density on [0, 2], with its peak at 1.

What is the sum of two independent exponential random variables?

With the same rate λ, the sum has a gamma distribution with shape 2 and rate λ: f(z) = λ²z e^(−λz). With different rates the density is a difference of two exponentials, as in Example 5.

Summary

  • For independent X and Y, the distribution of Z = X + Y is a convolution.
  • Discrete: p_Z(z) = Σ p_X(k)p_Y(z − k). Continuous: f_Z(z) = ∫ f_X(x)f_Y(z − x) dx.
  • The limits come from where both factors are positive; split into cases when they change.
  • Two uniforms give a triangle; two same-rate exponentials give a gamma; Poisson means add.
  • Check that the result adds or integrates to 1.

Previous lesson: Conditional Expectation

Next lesson: Bivariate Normal Distribution

Back to the Probability Theory Index