Bayes’ Theorem formula is a very important method for calculating conditional probabilities. It is used to calculate posterior probabilities under some already give a probability. This theorem describes the probability of an event, based on conditions that might be related to the event. For example, a patient is observed to have a certain symptom. Here the Bayes’ formula can be used to compute the probability that a diagnosis is correct, with the given observation. In this topic, we will discuss conditional probability and Bayes’ theorem Formula with examples. Let us learn the interesting topic.

**Bayes’ Theorem formula**

**What Is Conditional Probability?**

Conditional probabilities arise naturally in the investigation of experiments where some outcome of a trial may affect the outcomes of the trials subsequently. We may try to calculate the probability of the second event say event B given that the first event says event A has already happened. If the probability of second event changes while taking the first event into consideration. Then we can safely say that the probability of event B will be dependent on the occurrence of event A.

We can write the conditional probability as \(P(A | B)\), the probability of the occurrence of event A given that B has already happened.

\(P(A | B) = \frac{P(A and B)}{P(B)} = \frac {Probability of the occurrence of both A and B}{ Probability of B}\)

Source: en.wikipedia.org

### B**ayes Theorem:**

In statistics and probability theory, the Bayes’ theorem or Bayes’ rule is a mathematical formula used to determine the conditional probability of the events. Actually the Bayes’ theorem describes the probability of an event based on prior knowledge of the conditions, relevant to the event.

Bayes’ theorem is named after Thomas Bayes. He first provided an equation that allows new evidence to update beliefs. If we know the conditional probability \(P(B | A)\) , we can use the Bayes rule to find out the reverse probabilities \(P(A | B)\) as well. This theorem says that,

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

We can represent the above statement as the general statement as below:

\(P(A_i | B) = \frac{P(B | A_i) \times P(A_i)} {\displaystyle\sum\limits_{i=1}^n (P(B |A_i) \times P(A_i))}\)

\(A_i\) is the ith event with probability \(P(A_i)\)

## Solved Examples for Bayes’ Theorem Formula

Q.1: We wish to find a person’s probability of having rheumatoid arthritis if they have hay fever. Having hay fever is the test for rheumatoid arthritis i.e. the event in this case. A is the event “patient has rheumatoid arthritis.” Data indicates 10 percent of patients in a clinic have this type of arthritis. B is the test “patient has hay fever.” Data indicates 5 percent of patients in a clinic have hay fever. The clinic’s records also show that of the patients with rheumatoid arthritis, 7 percent have hay fever. In other words, the probability that a patient has hay fever, given they have rheumatoid arthritis, is 7 percent.

Solution: Given terms in the problem are:

- P(A) = 0.10
- P(B) = 0.05
- \(P(B | A)\) =0.07

Now, we use the Bays theorem formula:

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

Thus,

\(P(A | B) = \frac {0.07 \times 0.10}{0.05}\)

\(P(A | B) = 0.14\)

Therefore, if a patient has hay fever, then chance of having rheumatoid arthritis is 14 percent.

I get a different answer for first example.

I got Q1 as 20.5

median 23 and

Q3 26