Home » Machine Learning/Artificial Intelligence

# Bayes Theorem in Conditional Probability

In this article, we are going to study about the **Bayes theorem used in conditional probability**. We will learn **what Bayes theorem states** and will also see some of its applications?

Submitted by Monika Sharma, on June 10, 2019

## Bayes Theorem

**Bayes theorem**, given by Reverend Thomas Bayes and thus named after him, is a method to find the probability of an event whose occurrence is dependent on some other event’s occurrence. In simple words, using the **Bayes theorem**, we can find the conditional probability of any event.

The **Bayes Theorem**, also known as **Bayes law or Bayes equation** is a mathematical equation which is given as follows:

Where **A** and **B** are events and **P(B) ≠ 0**.

Here,

**P(A|B):** conditional probability of occurrence of **event A** when **event B** has already occurred.

**P(B|A):** conditional probability of occurrence of **event B** when **event A** has already occurred.

**P(A):** Probability of occurrence of **event A** alone without any dependence on other events.

**P(B):** Probability of occurrence of **event B** alone without any dependence on other events.

## Derivation of Bayes Theorem

**Similarly,**

Putting the value of P (A^B) in equation (1), we get

**Which is our required Bayes equation.**

It should be noted that in the Bayesian equation, we need not find the probability of both the events occurring simultaneously, i.e. **P(A^B)**. We can simply calculate the conditional probability of an event if we know the conditional probability of the event on which it is dependent and the individual probabilities of both the events without any dependency on each other.

Bayes Theorem is applicable only in those experiments where we have only two events. It is not applicable to the cases where the number of events is more than two.

Nowadays, Bayes Theorem is used in many areas, and we can find its applications in various fields. For example, in chemical engineering, Bayes theorem is used to predict the drug concentrations in a body, it is also used to anticipate the viability of generated H2 by the electrocatalyst made for hydrogen evolution process. It is also used to find the estimates that how likely a person is prone to cancer depending upon his/her age. Apart from these examples, the Bayes rule is widely used and this theorem has proved to be a very efficient method to find the conditional probabilities.

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions