**Concept of conditional probability -**The idea here is that the probabilities of certain events may be affected by whether or not other events have occurred**Example :**All the students in a certain high school were surveyed, then classified according to gender and whether they had either of their ears pierced:Suppose a student is selected at random from the school. Let M and not M denote the events of being male and female, respectively, and E and not E denote the events of having ears pierced or not, respectively.

**We'll start by asking what will seem like simple questions, and we'll build our way to conditional probability:****What is the probability that the student has one or both ears pierced?**Since a student is chosen at random from the group of 500 students, out of which 324 are pierced,

**P(E) = 324/500 = 0.648**What is the probability that the student is male?

Since a student is chosen at random from the group of 500 students, out of which 180 are male,

**P(M) = 180/500 = 0.36****What is the probability that the student is male and has ear(s) pierced?**Since a student is chosen at random from the group of 500 students out of which 36 are male and have their ear(s) pierced,

**P(M and E) = 36/500 = 0.072**Now something new: Given that the student that was chosen is male, what is the probability that he has one or both ears pierced?

At this point, new notation is required, to express the probability of a certain event given that another event holds.

**We will write "the probability of having one or both ears pierced (E) , given that a student is male (M)" as P(E | M).**A word about this new notation: The event whose probability we seek (in this case E) is written first, the vertical line stands for the word "given" or "conditioned on," and the event that is given (in this case M) is written after the "|" sign.

We call this probability the conditional probability of having one or both ears pierced, given that a student is male: it assesses the probability of having pierced ears under the condition of being male. Now to solve for the probability, we observe that choosing from only the males in the school essentially alters the sample space S from all students in the school to all male students in the school.

**The total number of possible outcomes is no longer 500, but has changed to 180. Out of those 180 males, 36 have ear(s) pierced, and thus:****P(E | M) = 36/180 = 0.20**.

Gender | Pierced | Not Pierced | Total |
---|---|---|---|

Male | 36 | 144 | 180 |

Female | 288 | 32 | 320 |

Total | 324 | 176 | 500 |

A good visual illustration of this conditional probability is provided by the two-way table:

which shows us that conditional probability is not very different from (and actually quite the same as) the conditional percents we calculated back in section 1.

Gender | Pierced | Not Pierced | Total |
---|---|---|---|

Male | 36 | 144 | 180 |

Female | 288 | 32 | 320 |

Total | 324 | 176 | 500 |

**Explanation :**P(E | not M) represents the probability that a randomly chosen student has pierced ears (E) given that this student is a female (not M).

**Explanation :**Indeed, we are not looking for a conditional probability here. We are looking for the probability that a randomly chosen student is a non-pierced male.

**Explanation :**P(not E | not M) conditions on the student being a female (not M). In other words, we choose only among the female students

**Explanation :**When we condition on "not M," this means that we are restricting ourselves to only the 320 female students. Indeed, among them, 32 are not pierced, and therefore 32/320 is the right answer.

Consider the piercing example, where the following two-way table is given,

Gender Pierced Not Pierced Total Male 36 144 180 Female 288 32 320 Total 324 176 500 Recall also that M represents the event of being a male

**("not M" represents being a female)**, and E represents the event of having one or both ears pierced.

Another way to visualize conditional probability is using a Venn diagram:

In both the two-way table and the Venn diagram, the reduced sample space (comprised of only males) is shaded light green, and within this sample space, the event of interest (having ears pierced) is shaded darker green.

**The two-way table illustrates the idea via counts, while the Venn diagram converts the counts to probabilities**, which are presented as regions rather than cells.We may work with counts, as presented in the two-way table, to write

**P(E | M) = 36/180.**Or we can work with probabilities, as presented in the Venn diagram, by writing

**P(E | M) = (36/500) / (180/500).**We will want, however, to write our formal expression for conditional probabilities in terms of other, ordinary, probabilities and therefore the definition of conditional probability will grow out of the Venn diagram.

**Notice that : P(E | M) = (36/500) / (180/500) = P(M and E) / P(M)**. Generalized, we have a formal definition of conditional probability:**Conditional probability :**(definition) The conditional probability of event B, given event A, is P(B | A) = P(A and B) / P(A)**Comments :**Note that when we evaluate the conditional probability, we always divide by the probability of the given event. The probability of both goes in the numerator.

The above formula holds as long as

**P(A) > 0**, since we cannot divide by 0. In other words, we should not seek the probability of an event given that an impossible event has occurred.Let's see how we can use this formula in practice:

**Example :**On the "Information for the Patient" label of a certain antidepressant, it is claimed that based on some clinical trials, there is a 14% chance of experiencing sleeping problems known as insomnia (denote this event by I), there is a 26% chance of experiencing headache (denote this event by H), and there is a 5% chance of experiencing both side effects (I and H).Suppose that the patient experiences insomnia; what is the probability that the patient will also experience headache? Since we know (or it is given) that the patient experienced insomnia, we are looking for P(H | I). According to the definition of conditional probability:

**P(H | I) = P(H and I) / P(I) = 0.05/0.14 = 0.357.**Suppose the drug induces headache in a patient; what is the probability that it also induces insomnia? Here, we are given that the patient experienced headache, so we are looking for P(I | H). Using the definition

**P(I | H) = P(I and H) / P(H) = 0.05/0.26 = 0.1923.****Comment : Note that the answers to (a) and (b) above are different**. In general, P(A | B) does not equal P(B | A). We'll come back and illustrate this point later in this module.The purpose of the following activity is to give you guided practice in using the definition of conditional probability, and teach you how the Complement Rule works with conditional probability.

It is vital that a certain document reach its destination within one day.

To maximize the chances of on-time delivery, two copies of the document are sent using two services, service A and service B, and the following probability table summarizes the chances of on-time delivery:

B not B Total **A**0.75 0.15 0.90 **not A**0.05 0.05 0.10 **Total**0.80 0.20 1.00

**Q. If the document has reached its destination on time through service A,
what is the probability that it will also reach its destination through service B? When you answer,
first write down the conditional probability we are looking for, and then find it using the definition of conditional probability:
P(B | A) = P(A and B) / P(A).**

We are given that the document has arrived on time using service A, and we are wondering what the probability is that it will also arrive on time using service B. We are therefore looking for P(B | A).

Using the definition of conditional probability and the probability table, we get that:

P(B | A) = P(A and B) / P(A) = .75/.9 = 0.833

**Q. If service A has failed to deliver the document on time, what is the probability
that it has arrived on time using service B? (Again, as before, first write down the conditional
probability that you are asked to find, and then apply the definition of conditional probability
to find it.)**

We are given that the document was not delivered on time using service A (not A), and we are wondering how likely is it that it was delivered on time using service B. We are therefore looking for P(B | not A).

Using the definition of conditional probability and the probability table, we get that:

P(B | not A) = P(not A and B) / P(not A) = .05/.1 = 0.50

**Q. If service A delivered the document on time, what is the probability that it was not delivered on time using service B?**

We are given that the document was delivered on time using service A, and we are wondering how likely it is that it was not delivered on time using service B. We are therefore looking for P(not B | A). Using the definition of conditional probability and the probability table, we get that:

P(not B | A) = P(A and not B) / P(A) = .15/.90 = 0.167

Let's summarize the results we got:

P(B | A) = 0.833

P(B | not A) = 0.50

P(not B | A) = 0.167

Note that P(B | A) = 1 - P(not B | A), which tells us that P(not B | A) is the complement event of P(B | A). Students sometimes tend to get confused and think that the complement event of P(B | A) is P(B | not A).

Please note the distinction. The Complement Rule extends to conditional probabilities only when you condition on the same event.

Recall the smoke alarms example from the previous module. A homeowner has smoke alarms installed in the dining room (adjacent to the kitchen) and an upstairs bedroom (above the kitchen).

The two-way table below shows probabilities of smoke in the kitchen triggering the alarm in the dining room (D) or not, and in the bedroom (B) or not. Use this two-way table to answer the following:

B not B Total **D**0.38 0.57 0.95 **not D**0.02 0.03 0.05 **Total**0.40 0.60 1.00

**Explanation :**Indeed, P(B | D) = P(B and D) / P(D) = .38/.95

**Explanation :**Indeed P(D | not B) = P(D and not B) / P(not B) = .57/.60

**Explanation :**Indeed, lifting directly from the table, P(D and not B) = .57

Whenever a situation involves more than one variable, it is generally of interest to determine whether or not the variables are related.

In probability, we talk about independent events, and in the first module we said that two events A and B are independent if event A occurring does not affect the probability that event B will occur.

Now that we've introduced conditional probability, we can formalize the definition of independence of events and develop four simple ways to check whether two events are independent or not.

Gender Pierced Not Pierced Total Male 36 144 180 Female 288 32 320 Total 324 176 500 Would you expect those two variables to be related? That is, would you expect having pierced ears to depend on whether the student is male or female?

Or, to put it yet another way, would knowing a student's gender affect the probability that the student's ears are pierced? To answer this, we may compare the overall probability of having pierced ears to the conditional probability of having pierced ears, given that a student is male.

Our intuition would tell us that the latter should be lower: male students tend not to have their ears pierced, whereas female students do.

Indeed, for students in general, the probability of having pierced ears (event E) is P(E) = 324/500 = 0.648.

But the probability of having pierced ears given that a student is male is only P(E | M) = 36/180 = 0.20.

As we anticipated,

**P(E | M) is lower than P(E)**. The probability of a student having pierced ears changes (in this case, gets lower) when we know that the student is male, and therefore the events E and M are dependent.(If E and M were independent, knowing or not knowing that the student is male would not have made a difference ... but it did.)

This example illustrates that one method for determining whether two events are independent is to compare P(B | A) and P(B).

If the two are equal (i.e., knowing or not knowing whether A has occurred has no effect on the probability of B occurring) then the two events are independent.

Otherwise, if the probability changes depending on whether we know that A has occurred or not, then the two events are not independent. Similarly, using the same reasoning,

**we can compare P(A | B) and P(A).**Example Recall the side effects example. On the "Information for the Patient" label of a certain antidepressant it is claimed that based on some clinical trials, there is a 14% chance of experiencing sleeping problems known as insomnia (denote this event by I), there is a 26% chance of experiencing headache (denote this event by H), and there is a 5% chance of experiencing both side effects (I and H).

Are the two side effects independent of each other?

To check whether the two side effects are independent, let's compare

**P(H | I) and P(H)**.In the previous part of this module,

**we found that P(H | I) = P(H and I) / P(I) = 0.05/0.14 = 0.357, while P(H) = 0.26**. Knowing that a patient experienced insomnia increases the likelihood that he/she will also experience headache from 0.26 to 0.357. The conclusion, therefore is that the two side effects are not independent, they are dependent.**Alternatively, we could have compared P(I | H) to P(I). P(I) = 0.14**, and previously we found that P(I | H) = P(I and H) / P(H) = 0.05/0.26 = 0.1923, and again, since the two are not equal, we can conclude that the two side effects I and H are dependent.

Recall again the smoke alarms example.

A homeowner has smoke alarms installed in the dining room (adjacent to the kitchen) and an upstairs bedroom (above the kitchen).

The two-way table below shows probabilities of smoke in the kitchen triggering the alarm in the dining room (D) or not, and in the bedroom (B) or not

B not B Total **D**0.38 0.57 0.95 **not D**0.02 0.03 0.05 **Total**0.40 0.60 1.00

**Explanation :**Indeed, to check whether two events are independent, we need to check whether the probability of one of the events (D) changes when we know that the other event (B) has occurred.

**Explanation :**Indeed, P(D | B) = P(D and B) / P(B) = 0.38/0.40 = 0.95

**Explanation :**Indeed P(D) = 0.95

**Explanation :**Since P(D | B) = P(D), the events are independent.