Bayes' Theorem

Suppose a diagnostic test for a rare disease is 99% accurate. A patient tests positive. How worried should they be? Intuition trained on the accuracy figure alone screams "very worried." Yet the honest answer depends crucially on how rare the disease actually is. Getting from "accuracy of the test" to "chance you're actually sick" requires inverting a conditional probability. Bayes' theorem is the precise, provable rule for performing that inversion. The idea matters because most evidence in science, medicine, law, and everyday reasoning arrives in the wrong direction. We observe an effect and want to reason back to a cause. We know P(evidence∣hypothesis)P(\text{evidence} \mid \text{hypothesis}) — this is what a model or an experiment tells us directly. But we want P(hypothesis∣evidence)P(\text{hypothesis} \mid \text{evidence}) instead. Bayes' theorem is the bridge between these two. It is also the algebraic engine behind an entire philosophy of statistical inference (Bayesian statistics). In this philosophy, unknown parameters are treated as random quantities. They carry prior beliefs that get updated into posterior beliefs upon seeing data. The big picture is deceptively simple. The theorem is a one-line rearrangement of the definition of conditional probability. Its power comes from combining it with the Law of Total Probability to compute a normalizing constant. There is no new axiom here. It only demands the discipline of writing down every piece explicitly. This means the prior probability of each hypothesis, the likelihood of the observed evidence under each hypothesis, and the resulting posterior probability after the evidence is taken into account. This article states the precise definitions of prior, likelihood, and posterior. It proves the theorem rigorously from the axioms of probability. It works through two asymmetric numerical examples (a diagnostic test and an urn/factory problem). It shows exactly what breaks if the partition hypothesis is dropped. Finally, it surveys where the theorem is used today, from spam filters to forensic DNA evidence to the foundations of Independence of Events.

Key takeaways
  • Bayes' theorem inverts a conditional probability: it converts P(B∣A)P(B\mid A) into P(A∣B)P(A\mid B).
  • It requires a partition of hypotheses A1,…,AnA_1,\dots,A_n (mutually exclusive, exhaustive) with known priors P(Ai)P(A_i).
  • The likelihood P(B∣Ai)P(B\mid A_i) measures how probable the observed evidence BB is under each hypothesis.
  • The denominator is exactly the Law of Total Probability applied to BB; it normalizes the posterior to sum to 1.
  • Base rates dominate: rare hypotheses stay improbable even under fairly strong evidence — this is the resolution of the diagnostic-test paradox.
  • Bayes' theorem is a theorem, not an assumption — it follows purely from the definition of conditional probability.
  • Key idea: posterior probability is proportional to prior times likelihood, renormalized so all hypotheses' posteriors sum to one.

Where this lives today

Bayes' theorem is the computational core of Bayesian statistics, in which unknown parameters θ\theta are assigned a prior distribution π(θ)\pi(\theta), data xx are modeled via a likelihood f(x∣θ)f(x\mid\theta), and inference proceeds by computing the posterior π(θ∣x)∝f(x∣θ)π(θ)\pi(\theta\mid x) \propto f(x\mid\theta)\pi(\theta) — an infinite-partition version of the same identity proved above. In medical diagnostics and epidemiology, it is the standard tool for converting test sensitivity/specificity and disease prevalence into predictive values, exactly as in Example 1. In forensic science and law, likelihood ratios (the odds-form corollary) are used to weigh DNA or fingerprint evidence, with careful attention paid to avoiding the prosecutor's fallacy. In machine learning, naive Bayes classifiers apply the theorem (with a simplifying conditional-independence assumption, foreshadowing Independence of Events) to spam filtering, document classification, and sentiment analysis. In engineering, Bayesian filters — including the Kalman filter and particle filters — recursively apply the theorem to update state estimates from noisy sensor readings, underlying GPS navigation and robotics. In cryptography and information theory, Bayesian updating models an adversary's evolving beliefs about a secret key given observed ciphertext, informing security proofs. In cognitive science, "Bayesian brain" models propose that perception itself operates as approximate Bayesian inference, combining sensory likelihoods with learned priors.

Ask the tutor: How does Bayes' theorem generalize when the evidence arrives as a continuous stream of observations rather than a single event?

DefinitionPrior, Likelihood, Posterior, and Bayes' Rule

Let (Ω,F,P)(\Omega, \mathcal{F}, P) be a probability space. Let A1,A2,…,AnA_1, A_2, \dots, A_n (or countably many A1,A2,…A_1, A_2, \dots) be events forming a partition of Ω\Omega: they are pairwise disjoint,

Ai∩Aj=∅(i≠j),A_i \cap A_j = \varnothing \quad (i \neq j),

and exhaustive,

⋃iAi=Ω,\bigcup_i A_i = \Omega,

with P(Ai)>0P(A_i) > 0 for every ii. Let B∈FB \in \mathcal{F} be an event with P(B)>0P(B) > 0.

  • The numbers P(Ai)P(A_i) are called the prior probabilities of the hypotheses AiA_i — the probabilities assigned before observing BB.
  • The numbers P(B∣Ai)P(B \mid A_i) are called the likelihoods of the evidence BB under hypothesis AiA_i.
  • The numbers P(Ai∣B)P(A_i \mid B) are called the posterior probabilities — the updated probabilities of the hypotheses after observing BB.

Bayes' theorem states:

P(Ai∣B)=P(B∣Ai) P(Ai)∑jP(B∣Aj) P(Aj),i=1,2,…P(A_i \mid B) = \frac{P(B \mid A_i)\, P(A_i)}{\sum_{j} P(B \mid A_j)\, P(A_j)}, \qquad i = 1, 2, \dots

In the special two-hypothesis case A1=AA_1 = A, A2=AcA_2 = A^c, this reads

P(A∣B)=P(B∣A)P(A)P(B∣A)P(A)+P(B∣Ac)P(Ac).P(A \mid B) = \frac{P(B\mid A) P(A)}{P(B\mid A)P(A) + P(B \mid A^c) P(A^c)}.

Intuition

Think of the sample space Ω\Omega as sliced into disjoint wedges A1,…,AnA_1, \dots, A_n — the possible "causes" or "states of the world." The event BB — the observed "evidence" — is some region overlapping several wedges. Before you learn that BB happened, your belief about which wedge you're in is given by the prior areas P(Ai)P(A_i). Once you learn BB occurred, you know you are somewhere in the shaded region BB, and your belief about which wedge you're in should be re-proportioned according to how much of BB sits inside each wedge — that's exactly P(Ai∩B)=P(B∣Ai)P(Ai)P(A_i \cap B) = P(B\mid A_i) P(A_i). Dividing by the total area of BB renormalizes these into genuine probabilities. The key perceptual trap the diagnostic-test example exposes is confusing P(B∣A)P(B\mid A) with P(A∣B)P(A\mid B). A test can be highly reliable (P(positive∣sick)P(\text{positive}\mid\text{sick}) large) while P(sick∣positive)P(\text{sick}\mid\text{positive}) remains small, purely because sick people are rare — the wedge AA = "sick" is tiny compared to Ω\Omega, so even a fairly complete overlap of BB with AA is dwarfed by the small sliver of BB that leaks into the enormous wedge AcA^c = "healthy."

Figure
Partition of Ω\Omega into hypotheses A1,A2,A3A_1,A_2,A_3, with evidence event BB overlapping each
A₁ A₂ A₃ B P(A₁)=0.5 P(A₂)=0.3 P(A₃)=0.2 P(A₁∩B)=0.10, P(A₂∩B)=0.24, P(A₃∩B)=0.04 → P(A₂∣B) = 0.24/0.38 ≈ 0.632

Deriving the theorem

TheoremBayes' Theorem

Let (Ω,F,P)(\Omega,\mathcal F,P) be a probability space. Let A1,A2,…A_1,A_2,\dots be a finite or countable partition of Ω\Omega (pairwise disjoint, ⋃iAi=Ω\bigcup_i A_i=\Omega) with P(Ai)>0P(A_i)>0 for all ii. Let B∈FB\in\mathcal F with P(B)>0P(B)>0. Then for every index ii,

P(Ai∣B)  =  P(B∣Ai) P(Ai)∑jP(B∣Aj) P(Aj).P(A_i\mid B) \;=\; \frac{P(B\mid A_i)\,P(A_i)}{\displaystyle\sum_{j} P(B\mid A_j)\,P(A_j)}.
Proof

We use two facts already established: the definition of conditional probability, and the Law of Total Probability.

Step 1 (definition of conditional probability, applied twice). For any two events E,FE, F with P(F)>0P(F) > 0, conditional probability is defined as

P(E∣F)=P(E∩F)P(F).P(E \mid F) = \frac{P(E \cap F)}{P(F)}.

Since P(B)>0P(B) > 0 by hypothesis, apply this with E=AiE = A_i, F=BF = B:

P(Ai∣B)=P(Ai∩B)P(B).(1)P(A_i \mid B) = \frac{P(A_i \cap B)}{P(B)}. \tag{1}

Since P(Ai)>0P(A_i) > 0 by hypothesis, apply the same definition with E=BE = B, F=AiF = A_i:

P(B∣Ai)=P(B∩Ai)P(Ai)⟹P(Ai∩B)=P(B∣Ai) P(Ai),(2)P(B \mid A_i) = \frac{P(B \cap A_i)}{P(A_i)} \quad \Longrightarrow \quad P(A_i \cap B) = P(B \mid A_i)\, P(A_i), \tag{2}

using Ai∩B=B∩AiA_i \cap B = B \cap A_i (intersection is commutative as a set operation).

Step 2 (substitute). Combining (1) and (2):

P(Ai∣B)=P(B∣Ai) P(Ai)P(B).(3)P(A_i \mid B) = \frac{P(B \mid A_i)\, P(A_i)}{P(B)}. \tag{3}

This is already a valid inversion formula, but P(B)P(B) on the right is not yet expressed in terms of the given priors and likelihoods; Step 3 removes this by expanding P(B)P(B).

Step 3 (expand the denominator via the Law of Total Probability). Because {Aj}\{A_j\} is a partition of Ω\Omega with P(Aj)>0P(A_j) > 0 for every jj, the Law of Total Probability gives

P(B)=∑jP(B∩Aj)=∑jP(B∣Aj) P(Aj),(4)P(B) = \sum_j P(B \cap A_j) = \sum_j P(B \mid A_j)\, P(A_j), \tag{4}

where the second equality again uses the definition of conditional probability (as in (2), applied to each AjA_j in place of AiA_i). This step is legitimate precisely because the AjA_j are pairwise disjoint (so the events B∩AjB \cap A_j are pairwise disjoint, allowing countable additivity of PP to be applied to B=⋃j(B∩Aj)B = \bigcup_j (B \cap A_j)) and exhaustive (so no part of BB is missed).

Step 4 (conclude). Substituting (4) into (3):

P(Ai∣B)=P(B∣Ai) P(Ai)∑jP(B∣Aj) P(Aj).P(A_i \mid B) = \frac{P(B \mid A_i)\, P(A_i)}{\sum_j P(B \mid A_j)\, P(A_j)}.

This holds for every index ii, which is exactly the claimed identity. ■\blacksquare

∎

Note the proof technique: direct algebraic derivation from the definitions, using the Law of Total Probability only as a lemma to rewrite the denominator — no circularity, since the Law of Total Probability does not itself depend on Bayes' theorem.

CorollaryOdds form of Bayes' theorem

For two complementary hypotheses AA, AcA^c with 0<P(A)<10 < P(A) < 1 and P(B)>0P(B) > 0,

P(A∣B)P(Ac∣B)=P(B∣A)P(B∣Ac)⋅P(A)P(Ac).\frac{P(A \mid B)}{P(A^c \mid B)} = \frac{P(B \mid A)}{P(B \mid A^c)} \cdot \frac{P(A)}{P(A^c)}.
Proof

Apply the theorem's Step 1–2 identity (3) to both AA and AcA^c:

P(A∣B)=P(B∣A)P(A)P(B),P(Ac∣B)=P(B∣Ac)P(Ac)P(B).P(A\mid B) = \frac{P(B\mid A) P(A)}{P(B)}, \qquad P(A^c \mid B) = \frac{P(B\mid A^c) P(A^c)}{P(B)}.

The common factor P(B)P(B) (which is positive and identical in both) cancels upon taking the ratio, giving the stated identity. ■\blacksquare

∎

This corollary says: posterior odds = likelihood ratio × prior odds. It is the form most used in sequential updating, since each new piece of evidence simply multiplies the running odds by a new likelihood ratio.

Worked examples

Example 1 — the diagnostic test (asymmetric numbers, two hypotheses). A disease is present in 0.4%0.4\% of a population: P(D)=0.004P(D) = 0.004, so P(Dc)=0.996P(D^c) = 0.996. A test has sensitivity P(+∣D)=0.97P(+\mid D) = 0.97 (true positive rate) and false-positive rate P(+∣Dc)=0.05P(+\mid D^c) = 0.05. A random person tests positive. Find P(D∣+)P(D \mid +). By Bayes' theorem with partition {D,Dc}\{D, D^c\} and evidence B={+}B = \{+\}:

P(D∣+)=P(+∣D)P(D)P(+∣D)P(D)+P(+∣Dc)P(Dc).P(D \mid +) = \frac{P(+\mid D) P(D)}{P(+\mid D) P(D) + P(+\mid D^c) P(D^c)}.

Compute the numerator:

P(+∣D)P(D)=0.97×0.004=0.00388.P(+\mid D) P(D) = 0.97 \times 0.004 = 0.00388.

Compute the other joint term:

P(+∣Dc)P(Dc)=0.05×0.996=0.0498.P(+\mid D^c) P(D^c) = 0.05 \times 0.996 = 0.0498.

Sum (this is P(+)P(+) via the Law of Total Probability):

P(+)=0.00388+0.0498=0.05368.P(+) = 0.00388 + 0.0498 = 0.05368.

Therefore

P(D∣+)=0.003880.05368≈0.07227.P(D \mid +) = \frac{0.00388}{0.05368} \approx 0.07227.

So even with a 97%97\%-sensitive test and only a 5%5\% false-positive rate, a positive result implies only about a 7.2% chance of actually having the disease — because the disease is rare, the 5%5\% false-positive rate applied to the huge healthy population (0.04980.0498) swamps the true positives (0.003880.00388). This is the classic base-rate phenomenon, and it is not a paradox once the denominator is examined term by term. Checking via odds form: prior odds of disease are 0.004/0.996≈0.0040160.004/0.996 \approx 0.004016; likelihood ratio is 0.97/0.05=19.40.97/0.05 = 19.4; posterior odds ≈0.004016×19.4≈0.07791\approx 0.004016 \times 19.4 \approx 0.07791, giving P(D∣+)=0.07791/(1+0.07791)≈0.07227P(D\mid+) = 0.07791/(1+0.07791) \approx 0.07227 — matching, as it must, confirming internal consistency of the two forms.

Example 2 — three factories, asymmetric priors and likelihoods. A company buys light bulbs from three factories, A1,A2,A3A_1, A_2, A_3, supplying 50%50\%, 30%30\%, 20%20\% of stock respectively:

P(A1)=0.50,P(A2)=0.30,P(A3)=0.20.P(A_1) = 0.50, \quad P(A_2) = 0.30, \quad P(A_3) = 0.20.

Their defect rates are P(D∣A1)=0.02P(D\mid A_1) = 0.02, P(D∣A2)=0.05P(D\mid A_2) = 0.05, P(D∣A3)=0.08P(D\mid A_3) = 0.08. A bulb is drawn at random and found defective (DD). Find P(A3∣D)P(A_3 \mid D), the probability it came from the highest-defect-rate factory, and compare to its prior P(A3)=0.20P(A_3) = 0.20. Compute each joint probability P(D∩Aj)=P(D∣Aj)P(Aj)P(D \cap A_j) = P(D\mid A_j) P(A_j):

P(D∩A1)=0.02×0.50=0.010,P(D \cap A_1) = 0.02 \times 0.50 = 0.010,
P(D∩A2)=0.05×0.30=0.015,P(D \cap A_2) = 0.05 \times 0.30 = 0.015,
P(D∩A3)=0.08×0.20=0.016.P(D \cap A_3) = 0.08 \times 0.20 = 0.016.

By the Law of Total Probability,

P(D)=0.010+0.015+0.016=0.041.P(D) = 0.010 + 0.015 + 0.016 = 0.041.

By Bayes' theorem,

P(A3∣D)=0.0160.041=1641≈0.3902.P(A_3 \mid D) = \frac{0.016}{0.041} = \frac{16}{41} \approx 0.3902.

So observing a defect nearly doubles our belief that the bulb came from factory 3, moving it from a 20%20\% prior share to a ≈39.0%\approx 39.0\% posterior share — even though factory 3 supplies the fewest bulbs, its higher defect rate makes it disproportionately likely to be the source once a defect is observed. For completeness,

P(A1∣D)=0.0100.041=1041≈0.2439,P(A2∣D)=0.0150.041=1541≈0.3659,P(A_1 \mid D) = \frac{0.010}{0.041} = \frac{10}{41} \approx 0.2439, \qquad P(A_2 \mid D) = \frac{0.015}{0.041} = \frac{15}{41} \approx 0.3659,

and indeed 10/41+15/41+16/41=41/41=110/41 + 15/41 + 16/41 = 41/41 = 1, confirming the posteriors form a valid probability distribution over the partition, as guaranteed by the theorem's denominator being exactly P(D)P(D).

CounterexampleDropping the partition hypothesis breaks the formula

The theorem requires {Ai}\{A_i\} to be pairwise disjoint and exhaustive with P(Ai)>0P(A_i)>0. Suppose instead we only have two overlapping events AA and A′A' (not a partition of Ω\Omega, and not complementary), and we naively apply the "Bayes formula"

"P(A∣B)"P(B∣A)P(A)P(B∣A)P(A)+P(B∣A′)P(A′)\text{"}P(A\mid B)\text{"} \overset{?}{=} \frac{P(B\mid A) P(A)}{P(B\mid A)P(A) + P(B\mid A')P(A')}

treating {A,A′}\{A, A'\} as if they partitioned Ω\Omega. This can produce a nonsensical answer.

Concrete construction. Let Ω={1,2,3,4}\Omega = \{1,2,3,4\} with each outcome equally likely, P({k})=1/4P(\{k\}) = 1/4. Let

A={1,2},A′={2,3},B={1,2,3}.A = \{1,2\}, \qquad A' = \{2,3\}, \qquad B = \{1,2,3\}.

Note A∩A′={2}≠∅A \cap A' = \{2\} \neq \varnothing (not disjoint) and A∪A′={1,2,3}≠ΩA \cup A' = \{1,2,3\} \neq \Omega (not exhaustive) — {A,A′}\{A, A'\} is not a partition. Compute directly using the true definition of conditional probability:

P(A∣B)=P(A∩B)P(B)=P({1,2})P({1,2,3})=2/43/4=23.P(A \mid B) = \frac{P(A \cap B)}{P(B)} = \frac{P(\{1,2\})}{P(\{1,2,3\})} = \frac{2/4}{3/4} = \frac{2}{3}.

Now compute what the (misapplied) formula would give. We have P(A)=1/2P(A) = 1/2, P(A′)=1/2P(A') = 1/2,

P(B∣A)=P(B∩A)P(A)=P({1,2})P({1,2})=1,P(B∣A′)=P(B∩A′)P(A′)=P({2,3})P({2,3})=1.P(B \mid A) = \frac{P(B \cap A)}{P(A)} = \frac{P(\{1,2\})}{P(\{1,2\})} = 1, \qquad P(B \mid A') = \frac{P(B \cap A')}{P(A')} = \frac{P(\{2,3\})}{P(\{2,3\})} = 1.

Plugging into the "formula":

"P(A∣B)"=1×121×12+1×12=12.\text{"}P(A\mid B)\text{"} = \frac{1 \times \tfrac12}{1 \times \tfrac12 + 1 \times \tfrac12} = \frac{1}{2}.

This gives 1/21/2, not the correct value 2/32/3. The formula fails because the denominator P(B∣A)P(A)+P(B∣A′)P(A′)P(B\mid A)P(A) + P(B\mid A')P(A') double-counts the overlap A∩A′={2}A \cap A' = \{2\} and is not equal to P(B)P(B) at all: direct computation gives P(B)=3/4P(B) = 3/4, while the sum above equals 11. Since {A,A′}\{A,A'\} do not partition Ω\Omega, the Law of Total Probability step (Step 3 of the proof) is invalid, and the entire derivation collapses. This shows the partition hypothesis is not a technicality — without it the "denominator" is simply the wrong number.

Scope, edge cases & common traps

SituationWhat happensCorrect handling
{Ai}\{A_i\} not a partitionDenominator ≠P(B)\ne P(B); formula invalid (see counterexample)Choose or verify a genuine partition before applying the theorem
Some P(Ai)=0P(A_i) = 0Conditioning P(Ai∣B)P(A_i \mid B) undefined for that hypothesis; term still contributes 0 to the sum if P(Ai)=0P(A_i)=0Drop hypotheses with zero prior, or restrict to positive-prior atoms
P(B)=0P(B) = 0P(Ai∣B)P(A_i \mid B) undefined (division by zero)Bayes' theorem does not apply to zero-probability evidence; needs limiting/density arguments (continuous case)
Continuous parameter θ\thetaSums become integrals: f(θ∣B)=f(B∣θ)π(θ)/∫f(B∣θ′)π(θ′) dθ′f(\theta\mid B) = f(B\mid\theta)\pi(\theta)/\int f(B\mid\theta')\pi(\theta')\,d\theta'Same theorem, densities replace probability masses
Confusing P(B∣A)P(B\mid A) with P(A∣B)P(A\mid B)The "prosecutor's fallacy" — treating likelihood as posteriorAlways renormalize by P(B)P(B), weighting by the prior

The mathematician behind it

Origins · 1 minThomas Bayes and how this was discovered
TB
Thomas Bayes
c. 1701–1761 · Presbyterian minister and mathematician, Tunbridge Wells, England

Thomas Bayes was an English Nonconformist minister with a serious sideline in mathematics, elected a Fellow of the Royal Society in 1742 largely on the strength of a defense of Newton's calculus against philosophical attacks. The result now bearing his name appeared only posthumously: his friend Richard Price found the manuscript among Bayes' papers after his death, edited it, and presented it to the Royal Society in 1763 as "An Essay towards solving a Problem in the Doctrine of Chances." Bayes' original essay addressed a specific inverse-probability problem — given the number of successes in Bernoulli trials, what can be inferred about the underlying success probability — using a billiard-table thought experiment to justify a uniform prior. The general algebraic form used throughout probability today, and the modern emphasis on priors and posteriors as a general framework for inference, was substantially developed later by Pierre-Simon Laplace, working independently and more systematically.

History
- c. 1701 — Thomas Bayes is born (exact date and birthplace uncertain), son of a Presbyterian minister in London.
- 1742 — Bayes is elected Fellow of the Royal Society.
- 1761 — Bayes dies in Tunbridge Wells; his mathematical papers pass to his family.
- 1763 — Richard Price posthumously communicates Bayes' essay "An Essay towards solving a Problem in the Doctrine of Chances" to the Royal Society.
- 1774–1812 — Pierre-Simon Laplace independently derives and generalizes inverse probability, embedding it in the broader theory now called Bayesian inference.
Is Bayes' theorem an assumption of Bayesian statistics, or a proven fact?

It is a proven mathematical fact, true in any probability space satisfying the Law of Total Probability hypotheses (a valid partition with positive prior probabilities). What is philosophically distinctive about Bayesian statistics is not the theorem itself — frequentist and Bayesian statisticians agree it is a theorem — but the willingness to assign prior probability distributions to unknown parameters or hypotheses, treating them as random quantities with degrees of belief. The theorem then supplies the mechanically correct way to update those beliefs given data. So the controversy in statistical philosophy is about the interpretation and use of priors, never about whether the algebraic identity holds.

Why does a positive result on an accurate test still leave a low probability of disease?

Because the theorem weighs the likelihood against the prior, and rare diseases have tiny priors. Even a small false-positive rate applied to the enormous healthy population can generate more false positives in absolute terms than the small diseased population generates true positives. Concretely, in Example 1 the false positives contributed 0.04980.0498 to P(+)P(+) while true positives contributed only 0.003880.00388 — the healthy group is 249 times larger, so its 5% false-positive rate dwarfs the sick group's 97% true-positive rate in absolute counts. This is exactly the base-rate effect Bayes' theorem quantifies precisely.

What happens if two candidate hypotheses overlap instead of being disjoint?

The theorem's denominator is derived from the Law of Total Probability, which strictly requires a partition — pairwise disjoint and exhaustive events. If the "hypotheses" overlap, the sum ∑jP(B∣Aj)P(Aj)\sum_j P(B\mid A_j)P(A_j) double-counts the overlapping probability mass and no longer equals P(B)P(B), so the formula's output is simply the wrong number, as shown explicitly in the counterexample above. The fix is always to first construct a genuine partition — for instance, by refining the events into disjoint atoms — before applying the theorem.

Does Bayes' theorem work with continuous random variables and probability densities?

Yes, with sums replaced by integrals. If θ\theta has prior density π(θ)\pi(\theta) and data xx has conditional density f(x∣θ)f(x\mid\theta), the posterior density is

π(θ∣x)=f(x∣θ) π(θ)∫f(x∣θ′) π(θ′) dθ′,\pi(\theta \mid x) = \frac{f(x\mid\theta)\,\pi(\theta)}{\int f(x\mid\theta')\,\pi(\theta')\,d\theta'},

which is the continuous analogue of the discrete formula, with the denominator again playing the role of a normalizing constant guaranteeing ∫π(θ∣x) dθ=1\int \pi(\theta\mid x)\,d\theta = 1. The derivation is essentially identical, using density-based conditional probability and an integral form of the Law of Total Probability.

How does sequential updating with multiple pieces of evidence work?

The odds-form corollary makes this transparent: each new independent piece of evidence multiplies the running posterior odds by its own likelihood ratio. If evidence B1B_1 updates prior odds to posterior odds O1O_1, and a second piece of evidence B2B_2 is conditionally independent of B1B_1 given each hypothesis, then O2=O1×P(B2∣A)P(B2∣Ac)O_2 = O_1 \times \frac{P(B_2\mid A)}{P(B_2\mid A^c)}. This is exactly how naive Bayes classifiers and sequential Bayesian filters accumulate evidence, and it foreshadows the formal treatment of Independence of Events, since the simple multiplicative update relies on a conditional independence assumption between pieces of evidence.

Can Bayes' theorem give a posterior probability of exactly 0 or 1?

Yes, in degenerate cases. If P(B∣Ai)=0P(B \mid A_i) = 0 for some hypothesis AiA_i — the evidence is literally impossible under that hypothesis — then its posterior becomes exactly 00, regardless of how strong its prior was: one contradicting observation can eliminate a hypothesis entirely. Conversely if every other hypothesis has P(B∣Aj)=0P(B\mid A_j) = 0 while P(B∣Ai)>0P(B\mid A_i) > 0, then P(Ai∣B)=1P(A_i\mid B) = 1. This is the mathematical expression of Sherlock Holmes' principle: once impossible alternatives are excluded, whatever remains, however improbable a priori, must be the truth — provided its likelihood for the evidence is strictly positive.

Before this

Where this leads