Canadian flagMath101 · Independent Ontario learning libraryCreated and edited by Kamran
Probability and StatisticsUniversity3 min read

Bayes' Theorem

A precise treatment of Bayes' theorem, base rates, partitions, diagnostic tests, and interpretation.

Cheat sheet

Precise definition

For events $A,B$ with $P(B)>0$, Bayes' theorem is $P(A\mid B)=P(B\mid A)P(A)/P(B)$. If $A_1,\ldots,A_k$ partition the sample space, then $P(A_i\mid B)=P(B\mid A_i)P(A_i)/\sum_jP(B\mid A_j)P(A_j)$.

Notation and mathematical language

$P(A)$ is a prior probability, $P(B\mid A)$ a likelihood for event data, $P(A\mid B)$ a posterior, and $P(B)$ the evidence or normalizing probability. In diagnostic testing, sensitivity is $P(+\mid D)$ and specificity is $P(-\mid D^c)$; neither is the positive predictive value $P(D\mid+)$.

Conceptual picture

Bayes reverses a conditional probability by reweighting prior possibilities according to how compatible each is with the evidence. A probability tree or frequency table makes the denominator visible and prevents ignoring the many false positives possible when a condition is rare.

Conditions and key results

Events in the denominator must cover all mutually exclusive routes to $B$. Priors and likelihoods must refer to the relevant population and testing process. Conditional probabilities cannot be reversed, and dependence among repeated evidence must be modelled rather than multiplying likelihoods automatically.

A reliable strategy

  1. Name the target event and evidence; write the requested conditional in the correct direction.
  2. List a complete partition and attach priors and conditional evidence probabilities.
  3. Compute joint branch probabilities, sum all evidence branches for the denominator, and divide the target branch.
  4. Interpret the posterior for the stated population and examine sensitivity to base-rate or model assumptions.

Fully worked example

Interpretation and application

Bayesian updating supports diagnosis, quality control, classification, and scientific inference. The posterior is conditional on the prior, likelihood model, data quality, and population; it is not an assumption-free statement of certainty or causal proof.

Common mistakes

Verification and reasonableness

  • Recompute with a natural-frequency table such as 10,000 cases.
  • Check posterior lies between 0 and 1 and evidence probabilities sum correctly.
  • Vary the prior to see whether the conclusion is base-rate sensitive.

Practice

  1. If $P(A)=0.2$, $P(B\mid A)=0.5$, and $P(B)=0.25$, find $P(A\mid B)$.
  2. What is the false-positive rate if specificity is 0.97?
  3. Is sensitivity the chance of disease after a positive result?
Answers and brief solutions
  1. $0.4$.
  2. $0.03$.
  3. No; sensitivity is $P(+\mid D)$, while the latter is $P(D\mid+)$.

Further deduction

In odds form, posterior odds equal prior odds times a likelihood ratio. For a positive diagnostic result, $LR^+=\text{sensitivity}/(1-\text{specificity})$. In the example, $LR^+=0.90/0.05=18$: the test multiplies prior odds $0.01/0.99$ by 18, yielding posterior odds about 0.1818 and probability $0.1818/(1+0.1818)\approx0.1538$.

When evidence arrives sequentially, update the posterior from the first observation and use it as the next prior. Multiplying likelihoods is valid when observations are conditionally independent given each hypothesis. If tests share specimens, instruments, or symptoms, conditional dependence can make naive multiplication overstate evidence; model that dependence or perform sensitivity analysis.

Explore the idea

Probability sampler

Change one quantity at a time and connect what moves to Bayes' Theorem.

Works offline

highlighted: expected A ∩ B cases

What the model is showing Static Bayes example: P(A)=0.20, P(B|A)=0.80, and P(B|not A)=0.10 give P(A|B)=2/3. The base rate remains part of the denominator.
Check your understanding

Try it yourself

Hints are part of learning. Open one whenever it makes the next step feel possible.

1 practice question
Question 1Apply Bayes' theorem · Standard

If $P(A)=0.3$, $P(B|A)=0.4$, and $P(B)=0.2$, what is $P(A|B)$?

End of lesson

Nice work making it this far.

Understanding grows through return visits. Save this lesson, try the practice, or continue when you are ready.

Lesson complete

That one is yours now.

Bayes' Theorem is saved to My Learning. Take the win—you earned it.

1Your Math101 collectionlesson completed
Search 464 published lessons, 123 answer guides, courses, and learning tools.
Your experience

Settings

Ontario math tutoringWork with KamranBook ↗