---
title: "Bayes' Rule and Updating a Belief"
description: "Bayes' rule combines a prior probability with evidence likelihoods to find a posterior probability. A test with high sensitivity and specificity can still have many false positives when the condition "
canonical: https://lightmysky.com/learn/computing/bayes-rule-and-updating-a-belief-mt_A4p5--f7Io
source: https://lightmysky.com/learn/computing/bayes-rule-and-updating-a-belief-mt_A4p5--f7Io.md
retrieved: 2026-11-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Bayes' Rule and Updating a Belief

Bayes' rule combines a prior probability with evidence likelihoods to find a posterior probability. A test with high sensitivity and specificity can still have many false positives when the condition is rare. Repeated updates use likelihoods that account for earlier evidence.

Subject: Computing · Area: Machine Learning · Ages 18 to 19
Page: https://lightmysky.com/learn/computing/bayes-rule-and-updating-a-belief-mt_A4p5--f7Io

## Ready when they can

- Interpret priors and test error rates, then compute result probabilities and posteriors
- Explain the base rate effect on a rare condition with an accurate test
- Update a belief twice using the correct conditional likelihoods and obtain the same posterior in either order

## Lesson: Flipping what the test tells you

Let C mean a condition is present and + mean a positive result. The prior q = P(C) is the chance before the test. Let s = P(+ given C) and r = P(+ given not C). The true-positive share is q × s; the false-positive share is (1-q) × r. Their sum is P(+). If this sum is positive, the posterior is P(C given +) = q × s / [q × s + (1-q) × r]. It is the condition share within the positive group.

**Example.** Suppose 1% have the condition. A test detects 99% with it and flags 1% without it. In a model group of 10,000, 100 have the condition and 9,900 do not. The test gives 99 true positives and 99 false positives. Among all 198 positives, the condition share is 99/198 = 0.5. To use this counting method with other rates, split the group first, apply each rate, then divide true positives by all positives.

*(drawing: The positive group contains equal numbers with and without the condition. Its condition share is one half.)*

A false positive is a positive result when C is absent. Its rate divides false positives by everyone without C. Sensitivity s is the positive rate within C. Specificity 1-r is the negative rate without C. A false negative is a negative result within C; its rate is 1-s. Rarity can make false positives outnumber true ones, but this is not automatic. With fixed rates 0 < r < s, a higher base rate gives a higher positive-result posterior.

A negative result also updates the prior. Its likelihood is 1-s when C is present and 1-r when C is absent. The negative shares are q × (1-s) and (1-q) × (1-r). Divide the first by their sum to find P(C given negative), provided the sum is positive. The denominator now contains everyone with a negative result.

For two results, use the first posterior as the next prior. You may reuse each test's original rates if the results are independent given C and also given not C. This means learning one result leaves the other's rate unchanged within either group. Independence across the whole population is not enough. Without within-group independence, use rates conditional on the earlier result.

*(drawing: These products use independence within each condition group. The example below explains their rates.)*

**Example.** Take q = 0.2. A's positive rates are 0.75 with C and 0.25 without; B's are 0.5 and 0.1. Assume independence within each group. For two positives, the shares are 0.2 × 0.75 × 0.5 = 0.075 and 0.8 × 0.25 × 0.1 = 0.02. The posterior is 0.075/0.095, about 0.7895. Reversing A and B leaves both products unchanged. This gives the same result as two Bayes updates. Keep intermediate values unrounded.

**Recap.** For a positive result, divide the true-positive share by all positives. Base rates matter. Repeated updates need the correct conditional likelihoods and give the same posterior in either order.

*Lesson, question and flashcard revisions written for this dataset.*

## Practice

14 questions on this page, each with its working shown.

## Needs first

- [Joint, Marginal and Conditional Probability](https://lightmysky.com/learn/computing/joint-marginal-and-conditional-probability-mt__Rj-hOSMEw)
- [Likelihood and the Maximum Likelihood Estimate](https://lightmysky.com/learn/computing/likelihood-and-the-maximum-likelihood-estimate-mt_crcBnSqkTE)

## Optional connections

- [Conditional Probability, Independence and Bayes' Theorem](https://lightmysky.com/learn/mathematics/conditional-probability-independence-and-bayes-theorem-mt_wIi_XRzwwK)

## Opens up

- [Bayesian Phylogenetics: Priors, Sampling and Judging Convergence](https://lightmysky.com/learn/science/bayesian-phylogenetics-priors-sampling-and-judging-convergence-mt_7jWhYh1n5X)
