Tutorials › Statistical Theory I - Probability and Distribution Theory › Distribution of a Random Sum by Conditioning

Joint Laws of Independent Variables · Tutorial 290 of 994

Distribution of a Random Sum by Conditioning

Learn to construct a random sum’s distribution by mixing the laws of fixed-length sums over the possible values of an independent count.

Intermediate 10 min read

What You'll Learn

  • Define a random sum, including the empty sum when the count is zero.
  • Express its distribution function as a weighted sum of fixed-count distribution functions.
  • Obtain mass functions and densities from the same mixture principle.
  • Calculate random-sum laws in discrete and continuous examples.
  • Check normalization and distinguish independence from mere identical distribution.

Why a Random Sum Is a Mixture

A sum with a fixed number of terms has a distribution determined by the laws of those terms. If the number of terms is itself random, the total can have several different fixed-count distributions, depending on the realized count. Its overall distribution combines those possibilities, weighted by the probabilities of the corresponding counts.

The key condition is independence: the count must be independent of the sequence of summands. Then learning the count does not change the distribution of any fixed number of terms. We can condition on the count, use the appropriate fixed-sum law, and average over all possible counts.

Definition: Let \(N\) be a random variable taking values in \(\{0,1,2,\ldots\}\), and let \(X_1,X_2,\ldots\) be iid real-valued random variables, independent of \(N\). The random sum is $$ S_N=\sum_{i=1}^{N}X_i. $$ When \(N=0\), the sum is defined to be \(0\). Write \(p_n=P(N=n)\). For \(n\geq 1\), let \(F_n\) be the distribution function of \(X_1+\cdots+X_n\), and define \(F_0(x)=\mathbf{1}\{x\geq 0\}\), the distribution function of the empty sum.

Because \(N\) takes finite nonnegative integer values, it is finite with probability one. For each possible value \(n\), the conditional law of \(S_N\) given \(N=n\) is the law of a sum of exactly \(n\) iid terms. For \(n\geq 1\), that fixed-sum law is obtained by the \(n\)-fold convolution of the summand law; the \(n=0\) law is a point mass at zero.

The Mixture Formula

Theorem: Under the conditions in the definition, for every real \(x\), $$ F_{S_N}(x)=P(S_N\leq x)=\sum_{n=0}^{\infty}p_nF_n(x). $$ More generally, for every Borel set \(A\subseteq\mathbb{R}\), $$ P(S_N\in A)=\sum_{n=0}^{\infty}p_nP(X_1+\cdots+X_n\in A), $$ where the \(n=0\) term uses the convention that the empty sum equals \(0\).

Proof. The events \(\{N=n\}\), \(n=0,1,2,\ldots\), are disjoint and their union has probability one. Therefore, for any Borel set \(A\), countable additivity gives $$ P(S_N\in A)=\sum_{n=0}^{\infty}P(S_N\in A,\ N=n). $$ On \(\{N=n\}\), the random sum equals \(X_1+\cdots+X_n\), with the empty-sum convention at \(n=0\). Independence of \(N\) from the entire summand sequence implies $$ P(S_N\in A,\ N=n) =P(N=n)P(X_1+\cdots+X_n\in A). $$ Substituting this into the countable sum proves the Borel-set formula. Taking \(A=(-\infty,x]\) gives the distribution-function formula. \(\square\)

The result is a mixture of probability distributions: first select a count \(n\) with probability \(p_n\), then use the fixed-count sum law for that \(n\). It applies whether the summands are discrete, continuous, or have a mixture of discrete and continuous parts.

Mass and density forms: If the summands are integer-valued and \(q_n(k)=P(X_1+\cdots+X_n=k)\), then $$ P(S_N=k)=\sum_{n=0}^{\infty}p_nq_n(k), $$ where \(q_0(k)=\mathbf{1}\{k=0\}\). If, instead, every fixed-count law for \(n\geq1\) has a density \(g_n\), then the part of the law of \(S_N\) contributed by positive counts has density $$ g_{S_N}(s)=\sum_{n=1}^{\infty}p_ng_n(s) $$ for almost every \(s\). There is also an atom of size \(p_0\) at zero from \(N=0\).

For the density statement, the probability assigned to a Borel set \(A\) by positive counts is \(\sum_{n\geq1}p_n\int_A g_n(s)\,ds\). Since all terms are nonnegative, Tonelli’s theorem permits interchanging the sum and integral: $$ \sum_{n=1}^{\infty}p_n\int_Ag_n(s)\,ds =\int_A\sum_{n=1}^{\infty}p_ng_n(s)\,ds. $$ The proposed mixture is a density for that part of the law. Its total integral is \(\sum_{n\geq1}p_n=1-p_0\), so including the zero-count atom gives total probability one. This also shows why a random sum can be mixed even when each positive-count component has a density.

Worked Random-Sum Distributions

Worked Example: A Discrete Count and Bernoulli Summands

Suppose \(P(N=0)=1/2\), \(P(N=1)=1/3\), and \(P(N=2)=1/6\). Independently, let the \(X_i\) be iid Bernoulli random variables with \(P(X_i=1)=P(X_i=0)=1/2\). Find the mass function of \(S_N\).

If \(N=0\), then \(S_N=0\) with probability one. If \(N=1\), the sum has probabilities \(1/2\) at both 0 and 1. If \(N=2\), the possible sums are 0, 1, and 2, with probabilities \(1/4,1/2,1/4\), respectively. Mixing these laws gives $$ P(S_N=0)=\frac12+\frac13\cdot\frac12+\frac16\cdot\frac14 =\frac{12}{24}+\frac{4}{24}+\frac{1}{24} =\frac{17}{24}, $$ $$ P(S_N=1)=\frac13\cdot\frac12+\frac16\cdot\frac12 =\frac16+\frac{1}{12} =\frac14, $$ and $$ P(S_N=2)=\frac16\cdot\frac14=\frac{1}{24}. $$ There is no probability at any other value. As a check, the probabilities sum to \(17/24+6/24+1/24=1\). In particular, the probability at zero includes the entire \(N=0\) contribution, not just the chance that one or more Bernoulli summands equal zero.

Worked Example: A Point Mass Plus a Continuous Part

Let \(P(N=0)=1/4\), \(P(N=1)=1/2\), and \(P(N=2)=1/4\), independently of iid \(X_i\sim\operatorname{Uniform}(0,1)\). Find the atom and the density of the continuous part of \(S_N\).

The event \(N=0\) contributes an atom of probability \(1/4\) at \(S_N=0\). Given \(N=1\), the sum is uniform on \((0,1)\), with density 1 there. Given \(N=2\), convolution of the two uniform densities gives the triangular density \(s\) on \(0<s<1\) and \(2-s\) on \(1<s<2\). Thus the mixture density, away from endpoints where density values do not affect probabilities, is $$ g_{S_N}(s)= \begin{cases} \frac12+\frac14s, & 0<s<1,\\ \frac14(2-s), & 1<s<2,\\ 0, & \text{otherwise}. \end{cases} $$ The continuous part has total probability $$ \int_0^1\left(\frac12+\frac14s\right)\,ds +\int_1^2\frac14(2-s)\,ds =\left(\frac12+\frac18\right)+\frac18 =\frac34. $$ Together with the atom \(1/4\) at zero, the total is 1. The density describes the positive-count component; it does not represent the atom at zero.

Worked Example: Exponential Summands and Three Possible Counts

Suppose \(P(N=1)=1/2\), \(P(N=2)=1/3\), and \(P(N=3)=1/6\), independently of iid exponential summands with rate 2. Find the density of \(S_N\).

For one summand the density is \(g_1(s)=2e^{-2s}\) for \(s>0\). The fixed-count sums for two and three such summands have gamma densities $$ g_2(s)=4se^{-2s},\qquad g_3(s)=4s^2e^{-2s},\qquad s>0. $$ These are the fixed-count convolution laws. Weighting them by the probabilities of their counts gives $$ g_{S_N}(s) =\frac12(2e^{-2s})+\frac13(4se^{-2s})+\frac16(4s^2e^{-2s}) =e^{-2s}\left(1+\frac43s+\frac23s^2\right),\quad s>0. $$ There is no atom at zero because \(N\geq1\) with probability one and each exponential summand is positive with probability one. To check the density’s normalization, use \(\int_0^\infty e^{-2s}\,ds=1/2\), \(\int_0^\infty se^{-2s}\,ds=1/4\), and \(\int_0^\infty s^2e^{-2s}\,ds=1/4\). Then $$ \int_0^\infty g_{S_N}(s)\,ds =\frac12+\frac43\cdot\frac14+\frac23\cdot\frac14 =\frac12+\frac13+\frac16=1. $$

Common Pitfall: The Count Must Be Independent

Identical distribution of the summands alone is not enough to use the mixture formula with the unconditional fixed-sum laws. Independence of \(N\) and the entire sequence is what makes the conditional law given \(N=n\) match the unconditional law of a sum of \(n\) terms.

For a counterexample, take iid \(X_i\sim\operatorname{Bernoulli}(1/2)\) and define \(N=X_1\). Then \(N\) takes values 0 and 1 but is not independent of the summands. In fact, \(S_N=0\) when \(N=0\), while when \(N=1\), \(S_N=X_1=1\). Hence \(P(S_N=0)=P(S_N=1)=1/2\). If we incorrectly used the unconditional law of \(X_1\) for the \(N=1\) case, we would calculate \(P(S_N=0)=1/2+(1/2)(1/2)=3/4\), which is wrong: conditional on \(N=1\), \(X_1=1\) with probability one.

1
List the possible counts.
Write \(p_n=P(N=n)\), including \(n=0\) if it is possible.
2
Find each fixed-count law.
For each \(n\), use the distribution of a sum of \(n\) iid summands; use a point mass at zero when \(n=0\).
3
Weight and combine.
Multiply each fixed-count law by \(p_n\) and add the resulting probabilities, distribution functions, or densities.
4
Check the whole law.
Verify that the component weights sum to one and account separately for atoms and continuous parts.

Why the Conditioning View Matters

Conditioning turns a random-length sum into a collection of fixed-length problems, for which convolution gives the relevant laws. The mixture formula then assembles those laws without requiring a new convolution rule for every possible count. It also makes the role of the count probabilities explicit: changing the law of \(N\) changes the mixture weights, even when the summand distribution stays the same.

A useful practical check is to ask whether the count-zero outcome has been included and whether any component has an atom. A density alone cannot describe a point mass, and omitting the empty sum can lose genuine probability at zero. For discrete laws, the corresponding check is that all possible values receive contributions from every count that can produce them.

Check Your Understanding

Use the mixture principle and the independence condition to answer the following.

  1. Write the distribution-function formula for \(S_N\), and explain what \(F_0\) represents.
  2. If \(P(N=0)>0\) and all positive-count sums have densities, where does the zero-count probability appear in the law of \(S_N\)?
  3. Suppose a fixed-count sum has mass \(q_n(k)\) at \(k\). How does it contribute to \(P(S_N=k)\)?
  4. Why does the mixture formula use the unconditional fixed-count law when \(N\) is independent of the summands?
  5. What can go wrong if \(N\) depends on \(X_1\), even though the \(X_i\) are iid?