3.6 Conditional Probability

LEARNING OBJECTIVES

  • Calculate conditional probabilities.
  • Determine if two events are independent.

A conditional probability is the probability of an event [latex]A[/latex] given that another event [latex]B[/latex] has already occurred.  The idea behind conditional probability is that it reduces the sample space to the part of the sample space that involves just the given event [latex]B[/latex]—except for the event [latex]B[/latex], everything else in the sample space is throw away.  Once the sample space is reduced to the given event [latex]B[/latex], we calculate the probability of [latex]A[/latex] occurring within the reduced sample space.

The conditional probability of [latex]A[/latex] given [latex]B[/latex] is written as [latex]P(A|B)[/latex] and is read “the probability of [latex]A[/latex] given [latex]B[/latex].”

Recognizing a conditional probability and identifying which event is the given event can be challenging.  The following sentences are all asking the same conditional probability just in different ways:

  • What is the probability a student has a smartphone given that the student has a tablet?
  • If a student has a tablet, what is the probability the student has a smartphone?
  • What is the probability that a student with a tablet has a smartphone?

The given event is “has a tablet,” so in calculating the conditional probability we would restrict the sample space to just those students that have a tablet and then find the probability a student has a smartphone from among just those students with a tablet.

NOTE

The conditional probability [latex]P(A|B)[/latex] is NOT the same as [latex]P(A \mbox{ and }B)[/latex].

  • In the conditional probability [latex]P(A|B)[/latex] we want to find the probability of [latex]A[/latex] occurring after [latex]B[/latex] has already happened.  In the conditional probability the sample space is restricted to just event [latex]B[/latex] before we calculate the probability of [latex]A[/latex] in the restricted sample space.
  • In [latex]P(A \mbox{ and }B)[/latex] we want to find the probability of events [latex]A[/latex] and [latex]B[/latex] happening at the same time in the unrestricted sample space.

EXAMPLE

Suppose a study of speeding violations and drivers who use cell phones produced the following fictional data:

Speeding violation in the last year No speeding violation in the last year Total
Cell phone user 25 280 305
Not a cell phone user 45 405 450
Total 70 685 755
  1. What is the probability that a randomly selected person is a cell phone user given that they had no speeding violations in the last year?
  2. If a randomly selected person does not have a cell phone, what is the probability they had a speeding violation last year?
  3. What is the probability that someone with a cell phone did not have a speeding violation last year?

Solution:

  1. The given event is “no speeding violations,” so we restrict the table to just the column involving “no speeding violations.”  With this restriction, the table would look like this:
    No speeding violation in the last year
    Cell phone user 280
    Not a cell phone user 405
    Total 685

    Now, we want to find the probability a person is a cell phone user in this restricted sample space:

    [latex]\begin{eqnarray*}  P(\mbox{cell phone}|\mbox{no violations}) & = & \frac{\mbox{number of cell phone users in restricted sample space}}{\mbox{total number in restricted sample space}} \\ & = & \frac{280}{685} \\ \\ \end{eqnarray*}[/latex]

  2. The given event is “no cell phone,” so we restrict the table to just the row involving “no cell phone.”  With this restriction, the table would look like this:
    Speeding violation in the last year No speeding violation in the last year Total
    Not a cell phone user 45 405 450

    Now, we want to find the probability a person has a speeding violation in the last year in this restricted sample space:

    [latex]\begin{eqnarray*}  P(\mbox{violation}|\mbox{no cell phone}) & = & \frac{\mbox{number of violations in restricted sample space}}{\mbox{total number in restricted sample space}} \\ & = & \frac{45}{450} \\ \\ \end{eqnarray*}[/latex]

  3. The given event is “cell phone,” so we restrict the table to just the row involving “cell phone.”  With this restriction, the table would look like this:
    Speeding violation in the last year No speeding violation in the last year Total
    Cell phone user 25 280 305

    Now, we want to find the probability a person does not have a speeding violation in the last year in this restricted sample space:

    [latex]\\ \begin{eqnarray*} P(\mbox{no violations}|\mbox{cell phone}) & = & \frac{\mbox{number with no violations in restricted sample space}}{\mbox{total number in restricted sample space}} \\ & = & \frac{280}{305} \end{eqnarray*}[/latex]

NOTE

The conditional probability [latex]P(A|B)[/latex] does not equal the conditional probability [latex]P(B|A)[/latex].  In the above example, [latex]\displaystyle{P(\mbox{cell phone}|\mbox{no violations}) = \frac{280}{685}}[/latex] does not equal [latex]\displaystyle{ P(\mbox{no violations}|\mbox{cell phone}) =\frac{280}{305}}[/latex].

TRY IT

This table shows the number of athletes who stretch before exercising and how many had injuries within the past year.

Injury in last year No injury in last year Total
Stretches 55 295 350
Does not stretch 231 219 450
Total 286 514 800
  1. What is the probability that a randomly selected athlete stretches before exercising given that they had an injury last year?
  2. What is the probability that a randomly selected athlete that had no injuries in the last year does not stretch before exercising?
  3. If a randomly selected athlete does not stretch before exercising, what is the probability they had an injury in the last year?
Click to see Solution
  1. [latex]\displaystyle{\mbox{Probability}=\frac{55}{286}}[/latex]
  2. [latex]\displaystyle{\mbox{Probability}=\frac{219}{514}}[/latex]
  3. [latex]\displaystyle{\mbox{Probability}=\frac{231}{450}}[/latex]

Calculating Conditional Probabilities Using the Formula

When working with a contingency table as in the above examples, we can simply calculate conditional probabilities by restricting the table to the given event and then finding the required probability in the restricted sample space.  Depending on the situation, it might not be possible to workout a conditional probability this way.  In these situations we can use the following formula to find a conditional probability:

[latex]\begin{eqnarray*} \\ P(A|B) & = & \frac{P(A \mbox{ and }B)}{P(B)} \\ \\ \end{eqnarray*}[/latex]

EXAMPLE

At a local language school, 40% of the students are learning Spanish, 20% of the students are learning German and 8% of the students are learning both Spanish and German.

  1. What is the probability that a randomly selected student is learning Spanish given that they are learning German?
  2. What is the probability that a randomly selected Spanish student is learning German?

Solution:

  1. [latex]\displaystyle{P(\mbox{Spanish}|\mbox{German})  =   \frac{P(\mbox{Spanish and German})}{P(\mbox{German})}  =  \frac{0.08}{0.2} =  0.4}[/latex]
  2. [latex]\displaystyle{P(\mbox{German}|\mbox{Spanish}) = \frac{P(\mbox{Spanish and German})}{P(\mbox{Spanish})}= \frac{0.08}{0.4} = 0.2}[/latex]

EXAMPLE

There are 50 students enrolled in the second year of a business degree program.  During this semester, the students have to take some elective courses.  18 students decide to take an elective in psychology, 27 students decide to take an elective in philosophy, and 10 students decide to take an elective in both psychology and philosophy.

  1. What is the probability that a student takes an elective in psychology given that they take an elective in philosophy?
  2. If a student takes an elective in psychology, what is the probability that they take an elective in philosophy?

Solution:

  1. [latex]\displaystyle{P(\mbox{psychology}|\mbox{philosohpy})  =  \frac{P(\mbox{psychology and philosophy})}{P(\mbox{philosophy})} = \frac{\frac{10}{50}}{\frac{27}{50}} = 0.3704}[/latex]
  2. [latex]\displaystyle{P(\mbox{philosophy}|\mbox{psychology}) = \frac{P(\mbox{psychology and philosophy})}{P(\mbox{philosophy})} = \frac{\frac{10}{50}}{\frac{18}{50}} = 0.5556}[/latex]

TRY IT

At a local basketball game, 70% of the fans are cheering for the home team, 25% of the fans are wearing blue, and 12% of the fans are cheering for the home team and wearing blue.

  1. What is the probability that a randomly selected fan is cheering for the home team given that they are wearing blue?
  2. If a randomly selected fan is cheering for the home team, what is the probability they are wearing blue?
Click to see Solution

 

  1. [latex]\displaystyle{P(\mbox{home team}|\mbox{blue}) =\frac{0.12}{0.25}=0.48}[/latex]
  2. [latex]\displaystyle{P(\mbox{blue}|\mbox{home team}) =\frac{0.12}{0.7}=0.1714}[/latex]

Independent Events

Two events are independent if the probability of the occurrence of one of the events does not affect the probability of the occurrence of the other event.  In other words, two events [latex]A[/latex] and [latex]B[/latex] are independent if the knowledge that one of the events occurred does not affect the chance the other event occurs.  For example, the outcomes of two roles of a fair die are independent events—the outcome of the first roll does not change the probability of the outcome of the second roll.  If two events are not independent, then we say the events are dependent.

We can test two events [latex]A[/latex] and [latex]B[/latex] for independence by comparing [latex]P(A)[/latex] and [latex]P(A|B)[/latex]:

  • If [latex]P(A)=P(A|B)[/latex], then the events [latex]A[/latex] and [latex]B[/latex] are independent.
  • If [latex]P(A) \neq P(A|B)[/latex], then the events [latex]A[/latex] and [latex]B[/latex] are dependent.

EXAMPLE

At a local language school, 40% of the students are learning Spanish, 20% of the students are learning German and 8% of the students are learning both Spanish and German.  Are the events “Spanish” and “German” independent?  Explain.

Solution:

To check for independence, we need to check two probabilities:  [latex]P(\mbox{Spanish})[/latex] and [latex]P(\mbox{Spanish}|\mbox{German})[/latex].  If these probabilities are equal, the events are independent.  If the probabilities are not equal, the events are dependent.

From the information provided in the question, [latex]P(\mbox{Spanish})=0.4[/latex].  Previously, we calculated [latex]P(\mbox{Spanish}|\mbox{German})[/latex]:

[latex]\begin{eqnarray*} \\ P(\mbox{Spanish}|\mbox{German}) & = &  \frac{P(\mbox{Spanish and German})}{P(\mbox{German})}  \\ & = &  \frac{0.08}{0.2} \\ & = &0.4 \\ \\ \end{eqnarray*}[/latex]

We can see that [latex]P(\mbox{Spanish})=P(\mbox{Spanish}|\mbox{German})[/latex].  Because these two probabilities are equal, the events “Spanish” and “German” are independent.  This means that the probability a student is taking Spanish does not affect the probability a student is taking German.

EXAMPLE

Suppose a study of speeding violations and drivers who use cell phones produced the following fictional data:

Speeding violation in the last year No speeding violation in the last year Total
Cell phone user 25 280 305
Not a cell phone user 45 405 450
Total 70 685 755

Are the events “cell phone user” and “speeding violation in the last year” independent?  Explain.

Solution:

To check for independence, we need to check two probabilities:  [latex]P(\mbox{cell phone})[/latex] and [latex]P(\mbox{cell phone}|\mbox{speeding violation})[/latex].  If these probabilities are equal, the events are independent.  If the probabilities are not equal, the events are dependent.

[latex]\begin{eqnarray*} \\ P(\mbox{cell phone}) & = & \frac{305}{755} \\ & = & 0.4040 \\  \\ P(\mbox{cell phone}|\mbox{speeding violation})  & = & \frac{25}{70} \\ & = & 0.03571 \\  \\ \end{eqnarray*}[/latex]

We can see that [latex]P(\mbox{cell phone}) \neq P(\mbox{cell phone}|\mbox{speeding violation})[/latex].  Because these probabilities are not equal, the events “cell phone user” and “speeding violation” are dependent.  This means that the probability a person is a cell phone user does affect the probability the person had a speeding violation in the last year.

TRY IT

At a local basketball game, 70% of the fans are cheering for the home team, 25% of the fans are wearing blue, and 12% of the fans are cheering for the home team and wearing blue.  Are the events “cheering for the home team” and “wearing blue” independent?  Explain.

 

Click to see Solution

 

Because [latex]\displaystyle{P(\mbox{home team})=0.7}[/latex] does not equal [latex]\displaystyle{P(\mbox{home team}|\mbox{blue}) =\frac{0.12}{0.25}=0.48}[/latex], the events “cheering for the home team” and “wearing blue” are dependent.

TRY IT

This table shows the number of athletes who stretch before exercising and how many had injuries within the past year.

Injury in last year No injury in last year Total
Stretches 55 295 350
Does not stretch 231 219 450
Total 286 514 800

Are the events “does not stretch” and “injury in last year” independent?  Explain.

 

Click to see Solution

 

Because [latex]\displaystyle{P(\mbox{no stretch})=\frac{450}{800}=0.5625}[/latex] does not equal [latex]\displaystyle{P(\mbox{no stretch}|\mbox{injury}) =\frac{219}{514}=0.4261}[/latex], the events “does not stretch” and “injury in last year” are dependent.

Sampling may be done with replacement or without replacement, which effects whether or not events are considered independent or dependent.

  • With replacement:  If each member of a population is replaced after it is picked, then that member has the possibility of being chosen more than once.  When sampling is done with replacement, then events are considered to be independent because the result of the first pick will not change the probabilities for the second pick.
  • Without replacement:  When sampling is done without replacement, each member of a population may be chosen only once.  In this case, the probabilities for the second pick are affected by the result of the first pick.  Depending on the situation, the events are considered to be dependent or not independent.

Watch this video: Calculating Conditional Probability Khan Academy [6:42] (transcript available).


Watch this video: Conditional Probability and Independence Khan Academy [4:06] (transcript available).


Concept Review

A conditional probability is the probability of an event [latex]A[/latex] given that another event [latex]B[/latex] has already occurred.  The formula to find a conditional probability is: [latex]\displaystyle{P(A|B)=\frac{P(A \mbox{ and }B)}{P(B)}}[/latex].  Two events [latex]A[/latex] and [latex]B[/latex] are independent if the knowledge that one of the events occurred does not affect the chance that the other event occurs. If [latex]P(A)=P(A|B)[/latex], the events [latex]A[/latex] and [latex]B[/latex] are independent.  Otherwise the events are dependent.


Attribution

“3.1 Terminology”, “3.2 Independent and Mutually Exclusive Events”, and “3.4 Contingency Tables”  in Introductory Statistics by OpenStax is licensed under a Creative Commons Attribution 4.0 International License.

License

Icon for the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

Introduction to Statistics Copyright © 2022 by Valerie Watts is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.