Tutorials › Exam P - Probability › Sums of Nonidentical Bernoulli Variables

Exam P · Sums of Independent Variables · Tutorial 827 of 915

Sums of Nonidentical Bernoulli Variables

Use a recurrence or a generating function to calculate exact probabilities for sums of independent Bernoulli variables with unequal success probabilities.

Advanced 12 min read

What You'll Learn

  • Define a sum of independent Bernoulli variables with different success probabilities
  • Build its probability distribution one variable at a time
  • Read exact-count probabilities as coefficients of a probability-generating function
  • Check a computed distribution using total probability, the mean, and the variance
  • Recognize why a binomial model generally does not apply when success probabilities differ
  • Calculate event probabilities from the resulting distribution

Why Unequal Success Probabilities Matter

A count of successes is often modeled with a binomial distribution. That model requires independent trials with the same probability of success on every trial. In some settings the trials are independent, but their success probabilities differ: for example, hypothetical components may have different failure risks, or different applications may have different acceptance probabilities. The count is still a sum of Bernoulli variables, but it does not generally have a binomial distribution.

For this sum, the exact distribution can be built directly. A recursive convolution updates the probabilities after each Bernoulli variable is added. Equivalently, a probability-generating function packages the same probabilities as polynomial coefficients. Both methods rely on independence and keep the different success probabilities separate.

Definition: A Bernoulli variable \(X_i\) takes the value 1 with probability \(p_i\) and 0 with probability \(1-p_i\), where \(0\le p_i\le 1\). If \(X_1,\ldots,X_n\) are independent Bernoulli variables, their sum \(S=\sum_{i=1}^n X_i\) counts the number of successes. The probabilities \(p_i\) need not be equal.

Because each variable contributes either 0 or 1, the support of \(S\) is contained in the integers from 0 through \(n\). Some of those values can have probability zero in boundary cases such as \(p_i=0\) or \(p_i=1\). The method below still works in those cases.

Recursive Convolution

Let \(S_j=X_1+\cdots+X_j\) denote the sum of the first \(j\) variables, and let \(q_{j,k}=P(S_j=k)\). Start with \(q_{0,0}=1\), since a sum with no variables is 0 with certainty. Set \(q_{j,k}=0\) whenever \(k<0\) or \(k>j\). After adding \(X_j\), the updated probabilities are

$$ q_{j,k}=(1-p_j)q_{j-1,k}+p_jq_{j-1,k-1},\qquad 0\le k\le j. $$

The first term accounts for \(X_j=0\), so the previous sum must already equal \(k\). The second term accounts for \(X_j=1\), so the previous sum must equal \(k-1\). Independence lets us multiply each previous probability by the corresponding probability for \(X_j\).

Theorem: For independent Bernoulli variables with success probabilities \(p_1,\ldots,p_n\), repeated use of the recurrence gives the exact distribution \(P(S=k)=q_{n,k}\). The recurrence does not require equal success probabilities.

Worked Example: Building the Distribution in Three Steps

Three independent hypothetical screening tests each produce a positive result with a different probability: \(p_1=0.2\), \(p_2=0.5\), and \(p_3=0.8\). Let \(S\) be the number of positive results. Find the full distribution of \(S\), and calculate \(P(S\ge 2)\).

Method: recursive convolution. For the first test, \(q_{1,0}=0.8\) and \(q_{1,1}=0.2\). Add the second test, whose success probability is 0.5:

$$ q_{2,0}=0.8(0.5)=0.4,\qquad q_{2,1}=0.8(0.5)+0.2(0.5)=0.5,\qquad q_{2,2}=0.2(0.5)=0.1. $$

Now add the third test, whose success probability is 0.8 and failure probability is 0.2:

$$ \begin{aligned} q_{3,0}&=0.4(0.2)=0.08,\\ q_{3,1}&=0.5(0.2)+0.4(0.8)=0.10+0.32=0.42,\\ q_{3,2}&=0.1(0.2)+0.5(0.8)=0.02+0.40=0.42,\\ q_{3,3}&=0.1(0.8)=0.08. \end{aligned} $$

Thus \(P(S=0)=0.0800\), \(P(S=1)=0.4200\), \(P(S=2)=0.4200\), and \(P(S=3)=0.0800\). The requested probability is \(P(S\ge2)=0.4200+0.0800=0.5000\).

Check. The probabilities sum to \(0.08+0.42+0.42+0.08=1\). The mean is \(0.2+0.5+0.8=1.5\), and the distribution gives \(0(0.08)+1(0.42)+2(0.42)+3(0.08)=1.5\). The common mistake avoided here is treating the three unequal probabilities as if they defined a binomial model.

Probability-Generating Coefficients

The probability-generating function of a nonnegative integer-valued variable \(S\) is \(G_S(z)=E[z^S]\). For one Bernoulli variable, \(E[z^{X_i}]=(1-p_i)+p_i z\), since the variable contributes a factor of 1 when it is 0 and a factor of \(z\) when it is 1. Independence makes the generating function of a sum the product of the individual generating functions.

$$ G_S(z)=\prod_{i=1}^n\bigl((1-p_i)+p_i z\bigr) =\sum_{k=0}^n P(S=k)z^k. $$

This gives a second way to obtain the distribution: expand the product, and the coefficient of \(z^k\) is \(P(S=k)\). Multiplying the next factor \((1-p_j)+p_jz\) into the polynomial for \(S_{j-1}\) produces exactly the recursive convolution: the constant part retains the count \(k\), while the \(z\) part shifts the previous count \(k-1\) to \(k\).

Justification: Independence implies \(E[z^{X_1+\cdots+X_n}]=E[z^{X_1}\cdots z^{X_n}]=\prod_{i=1}^n E[z^{X_i}]\). Also, \(E[z^S]=\sum_{k=0}^n P(S=k)z^k\). Equating coefficients therefore identifies each exact-count probability. The product rule is valid here because the variables are independent.

Worked Example: Extracting Coefficients for Four Unequal Probabilities

Four independent hypothetical inspection outcomes have success probabilities \(0.1\), \(0.3\), \(0.6\), and \(0.8\). Find the probability of exactly two successes and the probability of at least three successes.

Method: multiply the generating-function factors in stages. The first two factors give

$$ (0.9+0.1z)(0.7+0.3z)=0.63+0.34z+0.03z^2. $$

Multiplying by the third factor, \(0.4+0.6z\), gives

$$ 0.252+0.514z+0.216z^2+0.018z^3. $$

For example, the coefficient of \(z^2\) is \(0.34(0.6)+0.03(0.4)=0.204+0.012=0.216\). Now multiply by the fourth factor, \(0.2+0.8z\):

$$ \begin{aligned} G_S(z) ={}&0.0504+0.3044z+0.4544z^2\\ &+0.1764z^3+0.0144z^4. \end{aligned} $$

Therefore \(P(S=2)=0.4544\), and \(P(S\ge3)=0.1764+0.0144=0.1908\).

Check. The coefficients sum to \(0.0504+0.3044+0.4544+0.1764+0.0144=1.0000\). The expected count from the individual probabilities is \(0.1+0.3+0.6+0.8=1.8\). The coefficients give \(0.3044+2(0.4544)+3(0.1764)+4(0.0144)=1.8\). The common mistake avoided is reading a coefficient before all factors have been included; the intermediate \(z^2\) coefficient is not yet the probability of exactly two successes among all four outcomes.

A Further Distribution Check and a Binomial Trap

For independent Bernoulli variables, the mean and variance provide useful checks on an exact distribution:

$$ E[S]=\sum_{i=1}^n p_i,\qquad \operatorname{Var}(S)=\sum_{i=1}^n p_i(1-p_i). $$

The mean follows from adding expectations. For the variance, each Bernoulli variable has variance \(p_i(1-p_i)\); independence makes the covariance terms between distinct variables zero. These summaries do not determine the full distribution, but a disagreement with a computed distribution signals an error.

A sum of independent Bernoulli variables is binomial with parameters \(n\) and \(p\) when all its success probabilities equal the same \(p\). When they differ, the binomial formula \(P(S=k)=\binom{n}{k}p^k(1-p)^{n-k}\) generally does not apply. Independence alone is not enough: the equal-probability condition matters.

Worked Example: Detecting an Incorrect Binomial Shortcut

Four independent hypothetical devices pass a stress check with probabilities \(0.2\), \(0.4\), \(0.7\), and \(0.9\). Find the probability that exactly two pass, and assess the shortcut of using a binomial model with \(p=0.55\), the average success probability.

Method: convolve the Bernoulli probabilities. For the first two devices, the probabilities of zero, one, and two passes are \(0.8(0.6)=0.48\), \(0.2(0.6)+0.8(0.4)=0.44\), and \(0.2(0.4)=0.08\).

After adding the third device, with success probability \(0.7\), the probabilities for zero through three passes are

$$ 0.48(0.3)=0.144,\quad 0.44(0.3)+0.48(0.7)=0.468,\quad 0.08(0.3)+0.44(0.7)=0.332,\quad 0.08(0.7)=0.056. $$

For exactly two passes among all four devices, the fourth device either fails while the first three had two passes, or passes while the first three had one pass. Thus

$$ P(S=2)=0.332(0.1)+0.468(0.9)=0.0332+0.4212=0.4544. $$

The binomial shortcut would give \(\binom{4}{2}(0.55)^2(0.45)^2=6(0.3025)(0.2025)=0.3675375\), or \(0.3675\) to four decimal places. This is not the exact answer because the four success probabilities are not all \(0.55\). The correct answer is \(0.4544\).

Check. The mean is \(0.2+0.4+0.7+0.9=2.2\), consistent with a count that is usually near two. The key distinction is between averaging probabilities and having the same probability on each independent trial.

Practical Calculation Strategy

For a small or moderate number of variables, a table of recurrence values is usually efficient. Keep one entry for each possible success count, update from \(k=0\) upward, and use zero for entries outside the current support. For hand calculations, exact decimals or fractions help prevent rounding drift. If the number of variables is larger, polynomial multiplication or a computational implementation of the same recurrence may be more convenient; the method remains exact apart from any numerical rounding.

1
State the model.
Confirm that each variable takes values 0 and 1, identify every \(p_i\), and verify that the variables are independent.
2
Choose the calculation form.
Use the recurrence for a probability table, or use the product \(\prod_i((1-p_i)+p_i z)\) to obtain probabilities as coefficients.
3
Read the requested event.
An exact count is one coefficient; a tail or interval probability is the sum of the relevant coefficients.
4
Check the result.
Verify that all probabilities sum to 1 and, when useful, compare the computed mean and variance with the sums of the Bernoulli means and variances.

The most important exam trap is replacing unequal probabilities by a single average and then applying a binomial formula. Another is reversing the recurrence terms: the probability of reaching \(k\) after a new success comes from the old count \(k-1\), not the old count \(k\). Labeling the failure and success contributions explicitly prevents that indexing error.

These exact calculations are aligned with the SOA Exam P (Probability) syllabus. They provide a direct way to solve independent-count problems when distributional closure does not apply, without assuming that trials are identically distributed.

Check Your Understanding

For each problem, assume the stated Bernoulli variables are independent. Work through the probabilities before checking the final answer.

  1. Two independent sensors activate with probabilities \(0.25\) and \(0.60\). What is the probability that exactly one activates? (Answer: 0.5500)
  2. Three independent review flags are raised with probabilities \(0.2\), \(0.4\), and \(0.7\). Find the probability that exactly two flags are raised. (Answer: 0.3320)
  3. Four independent backup units operate with probabilities \(0.5\), \(0.2\), \(0.3\), and \(0.8\). Find the probability that all four operate. (Answer: 0.0240)
  4. Three independent parcels arrive on time with probabilities \(0.1\), \(0.4\), and \(0.6\). Find the probability that at most one arrives on time. (Answer: 0.7080)
  5. Three independent accounts generate a response with probabilities \(0.25\), \(0.5\), and \(0.75\). Find the probability of exactly one response. (Answer: 0.4063)
Clinical Biostats