Back to homeMathematics · Algebra 2 · Change subject
Start for free
Algebra 2 · Mathematics
Probability · Probability

Conditional Probability

Before you start, make sure you know: Dependence (Geometry)
Before you start, make sure you know: Trees (Geometry)

Your school's email filter flags a message as "suspicious." The filter catches 90% of spam, so is there a 90% chance this message is spam? Surprisingly, no. The answer depends on how much spam there is in the first place, and on how often the filter flags good emails by mistake. This page gives you the tools to get the real answer: conditional probability, the law of total probability, and Bayes' theorem. We'll come back to the filter at the end.

Conditional probability: P(A|B)

"What's the probability it rains today?" is a different question from "What's the probability it rains today, given that the sky is full of dark clouds?" Extra information changes the odds. We write the second one as $P(\text{rain} \mid \text{clouds})$ and read it "the probability of rain given clouds."

Why divide by $P(B)$? Because $B$ is now the whole world. Of all the outcomes inside $B$, we ask what fraction are also in $A$. When all outcomes are equally likely, this is just a count: $P(A \mid B) = \dfrac{\text{number in } A \cap B}{\text{number in } B}$.

Venn-style diagram of a 52-card deck: the 12 face cards form the new sample space, and the 4 kings are inside it. S = standard deck (52 cards) B: face cards (12) A∩B: kings (4)
Practice★☆☆Not started
A card is drawn at random from a 40-card Spanish deck. We consider the events $A$: "drawing a king" and $B$: "drawing a face card" (jack, knight, or king). Calculate the…

A card is drawn at random from a 40-card Spanish deck. We consider the events $A$: "drawing a king" and $B$: "drawing a face card" (jack, knight, or king). Calculate the probability that the card is a king knowing that a face card has been drawn, that is, determine $P(A|B)$.

S C R Sample space: Deck (40) Event B: Face cards (12) Event A (4) 4 Jacks 4 Knights 4 Kings P(A|B) = 4 12
Solve
Practice★☆☆Not started
Given two events $A$ and $B$ of a random experiment, it is known that the probability of their intersection is $P(A \cap B) = 0,12$ and that the probability of event $B$…

Given two events $A$ and $B$ of a random experiment, it is known that the probability of their intersection is $P(A \cap B) = 0,12$ and that the probability of event $B$ is $P(B) = 0,4$. Calculate the probability that $A$ occurs knowing that $B$ has occurred.

Solve
Practice★☆☆Not started
In a group of friends, $60\%$ use Spotify ($S$), $40\%$ use Netflix ($N$) and $20\%$ use both platforms. If we choose a person who we know uses Netflix, what is the…

In a group of friends, $60\%$ use Spotify ($S$), $40\%$ use Netflix ($N$) and $20\%$ use both platforms. If we choose a person who we know uses Netflix, what is the probability that they also use Spotify?

Solve

Two-way tables

When data come from a survey that sorts people by two categories (grade and favorite app, or gender and sport), a two-way table is the easiest place to read conditional probabilities. Some problems call it a contingency table. The condition tells you which row or column to look at, and that row or column's total is your denominator.

Here are 100 students sorted by gender and whether they play a school sport:

Plays a sport ($S$) No sport ($N$) Total
Girls ($G$) 30 20 50
Boys ($B$) 36 14 50
Total 66 34 100
Two-way table of 100 students by gender and sport, with the Girls row highlighted as the new sample space. Sport No sport Total Girls Boys Total 30 20 50 36 14 50 66 34 100 P(S | girl) = 30 out of the 50 girls
Practice★☆☆Not started
A survey was conducted among 100 high school juniors about their preference between two social media platforms. The data is collected in the following contingency table:…

A survey was conducted among 100 high school juniors about their preference between two social media platforms. The data is collected in the following contingency table:

Instagram ($I$) TikTok ($T$) Total
Girls ($M$) 40 25 65
Boys ($H$) 15 20 35
Total 55 45 100

If we choose a student at random and they turn out to be a girl, what is the probability that she prefers TikTok? Calculate $P(T|M)$.

Solve
Practice★★☆Not started
A study has been carried out in a high school in Chicago on the leisure habits of $100$ 11th-grade students. The data has been collected in the following contingency…

A study has been carried out in a high school in Chicago on the leisure habits of $100$ 11th-grade students. The data has been collected in the following contingency table, classifying the students by their gender and their preferred social media platform (Instagram or TikTok):

Instagram ($I$) TikTok ($T$) Total
Girls ($M$) $35$ $25$ $60$
Boys ($H$) $15$ $25$ $40$
Total $50$ $50$ $100$

If we choose a student at random, calculate the following probabilities using conditional probability notation:

  1. a) That they prefer TikTok, knowing that they are a girl.
  2. b) That they are a boy, given that their preferred social media platform is Instagram.
  3. c) Are the events "being a boy" ($H$) and "preferring Instagram" ($I$) independent? Justify your answer by comparing $P(I/H)$ with $P(I)$.
Instagram (I) TikTok (T) Total Girls (M) Boys (H) Total 35 25 60 15 25 40 50 50 100
Solve

The multiplication rule and tree diagrams

Solve the definition for $P(A \cap B)$ and you get a rule for "$A$ and $B$." It is the key tool for experiments that happen in stages, like drawing two cards in a row.

Many problems say with replacement or without replacement. Without replacement, the first draw changes what is left, so the second probability is conditional on the first. With replacement, nothing changes.

Tree diagram for the first two songs of a shuffle without repeats, with the probability of each of the four paths. 5/8 3/8 4/7 3/7 5/7 2/7 F N F, F: 5/8 · 4/7 = 5/14 F, N: 5/8 · 3/7 = 15/56 N, F: 3/8 · 5/7 = 15/56 N, N: 3/8 · 2/7 = 3/28

Check: the four paths add to $\frac{20}{56} + \frac{15}{56} + \frac{15}{56} + \frac{6}{56} = 1$.

When a problem says the first card drawn was one specific card (like "the ace of coins"), the first stage is already known. You only need the second stage: remove that card, count what is left, and divide. For a 40-card deck, that leaves $39$ cards, with $3$ aces.

Practice★☆☆Not started
In a language center, $30\%$ of the students study French ($F$). Of these, $60\%$ are high school students ($B$). If we select a student at random from the center's…

In a language center, $30\%$ of the students study French ($F$). Of these, $60\%$ are high school students ($B$). If we select a student at random from the center's list, what is the probability that they study French and are a high school student? Use the conditional probability formula: $P(F \cap B) = P(F) \cdot P(B|F)$.

Solve
Practice★☆☆Not started
We draw two cards from a Spanish deck without replacement. Calculate the probability that the second card is an ace, knowing that the first card drawn was the ace of…

We draw two cards from a Spanish deck without replacement. Calculate the probability that the second card is an ace, knowing that the first card drawn was the ace of coins.

1st Draw 1 1 Ace of Coins WITHOUT REPLACEMENT −1 total card −1 ace Remaining deck 39 cards 3 aces 2nd Draw P(As₂ | As₁) = ?
Solve
Practice★★☆Not started
A toolbox contains $12$ LED bulbs, of which $4$ are defective. If we draw two bulbs from the box consecutively and without replacement, calculate the probability of the…

A toolbox contains $12$ LED bulbs, of which $4$ are defective. If we draw two bulbs from the box consecutively and without replacement, calculate the probability of the following events:

  1. a) That the second bulb is defective, knowing that the first one drawn worked correctly.
  2. b) That both bulbs are defective.
  3. c) That at least one of the two bulbs works correctly.
Solve

Independence and the probability rules

That last question points to a big idea. If knowing $B$ doesn't change the probability of $A$, the events are independent.

To test independence, compare $P(A \cap B)$ with $P(A)P(B)$. To get $P(A \cap B)$ from other information, you often need these rules:

The splitting rule says the part of $B$ outside $A$ is "all of $B$ minus the overlap." A Venn diagram makes all four rules easy to see.

Venn diagram with A only 0.2, both 0.4, B only 0.1, and neither 0.3. A B 0.2 0.4 0.1 0.3

Sometimes a problem calls two events compatible when they can happen together, that is, when $P(A \cap B) > 0$. Events that cannot happen together are mutually exclusive.

Practice★★☆Not started
Let $A$ and $B$ be two events of a random experiment such that $P(A) = 0,5$, $P(B) = 0,7$ and $P(A \cup B) = 0,85$. a) Calculate $P(A \cap B)$. b) Find the probability…

Let $A$ and $B$ be two events of a random experiment such that $P(A) = 0,5$, $P(B) = 0,7$ and $P(A \cup B) = 0,85$.

  1. a) Calculate $P(A \cap B)$.
  2. b) Find the probability that $A$ occurs knowing that $B$ has occurred.
  3. c) Determine whether events $A$ and $B$ are compatible and whether they are independent.
Solve
Practice★★☆Not started
Two fair six-sided dice with faces numbered from $1$ to $6$ are rolled. We consider the following events: $S$: "The sum of the numbers rolled is equal to $7$". $A$: "An…

Two fair six-sided dice with faces numbered from $1$ to $6$ are rolled. We consider the following events:

  • $S$: "The sum of the numbers rolled is equal to $7$".

  • $A$: "An even number has been rolled on the first die".

Calculate:

  1. a) The sample space of the sum of the numbers rolled and the probability of event $S$.
  2. b) The probability that the sum is $7$ knowing that an even number has been rolled on the first die, $P(S/A)$.
  3. c) Does the fact that the first die is even influence the probability that the sum is $7$? Justify whether the events are dependent or independent.
Die 2 1 2 3 4 5 6 Die 1 1 2 3 4 5 6 Event A (Die 1 even) Event S (Sum = 7) S ∩ A (Sum 7 and Even) Sample space (36)
Solve
Practice★★★Not started
Let $A$ and $B$ be two events of the same random experiment such that the following probabilities are known: $P(A^C \cup B^C) = 0,8$ $P(A^C | B) = 0,5$…

Let $A$ and $B$ be two events of the same random experiment such that the following probabilities are known:

  • $P(A^C \cup B^C) = 0,8$

  • $P(A^C | B) = 0,5$

  • $P(A \cup B) = 0,75$

Calculate, justifying each step using the properties of probability:

  1. a) $P(A \cap B)$
  2. b) $P(B)$
  3. c) $P(A)$
  4. d) Determine with reasoning whether events $A$ and $B$ are independent.
E A B A ∩ Bᶜ Aᶜ ∩ B A ∩ B Aᶜ ∩ Bᶜ
Solve

The law of total probability

Sometimes an outcome can arrive by several different routes. To find its overall probability, find the probability of each route and add them up.

Tree diagram with three routes to school (bike 0.5, bus 0.3, car 0.2) and the probability of being late on each route. bike 0.5 bus 0.3 car 0.2 late 0.10 late 0.20 late 0.05 0.5 × 0.10 = 0.05 0.3 × 0.20 = 0.06 0.2 × 0.05 = 0.01

Some problems add a transfer step before the final draw. The trick is to let the first stage be the partition, and work out the final probability separately for each case.

Practice★★☆Not started
In a language academy, $40\%$ of the students study French ($F$), $30\%$ study German ($G$) and the rest study Italian ($I$). It is known that the percentage of students…

In a language academy, $40\%$ of the students study French ($F$), $30\%$ study German ($G$) and the rest study Italian ($I$). It is known that the percentage of students who pass the final exam is $60\%$ in French, $50\%$ in German and $80\%$ in Italian.

  1. a) If we choose a student who has passed the exam, what is the probability that they study German?
  2. b) If we choose a student at random, what is the probability that they have not passed the exam?
Solve
Practice★★★Not started
We have two urns with the following composition: Urn A: 4 red balls and 6 blue balls. Urn B: 7 red balls and 3 blue balls. The experiment consists of rolling a fair…

We have two urns with the following composition:

  • Urn A: 4 red balls and 6 blue balls.

  • Urn B: 7 red balls and 3 blue balls.

The experiment consists of rolling a fair six-sided die. If a prime number is rolled, we draw a ball from Urn A and place it in Urn B without looking at its color; then, we draw a ball from Urn B. If a non-prime number is rolled, we directly draw a ball from Urn B.

Calculate the probability that the final ball drawn from Urn B is red.

Probability experiment Prime rolled (2, 3, 5) Non-prime (1, 4, 6) Urn A 4 Red, 6 Blue Urn B 7 Red, 3 Blue Urn B 7 Red, 3 Blue Transfer 1 ball (without looking) ? Draw ball Draw ball Probability that the drawn ball is RED P( ) = ?
Solve
Practice★★★Not started
A streaming* platform uses three servers ($S_1, S_2, S_3$) to distribute its content. $40\%$ of the traffic is managed from $S_1$, $35\%$ from $S_2$ and the rest from…

A streaming platform uses three servers ($S_1, S_2, S_3$) to distribute its content. $40\%$ of the traffic is managed from $S_1$, $35\%$ from $S_2$ and the rest from $S_3$. Due to network load, micro-cuts in playback occur with the following probabilities:

  • On server $S_1$, the probability of a micro-cut is $2\%$.

  • On server $S_2$, the probability of a micro-cut is $5\%$.

  • On server $S_3$, the probability of a micro-cut is $8\%$.

  1. a) If a user is watching a show, what is the probability that they experience a micro-cut?
  2. b) If a user calls technical support reporting a micro-cut, what is the probability that their connection is being served by server $S_3$?
0.40 0.35 0.25 0.02 0.98 0.05 0.95 0.08 0.92 Traffic S₁ S₂ S₃ Micro-cut OK Micro-cut OK Micro-cut OK
Solve

Bayes' theorem

The law of total probability goes from causes to an effect. Bayes' theorem goes backward: if you see the effect, how likely is each cause? It turns $P(A \mid B_i)$ into $P(B_i \mid A)$.

Now let's close the loop on the spam filter. Suppose $10\%$ of emails are spam, the filter flags $90\%$ of spam, and it also flags $5\%$ of legitimate emails by mistake.

Think of $1{,}000$ emails: $100$ are spam and $90$ of those get flagged. Of the $900$ legitimate ones, $45$ get flagged. That makes $135$ flagged emails, and only $90$ of them are spam.

Bar showing the 135 flagged emails out of 1,000: 90 are spam and 45 are legitimate. All 135 flagged emails spam: 90 legit: 45 P(spam | flagged) = 90 / 135 = 2/3

So back to the start: the filter's $90\%$ is $P(\text{flagged} \mid \text{spam})$, not $P(\text{spam} \mid \text{flagged})$. Because legitimate email is so common, its false alarms are a big share of all flags.

Practice★★☆Not started
A medical study indicates that the probability of a person from a certain population having a spring allergy is $0,15$. A test has been developed to detect it, but it is…

A medical study indicates that the probability of a person from a certain population having a spring allergy is $0,15$. A test has been developed to detect it, but it is not perfect:

  • If a person has an allergy, the test is positive in $95\%$ of cases.

  • If a person does not have an allergy, the test is positive (false positive) in $4\%$ of cases.

If a person is chosen at random and the test is positive, what is the probability that they actually have an allergy?

Solve
Practice★★☆Not started
On a streaming platform, $20\%$ of users prefer horror movies, $50\%$ prefer comedies and $30\%$ prefer dramas. The data analysis department has observed that the…

On a streaming platform, $20\%$ of users prefer horror movies, $50\%$ prefer comedies and $30\%$ prefer dramas. The data analysis department has observed that the probability of a user finishing watching a full movie depends on the genre:

  • Horror: $0,6$

  • Comedy: $0,8$

  • Drama: $0,7$

If we select a user at random and see that they have left a movie halfway through (they have not finished it), what is the probability that the movie was a horror movie?

Solve
Practice★★★Not started
In a cybersecurity laboratory, an artificial intelligence algorithm analyses emails to detect phishing*. It is known that: $5\%$ of the emails the company receives are…

In a cybersecurity laboratory, an artificial intelligence algorithm analyses emails to detect phishing. It is known that:

  • $5\%$ of the emails the company receives are scam attempts (phishing).

  • If an email is phishing, the algorithm correctly identifies it as "suspicious" in $98\%$ of cases.

  • If an email is legitimate, the algorithm makes a mistake and marks it as "suspicious" in $3\%$ of occasions (false positive).

If an employee receives a "suspicious email" alert in their inbox:

  1. a) What is the real probability that the email is actually a phishing attempt?
  2. b) If the algorithm indicates that the email is "safe", what is the probability that it is a mistake and is actually phishing?
0.05 0.95 0.98 0.02 0.03 0.97 Phishing Legitimate Suspicious Safe Suspicious Safe 0.05 × 0.98 = 0.0490 0.05 × 0.02 = 0.0010 0.95 × 0.03 = 0.0285 0.95 × 0.97 = 0.9215
Solve

Putting it all together

Multi-part problems usually use several tools in a row. Match the question to the tool:

Four-row guide matching each type of question to the right probability tool. Given a condition? Use P(A | B) = P(A ∩ B) / P(B) Stages in a row? Multiply along the branches Several causes? Add all the paths (total probability) Know P(effect | cause), want P(cause | effect)? Bayes

Some problems use letters instead of numbers, such as "knows the answer with probability $p$, guesses among $k$ options." Do the same steps, then simplify the algebra with a common denominator. A good check is to plug in simple numbers like $p = 0$ or $p = 1$ and see if the answer makes sense.

When a problem asks you to compare two probabilities or decide whether someone's claim is true, compute both numbers and compare them. A short sentence of justification is part of the answer.

Practice★★★Not started
In an Esports competition, a League of Legends* player has a $70\%$ probability of winning if they choose their favorite character (Main*). If they do not choose it,…

In an Esports competition, a League of Legends player has a $70\%$ probability of winning if they choose their favorite character (Main). If they do not choose it, their probability of winning drops to $45\%$. The matchmaking system allows the player to get their favorite character $60\%$ of the time.

  1. a) Calculate the probability that the player wins their next match.
  2. b) Knowing that the player has lost the match, what is the probability that they were not able to play with their favorite character?
  3. c) Are the events "winning the match" and "playing with the favorite character" independent? Justify your answer by comparing probabilities.
Solve
Practice★★★Not started
A logistics company has two routes to deliver orders in the city center. Route A is used $70\%$ of the time and route B the remaining $30\%$. Due to traffic, on route A…

A logistics company has two routes to deliver orders in the city center. Route A is used $70\%$ of the time and route B the remaining $30\%$.

  • Due to traffic, on route A the delivery driver arrives late $15\%$ of the days.

  • On route B, the delivery driver arrives late $25\%$ of the days.

On a given day, the manager observes that an order has arrived late. The delivery driver states: "If I had taken route A, the probability of arriving on time would have been greater than the probability of having come today via route A given that I arrived late". Prove mathematically whether the delivery driver's statement is true or false by calculating both probabilities.

Solve
Practice★★★Not started
In a multiple-choice exam, a student knows the correct answer to a question with probability $p$ and guesses it at random with probability $1-p$. Each question has $k$…

In a multiple-choice exam, a student knows the correct answer to a question with probability $p$ and guesses it at random with probability $1-p$. Each question has $k$ answer options, of which only one is correct.

  1. a) Show that the probability that the student answers the question correctly is $\frac{1 + (k-1)p}{k}$.
  2. b) Knowing that the student has answered correctly, what is the probability that they actually knew the answer and did not guess it at random? Express the result in terms of $p$ and $k$.
  3. c) If a question has 4 options ($k=4$) and the student has a $50\%$ probability of knowing the answer ($p=0,5$), calculate the numerical value of the previous section and interpret it.
Event: Answers correctly Question Knows the answer Guesses at random Correct Correct Incorrect p 1 - p 1 1/k (k-1)/k ... k options (1 correct)
Solve

Summary

See all the exercises in this section