Imagine I have a process with $N$ distinct trials, $(t_1,t_2,t_3,t_4,...,t_N)$, where each trial $t_i$ has its own probability of success $p_i$ and probability of failure $q_i = (1-p_i)$.

After performing a single random instance of each trial, how do we calculate something like a probability distribution for the overall number of successes, or less ambitiously, the mean / median number of expected overall successes?

For example:

Let's say we perform ten distinct trials, $(t_1,t_2,...,t_10)$, a single time per trial, where the probabilities of success for each trial are $(0.3,0.23,0.94,0.1,0.1,0.44,0.1,0.4955,0.64,0.0987)$. What probability distribution do we have for the number of overall successes, or can we at least compute a mean / median?

  • $\begingroup$ The mean has a simple answer. Let $X_i=1$ if we have a success on the $i$-th trial, and $0$ otherwise. Then the number of successes is $X_1+\cdots+X_n$, so the mean is $E(X_1)+\cdots+E(X_n)$. This is $p_1+\cdots+p_n$. $\endgroup$ Apr 7, 2014 at 6:05
  • $\begingroup$ @AndréNicolas Ah, yup that makes sense. Is there something similar we can do for the median? $\endgroup$
    – T.S.
    Apr 7, 2014 at 6:09
  • $\begingroup$ I don't think so. The linearity of the mean is one reason for using it as the measure of (average) location. $\endgroup$ Apr 7, 2014 at 6:11
  • $\begingroup$ @AndréNicolas Surely there must be some known algorithm though for computing a median under these circumstances? $\endgroup$
    – T.S.
    Apr 7, 2014 at 6:12
  • $\begingroup$ Probably. But not known by me. $\endgroup$ Apr 7, 2014 at 6:13

1 Answer 1


The probability generating function for $Y = X_1 + \ldots + X_n$ is $$E[ z^Y] = \prod_{i=1}^n E[z^{X_i}] = \prod_{i=1}^n (q_i + p_i z) $$ Expand this and you can read off the probability mass function of $Y$.

Or you can proceed iteratively: if $Y_k = X_1 + \ldots + X_k$, then for $0 \le j \le k$, $$P(Y_k = j) = q_k P(Y_{k-1} = j) + p_k P(Y_{k-1} = j-1)$$

There is no nice expression for the median, however.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .