User Rating 0.0
Total Usage 0 times
Value between 0 and 1
Value between 0 and 1, must be > 0
Must be ≤ min(P(A), P(B))
Is this tool helpful?

Your feedback helps us improve.

About

Conditional probability quantifies the likelihood of event A occurring given that event B has already occurred. The fundamental definition is P(A|B) = P(A B) ÷ P(B), valid only when P(B) > 0. Misapplying this formula leads to the base rate fallacy, a documented cause of diagnostic errors in medicine and false-positive inflation in screening tests. This calculator implements the general definition, Bayes' theorem for inverse conditioning, and the law of total probability for partitioned sample spaces.

The tool assumes events are defined on a standard probability space where all inputs fall within [0, 1]. It does not handle fuzzy logic or subjective priors beyond numeric specification. Pro tip: when working with medical diagnostics, always verify that P(B) accounts for both true positives and false positives across the entire population, not just the symptomatic subgroup.

conditional probability bayes theorem probability calculator P(A|B) statistics law of total probability joint probability

Formulas

The primary computation uses the definition of conditional probability and its Bayesian inverse.

P(A|B) = P(A B)P(B)

When the joint probability P(A B) is not directly known but the reverse conditional P(B|A) is available, Bayes' theorem applies:

P(A|B) = P(B|A) P(A)P(B)

For the Law of Total Probability, when the sample space is partitioned into n mutually exclusive events {A1, A2, …, An}:

P(B) = ni=1 P(B|Ai) P(Ai)

Derived quantities computed by the tool include:

P(A B) = P(A) + P(B) P(A B)

Where P(A) = probability of event A, P(B) = probability of event B, P(A B) = joint probability of both events occurring, P(A|B) = probability of A given B has occurred, and P(B|A) = probability of B given A has occurred.

Reference Data

ConceptFormulaConditionCommon Application
Conditional ProbabilityP(A|B) = P(A B) ÷ P(B)P(B) > 0General event dependence
Bayes' TheoremP(A|B) = P(B|A) P(A) ÷ P(B)P(B) > 0Medical diagnostics, spam filters
Law of Total ProbabilityP(B) = ni=1 P(B|Ai) P(Ai){Ai} is a partitionRisk assessment, decision trees
Multiplication RuleP(A B) = P(A|B) P(B)Always validSequential event chains
Independence TestP(A B) = P(A) P(B)If true, events are independentQuality control, A/B testing
Complement RuleP(Ac) = 1 P(A)Always validSurvival analysis
Union (Inclusion-Exclusion)P(A B) = P(A) + P(B) P(A B)Always validInsurance, compound events
Mutual ExclusivityP(A B) = 0Events cannot co-occurDice outcomes, card suits
Odds Form (Bayes)P(A|B)P(Ac|B) = P(B|A)P(B|Ac) P(A)P(Ac)P(B) > 0Bayesian updating, forensics
Conditional IndependenceP(A B|C) = P(A|C) P(B|C)Given CNaive Bayes classifiers
Chain RuleP(A1 An) = nk=1 P(Ak|A1 Ak1)All conditional probs definedMarkov chains, NLP
Posterior PredictiveP(x|data) = P(x|θ) P(θ|data) dθContinuous parameter spaceBayesian prediction
Sensitivity (True Positive Rate)P(T+|D+)Disease presentMedical screening
Specificity (True Negative Rate)P(T|D)Disease absentMedical screening
Positive Predictive ValueP(D+|T+)Test positiveClinical decision-making
Negative Predictive ValueP(D|T)Test negativeClinical decision-making

Frequently Asked Questions

The conditional probability P(A|B) = P(A∩B) / P(B) is undefined when P(B) = 0 because division by zero has no meaning in standard probability theory. This calculator validates that P(B) > 0 before computation. If your marginal probability is zero, the conditioning event is impossible and the question "given B occurred" is logically vacuous.
After computing P(A∩B), the tool compares it against P(A) · P(B). If the absolute difference |P(A∩B) − P(A)·P(B)| < 0.0001 (epsilon tolerance for floating-point arithmetic), the events are flagged as statistically independent. Independence means conditioning on B does not change the probability of A: P(A|B) = P(A).
This is the base rate fallacy. Even with a test sensitivity of 0.99, if the disease prevalence P(D) = 0.001, the positive predictive value P(D|T⁺) is approximately 0.09 - meaning over 90% of positive results are false positives. The calculator exposes this by showing all intermediate values. Always supply the true population prevalence as P(A), not the in-clinic rate.
No. By the axioms of probability, P(A∩B) ≤ min(P(A), P(B)). The calculator enforces this constraint and displays a validation error if you enter a joint probability larger than either marginal probability. Violating this constraint means the input values are inconsistent and do not describe a valid probability space.
A valid partition requires that the prior probabilities P(A₁) + P(A₂) + … + P(Aₙ) = 1 exactly. The calculator checks this sum and displays a warning if it deviates from 1 by more than 0.0001. Partitions that fail this check represent an incomplete or overcounted sample space, and any derived P(B) would be incorrect.
These are generally not equal - confusing them is called the prosecutor's fallacy. P(A|B) is the probability of A given B occurred. P(B|A) is the reverse. Bayes' theorem connects them: P(A|B) = P(B|A) · P(A) / P(B). The calculator computes both directions so you can see the asymmetry directly.
No. This calculator operates on discrete event probabilities expressed as scalar values in [0, 1]. For continuous distributions, conditional probability involves density functions and integration: f(x|y) = f(x,y) / f(y). That requires specifying a distribution family (Normal, Exponential, etc.), which is outside the scope of this tool.