The Wayback Machine - https://web.archive.org/web/20250403100151/https://www.geeksforgeeks.org/conditional-probability/
Open In App

Conditional Probability

Last Updated : 02 Apr, 2025
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

Conditional probability defines the probability of an event occurring based on a given condition or prior knowledge of another event. Conditional probability is the likelihood of an event occurring, given that another event has already occurred. In probability this is denoted as A given B, expressed as P(A | B), indicating the probability of event A when the event B has already occurred.

Example :
We flip two coins. What is the probability that both are heads, given that at least one of them is heads?
We are given that there is at least one head. So there are three possibilities HH, HT, TH. Only one outcome has both coins as heads: HH.
So our answer is = 1/3

Conditional-Probability

Conditional Probability

Conditional Probability Formula

Let’s consider two events A and B, then the formula for the conditional probability of A when B has already occurred is given by:

[Tex]P(A | B) = \dfrac{P (A ∩ B)}{P(B)}[/Tex]

Where,
P (A ∩ B) represents the probability of both events A and B occurring simultaneously.
P(B) represents the probability of event B occurring.

Steps to Find Probability of One Event Given Another Has Already Occurred

To calculate the conditional probability, we can use the following step-by-step method:

Step 1: Identify the Events. Let’s call them Event A and Event B.
Step 2: Determine the Probability of Event A i.e., P(A)
Step 3: Determine the Probability of Event B i.e., P(B)
Step 4: Determine the Probability of Event A and B i.e., P(A ∩ B).
Step 5: Apply the Conditional Probability Formula and calculate the required probability.

Conditional Probability Examples

There are various examples of conditional probability as in real life all the events are related to each other and happening any event affects the probability of another event. For example, if it rains, the probability of road accidents increases as roads have less friction. Let’s consider some problem-based examples here:

1) Tossing a Coin
Let’s consider two events in tossing two coins,

A: Getting a head on the first coin.
B: Getting a head on the second coin.

Sample space for tossing two coins is:
S = {HH, HT, TH, TT}

The conditional probability of getting a head on the second coin (B) given that we got a head on the first coin (A) is = P(B|A)
Since the coins are independent (one coin’s outcome does not affect the other),
P(B|A) = P(B) = 0.5 (50%), which is the probability of getting a head on a single coin toss.

2) Drawing Cards

In a deck of 52 cards where two cards are being drawn, then let’s consider the events be.

  • A: Drawing a red card on the first draw, and
  • B: Drawing a red card on the second draw.

The conditional probability of drawing a red card on the second draw (B) given that we drew a red card on the first draw (A) is = P(B|A) 

After drawing a red card on the first draw, there are 25 red cards and 51 cards remaining in the deck.
So, P(B|A) = 25/51 ≈ 0.49 (approximately 49%).

Properties of Conditional Probability 

Some of the common properties of conditional property are:

1: Let’s consider an event A in any sample space S of an experiment.
P( S | A) = P(A | A) = 1

2: For any two events A and B of a sample space S, and an event X such that P(X) ≠ 0,
P((A ∪ B) | X) = P(A | X) + P(B | X) – P((A ∩ B) | X)

3: The order of sets or events is important in conditional probability, i.e.,
P(A | B) ≠ P(B | A)

4: The complement formula for probability only holds conditional probability if it is given in the context of the first argument in conditional probability i.e.,
P(A’ | B ) = 1 – P( A | B )
P(A | B’) ≠ 1 – P(A | B)

5: For any two or three independent events, the intersection of events can be calculated using the following formula:

  • For the intersection of two events A and B
    P(A ⋂ B) = P(A) P(B)
  • For the intersection of three events A, B, and C,
    P (A ⋂ B ⋂ C) = P(A) P(B) P(C)

Conditional Probability and Independent Events

With the help of conditional probability, we can tell apart dependent and independent events. When the probability of one event happening doesn’t influence the probability of any other event, then events are called independent, otherwise dependent events.

Conditional Probability of Independent Events

When two events are independent, those conditional probability is the same as the probability of the event individually i.e., P (A | B) is the same as P(A) as there is no effect of event B on the probability of event A. For independent events, A and B, the conditional probability of A and B concerning each other is given as follows:

  • P(B | A) = P(B)
  • P(A | B) = P(A)

Check, Probability Formulas

Conditional Probability vs Joint Probability vs Marginal Probability

The difference between Conditional Probability, Joint Probability, and Marginal Probability is given in the following table:

ParameterConditional ProbabilityJoint ProbabilityMarginal Probability
DefinitionThe probability of an event occurring is given.
That another event has already occurred.
The probability of two or more 
events occurring simultaneously.
The probability of an event occurring 
without considering any other events.
CalculationP (A | B)P (A ∩ B)P(A)
Variables involvedTwo or more eventsTwo or more eventsSingle event.

Conditional Probability and Bayes’ Theorem

Bayes’ Theorem is a key concept in probability theory that updates beliefs based on new evidence. It calculates the probability of a hypothesis being true given observed evidence, expressed as:

P(A∣B) = (P(B∣A) × P(A)) / P(B)

Where:

  • P(A∣B) is the updated probability of hypothesis A given evidence B (posterior probability).
  • P(B∣A) is the likelihood of evidence B given hypothesis A.
  • P(A) is the initial belief in hypothesis A (prior probability).
  • P(B) is the total probability of observing evidence B.

Bayes’ Theorem allows for iterative updates as new data is gathered, making it useful in fields like machine learning, medical diagnosis, and spam filtering. It provides a systematic approach to reasoning under uncertainty.

Here’s a breakdown of how Bayes’ Theorem works:

  • Prior Probability P(A): Initial belief in hypothesis A before evidence.
  • Likelihood P(B|A): Probability of observing evidence B if A is true.
  • Evidence P(B): Normalization factor, total probability of B across all hypotheses.
  • Posterior Probability P(A|B): Updated probability of A after considering evidence B.

Multiplication Rule of Probability

Multiplication Rule of Probability, when applied in the context of conditional probability, helps us calculate the probability of the intersection of two events when the probability of one event depends on the occurrence of the other event. This rule is crucial in understanding the joint probability of events under specific conditions.

In the context of conditional probability, the Multiplication Rule is often stated as follows:

P(A ∩ B) = P(A) × P(B ∣ A )

Here’s what each term represents:

  • P(A∩B): This denotes the probability that both events A and B occur simultaneously.
  • P(A): This represents the probability of event A happening.
  • P(B∣A): This is the conditional probability of event B occurring given that event A has already occurred.

How to Apply the Multiplication Rule?

To apply the Multiplication Rule in the context of conditional probability, we can use the following steps:

  • First, we calculate the probability of event A occurring.
  • Then, we compute the probability of event B occurring given that event A has occurred.
  • Multiplying these probabilities together gives us the joint probability of both events happening under the specified conditions.
  • This rule is particularly useful when dealing with events that are not independent, meaning that the occurrence of one event affects the probability of the other event.

Applications of Conditional Probability

Various applications of conditional probability are,

Finance and Risk Management

  • Example: Assessing the probability of default for a borrower given certain financial indicators.
  • Application: Banks and financial institutions use conditional probability to evaluate the risk associated with loans and investments.

Healthcare and Diagnostics

  • Example: Determining the probability of a patient having a specific disease given the results of diagnostic tests.
  • Application: Conditional probability is crucial in medical diagnoses and decision-making, helping healthcare professionals make informed decisions based on test results.

Marketing and Customer Relationship Management (CRM)

  • Example: Predicting the probability of a customer making a purchase based on their past buying behavior.
  • Application: Businesses use conditional probability to tailor marketing strategies, optimize customer experiences, and personalize product recommendations.

Machine Learning and Artificial Intelligence

  • Example: Predicting the likelihood of a user clicking on a particular ad based on their online behavior.
  • Application: Conditional probability is fundamental in machine learning algorithms for tasks such as classification, recommendation systems, and natural language processing.

Weather Forecasting

  • Example: Estimating the probability of rain tomorrow given today’s weather conditions.
  • Application: Meteorologists use conditional probability to make weather predictions based on historical data and current atmospheric conditions.

Solved Examples of Conditional Probability

Question 1: A bag contains 5 red balls and 7 blue balls. Two balls are drawn without replacement. What is the probability that the second ball drawn is red, given that the first ball drawn was red?
Solution:

Let the events be,

Event A: The first ball drawn is red.
Event B: The second ball drawn is red.

P(A) = 5/12 and P(B) = 4/11 (as first ball drawn is already red, thus only 4 red balls remain in the bag)

Therefore, probability of the second ball drawn being red given that the first ball drawn was red is 4/11.

Question 2: In a survey among a group of students, 70% play football, 60% play basketball, and 40% play both sports. If a student is chosen at random and it is known that the student plays basketball, what is the probability that the student also plays football?
Solution:

Let’s assume there are 100 students in the survey.

Number of students who play football = n(A) = 70
Number of students who play basketball = n(B) = 60
Number of students who play both sports = n(A ∩ B) = 40

To find the probability that a student plays football given that they play basketball, we use the conditional probability formula:
P(A|B) = n(A ∩ B) / n(B)

Substituting the values, we get:
P(A|B) = 40 / 60 = 2/3

Therefore, probability that a randomly chosen student who plays basketball also plays football is 2/3.

Question 3: In a certain city, it rains 30% of the day. A weather forecaster correctly predicts rain 80% of the time when it rains, and correctly predicts no rain 90% of the time when it doesn’t rain. If the forecast predicts rain, what is the probability that it will rain?
Solution:

Let R be the event that it rains, and F be the event that rain is forecast.

P(R|F) = P(F|R) × P(R) / P(F)
P(F) = P(F|R) × P(R) + P(F|not R) × P(not R) = 0.8 × 0.3 + 0.1 × 0.7 = 0.31
P(R|F) = (0.8 × 0.3) / 0.31 = 0.7742

Question 4: A fair die is rolled twice. Given that the sum of the two rolls is even, what is the probability that the first roll was an even number?
Solution:

There are 18 ways to get an even sum (out of 36 total outcomes).
12 of these 18 ways have an even number on the first roll.
P(First even | Sum even) = 12/18 = 2/3

Question 5: In a bag, there are 4 red balls and 6 blue balls. Two balls are drawn without replacement. What is the probability that the second ball is red, given that the first ball drawn was blue?
Solution:

After drawing a blue ball, there are 4 red balls and 5 blue balls left.
P(Second is red | First was blue) = 4 / (4 + 5) = 4/9 = 0.444

Articles Related to Conditional Probability:

Probability Theory

Addition Rule for Probability

Complement of a Set

Types of Events in Probability

Coin Toss Probability Formula

Mutually Exclusive Events

Resources related to Conditional Probability:

Conditional Probability – FAQs

What are some real-world examples of conditional probability?

  • The probability of a person having a specific disease given that they tested positive.
  • The probability of it raining today given that it is cloudy.
  • The probability of a student passing an exam given that they studied.

What is the difference between conditional probability and regular probability?

  • Regular probability, often referred to as unconditional probability, calculates the likelihood of an event occurring without any prior information and is the basic probability of an event in isolation.
  • Conditional probability takes into account additional information or the occurrence of another event to calculate the probability of a particular event.

Can the conditional probability be greater than 1?

No, conditional probability cannot be greater than 1 as the conditional probability is a type of probability. It can only be between 0 and 1.

Can the conditional probability be used in Bayesian inference?

Yes, conditional probability plays a crucial role in Bayesian inference, where prior beliefs are updated based on observed evidence using Bayes’ theorem.

Can the conditional probability be negative?

No, conditional probability cannot be negative as probabilities are always non-negative values between 0 and 1.


Suggested Quiz
10 Questions

What is the conditional probability formula used to compute P(A|B)?

  • P(A|B) = P(A ∩ B) + P(B)

  • P(A|B) = P(A ∩ B) / P(B)

  • P(A|B) = P(B ∩ A) - P(A)

  • P(A|B) = P(B) / P(A ∩ B)

Explanation:

Formula for Conditional Probability : P(A|B) = P(A ∩ B) / P(B)

In a scenario where two events A and B are independent, which statement is true regarding their conditional probabilities?

  • P(A|B) = P(A)

  • P(A|B) > P(A)

  • P(A|B) < P(A)

  • P(A|B) = P(A ∩ B)

Explanation:

When two events are independent the occurring or non occurring of an event does not affect the probability of the other event.

If the probability of event A is 0.4 and the probability of event B is 0.5, what is the maximum possible value of P(A ∩ B)?

  • 0.4

  • 0.5

  • 0.9

  • 0.2

Explanation:

The maximum possible value of P(A∩B) is the smaller of P(A) and P(B). Therefore:[Tex]P(A \cap B) \leq \min(0.4, 0.5) = 0.4[/Tex]

Given two events A and B, if P(A) = 0.7 and P(B) = 0.2, what is the minimum value of P(A ∩ B)?

  • 0.0

  • 0.2

  • 0.5

  • 0.1

Explanation:

In case of mutually exclusive events where the sample space do not overlap then P(A ∩ B) = 0

As there are zero sample space corresponding to both event simultaneously.

In a situation where the probability of event A is 0.3 and the probability of event B is 0.4, and they are independent, what is P(A ∩ B)?

  • 0.12

  • 0.7

  • 0.1

  • 0.5

Explanation:

In case of independent events P(A ∩ B) = P(A) × P(B)
then P(A ∩ B) = 0.4 × 0.3 = 0.12

If the probability of event B occurring is 0.6, and the conditional probability of event A given B is 0.5, what is the probability of both A and B occurring?

  • 0.3

  • 0.5

  • 0.6

  • 0.2

Explanation:

By using the formula of conditional probability: [Tex]P(A|B) = \frac{P(A \cap B)}{P(B)}[/Tex]

P(A|B) = 0.5
P(B) = 0.6

then putting these values in the formula
0.5 = [Tex]\frac{P(A\cap B)}{0.6}[/Tex]

[Tex]P(A\cap B) = 0.5 \times 0.6 = 0.30 [/Tex]

[Tex]P(A \cap B) = 0.3[/Tex]

In a group of 100 students, 60 play cricket, 50 play football, and 30 play both. If a student is selected at random, what is the probability that the student plays cricket given that the student plays football?

  • 0.15

  • 0.30

  • 0.6

  • 0.18

Explanation:

C = playing cricket
F = playing football.

P(F)=10050​=0.5.
Number of students playing both = 30.
P(C∩F)=10030​=0.3.

Probability that a student plays cricket given they play football: P(C∣F)=P(F)P(C∩F)​=0.50.3​=0.6

Conditional Probability: In a class, 60% of the students are girls, and 70% of the students like math. If 80% of the girls like math, what is the probability that a randomly selected math-loving student is a girl?

  • 0.68

  • 0.25

  • 0.50

  • 0.42

Explanation:

G = student is a girl
M = student likes math.

We need to find P(G∣M).

Given:
P(G)=0.6
P(M)=0.7
P(M∣G)=0.8

Using Bayes' theorem:
[Tex] P(G \mid M) = \frac{P(M \mid G) \cdot P(G)}{P(M)} = \frac{0.8 \times 0.6}{0.7} = \frac{0.48}{0.7} \approx 0.686[/Tex]

A factory has two machines producing widgets. Machine A produces 60% of the widgets, and Machine B produces 40%. 3% of the widgets produced by Machine A are defective, and 5% of the widgets produced by Machine B are defective. If a randomly selected widget is defective, what is the probability that it was produced by Machine A?

  • 0.47

  • 0.018

  • 0.012

  • 0.047

Explanation:

A = widget is from Machine A
D = widget is defective.

Given:
P(A)=0.6
P(D∣A)=0.03
P(D∣B)=0.05
We need to find P(A∣D).

Using Bayes' theorem:
[Tex]P(A \mid D) = \frac{P(D \mid A) \cdot P(A)}{P(D)} [/Tex]

where, [Tex]P(D) = P(D \mid A) \cdot P(A) + P(D \mid B) \cdot P(B)[/Tex]
[Tex]P(D) = 0.03 \cdot 0.6 + 0.05 \cdot 0.4 = 0.018 + 0.02 = 0.038[/Tex]
[Tex]P(A \mid D) = \frac{0.03 \times 0.6}{0.038} = \frac{0.018}{0.038} \approx 0.474[/Tex]

If the probability of event A is 0.2 and the probability of event B is 0.3, what is the probability of A or B occurring if A and B are mutually exclusive?

  • 0.5

  • 0.6

  • 0.2

  • 0.3

Explanation:

For mutually Exclusive events P(A or B) = P(A) + P(B)

P(A or B) = 0.3 + 0.2 = 0.5

Quiz Completed Successfully
Your Score :   2/10
Accuracy :  0%
Login to View Explanation
1/10 1/10 < Previous Next >

Next Article

Similar Reads

three90RightbarBannerImg