In this article, we will discuss what is Bayes' theorem, its general formula and its special case. We will also learn how to use its formula to find the conditional probability. So, let us get started.

What is the Bayes’ Theorem?

The Bayes' theorem is also known as Bayes' rule. In probability theory and statistics, the Bayes' theorem refers to the mathematical formula to find the conditional probability of events. Specifically, Bayes' theorem tells us the probability of an event which is dependent on some initial information of conditions that might be related to that event. Bayes' theorem is named after an English statistician Thomas Bayes. This theorem is the basis of the Bayes' inference. Bayes' theorem is employed in various fields such as medicine, pharmacology, and finance.

The best Maths tutors available
1st lesson free!
Intasar
4.9
4.9 (23 reviews)
Intasar
£42
/h
1st lesson free!
Matthew
5
5 (17 reviews)
Matthew
£25
/h
1st lesson free!
Dr. Kritaphat
4.9
4.9 (6 reviews)
Dr. Kritaphat
£49
/h
1st lesson free!
Paolo
4.9
4.9 (11 reviews)
Paolo
£25
/h
1st lesson free!
Petar
4.9
4.9 (9 reviews)
Petar
£27
/h
1st lesson free!
Rajan
4.9
4.9 (11 reviews)
Rajan
£15
/h
1st lesson free!
Farooq
5
5 (13 reviews)
Farooq
£35
/h
1st lesson free!
Myriam
5
5 (15 reviews)
Myriam
£20
/h
1st lesson free!
Intasar
4.9
4.9 (23 reviews)
Intasar
£42
/h
1st lesson free!
Matthew
5
5 (17 reviews)
Matthew
£25
/h
1st lesson free!
Dr. Kritaphat
4.9
4.9 (6 reviews)
Dr. Kritaphat
£49
/h
1st lesson free!
Paolo
4.9
4.9 (11 reviews)
Paolo
£25
/h
1st lesson free!
Petar
4.9
4.9 (9 reviews)
Petar
£27
/h
1st lesson free!
Rajan
4.9
4.9 (11 reviews)
Rajan
£15
/h
1st lesson free!
Farooq
5
5 (13 reviews)
Farooq
£35
/h
1st lesson free!
Myriam
5
5 (15 reviews)
Myriam
£20
/h
First Lesson Free>

Bayes’ Theorem Formula

The following formula is used to express the Bayes' theorem:

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

Here:

  • P (A|B) refers to the probability of the occurrence of an event A, given that event B has already occurred
  • P (B|A) refers to the probability of the occurrence of an event B, given that event A has already occurred
  • P(A) represents the probability of an event A
  • P(B) represents the probability of an event B

You may have noticed that events A and B are independent events, which means that the probability of the result of  event A is independent of the probability of the result of event B.

 

Special Case

There is a special case of Bayes' theorem when event A is a binary variable. In such a case, we use the following formula to compute the probability:

P (A|B) = \frac {P(B|A) P (A)} {P(B|A) P (A) + P (not A) P(B not A)}

We can have 3 or more cases with A. In this case, we should use the following formula to calculate the probability:

P (A|B) = \frac {P(B|A) P (A)} {P(B|A1) P (A1) + P(B|A2) P (A2) + P(B|A3) P (A3) .....}

Now, we will solve certain examples in which we will use the above formula to compute the conditional probability.

Example 1

There are 3 green and 7 red marbles in a blue bag. Another black colored bag has 8 green and 2 red marbles in it. One marble is drawn at random from one of the bags, which is of the red color. What is the probability that this marble was drawn from the blue bag?

Solution

Suppose A is the probability of selecting a marble from a blue bag and B is the probability of selecting a marble from the black bag.

It means that P(A) = P(B) = \frac {1}{2} = 0.5

Probability of drawing a red marble from a blue bag = P (R|A) = \frac {7}{10} = 0.7

Probability of drawing a red marble from a black bag = P (R|B) = \frac {2}{10} = 0.2

We will use the Bayes' theorem to calculate the probability of selecting a red ball from blue bag out of two bags:

 P (A|R) = \frac {P(R|A) P (A)} {P(R|A) P (A) + P(R|B) P (B)}

 P (A|R) =\frac {0.7 \times 0.5} {0.7 \times 0.5 + 0.2 \times 0.5}

P(A|R) = \frac {0.35} {0.35 + 0.1}

P(A|R) = 0.77

 

Example 2

A small company has hired two architects to create designs for the clients. Architect 1 makes 65% of the designs and architect 2 makes 35% of the designs. Furthermore, 70% of the designs from architect 1 get approved and 85% of the designs produced by architect 2 get approved. Suppose a design is drawn at random. If the selected design is approved, find the probability that it was made by the architect 2.

Solution

Let A_1 be an event of the design made by the architect 1 and A_2 be an event of the design made by the architect 2. Suppose B is an event of selecting an approved design. Now, we will calculate the conditional probability P(A_2|B).

Use the following formula to calculate this probability:

P(A_2|B) = \frac {P(A_2) P(B|A2)} {P(A_1) P(B|A1) + P(A_2) P(B|A2)}

In this problem, we have:

P(A_1) = 0.65

P(B|A_1) = 0.70

P(A_2) = 0.35

P(B|A_2) = 0.85

Substitute these values in the formula:

P(A_2|B) = \frac {P(A_2) P(B|A2)} {P(A_1) P(B|A1) + P(A_2) P(B|A2)}

P(A_2|B) = \frac {0.35 \cdot 0.85} {0.65 \cdot 0.70 + 0.35 \cdot 0.85}

P(A_2|B) = \frac {0.2975} {0.455 + 0.2975}

P(A_2|B) = \frac {0.2975} {0.7525}

P(A_2|B) = \frac {0.2975} {0.7525}

P(A_2|B) = 0.395

 

Example 3

John, Alice, and Harry are working in the same company. There is a 25% chance that John will become a manager, 40% chance that Alice will become a manager, and a 35% chance that Harry will become a manager. The probabilities that new rules will be introduced when John, Alice, and Harry will become managers are 20%, 50%, and 40% respectively. If the new rules have been introduced, what is the probability that Harry is the manager?

Solution

Suppose A, B, and C are the events of John, Alice, and Harry becoming managers respectively. Let R be an event that the new rules are introduced. We have to compute the conditional probability P(C|R).

There are 3 cases in this problem, so we will use the following formula:

P (C|R) = \frac {P(R|C) P (C)} {P(R|A) P (A) + P(R|B) P (B) + P(R|C) P (C)}

Here:

P(A) = 0.25

P(B) = 0.40

P(C) = 0.35

P (R|A) = 0.20

P (R|B) = 0.50

P (R|C) = 0.40

Now, we will substitute the above values in the formula below to get the probability:

P (C|R) = \frac {0.40 \cdot 0.35} {0.20 \cdot 0.25 + 0.50 \cdot 0.40 + 0.40 \cdot 0.35}

P (C|R) = \frac {0.05} {0.05 + 0.2 + 0.15}

P (C|R) = \frac {0.15} {0.4} = 0.375

 

Example 4

In a school, 50% of the students play football and 40% of the boys play basketball. Suppose that 40% of those who play football also play basketball. What percent of those that play basketball also play football?

Solution

Let A be an event of a student playing a football and B be an event of the student playing a basketball.

P(A) = 0.50

P(B) = 0.40

P(B|A) =0.40

Use the Bayes' theorem to calculate percentage of students who play basketball also play football P(A|B).

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

Substitute the values in the above formula:

P (A|B) = \frac {0.40 \cdot 0.50} {0.40}

= \frac {0.20}{0.40} =0.5

Hence, 50% of the students who play basketball also play football.

 

Example 5

In a class, 30% of the students like mathematics and 60% of the students like science. Suppose that 20% of those who like mathematics also like science. What percent of those who like science also like mathematics?

Solution

Let A be an event of a student liking mathematics and B be an event of the student liking science.

P(A) = 0.30

P(B) = 0.60

P(B|A) =0.20

Use the Bayes' theorem to calculate percentage of students who like science also like mathematics P(A|B).

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

Substitute the values in the above formula:

P (A|B) = \frac {0.20 \cdot 0.30} {0.60}

= \frac {0.06}{0.60} =0.1

Hence, 10% of the students who like science also like mathematics.

 

 

Need a Maths teacher?

Did you like the article?

1 Star2 Stars3 Stars4 Stars5 Stars 5.00/5 - 1 vote(s)
Loading...

Rafia Shabbir