PROBABILITYProbability TheoryStatistics Calculator
📊

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.

Concept Fundamentals
P(A|B)=P(A∩B)/P(B)
Bayes' Formula
Conditional probability
Dependent events
Relationship
Joint vs marginal
Prior × Likelihood
Key Concept
Bayesian reasoning
Bayesian inference
Application
Medical tests, spam filters
Compute P(A|B)Direct, contingency, or 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
📊
CONDITIONAL PROBABILITYDirect, Contingency Table, From Probabilities

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

Joint probability
Probability of B
conditional_prob.sh
CALCULATED
P(A|B)
40.00%
P(A|B)
40.00%
P(not A|B)
60.00%
P(A∩B)
12.00%

🌳 Probability Tree

B: 30.0%
→ A|B: 40.00%
→ not A|B: 60.00%
not B: 70.0%
→ A|not B: —
→ not A|not B: —
P(A|B) = P(A∩B)/P(B) = 12.00% / 30.00% = 40.00%
Share:
Conditional Probability
P(A|B) = P(A∩B)/P(B)
40.00%
numbervibe.com/calculators/statistics/conditional-probability-calculator

P(A|B) vs P(not A|B)

1. Core Formula
P(AB)=P(AB)P(B)P(A|B) = \frac{P(A \cap B)}{P(B)}
2. Substitute
P(AB)=0.12000.3000P(A|B) = \frac{0.1200}{0.3000}
3. Result
P(AB)=0.4000(40.00P(A|B) = 0.4000 (40.00%)

For educational and informational purposes only. Verify with a qualified professional.

📈 Statistical Insights

P(A|B)

P(A|B) = P(A∩B)/P(B)

— Definition

P(A|B) and P(B|A) differ

— Confusion of inverse

Bayes

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

⚖️Sally Clark was wrongfully convicted of murder partly because the prosecution confused P(evidence|innocent) with P(innocent|evidence)
📊The entire field of machine learning is built on conditional probabilities — every prediction is P(class|features)
🎲Conditional probability was formalized by Thomas Bayes in 1763 and refined by Pierre-Simon Laplace
🏥Medical decision-making relies entirely on conditional probability: P(disease|symptom)
💻Spam filters compute P(spam|words in email) using conditional probability chains
🔐In cybersecurity, intrusion detection uses P(attack|network behavior)
🧬Genetic counseling uses conditional probability to calculate inheritance risks

📖 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

FeatureThis CalculatorBayes TheoremProbability CalcWolfram
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

P(A|B)
Core Formula
P(A|B) ≠ P(B|A)
1763
Bayes' Paper
2×2
Contingency Table

⚠️ 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.

👈 START HERE
⬅️Jump in and explore the concept!
AI

Related Calculators