Conditional Probability — P(A|B) = P(A∩B)/P(B)
Probability of A given B occurred. Restricts sample space to B. Three modes: direct, contingency table, from probabilities.
Why This Statistical Analysis Matters
Why: Conditional probability underpins medical diagnosis, spam filters, machine learning, and Bayesian inference. Never confuse P(A|B) with P(B|A).
How: Direct: enter P(A∩B) and P(B). Contingency: enter 2×2 counts. From probabilities: enter P(A), P(B), P(A∩B).
- ●P(A|B) ≠ P(B|A)
- ●Confusion of the inverse
- ●Foundation of Bayes theorem
P(A|B) from Direct Input, Contingency Tables, or Probability Values
From contingency tables to tree diagrams. Never confuse P(A|B) with P(B|A).
Input Mode
Real-World Scenarios — Click to Load
Inputs
🌳 Probability Tree
P(A|B) vs P(not A|B)
For educational and informational purposes only. Verify with a qualified professional.
📈 Statistical Insights
P(A|B) = P(A∩B)/P(B)
— Definition
P(A|B) and P(B|A) differ
— Confusion of inverse
P(A|B) = P(B|A)P(A)/P(B)
— Bayes theorem
📋 Key Takeaways
- • P(A|B) reads "probability of A GIVEN B has occurred" — it restricts the sample space to only events where B is true
- • P(A|B) ≠ P(B|A) — confusing these is the "confusion of the inverse" and has real-world consequences
- • Independence means P(A|B) = P(A) — knowing B gives no information about A
- • A contingency table is the most practical way to compute conditional probabilities from data
- • Conditional probability is the foundation of Bayes' theorem, decision trees, and Markov chains
💡 Did You Know
📖 How It Works
1. Restricting the Sample Space
P(A|B) = P(A∩B)/P(B) — we only consider outcomes where B occurred, then ask what fraction of those also have A.
2. Contingency Tables
A 2×2 table of counts (A∩B, A∩not B, not A∩B, not A∩not B) lets you compute all conditional probabilities from raw data.
3. Independence Check
If P(A∩B) = P(A)×P(B), then A and B are independent — P(A|B) = P(A) and P(B|A) = P(B).
4. Confusion of the Inverse
P(A|B) and P(B|A) are different. A positive medical test P(+|disease) vs P(disease|+) — the latter is what patients care about.
5. Bayes' Theorem
P(A|B) = P(B|A)P(A)/P(B) — conditional probability is the foundation for updating beliefs with evidence.
🎯 Expert Tips
Use contingency tables for data
When you have counts, build a 2×2 table — it's the most practical approach.
Never confuse P(A|B) and P(B|A)
The prosecutor's fallacy has led to wrongful convictions.
Test independence first
If P(A∩B) = P(A)×P(B), conditional probabilities simplify.
Draw tree diagrams
Visualizing P(B) → P(A|B) branches makes the math intuitive.
⚖️ This Calculator vs. Other Tools
| Feature | This Calculator | Bayes Theorem | Probability Calc | Wolfram |
|---|---|---|---|---|
| P(A|B) from P(A∩B)/P(B) | ✅ | ⚠️ | ⚠️ | ✅ |
| Contingency table mode | ✅ | ❌ | ❌ | ⚠️ |
| Tree & Venn visuals | ✅ | ⚠️ | ❌ | ❌ |
| All conditional variants | ✅ | ⚠️ | ⚠️ | ✅ |
| Independence test | ✅ | ❌ | ✅ | ⚠️ |
| Educational content | ✅ | ✅ | ✅ | ❌ |
❓ Frequently Asked Questions
What is conditional probability?
P(A|B) = P(A∩B)/P(B) — the probability of A given that B has occurred. It restricts the sample space to only outcomes where B is true.
Why is P(A|B) ≠ P(B|A)?
They measure different things. P(A|B) asks: of all B outcomes, what fraction have A? P(B|A) asks: of all A outcomes, what fraction have B? Confusing them is the 'confusion of the inverse.'
When are events independent?
When P(A∩B) = P(A)×P(B). Then P(A|B) = P(A) — knowing B gives no information about A.
How do I use a contingency table?
Enter counts for A∩B, A∩not B, not A∩B, not A∩not B. The calculator derives all probabilities and conditionals from the table.
What is the relationship to Bayes' theorem?
Bayes' theorem is P(A|B) = P(B|A)P(A)/P(B). Conditional probability P(A|B)=P(A∩B)/P(B) is the definition; Bayes shows how to compute it from the reverse conditional.
How is this used in machine learning?
Every classifier outputs P(class|features). Naive Bayes, logistic regression, and neural networks all use conditional probability.
What is the Sally Clark case?
A UK mother wrongly convicted of murdering her infants. The prosecution confused P(two cot deaths|innocent) with P(innocent|two cot deaths), vastly overstating the probability of guilt.
When should I use each input mode?
Direct: when you have P(A∩B) and P(B). Contingency: when you have raw count data. Probabilities: when you have P(A), P(B), and their relationship.
📊 Conditional Probability by the Numbers
📚 Official Sources
⚠️ Disclaimer: This calculator provides accurate conditional probability computations for educational and professional reference. For medical diagnosis, legal proceedings, or critical decision-making, consult qualified experts.
Related Calculators
Bertrand's Box Paradox
Interactive Bertrand's Box Paradox simulator. Explore why the probability of the other coin being gold is 2/3, not 1/2, with Monte Carlo simulation and Bayesian proof.
StatisticsBayes' Theorem Calculator
Calculate posterior probabilities using Bayes' theorem. Input prior, likelihood, and evidence to update beliefs with step-by-step Bayesian reasoning.
StatisticsProbability Calculator
Calculate single event, multiple event, conditional, and complementary probabilities. Supports union, intersection, and Bayes' theorem calculations with visual probability diagrams.
StatisticsBoy or Girl Paradox
Interactive Boy or Girl Paradox (Two-Child Problem). Explore why 'the older child is a boy' gives P=1/2 while 'at least one is a boy' gives P=1/3. With Monte Carlo simulation.
StatisticsJoint Probability Calculator
Compute P(A∩B) for independent and dependent events. Two modes: from probabilities or joint probability table. Marginal probabilities, independence test...
StatisticsMonty Hall Problem Calculator
Interactive Monty Hall Problem simulator. Choose a door, host reveals a goat, switch or stay. Run Monte Carlo simulation to prove switching wins 2/3.
Statistics