Bayes Theorem (aka, Bayes Rule)
Bayes' theorem (also known as Bayes' rule) is a useful tool for calculating conditional probabilities. Bayes' theorem can be stated as follows:
Bayes' theorem.. Let A_{1}, A_{2}, ... , A_{n} be a set of mutually exclusive events that together form the sample space S. Let B be any event from the same sample space, such that P(B) > 0. Then,
P( A_{k}  B ) =  P( A_{k}
∩ B )
[ P( A_{1} ∩ B ) + P( A_{2} ∩ B ) + . . . + P( A_{n} ∩ B ) ] 
Note: Invoking the fact that P( A_{k} ∩ B ) = P( A_{k} )P( B  A_{k} ), Baye's theorem can also be expressed as
P( A_{k}  B ) =  P( A_{k} ) P( B  A_{k} )
[ P( A_{1} ) P( B  A_{1} ) + P( A_{2} ) P( B  A_{2} ) + . . . + P( A_{n} ) P( B  A_{n} ) ] 
Unless you are a worldclass statiscian, Bayes' theorem (as expressed above) can be intimidating. However, it really is easy to use. The remainder of this lesson covers material that can help you understand when and how to apply Bayes' theorem effectively.
When to Apply Bayes' Theorem
Part of the challenge in applying Bayes' theorem involves recognizing the types of problems that warrant its use. You should consider Bayes' theorem when the following conditions exist.
 The sample space is partitioned into a set of mutually exclusive events { A_{1}, A_{2}, . . . , A_{n} }.
 Within the sample space, there exists an event B, for which P(B) > 0.
 The analytical goal is to compute a conditional probability of the form: P( A_{k}  B ).

You know at least one of the two sets of probabilities described below.
 P( A_{k} ∩ B ) for each A_{k}
 P( A_{k} ) and P( B  A_{k} ) for each A_{k}
Test Your Understanding
Bayes' theorem can be best understood through an example. This section presents an example that demonstrates how Bayes' theorem can be applied effectively to solve statistical problems.
Bayes' Rule Calculator
Use the Bayes Rule Calculator to compute conditional probability, when Bayes' theorem can be applied. The calculator is free, and it is easy to use. You can find the calculator in Stat Trek's main menu under the Stat Tools tab. Or you can tap the button below.
Bayes' Rule CalculatorExample 1
Marie is getting married tomorrow, at an outdoor ceremony in the desert. In
recent years, it has rained only 5 days each year. Unfortunately, the
weatherman has predicted rain for tomorrow. When it actually rains, the
weatherman correctly forecasts rain 90% of the time. When it doesn't rain, he
incorrectly forecasts rain 10% of the time. What is the probability that it
will rain on the day of Marie's wedding?
Solution: The sample space is defined by two mutuallyexclusive events  it rains or it does not rain. Additionally, a third event occurs when the weatherman predicts rain. Notation for these events appears below.
 Event A_{1}. It rains on Marie's wedding.
 Event A_{2}. It does not rain on Marie's wedding.
 Event B. The weatherman predicts rain.
 P( A_{1} ) = 5/365 =0.0136985 [It rains 5 days out of the year.]
 P( A_{2} ) = 360/365 = 0.9863014 [It does not rain 360 days out of the year.]
 P( B  A_{1} ) = 0.9 [When it rains, the weatherman predicts rain 90% of the time.]
 P( B  A_{2} ) = 0.1 [When it does not rain, the weatherman predicts rain 10% of the time.]
We want to know P( A_{1}  B ), the probability it will rain on the day of Marie's wedding, given a forecast for rain by the weatherman. The answer can be determined from Bayes' theorem, as shown below.
P( A_{1}  B ) =  P( A_{1} ) P( B  A_{1} )
P( A_{1} ) P( B  A_{1} ) + P( A_{2} ) P( B  A_{2} ) 
P( A_{1}  B ) =  (0.014)(0.9) [ (0.014)(0.9) + (0.986)(0.1) ] 
P( A_{1}  B ) =  0.111 
Note the somewhat unintuitive result. Even when the weatherman predicts rain, it rains only about 11% of the time. Despite the weatherman's gloomy prediction, there is a good chance that Marie will not get rained on at her wedding.