Data & ComputingProbabilityA-Level
AQAIBAbiturAPBaccalauréat GénéralBachilleratoCambridgeCAPS

Bayes' Theorem

Probability based on prior knowledge.

Understand the formulaSee the free derivationOpen the full walkthrough

This public page keeps the free explanation visible and leaves premium worked solving, advanced walkthroughs, and saved study tools inside the app.

Core idea

Overview

Bayes' Theorem is a mathematical formula used to determine the conditional probability of an event based on prior knowledge of conditions that might be related to the event. It describes how to update the initial probability of a hypothesis as more evidence or information becomes available.

When to use: Use this theorem when you need to calculate the probability of a cause given an observed effect, or when updating beliefs based on new data. It is essential in diagnostic testing, machine learning classification, and statistical inference where 'prior' probabilities are known.

Why it matters: It serves as the foundation for Bayesian statistics, which allows for dynamic learning from data. Its applications range from filtering spam emails and diagnosing rare diseases to refining autonomous vehicle navigation systems.

Symbols

Variables

P(A|B) = Posterior P(A|B), P(B|A) = Likelihood P(B|A), P(A) = Prior P(A), P(B) = Evidence P(B)

Posterior P(A|B)
Likelihood P(B|A)
Prior P(A)
Evidence P(B)

Walkthrough

Derivation

Derivation of Bayes' Theorem

Bayes’ theorem updates the probability of A after observing B and follows directly from the definition of conditional probability.

  • A and B are events.
  • P(B)>0.
1

Start from conditional probability:

Conditional probability is the probability of both events occurring divided by the probability of the condition.

2

Write the same intersection the other way:

Rearranging P(B A)= gives this expression for the intersection.

3

Substitute to obtain Bayes’ theorem:

This links the posterior P(A B) to the likelihood P(B A) and the prior P(A).

Note: P(B) can be expanded using the law of total probability when needed.

Result

Source: Edexcel A-Level Mathematics — Statistics (Probability)

Free formulas

Rearrangements

Solve for

Make Pab the subject

Pab is already the subject of the formula.

Difficulty: 1/5

Solve for

Make Pba the subject

Rearrange Bayes' Theorem to isolate the likelihood P(B|A).

Difficulty: 2/5

Solve for

Make Pa the subject

Rearrange Bayes' Theorem to isolate the prior probability P(A).

Difficulty: 2/5

Solve for

Make Pb the subject

Rearrange Bayes' Theorem to isolate the evidence P(B).

Difficulty: 3/5

The static page shows the finished rearrangements. The app keeps the full worked algebra walkthrough.

Visual intuition

Graph

The graph is linear because the posterior probability is directly proportional to the likelihood and prior probability when the marginal probability remains constant. As the independent variable representing the likelihood P(B|A) increases, the y-axis value increases at a constant rate, creating a straight line passing through the origin.

Graph type: linear

Why it behaves this way

Intuition

Imagine a Venn diagram where the total area represents the sample space. Event A and Event B are overlapping regions. Bayes' Theorem calculates the proportion of the area of Event B that is also covered by Event A

P(A|B)
The conditional probability of event A occurring, given that event B has occurred. This is the updated belief or posterior probability of A.
How likely event A is *after* we have observed event B.
P(B|A)
The conditional probability of event B occurring, given that event A has occurred. This is the likelihood of observing B if A is true.
How strongly event A predicts or explains event B.
P(A)
The prior probability of event A occurring, before any new evidence (event B) is considered.
Our initial assessment of how likely event A is.
P(B)
The marginal probability of event B occurring. It represents the overall prevalence of B and serves as a normalizing constant.
How likely event B is to happen in general.

Signs and relationships

  • P(B) in the denominator: The division by P(B) normalizes the product of the likelihood and prior probability (P(B|A)P(A), which equals P(A and B)) to convert it into a conditional probability P(A|B).

Free study cues

Insight

Canonical usage

Bayes' Theorem operates with probabilities, which are inherently dimensionless quantities expressed as numbers between 0 and 1.

Common confusion

A common confusion is incorrectly converting between decimal probabilities and percentages, or attempting to assign physical units to probability values.

Dimension note

All terms in Bayes' Theorem (P(A|B), P(B|A), P(A), P(B)) represent probabilities, which are dimensionless ratios. They quantify the likelihood of an event and are always values between 0 and 1.

Unit systems

dimensionless · The conditional probability of event A occurring given that event B has occurred.
dimensionless · The conditional probability of event B occurring given that event A has occurred.
dimensionless · The prior probability of event A occurring.
dimensionless · The prior probability of event B occurring.

One free problem

Practice Problem

In a clinical trial, a disease affects 1% of the population. A diagnostic test is 99% accurate for those who have the disease. If the total probability of any individual testing positive is 1.98%, what is the probability that an individual actually has the disease given a positive test result?

Prior P(A)0.01
Likelihood P(B|A)0.99
Evidence P(B)0.0198

Solve for:

Hint: Multiply the probability of testing positive while sick by the probability of being sick, then divide by the total probability of testing positive.

The full worked solution stays in the interactive walkthrough.

Where it shows up

Real-World Context

Updating disease probability after a test.

Study smarter

Tips

  • Always identify the 'prior' probability Pa before considering new evidence.
  • Distinguish clearly between Pba (likelihood of evidence given the hypothesis) and Pab (probability of hypothesis given evidence).
  • Ensure that the total probability of the evidence Pb is correctly calculated or provided.

Avoid these traps

Common Mistakes

  • Swapping P(A|B) and P(B|A).
  • Forgetting to divide by P(B).

Common questions

Frequently Asked Questions

Bayes’ theorem updates the probability of A after observing B and follows directly from the definition of conditional probability.

Use this theorem when you need to calculate the probability of a cause given an observed effect, or when updating beliefs based on new data. It is essential in diagnostic testing, machine learning classification, and statistical inference where 'prior' probabilities are known.

It serves as the foundation for Bayesian statistics, which allows for dynamic learning from data. Its applications range from filtering spam emails and diagnosing rare diseases to refining autonomous vehicle navigation systems.

Swapping P(A|B) and P(B|A). Forgetting to divide by P(B).

Updating disease probability after a test.

Always identify the 'prior' probability Pa before considering new evidence. Distinguish clearly between Pba (likelihood of evidence given the hypothesis) and Pab (probability of hypothesis given evidence). Ensure that the total probability of the evidence Pb is correctly calculated or provided.

References

Sources

  1. Wikipedia: Bayes' theorem
  2. A First Course in Probability by Sheldon Ross
  3. Wikipedia: Probability
  4. Sheldon Ross A First Course in Probability
  5. IUPAC Gold Book: Probability
  6. Edexcel A-Level Mathematics — Statistics (Probability)