Bayes' Theorem Calculator
Update an event probability after observing evidence, using two conditional likelihoods.
How the result changes
Only prior probability of a changes; all other inputs stay at your current values. The line illustrates the formula across the shown range. This is not a forecast of real-world outcomes.
About this calculation
Bayes' Theorem Calculator: Update an event probability after observing evidence, using two conditional likelihoods. Enter prior probability of a, probability of b given a, probability of b given not a; the reported quantities are posterior probability of a given b, probability of evidence b. The equations and examples below show how those inputs lead to the result and where the model's assumptions matter.
Formula
P(A|B) = P(B|A) P(A) / [P(B|A)P(A)+P(B|not A)(1-P(A))]
Worked example
With Prior probability of A: 0.1, Probability of B given A: 0.8, Probability of B given not A: 0.2, posterior probability of a given b is 0.307692.
Method and inputs
Bayes’ theorem begins with a prior chance of A. Multiply it by the chance of evidence B when A is true. Divide by the total chance of B, computed from both the A and not-A branches, to obtain the posterior chance.
Worked example
With prior 0.1, P(B given A) = 0.8 and P(B given not A) = 0.2, evidence B occurs with probability 0.08 + 0.18 = 0.26. The posterior P(A given B) is 0.08/0.26, about 0.3077.
In the example, evidence B is four times as likely under A as under not-A, yet posterior probability is only about 30.77 percent because A began at ten percent. This demonstrates how a rare prior can outweigh a seemingly strong positive signal.
How to read the result
The posterior can be much lower than the likelihood of evidence under A because B may also occur without A. The second output reveals the denominator and helps inspect the update rather than hiding it.
The denominator is built from two coherent branches. If prior is zero, all evidence comes from the not-A branch and posterior stays zero; if prior is one, posterior stays one. These boundary checks depend on the entered likelihoods referring to the same evidence definition.
Assumptions and checks
A and not A must form an exhaustive split, and both likelihoods must refer to the same evidence B and population. At least one evidence likelihood is required; the form uses positive bounds so its denominator is never zero.
Do not substitute P(A given B) for P(B given A); those conditional probabilities answer different questions. A prior from a different population can badly distort the posterior even if both likelihoods are measured accurately.
Common questions
What does the bayes' theorem calculator calculate?
It calculates an updated probability for A after B and the overall probability of observing B. All values are proportions between zero and one.
When should I recalculate or check another method?
Recalculate when base rates or evidence accuracy change. For clinical, legal or financial applications, verify how the prior and likelihoods were estimated and whether they apply to the actual population.
Sources and references
Inputs
- Prior probability of A
- Probability of B given A
- Probability of B given not A