Math + You = 1

Probability dice
Courses Bac reviews

Bayes' theorem: Statement, demonstration and corrected exercises

It is a classic theorem in probability, Bayes' theorem, also called Bayes' formula, has many applications in real life. We will see one.

Statement of Bayes' theorem

Let A and B be two events such that the probability of B is non-zero. We then have the following relationship:

\mathbb P(A|B) = \dfrac{\mathbb{P}(B|A) \mathbb{P}(A)}{\mathbb{P}(B)}

With P(A∣B) the conditional probability that event A occurs knowing that event B has occurred

Proof of Bayes' theorem

A fairly simple demonstration is to start from the definitions of conditional probability by writing on the one hand:

\mathbb{P}(A|B) \mathbb{P}(B) = \mathbb{P}(A\cap B) 

And on the other hand:

\mathbb{P}(B|A) \mathbb{P}(A) = \mathbb{P}(A\cap B) 

So that by equalizing we get

\mathbb{P}(A|B) \mathbb{P}(B) =\mathbb{P}(B|A) \mathbb{P}(A) 

We then divide by P(B) to obtain the desired result:

\mathbb{P}(A|B) =\dfrac{\mathbb{P}(A|B) \mathbb{P}(B) }{\mathbb{P}(B)}

Application of Bayes' theorem to screening tests

Here is a corrected exercise to better understand this notion. False positives are something present in just about every medical test. Sometimes a result can be positive without the person actually being. Here is an extremely reliable test that ultimately poses some problems:

  • If a patient is sick, the test gives the correct result 99% of the time
  • If a patient is not sick, the test is correct 95% of the time

Imagine that this disease affects only one person in 100, which is already very high if the disease is fatal.

  • Let At the event, "the person contracted the disease"
  • Let B be the event “the test is positive”

We then have the following result:

\begin{array}{ll} \mathbb{P}(A|B) &= \dfrac{\mathbb{P}(B|A)\mathbb{P}(A)}{\mathbb{P}(B )}\\ &= \dfrac{\mathbb{P}(B|A)\mathbb{P}(A)}{\mathbb{P}(B|A)\mathbb{P}(A)+\mathbb {P}(B|\bar A)\mathbb{P}(\bar A)}\\ &= \dfrac{0,99 \times 0,01}{0,99\times 0,01+0,05 \times 0,99} \\ &= \dfrac{1}{6} \approx 16,7 \% \end{array}

We applied the total probability formula to the denominator

Concretely, this means that when the test is positive then the person only has a probability of approximately 16,7% of being really sick and therefore is not sick in 83,3% of cases. If cancer is diagnosed, for example, then this test is not reliable enough. We are going to apply a treatment with heavy side effects to someone who probably does not have the disease and therefore take great risks. In such a case, we say that we are overdiagnosing.


Exercise 1 – Antibodies

In a laboratory, the following measurements were made:

  • If a mouse carries antibody A, then 2 times out of 5 it also carries antibody B;
  • If a mouse does not carry antibody A, then 4 out of 5 times it does not carry antibody B.

Note that 50% of the population carry the antibody A

  1. Calculate the probability that if a mouse carries antibody B, then it also carries antibody A.
  2. Calculate the probability that if a mouse does not carry antibody B, then it does not carry antibody A

Exercise 2

Consider two urns filled with balls. The first contains ten black and thirty white balls. The second has twenty of each.

We draw without particular preference in one of the urns at random and in this urn, we draw a ball at random. The resulting ball is white. What is the probability that this ball is drawn in the first urn knowing that it is white?

Exercise 3 – Application to the weather

  • A weather station A predicts rain for tomorrow.
  • Another, B, on the contrary predicts good weather
  • We know that in the past A was wrong 25% of the time in its forecasts, and B 30% of the time.
  • We also know that on average 60% of the days have good weather and 40% rain.

Who to believe, and with what probability?

Exercise 4

We consider 3 groups of students in music A1, A2 and A3.

  • Group A1 has 20 students, 3 of whom play bagpipes,
  • Group A2 has 30 students, 5 of whom play bagpipes,
  • Group A3 has 10 students, 8 of whom play bagpipes,

We choose a student at random and we see that he plays the bagpipes. What is the probability that it comes from group A2 ?

Exercise 5

A multiple-choice questionnaire offers n ≥ 2 answers for each question. Let p be the probability that a student knows the correct answer to a given question. If he does not know the correct answer, he randomly chooses one of the proposed answers. What is the corrector's probability that a student actually knows the correct answer when given?

Leave comments