skip to content

How do you find the distribution of the sum of two independent random variables?

level: middleimportance: must knowfreq 62%

answer

  1. enumerate every split of the target
  2. independence lets probabilities multiply
  3. sum over k, or integrate over x
  4. the operation has a name: convolution
  5. two uniforms give a triangle, not a rectangle

basics

~10 s

By convolution: enumerate every split of the target value and multiply the two probabilities, which independence permits. Discretely, P(X+Y=s) = sum over k of P(X=k)*P(Y=s-k); continuously, f_S(s) = integral of f_X(x)*f_Y(s-x) dx.

solid answer

~50 s

The sum's distribution is the convolution of the two individual ones: you enumerate every way the two values can add to the target and, because the variables are independent, multiply their probabilities. Discretely that is `P(X + Y = s) = sum over k of P(X = k) * P(Y = s - k)`; continuously it is `f_S(s) = integral of f_X(x) * f_Y(s - x) dx`. Two fair dice are the textbook discrete case: seven has six of the thirty-six ordered outcomes and twelve has one, which is why the totals form a triangle. The continuous twin is two independent Uniform(0,1) draws: the integral measures how much the two unit windows overlap, giving `f(s) = s` on `[0,1]` and `2 - s` on `[1,2]`, peaking at 1. You never add densities — the sum of two uniforms is not uniform.

go deeper

for a junior

Recall the shape of the formula: enumerate every pair of values that adds to the target and multiply their probabilities because the variables are independent. Knowing that two dice give a triangular total is enough to anchor it.

for a middle

Be ready to write both the discrete sum and the continuous integral and to carry out the two-uniform case to the triangular density, including checking that the resulting area is 1.

for a senior

Show judgment about when not to convolve: recognise closed families, reach for a transform when many summands are involved, and state the independence assumption before using either.

for a principal

Own the modelling call. Totals built from correlated components do not obey the convolution formula, so be able to explain what dependence does to the tail of a total and how you would decide whether the independence assumption is defensible.

## What a sum's distribution really asks If `X` and `Y` are independent random variables and `S = X + Y`, then knowing the distribution of `S` means knowing, for each target value `s`, how much probability lands there. There is only one honest way to compute it: enumerate every pair `(x, y)` with `x + y = s`, weight each pair by how likely it is, and add up. Independence is what makes the weight of a pair factor into `P(X = x) * P(Y = y)`. The resulting operation is called convolution. ## The discrete formula For integer-valued `X` and `Y`, `P(S = s) = sum over k of P(X = k) * P(Y = s - k)`. The index `k` runs over every value `X` can take; for each one, `Y` is forced to the complementary value `s - k`. Two fair six-sided dice make this concrete. `P(X = k) = 1/6` for `k = 1..6`, so `P(S = 7) = sum over k=1..6 of (1/6)*(1/6) = 6/36`, because every `k` has a partner `7 - k` inside the range. For `s = 2` only `k = 1` works, giving `1/36`; for `s = 12` only `k = 6` works, giving `1/36`. The number of viable partners rises to a peak at seven and falls away symmetrically, which is exactly why dice totals are triangular even though each die is flat. ## The continuous formula For independent continuous variables with densities `f_X` and `f_Y`, `f_S(s) = integral over x of f_X(x) * f_Y(s - x) dx`. The reasoning is the same, with an integral replacing the sum. The clean worked example is two independent Uniform(0,1) draws, where both densities equal 1 on `[0,1]` and 0 elsewhere. The integrand is 1 exactly when `0 <= x <= 1` and `0 <= s - x <= 1`, i.e. when `x` lies in the overlap of `[0,1]` and `[s-1, s]`. The length of that overlap is - `s` for `0 <= s <= 1`, and - `2 - s` for `1 <= s <= 2`, and zero outside. So the density of the sum climbs linearly to a peak value of 1 at `s = 1` and falls back to zero at `s = 2` — the triangular density. Sanity check: the triangle has base 2 and height 1, so its area is 1, as any density must have. Intuitively, a total near 1 can be produced by many splits (0.2 + 0.8, 0.5 + 0.5, 0.9 + 0.1), while a total near 2 requires both draws to be near their maximum, which is a much smaller target. ## Which families survive addition Convolution is heavy machinery, so it is worth knowing where you can skip it. Some families are closed under adding independent members, meaning the answer stays in the family with combined parameters: - independent normals add to a normal, with means added and variances added; - independent Poissons add to a Poisson, with rates added; - independent binomials that share the same success probability add to a binomial, with the trial counts added; - independent chi-squares add to a chi-square, with the degrees of freedom added. And some famously do not: uniforms, as shown above, and the Cauchy distribution behaves so badly under averaging that it deserves its own warning label. Do not assume closure — check it. ## Practical shortcuts When you need three or more summands, convolving repeatedly is painful but valid, since convolution is associative: convolve the first two, then convolve the result with the third. The slicker route is a transform. The moment generating function `M_X(t) = E[exp(t*X)]` turns convolution into multiplication, `M_{X+Y}(t) = M_X(t) * M_Y(t)` for independent `X` and `Y`, so an n-fold sum becomes an n-th power. Characteristic functions do the same job and always exist, which matters for heavy-tailed variables whose moment generating function does not. ## The mistakes that show up in interviews The most common wrong answer is adding the densities, `f_X + f_Y`. That produces a valid-looking object with total area 2 and describes something else entirely — a mixture that picks one of the two variables at random, not their sum. The second is assuming the family is preserved: uniform plus uniform "must be uniform" is wrong, and drawing the triangle is the fastest way to prove it. The third is dropping the independence assumption: with dependent variables the joint density does not factor, and you must integrate the joint density along the line `x + y = s` instead. ## Why this matters Any time you total quantities — two latencies in a chain, revenue from two independent segments, counts from two shards — the distribution of the total is a convolution, not an average of shapes. Knowing that sums concentrate in the middle, and that flat inputs can produce peaked outputs, is the intuition behind a great deal of applied probability.

  • Which families stay in the family when you add independent members?
    Normals (means and variances add), Poissons (rates add), binomials sharing the same success probability (trial counts add), and chi-squares (degrees of freedom add). Uniforms do not — two Uniform(0,1) draws give a triangular sum. Closure is a property to verify, not to assume, and the fastest verification is a transform argument.
  • Where does the triangular shape of the sum of two Uniform(0,1) draws come from?
    The convolution integral measures the overlap length of the interval [0,1] with the shifted interval [s-1, s]. That overlap grows linearly from 0 to 1 as s goes from 0 to 1, then shrinks back to 0 as s goes from 1 to 2, producing f(s) = s then 2 - s. Many splits produce a middling total; only extreme pairs produce an extreme total.
  • How would you handle a sum of many independent variables without convolving repeatedly?
    Use a transform. The moment generating function of a sum of independent variables is the product of their moment generating functions, so an n-fold sum becomes an n-th power, and you invert or recognise the result at the end. Characteristic functions do the same and always exist, which matters when the moment generating function does not.
  • What changes if X and Y are dependent?
    The factorisation P(X = x, Y = y) = P(X = x) * P(Y = y) fails, so the convolution formula no longer applies. You must integrate or sum the joint distribution along the line x + y = s, which needs the full joint description rather than the two marginals — two marginals alone do not determine the distribution of the sum.

Making change for a fixed total: you count every pair of coins that adds up to it, weighting each pair by how likely each coin was, rather than blending the two coins' own odds.

saying these in an interview costs you the question

  • Adds the two densities instead of convolving them
  • Says the sum of two uniforms is uniform
  • Applies the convolution formula to dependent variables
  • Assumes every sum stays in the same family
  • Confuses convolving densities with multiplying CDFs

context