“Given that” changes everything in probability. The chance of rain is one number; the chance of rain given those clouds is another — and the second is almost always the one a decision needs. This conditional probability calculator computes P(A|B) two ways: from the joint and marginal probabilities directly, or from raw counts in a two-way table, showing the restricted sample space that makes the formula obvious rather than memorised.
The Formula, and Why It Is a Fraction
P(A|B) = P(A and B) ÷ P(B). The logic is a shrinking universe: once B is given, every outcome without B is discarded, and within the surviving world the probability of A is the share of that world where A also holds. The default numbers make it concrete — if P(A and B) = 0.12 and P(B) = 0.30, then P(A|B) = 0.12 ÷ 0.30 = 0.40. Counts teach the same lesson without decimals: if 40 of 100 surveyed people bought the extended warranty (B) and 20 of those also bought the case (A), the count mode gives 20 ÷ 40 = 0.50 — among warranty buyers, half took the case.
Independence: When the Given Changes Nothing
If P(A|B) = P(A), learning B taught you nothing about A, and the events are independent — equivalently, P(A and B) = P(A) × P(B). The calculator is a working independence test: compute the conditional and compare it with A’s overall probability. Coin flips are independent (a head does not lean on the next flip); cards drawn without replacement are not (the first draw edits the deck); weather days are somewhere honestly in between. Most real-world probability errors are independence assumptions made on autopilot — the formula’s job is to force the question.
The Direction Trap: P(A|B) Is Not P(B|A)
The most consequential confusion in applied probability. A test that catches 99 percent of the ill (P(positive | ill) = 0.99) does not make a positive result 99 percent likely to mean illness — P(ill | positive) also depends on how common the illness is, which is Bayes’ theorem’s whole sermon and the reason screening low-prevalence populations produces mostly false positives. This calculator computes whichever direction you feed it, but it cannot know which you meant: before calculating, say the sentence aloud — “given what?” — and put that event in the denominator. Prosecutors, journalists and doctors have all famously swapped the two; the formula is trivial, the discipline is everything.
The Multiplication Rule, Running Backwards
Rearranged, the definition becomes the multiplication rule: P(A and B) = P(A|B) × P(B) — the engine of tree diagrams and sequential probability. The probability of drawing two aces without replacement is P(second ace | first ace) × P(first ace) = (3/51) × (4/52) ≈ 0.0045. Chain it for longer sequences and you have the probability of any fully specified path through a process — the object that reliability engineering, genetics and card counters all, in their dialects, compute.
Conditioning in Everyday Decisions
Conversion rates are conditional probabilities (purchases given a visit). Sports commentary runs on them too, usually badly: a team’s win percentage “when leading at half-time” is a conditional probability, and its small print is survivorship — the games where they led were disproportionately games against weaker opponents, so the condition smuggles in the cause. Weather, medicine, marketing and sport all teach the same lesson from different sides: the moment a statistic says “when” or “given” or “among,” you are reading a conditional probability, and the comparison you owe it is against the same event’s unconditioned rate. Churn models ask for P(leave | usage pattern). Medicine’s sensitivity is P(positive | disease) and its predictive value is the reversed conditional the patient actually wants. Weather apps that say “70 percent chance of rain given the morning’s pattern” are conditioning on data you cannot see. Once the concept clicks, the world starts presenting its statistics pre-conditioned — and the unconditioned headline number (“1 in 1,000 people…”) starts looking like what it is: an average over worlds, most of which are not yours.
Common Mistakes
Swapping the condition (computing P(B|A) when the question asked the reverse). Conditioning on an event of probability zero, where the ratio is undefined. Assuming independence to use P(A) × P(B) for the joint, then “discovering” a conditional that the assumption built in. And feeding the calculator a joint probability larger than the marginal — geometrically impossible, since the overlap is contained in B; the widget refuses it and says why.
Related Tools
The probability bench continues in the Statistics Calculators hub — the Rayleigh Distribution Calculator covers a continuous distribution, and the Effect Size Calculator quantifies group differences.
Frequently Asked Questions
How do you calculate conditional probability?
P(A|B) = P(A and B) ÷ P(B). With P(A and B) = 0.12 and P(B) = 0.30, the conditional probability is 0.40. From counts, divide the outcomes where both happen by the outcomes where B happens.
What does P(A|B) mean in words?
“The probability of A, given that B has occurred.” The vertical bar restricts attention to the outcomes where B holds, and asks how common A is inside that restricted world.
Is P(A|B) the same as P(B|A)?
Almost never. A medical test can have P(positive | ill) = 0.99 while P(ill | positive) is far lower when the illness is rare. Swapping them is the most common serious error in applied probability.
When are two events independent?
When conditioning changes nothing: P(A|B) = P(A), equivalently P(A and B) = P(A) × P(B). Coin flips are independent; cards drawn without replacement are not.
What is the multiplication rule?
The definition rearranged: P(A and B) = P(A|B) × P(B). It prices sequential events — for two aces drawn without replacement, (3/51) × (4/52) ≈ 0.0045.
Can you condition on an impossible event?
No — if P(B) = 0 the ratio is undefined. Conditioning means restricting to worlds where B happened; if there are none, the question has no sample space to live in.