Understanding the probability calculator for two events — concept and principle
This calculator combines the probabilities of two events A and B: both happen, at least one happens, A does not happen, exactly one happens, or neither happens. It is useful for everyday questions such as "what is the chance that at least one of two flights is delayed" or "what is the chance both machines work", and for checking homework on the basic rules of probability. Enter P(A) and P(B) as numbers between 0 and 1.
How it is calculated
All five results assume that A and B are independent, meaning that knowing one happened does not change the chance of the other.
- And: P(A ∩ B) = P(A)·P(B)
- Or (at least one): P(A ∪ B) = P(A) + P(B) − P(A)·P(B)
- Not A: P(Aᶜ) = 1 − P(A)
- Exactly one: P(A) + P(B) − 2·P(A)·P(B)
- Neither: (1 − P(A))·(1 − P(B))
The principle
The complement rule comes from the fact that A either happens or does not, so the two probabilities add to 1. The addition rule P(A ∪ B) = P(A) + P(B) − P(A ∩ B) holds for any events: adding P(A) and P(B) counts the overlap twice, so it is subtracted once. Independence is what turns the overlap into a simple product. "Exactly one" removes the overlap from both events, hence 2·P(A)P(B). "Neither" is the complement of "or": 1 − P(A ∪ B) = (1 − P(A))(1 − P(B)).
Worked example
- Defaults: P(A) = 0.5, P(B) = 0.4.
- And: 0.5 × 0.4 = 0.2.
- Or: 0.5 + 0.4 − 0.2 = 0.7.
- Not A: 1 − 0.5 = 0.5.
- Exactly one: 0.5 + 0.4 − 2 × 0.2 = 0.5.
- Neither: 0.5 × 0.6 = 0.3. Check: 0.2 (both) + 0.5 (exactly one) + 0.3 (neither) = 1.
| P(A) | P(A and B), independent |
|---|---|
| 0.125 | 0.05 |
| 0.25 | 0.1 |
| 0.375 | 0.15 |
| 0.5 | 0.2 |
| 0.625 | 0.25 |
| 0.75 | 0.3 |
| 1 | 0.4 |
How to read the result
The four cases "both", "only A", "only B" and "neither" always add up to 1, which is a quick consistency check. "At least one" is usually easiest to compute as 1 − P(neither), and this idea extends to many events: the chance of at least one success in k independent tries with probability p each is 1 − (1 − p)ᵏ.
Common mistakes
- Multiplying probabilities of events that are not independent, such as rain today and rain tomorrow.
- Confusing independent events with mutually exclusive ones. Mutually exclusive events cannot both happen, so P(A ∩ B) = 0 and P(A ∪ B) = P(A) + P(B); they are not independent unless one has probability 0.
- Entering percentages (50) instead of decimals (0.5).
Frequently asked questions
How do I find P(A and B) when the events are dependent?
Use the multiplication rule P(A ∩ B) = P(A)·P(B|A), where P(B|A) is the probability of B given that A happened.
Can P(A or B) be more than 1?
No. If adding gives more than 1, the overlap was not subtracted or the inputs are wrong.
How can I test whether two events are independent?
Check whether P(A ∩ B) observed in data is close to P(A)·P(B), or equivalently whether P(B|A) ≈ P(B).
Sources: Sheldon M. Ross, A First Course in Probability, Pearson — axioms of probability and independence · William Feller, An Introduction to Probability Theory and Its Applications, Vol. 1, Wiley