Explainer: Conditional Probability

In this explainer, we will learn how to calculate conditional probability using the formula and venn diagrams.

There are many situations where we might apply the rules of conditional probability. For example, the probability that a person’s eyes are a particular color is affected by, or conditional on, the color of their parents’ eyes. Similarly, the time a journey takes is likely to be conditional on the mode of transport used. The value of your second card from a pack, if you do not replace the first, is conditional on the value of your first. These are all situations where conditional probability can be applied. We can define conditional probability mathematically as follows.

Definition: Conditional Probability

If the probability of an event 𝐡 is affected by the occurrence of an event 𝐴, then we say that the probability of 𝐡 is conditional on the occurrence of 𝐴. The notation for conditional probability is 𝑃(𝐡∣𝐴), read as β€œthe probability of 𝐡 given 𝐴.”

Depending on the form of the problem, there are a few different methods we can use to help us calculate conditional probabilities. These include using Venn diagrams, tree diagrams, and the conditional probability formula. We will also need to use some of the rules of probability that you already know, so let us first remind ourselves of some of these.

Some Probability Rules

For any event 𝐴, if 𝑃(𝐴) is the probability of event 𝐴 occurring, then we have the following:

Rule 1

0≀𝑃(𝐴)≀1

Rule 2

The sum of the probabilities of all possible outcomes is equal to 1.

Rule 3

The probability of the complement, 𝐴, of event 𝐴, or β€œnot 𝐴,” is given by 𝑃𝐴=1βˆ’π‘ƒ(𝐴).

Note

The complement of event 𝐴 is sometimes also written as 𝐴.

In our first example, we will calculate the probability of the complement of an event.

Example 1: The Complement of an Event and Total Probability

In an animal rescue shelter, 42% of the current inhabitants are cats (C), and 38% are dogs (D).

  1. Find the probability that an animal chosen at random is not a cat.
  2. Find the probability that an animal chosen at random is neither a cat nor a dog.

Answer

Part 1

To find the probability that an animal chosen at random is not a cat, we note that since 42% of the inhabitants are cats, the probability of selecting a cat is 𝑃()=0.42C. The probability of selecting an animal that is not a cat is, therefore, 𝑃=1βˆ’π‘ƒ()=1βˆ’0.42=0.58CC.

Part 2

Since 42% of the inhabitants are cats and 38% are dogs, the probability that the chosen animal is neither a cat nor a dog is 𝑃βˆͺ=1βˆ’(𝑃()+𝑃())=1βˆ’(0.42+0.38)=0.2CDCD.

You will recall the idea that events may be mutually exclusive or disjoint. That is, the events cannot occur at the same time. For example, an animal cannot be both a cat and a dog: β€œbeing a cat” and β€œbeing a dog” are mutually exclusive or disjoint events. However, a person may like both cats and dogs, so β€œlikes cats” and β€œlikes dogs” are not mutually exclusive or disjoint events.

Let us define this mathematically and add some more rules to our collection.

Definition: Disjoint or Mutually Exclusive Events

If two events 𝐴 and 𝐡 cannot occur at the same time, they are known as disjoint, or mutually exclusive. In this case, the probability of both 𝐴 and 𝐡 is zero. We write this as 𝑃(𝐴∩𝐡)=0.

If events 𝐴 and 𝐡 are mutually exclusive, the probability that 𝐴 or 𝐡 occurs is the sum of their probabilities. That is,

Rule 4

𝑃(𝐴βˆͺ𝐡)=𝑃(𝐴)+𝑃(𝐡)

If events 𝐴 and 𝐡 are not mutually exclusive, the probability that either 𝐴 or 𝐡 or both occur is

Rule 5

𝑃(𝐴βˆͺ𝐡)=𝑃(𝐴)+𝑃(𝐡)βˆ’π‘ƒ(𝐴∩𝐡)

Since β€œbeing a cat” and β€œbeing a dog” are mutually exclusive events, in example 1, part (2), above we used a version of rule 4 to calculate the probability that at animal chosen at random is neither a cat nor a dog. Let us look at an example where the events are not disjoint.

Example 2: Conditional Probability with Venn Diagrams

On the street, 10 houses have a cat (C), 8 houses have a dog (D), 3 houses have both, and 7 houses have neither.

  1. Find the total number of houses on the street. Hence, find the probability that a house chosen at random has both a cat and a dog. Give your answer to three decimal places.
  2. Find the probability that a house on the street has either a cat or a dog or both. Give your answer to three decimal places.
  3. If a house on the street has a cat, find the probability that there is also a dog living there.

Answer

Part 1

Let us begin by putting the information we have into a Venn diagram.

Notice that we have split the 10 cat houses into 7 who only have a cat and 3 that have both a cat and a dog. Similarly, for the 8 dog houses: 5 have only a dog and 3 have both a cat and a dog. The 7 houses in the blue area have neither a cat nor a dog.

We can find the total number of houses by adding the numbers from each section of the diagram. So the total is 7+3+5+7=22. We can also calculate this without using the Venn diagram of course, using the numbers we are given in the question: 10+8+7βˆ’3=22, where 3 houses with both a cat and a dog have been subtracted, because these have been counted twice: once within the 10 cat houses and again within the 8 dog houses.

As there are 3 houses with both a cat and a dog and 22 houses in total, the probability that a house has both a cat and a dog is then 𝑃(∩)=322=0.136CD to three decimal places.

Part 2

To find the probability that a house has either a cat or a dog or both, we can use the rule of probability that 𝑃(βˆͺ)=𝑃()+𝑃()βˆ’π‘ƒ(∩)CDCDCD. Hence, 𝑃(βˆͺ)=1022+822βˆ’322=1522=0.6818….CD

Hence, the probability that a house has either a cat or a dog or both is 0.682 to three decimal places.

Part 3

If a house on the street has a cat, to find the probability that there is also a dog living there, we know that 10 houses have a cat and that, of those 10, 3 houses have both a cat and a dog. So the desired probability is 310=0.3.

In part (3), we have actually calculated the conditional probability, 𝑃(∣)DC: the probability that a house has a dog (D), given that it has a cat (C).

Another method of calculating conditional probabilities is by using the formula 𝑃(𝐴∣𝐡)=𝑃(𝐴∩𝐡)𝑃(𝐡).

Let us try an example.

Example 3: Using the Conditional Probability Formula

On a street, there are 25 houses, of which 12 have a cat and 4 have both a cat and a dog. If a house has a cat, what is the probability that there is also a dog living there? Give your answer to three decimal places.

Answer

To find the probability that a house with a cat (C) also has a dog (D), we can use the conditional probability formula 𝑃(∣)=𝑃(∩)𝑃()DCDCC. As there are 25 houses in total and 12 with a cat, the probability a house has a cat is 𝑃()=1225C. If 4 houses have both a cat and a dog, 𝑃(∩)=425CD. Hence, given that a house has a cat, the probability that it also houses a dog is 𝑃(∣)=𝑃(∩)𝑃()==412=13=0.333.3.DCDCCtod.pοŠͺ

If we multiply this by 100 (0.333Γ—100=33.3%), we can say that if a house on the street has a cat, there is a 33% chance that a dog lives there too.

Let us try one more example of calculating conditional probability using the formula.

Example 4: Conditional Probability Using the Formula

Suppose 𝐴 and 𝐡 are two events. Given that 𝑃(𝐴∩𝐡)=23 and 𝑃(𝐴)=913, find 𝑃(𝐡∣𝐴).

Answer

To find the probability of 𝐴 given 𝐡, we can use the formula 𝑃(𝐡∣𝐴)=𝑃(𝐴∩𝐡)𝑃(𝐴).

Substituting in the values we have been given, we have 𝑃(𝐡∣𝐴)==23Γ—139=2627.

The probability 𝑃(𝐡∣𝐴) is therefore 2627.

An important idea in probability theory is the independence of events. If I toss a coin repeatedly, each throw is an independent event. What happened in a previous throw does not affect the result of my next throw. If I take a card from a pack without replacing it, however, the probabilities for what my next card is will be affected by my having taken a card already.

Definition: Independent and Dependent Events

Two events 𝐴 and 𝐡 are

  • independent if the fact that 𝐴 occurs does not affect the probability of 𝐡 occurring,
  • dependent if the fact that 𝐴 occurs does affect the probability of 𝐡 occurring.

And we have the following.

Rule 6

For independent events, 𝑃(𝐴∩𝐡)=𝑃(𝐴)×𝑃(𝐡).

But if we rearrange the formula for conditional probability, we find that 𝑃(𝐴∩𝐡)=𝑃(𝐴∣𝐡)×𝑃(𝐡).

Comparing with rule 6, this must mean that, for independent events, 𝑃(𝐴∣𝐡)=𝑃(𝐴) and similarly, for 𝑃(𝐡∣𝐴), that 𝑃(𝐡∣𝐴)=𝑃(𝐡).

Let us look at an example.

Example 5: Determining Whether Two Events Are Independent Using Conditional Probability

Suppose 𝑃(𝐴)=25 and 𝑃(𝐡)=37. The probability that event 𝐴 occurs and event 𝐡 also occurs is 15. Calculate 𝑃(𝐴∣𝐡), and then evaluate whether events 𝐴 and 𝐡 are independent.

Answer

To find the probability of 𝐴 given 𝐡, we can use the formula 𝑃(𝐴∣𝐡)=𝑃(𝐴∩𝐡)𝑃(𝐡).

Substituting in the values we have been given, we have 𝑃(𝐴∣𝐡)==15Γ—73=715.

If events 𝐴 and 𝐡 are independent, then 𝑃(𝐴∣𝐡)=𝑃(𝐴).

This is not the case since 𝑃(𝐴∣𝐡)=715=0.467 and 𝑃(𝐴)=25=0.400. So events 𝐴 and 𝐡 are not independent.

In the next example, we will see how using a tree diagram can be helpful in working out probabilities.

Example 6: Tree Diagrams and Conditional Probability

A number of drivers were surveyed on where they learned to drive. Fifty-five percent of the drivers were taught to drive at a driving school, and the other forty-five percent were taught by family or friends (we will call this β€œother”). Of those who went to a driving school, 35% passed their test on the first time, and of those who learned through other ways, 20% passed on the first time.

  1. Draw a tree diagram to represent the possible outcomes of the learner driver tests described above.
  2. Work out the probability that a driver selected at random went to driving school and passed their test on the first time. Round your answer to two decimal places.
  3. Find, to two decimal places, the probability that a driver chosen at random passed their test on the first time.
  4. Given that a driver passed on the first time, find the probability that they went to driving school. Round your answer to two decimal places.

Answer

Part 1

To draw a tree diagram to represent the possible outcomes for learner drivers described above, let us first convert the percentages given to probabilities. To do this, we divide the percentages by 100: 𝑃()=55100=0.55,𝑃()=45100=0.45,𝑃()=35100=0.35,𝑃()=65100=0.65,𝑃()=20100=0.20,𝑃()=80100=0.80.DrivingSchoolOtherPassedwithSchoolFailedwithSchoolPassedwithOtherFailedwithOther

Now let us draw the first set of branches to represent whether or not a driver went to driving school.

We know that if a driver went to driving school, the probability that they passed their test on the first time is 0.35. And the probability that they failed is 0.65. Let us include a set of branches to represent this.

Note that the probabilities on the second set of branches are actually the conditional probabilities for whether a driver passed or failed on the first time, given that they went to driving school.

The final branches on our tree represent whether a driver passes or fails if they did not got to driving school.

The tree is now complete and represents every possible outcome, with the probabilities on each branch.

We can now use this to help us calculate more probabilities.

Part 2

The probability that a driver selected at random went to driving school and passed their test on the first time is found by multiplying the probability on the branch for β€œdriving school” with the β€œpassed” branch attached to it.

Hence, the probability a driver selected at random went to driving school and passed on the first time is 0.19 to 2 decimal places.

Now, if we do the same for every branch, we can find the probabilities for every possible outcome for a randomly selected driver: