Skip to content
Glacius
ProbabilityConcept reference

Bayes' rule

Bayes’ rule expresses the probability of a hypothesis given positive-probability evidence as their joint probability divided by the evidence probability.

On this page 8 sections
  1. Overview
  2. Bayes’ rule updates a belief about a hypothesis after observing evidence
  3. The same reversal works with counts
  4. All ways of getting E belong in the denominator, including evidence without H
  5. A closer look
  6. Key takeaway
  7. Sources & further reading
  8. Concept connections

01Bayes’ rule updates a belief about a hypothesis after observing evidence#

Bayes’ rule updates a belief about a hypothesis after observing evidence. It connects three quantities: how common the hypothesis was beforehand, how likely the evidence was under it, and how common that evidence is overall. These are different probabilities with different denominators.

Bayes’ rule reverses a conditional. For a hypothesis H and evidence E, the chance of E within H need not equal the chance of H within E.

Suppose P(H)=0.3 and P(E | H)=0.8. Their joint mass is 0.24. If all evidence has mass 0.4, H accounts for 0.24 / 0.4 = 0.6 of it.

P(H)=.3 and P(E|H)=.8 give joint area .24. The remaining evidence is .16 in not-H, so its conditional E rate is .16/.7. E has total .4. The lower evidence-only strip has H share .24/.4=.6.P(H)=.3 and P(E|H)=.8 give joint area .24. The remaining evidence is .16 in not-H, so its conditional E rate is .16/.7. E has total .4. The lower evidence-only strip has H share .24/.4=.6.
Figure 1P(H)=.3 and P(E|H)=.8 give joint area .24. The remaining evidence is .16 in not-H, so its conditional E rate is .16/.7. E has total .4. The lower evidence-only strip has H share .24/.4=.6.
Link to this figure ↗Download SVGDownload PNG

In 1000 records, suppose 100 satisfy a hypothesis and 90 of those show the evidence. If 300 records show the evidence in total, then 90 of the 300 evidence records satisfy the hypothesis. The posterior is 90/300=0.390/300=0.3. The 90% evidence rate within the hypothesis does not reverse to a 90% hypothesis rate within the evidence.

For P(HE)P(H\mid E):

P(H)P(EH)P(E)\frac{P(H)P(E\mid H)}{P(E)}

The prior is P(H). The likelihood is P(E | H). Divide their joint mass by positive total evidence P(E) to obtain the posterior.

Check your reasoning

P(H)=0.4, P(E | H)=0.5, P(E)=0.25. Find P(H | E).

Show answer and explanation
0.8

0.2 / 0.25 = 0.8.

02The same reversal works with counts#

The same reversal works with counts. If 40 records have H, half of them show E, and 80 records show E overall, the posterior is 20 / 80 = 0.25.

Check your reasoning

Among 200 uniform records, 50 have H. Within H, the E rate is 0.4. Exactly 40 records have E. Find P(H | E).

Show answer and explanation
0.5

20 H-and-E records out of 40: 0.5.

03All ways of getting E belong in the denominator, including evidence without H#

All ways of getting E belong in the denominator, including evidence without H. A zero likelihood can give posterior 0; zero total evidence makes this ratio undefined.

Check your reasoning

P(H)=0.25, P(E | H)=0.8, P(E)=0.5. “P(H | E)=0.8.” Repair it.

  1. A0.8
  2. B0.4
  3. C0.2
Show answer and explanation
0.4

Joint 0.2; divide by 0.5: 0.4.

04A closer look#

In a model that updates candidate explanations after a new observation, Bayes’ rule preserves both prior plausibility and evidence fit. Include all routes to the observed evidence in its total probability. Strong-looking evidence can still leave a modest posterior when the hypothesis is initially uncommon.

Key takeaway

Multiply prior by likelihood, then divide by all evidence. The two conditional directions use different denominators.

  • Reverse a conditional using the full evidence total.

Sources & further reading

  1. [1]
    Pishro-Nik, Introduction to Probability: 1.4.3 Bayes RulePishro-Nik, Introduction to Probability · Book

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Bayes' rule.” Math behind ML. /learn/p-bayes