Bayes' theorem is one of the central rules of probabilistic reasoning. It allows us to update what we believe about an unknown event after observing new data.
In this course, Bayes' theorem is introduced as a practical tool for statistical inference. It helps us move from one question to another:
This distinction matters because P(A|B) is generally not the same as P(B|A). For example, the probability that a detector gives an alert if an event has occurred is not the same as the probability that the event occurred because the detector gave an alert.
The basic relationship can be written as:
P(A and B) = P(A|B)P(B) = P(B|A)P(A)
Rearranging this gives the more familiar form of Bayes' theorem:
P(A|B) = P(B|A)P(A) / P(B)
In this expression:
In Bayesian inference, this updated probability is called the posterior probability. It combines prior knowledge with the information contained in the observed data.
Two events are statistically independent if knowing that one occurred does not change the probability of the other. In that case:
P(A|B) = P(A)
and the joint probability simplifies to:
P(A and B) = P(A) × P(B)
This is a special case. In most real inference problems, the events are not independent, and the conditional probabilities carry important information.
To use Bayes' theorem, we often need to calculate the overall probability of the observed data. This is where the marginalisation rule is useful.
The idea is to add together all the different ways in which an event could occur. If event B can occur when A is true or when A is false, then:
P(B) = P(B|A)P(A) + P(B|not A)P(not A)
This is also known as the law of total probability. The important point is that each conditional probability must be weighted by how likely that case is. This is why rare events can lead to counter-intuitive results: even a good test may produce misleading conclusions if the event being tested for is very uncommon.
In the next example, this rule is used together with Bayes' theorem to solve the vampire problem.
Stay up to date with our technology updates, events, special offers, news, publications and training
If you want to find out more about NAFEMS and how membership can benefit your organisation, please click below.
Joining NAFEMS© NAFEMS Ltd 2026
Developed By Duo Web Design