# Conditional Probability and Bayes Theorem

In this lesson, we will discuss Conditional Probability and Bayes Theorem

We'll cover the following

## Conditional probability

The probability of an event B occurring when an event A has occurred is called conditional probability. It is denoted as P(B|A), and it is read as “The probability that B occurs given A has occurred”.

It is calculated using the formula below.

P(B | A) = P (A $\cap$ B) / P(A) given P(A) > 0

Here, P(A) is the probability of A and P(A $\cap$ B) is the joint probability of A and B.

### Example

A math teacher gave her class two tests. 25% of the class passed both tests and 45% of the class passed the first test. What percent of those who passed the first test also passed the second test?

### Solution

From the above question, we can deduce the following:

• Let A be the event that each class passed the first test. Then P(A) = 0.45

• Let B be the event that each class passed the second test.

• The joint probability that each class passed both tests is P(A $\cap$ B) = 0.25.

• P(B | A) = ?

P(B | A) = P (A $\cap$ B) / P(A) = 0.25 / 0.45 = 0.60 = 60% of the class who passed the first class also passed the second class.

## Bayes’ theorem

On Wikipedia, Bayes Theorem is defined as:

“Bayes’ theorem (alternatively Bayes’ law or Bayes’ rule) describes the probability of an event, based on prior knowledge of conditions that might be related to the event.”

Bayes’ theorem is stated as seen below.

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

• $P(A | B)$ is the conditional probability of $A$ given $B$ has occurred. It is called the Posterior Probability.

• $P(B | A)$ is the conditional probability of $B$ given $A$ has occurred. It is called the Likelihood.

• $P(A)$ is the probability of $A$. It is called the Prior Probability.

• $P(B)$ is the probability of $B$. It is called the Evidence.

Get hands-on with 1200+ tech skills courses.