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**

**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

### 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).

- Find the probability that an animal chosen at random is not a cat.
- 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 . The probability of selecting an animal that is not a cat is, therefore, .

**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 .

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 .

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.

- 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.
- 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.
- 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 . We can also calculate this without using the Venn diagram of course, using the numbers we are given in the question: , 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 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 . Hence,

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 .

In part (3), we have actually calculated the conditional probability, : 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 . As there are 25 houses in total and 12 with a cat, the probability a house has a cat is . If 4 houses have both a cat and a dog, . Hence, given that a house has a cat, the probability that it also houses a dog is

If we multiply this by 100 (), 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 and , find .

### Answer

To find the probability of given , we can use the formula

Substituting in the values we have been given, we have

The probability is therefore .

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 and . The probability that event occurs and event also occurs is . 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

If events and are independent, then .

This is not the case since and 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.

- Draw a tree diagram to represent the possible outcomes of the learner driver tests described above.
- 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.
- Find, to two decimal places, the probability that a driver chosen at random passed their test on the first time.
- 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:

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: