Conditional Probability Calculator
Conditional probability is the probability of one event once another event is known to have occurred, and it is computed as P(A|B) = P(A ∩ B) / P(B). The new information narrows the sample space: instead of every outcome, only the outcomes in which B occurred are counted. The probability of disease given a test result, the purchase rate among people who saw a campaign, and the chance that a unit from a particular production line is defective are all found this way.
This calculator accepts your values in two different forms: enter P(A), P(B), and P(A ∩ B) directly, or type the observed counts of a 2×2 contingency table. The output is not limited to P(A|B): it also reports the reverse conditional P(B|A), the union P(A ∪ B), the complement condition P(A|Bʹ), the lift, and — most importantly — an independence check that compares P(A ∩ B) with P(A)·P(B).
Conditional Probability Formulas
Conditional probability: P(A|B) = P(A ∩ B) / P(B), P(B) > 0 Multiplication rule: P(A ∩ B) = P(A|B) · P(B) = P(B|A) · P(A) Independence: P(A ∩ B) = P(A) · P(B) ⇔ P(A|B) = P(A) Union: P(A ∪ B) = P(A) + P(B) − P(A ∩ B) Complement condition: P(A|Bʹ) = [P(A) − P(A ∩ B)] / [1 − P(B)] From a contingency table: P(A|B) = n(A ∩ B) / n(B) Lift: L = P(A|B) / P(A) Bayes link: P(A|B) = P(B|A) · P(A) / P(B)
In a conditional probability the denominator is not the whole sample space but only the conditioning event. That is why P(A|B) and P(B|A) usually differ, and why swapping them produces the mistake known as the base rate fallacy.
How to Calculate
- Choose the input format: 'Probabilities' if you have proportions, 'Contingency table' if you have raw counts.
- Optionally name the events (for example 'Purchased' and 'Saw the campaign'); the results are labeled with those names.
- In probability mode, enter P(A), P(B), and the intersection P(A ∩ B) as values between 0 and 1; in contingency table mode, enter the observation count of each of the four cells.
- Compare the resulting P(A|B) with P(A): the gap shows how much the information about B is worth.
- Read the independence line; if P(A ∩ B) equals P(A)·P(B), the events are independent.
- Check the four disjoint regions and the marginal totals in the summary table to confirm that your inputs are consistent.
Worked Examples
Campaign and purchase (probability input)
40% of customers make a purchase, 25% see the campaign, and 15% do both. Among those who saw the campaign, the probability of purchase rises to 0.15 / 0.25 = 60%, while among those who did not it stays at 33.33%. Independence would predict P(A)·P(B) = 10%, but the actual intersection is 15%, so the events are positively dependent and the lift is 1.500.
P(Satın aldı | Kampanyayı gördü): 60.00% · P(Kampanyayı gördü | Satın aldı): 37.50% · P(Satın aldı | not Kampanyayı gördü): 33.33%
Conditional probability from a contingency table
In a table of 300 people, 45 of the 75 who report a cough smoke: P(A|B) = 45/75 = 60%. Of the 100 smokers, 45 report the complaint, so P(B|A) = 45%. Because the overall smoking rate is 33.33%, the jump to 60% among those with the complaint shows that the two events are dependent; the lift is 1.800.
P(Sigara içiyor | Öksürük şikâyeti): 60.00% · P(Öksürük şikâyeti | Sigara içiyor): 45.00% · P(Sigara içiyor | not Öksürük şikâyeti): 24.44%
Two independent events
With P(A) = 0.5 and P(B) = 0.2, the intersection is exactly 0.5 × 0.2 = 0.1. Then P(A|B) = 0.1 / 0.2 = 50%, which is identical to P(A): knowing B changes nothing, so the events are independent. The lift is 1.000 and the union probability is 60%.
P(A | B): 50.00% · P(B | A): 20.00% · P(A | not B): 50.00%