Probability of Two Events Calculator
Probability of Two Events Calculator
Find the chance that A and B both happen, that either does, that neither does and that exactly one does, with both conditional chances, for independent, mutually exclusive and dependent events, a two way table of counts, an unknown link between the events, or one event repeated over many trials.
The four outcomes
P(A and B) = P(A) × P(B) for independent events and P(A) × P(B | A) in general. P(A or B) = P(A) + P(B) − P(A and B), which is P(A) + P(B) when the events cannot both happen. P(neither) = 1 − P(A or B). P(exactly one) = P(A) + P(B) − 2 P(A and B). P(A | B) = P(A and B) ÷ P(B). With only P(A) and P(B) known, P(A and B) lies between the larger of 0 and P(A) + P(B) − 1, and the smaller of P(A) and P(B). At least one success in n independent trials = 1 − (1 − p)^n. Chances can be typed as decimals, percentages or fractions. The CSV, image and printed report contain the values you entered, nothing preloaded.
How to use this tool
Pick the situation first, because it decides which boxes you fill in. Independent and mutually exclusive events take P(A) and P(B). The two dependent settings take P(A), P(B) and either P(B | A) or the chance of both. A two way table takes four counts, bounds takes P(A) and P(B) when the link is unknown, and repeated trials takes a chance per trial, a number of trials and a target. Type chances as decimals (0.4), percentages (40%) or fractions (2/5); answers come back as a percentage and a decimal.
The input people most often get wrong is P(B | A). It is the chance of B among the cases where A happened, not the chance of B overall and not P(A | B). The next slip is typing 40 for 40 percent. The tool refuses that and asks for 0.4 or 40%, rather than guess.
What the calculation is doing
Every two event problem has four cells: both happen, only A, only B, neither. Their chances add to 1 and every other question is a sum of cells. P(A or B) is everything except neither, and exactly one is A only plus B only. P(A) and P(B) leave one number open, the chance of both.
For independent events P(A and B) = P(A) × P(B). In general it is P(A) × P(B | A), and for events that cannot happen together it is 0. Then P(A or B) = P(A) + P(B) − P(A and B), P(neither) = 1 − P(A or B), P(exactly one) = P(A) + P(B) − 2 × P(A and B), and P(A | B) = P(A and B) ÷ P(B).
When only P(A) and P(B) are known, the chance of both lies between the larger of 0 and P(A) + P(B) − 1, and the smaller of P(A) and P(B). These are the Frechet inequalities, implicit in George Boole’s work of 1854 and derived explicitly by Maurice Frechet in 1935. The range for P(A or B) runs from the larger of P(A) and P(B) up to the smaller of 1 and P(A) + P(B). For n independent trials the chance of no success is (1 − p)^n, so at least one is 1 − (1 − p)^n, and a target t needs n ≥ ln(1 − t) ÷ ln(1 − p) trials, rounded up.

Independent and mutually exclusive are close to opposites
Two questions choose the formula. Can A and B both happen? Does knowing one happened change the chance of the other? If the first answer is no, the events are mutually exclusive and P(A or B) = P(A) + P(B). If the second answer is no, they are independent and P(A and B) = P(A) × P(B). If it is yes, you need P(B | A) or the chance of both.
The two ideas get mixed up because both sound like “separate”, but they are nearly opposites. If A and B are mutually exclusive with positive chances, learning that A happened tells you B did not, so P(B | A) is 0 while P(B) is positive. OpenStax makes the point with a coin and a die: heads with an even number has 3 chances in 12, heads with a three has 1 in 12, they cannot both occur, and 3/12 × 1/12 = 1/48 is not 0. Independent events with positive chances always overlap: 0.4 and 0.5 give both 20% of the time.
The subtraction in P(A or B) stops double counting. Add 0.4 and 0.5 and every case where both happen is counted twice, so the overlap of 0.2 is taken off once: 0.9 − 0.2 = 0.7. Exclusive events have no overlap. In the OpenStax example Klaus can afford one vacation, with a 60% chance of New Zealand and 35% of Alaska, so 95% choose one of them and 5% choose neither.
Impossible inputs get a message, not a number. Exclusive chances of 0.6 and 0.7 add to 1.3, so no such pair of events exists. A chance of both larger than either single chance is refused too, because both happening is part of each happening.
Reliability and quality: several checks, one fault
The commonest practical use is redundancy. Suppose two checks would catch a fault 80% and 70% of the time; these are illustrative figures. If the checks are independent, both miss with chance 0.2 × 0.3 = 6%, so at least one catches it 94% of the time. Three independent checks at 70% each give 1 − 0.3³ = 97.3%. Each added check helps, but adds less than the last.
Real checks are rarely independent. The same inspector, instrument or assumption sits behind both, so a fault that fools one is more likely to fool the other, and that lowers the chance that at least one catches it. The bounds setting shows the limits: with 80% and 70%, at least one catches the fault between 80% and 100% of the time. Independence, 94%, is one point in that range, and shared causes push the truth toward the bottom of it.
For planning, use repeated trials. At 5% a trial, 14 trials give 51.233%, about even, and 45 give 90.056%. Since ln 2 is about 0.69 and ln 20 is about 3, n ≈ 0.69 ÷ p gives even odds and n ≈ 3 ÷ p gives 95%. The shortcut n × p is worse: at 5% and 45 trials it says 225%.
Standard pairs of chances, worked out
Both, either, neither and exactly one for independent events, with the range of the chance of both when the link is unknown. The independent value is always inside that range.
| P(A) | P(B) | Both | Either | Neither | Exactly one | Both, range |
|---|---|---|---|---|---|---|
| 10% | 10% | 1% | 19% | 81% | 18% | 0% to 10% |
| 20% | 30% | 6% | 44% | 56% | 38% | 0% to 20% |
| 30% | 40% | 12% | 58% | 42% | 46% | 0% to 30% |
| 40% | 50% | 20% | 70% | 30% | 50% | 0% to 40% |
| 50% | 50% | 25% | 75% | 25% | 50% | 0% to 50% |
| 60% | 70% | 42% | 88% | 12% | 46% | 30% to 60% |
| 80% | 70% | 56% | 94% | 6% | 38% | 50% to 70% |
| 90% | 90% | 81% | 99% | 1% | 18% | 80% to 90% |
How many trials for a target chance
The chance of at least one success in n independent trials, and the trials needed for a 90% or 95% chance. A rare event needs surprisingly many tries.
| Chance each trial | 3 trials | 5 trials | 10 trials | 20 trials | 50 trials | Trials for 90% | Trials for 95% |
|---|---|---|---|---|---|---|---|
| 1% | 2.9701% | 4.901% | 9.5618% | 18.209% | 39.499% | 230 | 299 |
| 2% | 5.8808% | 9.6079% | 18.293% | 33.239% | 63.583% | 114 | 149 |
| 5% | 14.262% | 22.622% | 40.126% | 64.151% | 92.306% | 45 | 59 |
| 10% | 27.1% | 40.951% | 65.132% | 87.842% | 99.485% | 22 | 29 |
| 20% | 48.8% | 67.232% | 89.263% | 98.847% | 99.999% | 11 | 14 |
| 30% | 65.7% | 83.193% | 97.175% | 99.92% | above 99.999% | 7 | 9 |
A worked example you can check on paper
The calculator opens on independent events with P(A) = 0.4 and P(B) = 0.5. Both: 0.4 × 0.5 = 0.2. Either: 0.4 + 0.5 − 0.2 = 0.7. Neither: 1 − 0.7 = 0.3. Exactly one: 0.4 + 0.5 − 2 × 0.2 = 0.5. And P(A | B) = 0.2 ÷ 0.5 = 0.4, the same as P(A), which is what independent means.
Keep the two chances and change the link. If A and B are mutually exclusive, both is 0, either is 0.9 and neither is 0.1. If A sits wholly inside B, both is 0.4, either is 0.5 and neither is 0.5. Bounds shows that range: both from 0% to 40%, either from 50% to 90%. For a table of 30 both, 10 A only, 20 B only and 40 neither, the total is 100, P(A and B) = 0.3, P(A) = 0.4 and P(B) = 0.5. Independence would give 0.2, so the lift is 0.3 ÷ 0.2 = 1.5, and P(A | B) = 30 ÷ 50 = 0.6.
Mistakes that catch people out
Multiplying for exclusive events. If A and B cannot both happen, P(A and B) is 0, not P(A) × P(B).
Adding without subtracting. P(A) + P(B) is the chance of A or B only for exclusive events. Otherwise it double counts the overlap, and chances of 0.7 and 0.6 would give a union of 1.3.
Swapping P(A | B) and P(B | A). They share the numerator, P(A and B), but not the denominator. With both at 0.3, P(A) = 0.4 and P(B) = 0.5, they are 0.6 and 0.75. Converting one into the other needs the base rates, which is Bayes theorem.
Drawing without replacement. Two hearts from a deck with replacement have chance 1/4 × 1/4 = 6.25%. Without it the second card depends on the first, P(B | A) = 12/51 = 4/17, and the chance is 1/4 × 4/17 = 1/17, or 5.8824%.
Reading a sample gap as proof. A table with a lift of 1.2 describes those observations, and with a small total chance alone can produce it. The tool reports the difference and leaves the test to the chi square calculator.
Popular calculations
Each opens the calculator with those numbers filled in. Examples marked illustrative are made up to show the method; those marked textbook come from OpenStax.
Coins, dice and cards with independent draws
Weather and reliability, illustrative
Mutually exclusive events
Dependent events and conditional chances
Two way tables of counts
Bounds when the link is unknown
At least one in n trials
How this was checked
Every joint distribution on 2, 3, 4, 5, 6, 7, 8, 10 and 12 equal cells, 1,231 in all, was compared with counting the four cells. So were all 4,096 pairs of events on one die, 3,969 independent pairs on two dice and 6,561 ways to give eight outcomes to A, B or neither; the worst difference was 2.2 × 10^−16. Another 3,000 random tables were counted person by person, and 6,000 random valid joint distributions satisfied inclusion and exclusion, De Morgan style identities, Bayes consistency and the Frechet bounds, with both extremes accepted and a joint chance 0.0001 outside them refused.
Repeated trials matched exact fractions in big integer arithmetic for 800 random cases, worst difference 3.3 × 10^−16, and the fewest trials for 600 random targets matched the exact answer every time. All 35 impossible inputs returned a message and no numbers.
Published examples were reproduced. OpenStax Introductory Statistics 2e supplied the classes example, independent at 0.3 (Example 3.9), and the long hair example, dependent with P(L | W) = 0.75 (3.12). Klaus gave 0.95 (3.14), Carlos 0.585 and 0.715 (3.15), the swim team table 10 of 150 against a product of 0.0996 (3.16) and breast cancer testing 0.0029 and 0.9901 (3.18). The 755 driver table in section 3.4 matched too. MacEwan’s Introduction to Applied Statistics gives 1 − 0.75^10 = 0.9437, and MathWorld gives 0.5177, 0.4914 and 0.5055 for the de Mere dice problems. The Frechet inequalities match Wikipedia’s statement.
Common questions
How do you find the probability of A and B?
It depends on the link between the events. For independent events multiply: 0.4 × 0.5 = 0.2, or 20%. In general use P(A) × P(B | A). For mutually exclusive events it is 0. If you know only P(A) and P(B), it lies between the larger of 0 and P(A) + P(B) − 1 and the smaller of P(A) and P(B).
How do you find the probability of A or B?
Add the two chances and subtract the chance of both: P(A) + P(B) − P(A and B). With 0.4 and 0.5 that is 0.9 − 0.2 = 0.7 for independent events. The subtraction stops the overlap being counted twice. For mutually exclusive events there is nothing to subtract.
What is the difference between independent and mutually exclusive events?
Independent events do not affect each other, so P(A and B) = P(A) × P(B). Mutually exclusive events cannot both happen, so P(A and B) = 0. With positive chances, exclusive events are never independent: if A happens, B cannot, which is the strongest effect one event can have on another.
How do you find the probability that neither event happens?
Take the chance that at least one happens from 1: P(neither) = 1 − P(A or B). For independent events that is also (1 − P(A)) × (1 − P(B)), so 0.6 × 0.5 = 0.3 for 0.4 and 0.5. Exactly one is P(A) + P(B) − 2 × P(A and B), which is 0.5 for the same pair.
How can you check whether two events are independent?
Compare P(A and B) with P(A) × P(B), or P(A | B) with P(A). In an OpenStax example P(G) = 0.6, P(H) = 0.5 and P(G and H) = 0.3, and 0.6 × 0.5 = 0.3, so they are independent. In another P(W) = 0.6, P(L) = 0.5 and P(W and L) = 0.45, which is not 0.3, so they are dependent. From a table the gap describes the sample; the chi square calculator tests it.
What is the chance of at least one success in n trials?
For independent trials with the same chance p it is 1 − (1 − p)^n. At 5% a trial and 10 trials that is 40.126%, not the 50% that n × p suggests. The trials needed for a target t is n ≥ ln(1 − t) ÷ ln(1 − p), which is 45 for 90% at 5%. Trials that share a cause do worse than the formula says.
Related Calculators and Reference
- Bayes Theorem Calculator: turns P(B | A) into P(A | B) when you know the base rate.
- Binomial Distribution Calculator: exactly, at most or at least k successes in n trials, beyond the at least one case here.
- Dice Probability Calculator: sums, highest and lowest values and other dice questions worked exactly.
- Permutation and Combination Calculator: counts orderings and selections when every outcome is equally likely.
- Chi Square Calculator: tests whether the gap between a table and independence is more than chance.
- OpenStax Introductory Statistics 2e, section 3.2: definitions and worked examples of independent and mutually exclusive events.
