## Bayes Theorem

Result | x |

To Calculate: |
||

P(A): |
% | |

P(B): |
% | |

P(B|A): |
% | |

P(A|B): |
% |

⚠️ Report an Issue

# Bayes’ Theorem Calculator

Bayes theorem is a concept of probability in mathematics. The theorem is named after 18th-century British mathematician Thomas Bayes. The theorem gives the probability of occurrence of an event given a condition. In other words, you can use Bayes theorem under conditional probability events.

Bayes' theorem is also termed as Bayes' Rule or Bayes' Law. The field of Bayesian statistics is based on this theorem itself.

## What is conditional probability?

The probability of occurrence of an event given the set of conditions is said to be conditional probability. For example, consider this scenario:

There are three different bags. Each bag has three balls of different colors – black, blue and yellow. Now, we are interested in calculating the probability of picking up a blue colored ball in the first attempt from the second bag. Such situation comes under conditional probability.

Bayes theorem statement:

If {E1,E2,…,En} be a set of events in a given sample space S, where all the events E1, E2,…, En have nonzero probability of occurrence. Let A be any event associated with S, then according to Bayes theorem:

P(Ei│A) = P(E_{i})P(E_{i}│A)∑(k=0 to n) P(Ek)P(A|E_{k})

Proof:

According to conditional probability, P(Ei│A) = P(Ei∩A)P(A) ⋯⋯⋯⋯⋯⋯⋯⋯(1)

But from multiplication rule of probability, P(Ei∩A) = P(Ei)P(Ei│A)⋯⋯⋯⋯⋯⋯⋯⋯(2)

From total probability theorem, P(A) = ∑k=0n P(Ek)P(A|Ek)⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯(3)

Substituting the values from equations (2) and (3) in equation 1, we arrive at:

P(Ei│A) = P(E_{i})P(E_{i}│A)∑(k=0 to n) P(Ek)P(A|E_{k})

In simple terms, considering there are only two events, A and B, Bayes theorem may be stated as:

P(A∣B)=P(B)P(A⋂B)=P(B)P(A)⋅P(B∣A)

where:P(A)= The probability of occurrence of event A

P(B)= The probability of occurrence of event B

P(A∣B)=The probability of occurrence of event A given B

P(B∣A)= The probability of occurrence of event B given A

P(A⋂B))= The probability of occurrence of both A and B

One cannot really argue with a mathematical theorem. – Stephen Hawking

## Examples of Bayes theorem

### Example 1: In mathematics

Assume that bag A contains 4 white and 6 black balls while another bag B contains 4 white and 3 black balls. One ball is drawn at random from one of the bags and it is found to be black. Find the probability that it was drawn from Bag A.

Solution:Let:

The event of choosing the bag A be E1

The event of choosing bag B is E2.

The event of drawing a black ball be A.

Then, P(E1) = P(E2) = 1/2

P(A|E1) = P(drawing a black ball from Bag A) = 6/10 = 3/5

P(A|E2) = P(drawing a black ball from Bag B) = 3/7

From Bayes’ theorem, the probability of drawing out a black ball from bag A out of two bags is:

P(E1|A) = P(E1)P(A|E1)P(E1)P(A│E1)+P(E2)P(A|E2)

={1/2 × 3/5}/{(1/2 × 3/7) + (1/2 × 3/5)} = 7/12

### Example 2: In the field of drug testing

Suppose a drug test has 96% accuracy, which means if the test is done 100 times, the results are 96times positive for drug users and 96 times negative for non-drug users.

Next, assuming that 0.4% of people use the drug if a person selected at random tests positive for the drug, what is the probability the person is actually a user of the drug?

Solution:(0.96 x 0.004) / [(0.96 x 0.004) + ((1 - 0.96) x (1 - 0.004))] = 90.61%

## Applications of Bayes theorem

Bayes theorem gives the probability as more and more information becomes available. It is applicable in multiple streams and subjects such as sports, philosophy, medicine, pharmaceuticals, engineering, science, etc.

Bayes theorem mainly focuses on narrowing down the scope of our search. This concept we use in our daily life without our knowledge too. For example, when we are searching for our spectacles or car keys, the places where we keep them daily strikes our mind at first. Thus we are narrowing down the scope of the search to get the work done with the highest probability.

- In medicine, you can calculate the probability of the occurrence of the disease to a patient, given his medical history and other data about the disease. The most common example of Bayesian application in medicine is in cancer screening.
- In Big Data and data science, the concept of Bayesian inference plays a key role in statistical inferences.
- In the banks and finance industry, the Bayesian concept helps in assessing the risk of lending money to potential customers who might have chances of not repaying.
- Insurance companies use the Bayesian approach to estimate the risk and calculate the insurance premiums accordingly.
- The famous Enigma code during the times of World War II was finally decoded by Alan Turing with the help of the Bayesian approach itself.
- The Bayesian concept is also used in genetics, global warming and taking decisions about monetary policies too.
- Bayesian reasoning now underpins vast areas of human enquiry, from cancer screening to global warming, genetics, monetary policy, and artificial intelligence.

However, with Bayesian, the results may not always be convincing. For example, in cancer screening or in online medical tools that help predict the probable health ailments the results may not be accurate all the time. The chances of occurrence of disease in people depend on many factors, and one may not always rely on the probability of predicting the same.

A reasonable probability is the only certainty. – E W Howe

## How CalculatorHut’s online free Bayes theorem calculator helps you?

CalculatorHut contains a huge range of nearly 120 scientific, health and other calculators specifically designed to make calculations easy and simple. The website is born out of the notion to design a handy online free calculating tool for students, professionals, finance enthusiasts, health-conscious people, and everyone who deal with numbers and calculations in their day to day life.

Bayes theorem is an indispensable concept in many subjects as we have seen above. With the help of our calculator, you can easily calculate any parameter of Bayes theorem and get instant results. CalculatorHut’s free Bayes theorem calculator is a useful tool for cross verifying the results that you obtain during calculations and learning Bayesian concepts.

Do you know? CalculatorHut is a hub of online free calculators. Check out our wide range of calculators in math, physics, chemistry, finance, health, vehicle, and others.

If you own a study blog or website based on Big data or Data Science and wish to get our Bayes theorem calculator or any of our calculators embedded as widgets on your website, drop a word to us at [email protected], and we will design you the widget absolutely free!

CalculatorHut also has its app for free for its users! Just download the CalculatorHut’s app in your mobile and cheers, you have this huge range of online free calculators in your hand. With CalculatorHut, you can enjoy any type of calculations on the go!

With CalculatorHut, you can always enjoy hassle-free calculations of all sort, because we aim at making scientific calculations simple and easy! CalculatorHut simplifies your calculations!