# Probabilities of set number of events happening from multiple different probability events

I have 10 independent events and I would like to be able to work out the probability of EXACTLY 2,3,4,5 etc. happening, I can gain the probability of 1 happening by taking the probability of the sum of any happening and I can get the probability of more than 1 happening by taking away the probability of 0 happening, I can also get chances of 2 happening by taking away the chance of just 1 happening from the chance of 0, but I am struggling with how I can do this with exactly 2 without individually calculating the chances of event 1 & 2, chances of event 1 & 3, so on and so forth. Is there a way to do this with Excel/Google Sheets? I looked into binomial distribution but I think this requires the probability of each event to be the same.

Not a hugely maths savvy person, so your patience (and simplicity) in answering would be much appreciated.

The table shows the probabilities I have for the 10 events.

• What does the "1 Winning" column represent? – saulspatz Jan 8 at 13:13
• Ah, sorry, that is the chance of that event winning and all others losing. – N App Jan 8 at 13:28
• I thought that's what you meant, but I don't get the same answers. For the probability that the first event wins and the others lose, for example, I get $4.36\%$ – saulspatz Jan 8 at 13:30
• Hmm, my numbers are rounded, could that be the difference, here is the link to the Google Sheet if that helps.. docs.google.com/spreadsheets/d/… – N App Jan 8 at 13:33
• The difference is too large to be explained by rounding, and I can't follow the spreadsheet. The first entry in the "1 winning" column should be computed as $$.2714\cdot.6241\cdot.5327\cdots.7368$$ Is that what you did? – saulspatz Jan 8 at 13:38

Here is a python script that computes the probabilities you want:

from collections import defaultdict

p = [.2174, .3759, .4673, .0769, .0357, .2632, .2632]
N = len(p)

def bitsum(n):
'Number of 1 bits in n'
count = 0
while n:
count +=1
n &= n-1
return count

def prob(v):
'''
v is a bit vector indicating which events occurs
v[k]==1 iff event k occurs
'''
for k in range(N):
v,r = divmod(v,2)
answer *= p[k] if r else (1-p[k])

exact = defaultdict(float)
for v in range(2**N):
exact[bitsum(v)] += prob(v)

for k in range(N+1):
print('probability exactly', k, 'events occur', exact[k])

print('Sum of computed probabilities', sum(exact.values()))


This produces the output:

probability exactly 0 events occur 0.12572940926350773
probability exactly 1 events occur 0.32590285691607773
probability exactly 2 events occur 0.3297864319159991
probability exactly 3 events occur 0.1671225468059581
probability exactly 4 events occur 0.0449221573418514
probability exactly 5 events occur 0.006158839703878074
probability exactly 6 events occur 0.0003704954218414138
probability exactly 7 events occur 7.262630886494916e-06
Sum of computed probabilities 1.0000000000000002


The script just computes the probability of each of the $$128$$ possible outcomes, and tosses it into the appropriate bin. Since the last $$3$$ events never occur, I just ignored them.

• That's awesome, thanks a lot. – N App Jan 8 at 14:47