I have a programming problem I'm trying to solve where, in order to be efficient, I have to find the probability of some events occuring.
Lets say I have 3 transactions. At each transaction there is a 5% chance that the transaction will be declined. I want to know what are the chances of 0, 1, 2 and 3 of the transactions being declined.
I have being trying to visualise this with a venn diagram and trying to work out the areas of each event, but unfortunately when I add up the separate events I keep on getting more than or less than 1.
The event that 0 of the transactions will be declined is simply:
p(0 transactions declined) = .95 * .95* .95 = 6859/8000
The event that all 3 of the transactions will be declined should be:
p(3 transactions declined) = .05 * .05 * .05 = 1/8000
Now I start running into trouble:
p(2 transactions only declined) = (3 x (.05 * .05)) -3/8000 (because the A∩B∩C has been counted three times and we only want to know about when there are 2 transactions, and NOT when there are 2 or 3) = 57/8000
p(1 transaction only declined) = Well p(A∩(A'∪B'∪C')) x 3 would give us the answer. I make this out to be 3 x (0.05 -(2 x 20/8000) - 1/8000) = 1077/8000
If I add all those events up, then I get 7994/8000. I'm not sure what the right way to go about this is. I'd like to work it out for myself, but I really need a point in the right direction. I don't just want to make this work for three transactions, but for as many as I want so I need a general formula.