P(A\mid B)=\frac{P(B\mid A)P(A)}{P(B)}Variables
- P(A|B): posterior probability
- P(B|A): likelihood
- P(A): prior probability
- P(B): evidence probability
How to use this formula
Updates the probability of an event after observing evidence.
Important notes
- P(B) must be greater than zero.
- The denominator can be expanded with the law of total probability when needed.
Quick example
Bayes’ theorem is commonly used to interpret medical test results.
Applicability, worked calculation, and verification
Domain and applicability
Requires defined prior and conditional probabilities with a nonzero probability for the observed evidence in the denominator.
Units
- all probabilities are dimensionless values from 0 to 1 or equivalent percentages
Assumptions and domain checks
- P(B) must be greater than zero.
- For the Bayes’ Theorem, every denominator must be nonzero, and the numerator and denominator must remain correctly grouped.
- The event model, conditioning information, independence assumptions, and probability range must match the problem.
Do not use this formula when
- Do not use Bayes’ Theorem until the sample, event, distribution, independence assumptions, and parameter convention match the problem.
Boundary and special cases
- For Bayes’ Theorem, check zero, negative, and extreme input values before relying on the result.
- When using Bayes’ Theorem, confirm that denominators, radicals, logarithms, and domain restrictions remain valid for the chosen values.
Equivalent and alternative forms
- Keep the canonical LaTeX form P(A\mid B)=\frac{P(B\mid A)P(A)}{P(B)} for copying; rearrange only after preserving equivalence and domain restrictions.
Worked example
With 1% prevalence, 90% sensitivity, and 5% false-positive rate, P(condition|positive) = 0.009/(0.009 + 0.0495) ≈ 0.1538, or 15.38%.
- Compute the true-positive joint probability: 0.01 × 0.90 = 0.009.
- Compute the false-positive joint probability: 0.99 × 0.05 = 0.0495.
- Add both paths to get P(positive) = 0.0585.
- Divide 0.009 by 0.0585 to obtain approximately 0.1538.
Independent verification
In a hypothetical 10,000-person group, about 90 true positives and 495 false positives produce 90/585 = 15.38%, matching the formula.
Common mistakes
- When copying Bayes’ Theorem, keep the complete numerator and denominator grouped; a missing brace or parenthesis changes the result.
- Do not assume events are independent or mutually exclusive unless the problem states or proves that condition.
Continue the workflow
Use Bayes’ Theorem in your own work
- Check the domainMatch the variables and assumptions to the problem before substituting values.
- Copy the exact notationPreserve grouping, signs, and exponents in
P(A\mid B)=\frac{P(B\mid A)P(A)}{P(B)}. - Edit or convertOpen the expression in the LaTeX editor, then export it for your document or web page.
Review and verification
Last reviewed: 2026-07-26
Review method: Reviewed the notation, variable definitions, applicability conditions, worked workflow, and verification method for Bayes’ Theorem.
Verified against: OpenStax Introductory Statistics
Automated quality check: Passed the core formula indexing gate.
Formula references
- Introductory Statistics 2eOpenStax, Rice University — Reviewed probability and statistics definitions, notation, and formulas.
Frequently asked questions
What is the Bayes’ Theorem used for?
Updates the probability of an event after observing evidence.
Can I copy this formula as LaTeX?
Yes. Copy P(A\mid B)=\frac{P(B\mid A)P(A)}{P(B)} or open it in the LaTeX editor.
What should I check before using it?
Confirm that each variable, unit, domain restriction, and assumption matches the problem.