Conditional probability answers the question: "Given that B has happened, what's the probability that A also happens?" It updates our knowledge based on new information. This is the mathematical foundation of learning from experience — every time you update a belief after receiving new evidence, you are performing conditional probability. Our conditional probability calculator computes P(A|B) directly, and our Bayes theorem calculator reverses the condition.
The Formula
Read as "Probability of A given B." We restrict our attention to only the outcomes where B occurs, and ask what fraction of those also include A. For example, in a deck of cards, the probability of drawing a king given that you've drawn a face card is P(king | face card) = (4/52) / (12/52) = 4/12 = 1/3 ≈ 33.3%.
Bayes Theorem
Where P(B) = P(B|A)×P(A) + P(B|¬A)×P(¬A). Bayes theorem tells us how to reverse conditional probability — from P(B|A) to P(A|B). This is the foundation of Bayesian statistics and diagnostic testing.
Sensitivity Analysis
The sensitivity analysis tab lets you explore how the posterior probability P(A|B) changes as the likelihood P(B|A) varies from 0 to 1. The interactive slider updates the line chart in real time, showing the functional relationship. This is particularly useful for understanding how test accuracy affects diagnostic confidence.
Likelihood Ratios
The positive likelihood ratio LR+ = P(B|A) / P(B|¬A) measures how much the odds of the hypothesis increase when the evidence is observed. The negative likelihood ratio LR− = (1−P(B|A)) / (1−P(B|¬A)) measures the decrease in odds when the evidence is absent. Post-test odds = prior odds × LR. A LR+ greater than 10 provides strong evidence for the hypothesis.
Worked Example (Medical Test)
A disease affects 1% of people (P(A)=0.01). The test is 90% accurate for those with the disease (P(B|A)=0.9) and has a 5% false positive rate (P(B|¬A)=0.05). If you test positive, P(A|B) = 0.9 × 0.01 / (0.9×0.01 + 0.05×0.99) = 0.009 / 0.0585 ≈ 0.154 = 15.4%. Even with a positive test, there's only a 15.4% chance you have the disease — because the disease is rare and false positives outnumber true positives. This is the base rate fallacy in action.