Unit 4, lesson 18

Conditional Probability and Independence

How conditional probability restricts attention to a known event, how joint and marginal probabilities appear in a two-way table, and how the multiplication rule, independent events and the law of total probability build on them.

  • Video 18
  • Events, Conditioning and Counting

A clinic reports that 22 percent of its visits involve a long wait. If you book a morning visit, is 22 percent the right figure for you? Not necessarily, because the rate among morning visits can differ from the rate among all visits. This lesson shows how to compute a probability within a subgroup, how these conditional probabilities combine into the overall rate, and what it means for two events to be independent. All counts on this page are constructed for illustration.

Key terms

Joint and marginal probability

Definition For two events AA and BB, the joint probability P(A∩B)P(A \cap B) is the probability that both occur. A marginal probability is the probability of one event on its own, such as P(A)P(A), without regard to the other classification. Marginal probabilities are sums of joint probabilities. The events A∩BA \cap B and A∩BcA \cap B^c are disjoint with union AA, so

P(A)=P(A∩B)+P(A∩Bc).\begin{aligned} P(A) &= P(A \cap B) \\[0.4em] &\quad + P(A \cap B^c). \end{aligned}

When a model is given as a two-way table of probabilities, the joint probabilities are the cells and the marginal probabilities are the row and column totals in the margins of the table.

In plain words Joint means both at once, and marginal means one classification while ignoring the other. Both are measured against the whole sample space, so in a table of counts both divide by the grand total.

Example A constructed set of 100100 clinic visits is classified by time of day and length of wait. Choose one visit at random, with all 100100 equally likely, so that each count divided by 100100 is a probability.

Long waitShort waitTotal
Morning103040
Not morning124860
Total2278100

Let MM be the event of a morning visit and LL the event of a long wait. The joint probability is P(M∩L)=10/100=0.10P(M \cap L) = 10/100 = 0.10, and the marginal probabilities are P(M)=0.40P(M) = 0.40 and P(L)=0.22P(L) = 0.22. The second one sums the joint probabilities in the long-wait column, 0.10+0.12=0.220.10 + 0.12 = 0.22.

Conditional probability

Definition Let AA and BB be events with P(B)>0P(B) > 0. The conditional probability of AA given BB is

P(A∣B)=P(A∩B)P(B).P(A \mid B) = \frac{P(A \cap B)}{P(B)}.

The vertical bar is read “given” and is not a division sign. When P(B)=0P(B) = 0 this formula does not define P(A∣B)P(A \mid B). For a fixed event BB with P(B)>0P(B) > 0, the conditional probabilities given BB obey all the rules of a probability model, so for example P(Ac∣B)=1−P(A∣B)P(A^c \mid B) = 1 - P(A \mid B).

In plain words Once you know that BB has happened, the outcomes outside BB are out of play. Restrict attention to BB and ask what share of it, measured by probability, also lies in AA. With equally likely outcomes this is the number of outcomes in both AA and BB divided by the number in BB. The order matters, because P(A∣B)P(A \mid B) divides the joint probability by P(B)P(B), while P(B∣A)P(B \mid A) divides it by P(A)P(A), and these two usually differ.

Example In the visit table, P(L∣M)=0.10/0.40=0.25P(L \mid M) = 0.10/0.40 = 0.25, the share of long waits among the 4040 morning visits. Among the 6060 other visits it is P(L∣Mc)=12/60=0.20P(L \mid M^c) = 12/60 = 0.20. Reversing the condition gives

P(M∣L)=0.100.22=511,P(M \mid L) = \frac{0.10}{0.22} = \frac{5}{11},

about 0.4550.455, the share of morning visits among the 2222 long waits. The joint probability 0.100.10 is the same in both directions, but the denominators 0.400.40 and 0.220.22 differ. A higher rate of long waits among morning visits in these counts describes an association. On its own it does not show that the time of day causes the longer waits.

Multiplication rule

Definition For events AA and BB with P(A)>0P(A) > 0,

P(A∩B)=P(A) P(B∣A),P(A \cap B) = P(A)\,P(B \mid A),

and likewise P(A∩B)=P(B) P(A∣B)P(A \cap B) = P(B)\,P(A \mid B) when P(B)>0P(B) > 0. The rule is the definition of conditional probability multiplied out, and it holds whether or not the events are independent. It extends to more events, for example P(A∩B∩C)=P(A) P(B∣A) P(C∣A∩B)P(A \cap B \cap C) = P(A)\,P(B \mid A)\,P(C \mid A \cap B) when P(A∩B)>0P(A \cap B) > 0.

In plain words To find the probability that both events happen, follow a path. First AA happens, and then BB happens given that AA did. Each branch of a probability tree carries the conditional probability of its step, and the probability of a whole path is the product along it.

Example In the visit table, P(M) P(L∣M)=0.40×0.25=0.10P(M)\,P(L \mid M) = 0.40 \times 0.25 = 0.10, and the reverse route gives P(L) P(M∣L)=0.22×511=0.10P(L)\,P(M \mid L) = 0.22 \times \tfrac{5}{11} = 0.10, the same joint probability. The rule is most useful when the second step depends on the first. Draw two items without replacement from a box of 1010 items of which 33 are defective, with each draw equally likely to be any item still in the box. Let D1D_1 and D2D_2 be the events that the first and the second item are defective. After a defective first draw, 22 of the remaining 99 items are defective, so

P(D1∩D2)=310×29=115.\begin{aligned} P(D_1 \cap D_2) &= \frac{3}{10} \times \frac{2}{9} \\[0.4em] &= \frac{1}{15}. \end{aligned}

Independent events

Definition Events AA and BB are independent if

P(A∩B)=P(A) P(B).P(A \cap B) = P(A)\,P(B).

When P(B)>0P(B) > 0 this is equivalent to P(A∣B)=P(A)P(A \mid B) = P(A), and when P(A)>0P(A) > 0 it is equivalent to P(B∣A)=P(B)P(B \mid A) = P(B). If AA and BB are independent, then so are AA and BcB^c, AcA^c and BB, and AcA^c and BcB^c. Disjoint events with P(A)>0P(A) > 0 and P(B)>0P(B) > 0 are never independent, because P(A∩B)=0P(A \cap B) = 0 while P(A) P(B)>0P(A)\,P(B) > 0. An event with probability 00 or 11 is independent of every event.

In plain words For events with positive probabilities, independence means that learning one of them occurred leaves the probability of the other unchanged. It is a property of a probability model, justified by the mechanism that produces the outcomes, such as a separate coin and die, or checked against data. Two disjoint events with positive probabilities are strongly related, since each one rules out the other. In observed counts the product equation usually fails to hold exactly even when the process behind them is independent, so judging independence from a sample is a task for later inference lessons.

Example In the visit table, P(M) P(L)=0.40×0.22=0.088P(M)\,P(L) = 0.40 \times 0.22 = 0.088, while P(M∩L)=0.10P(M \cap L) = 0.10. The two differ, so MM and LL are not independent in this set of visits, as the comparison P(L∣M)=0.25≠0.22=P(L)P(L \mid M) = 0.25 \ne 0.22 = P(L) also shows. In a model of a fair coin and a fair die tossed independently, the probability of heads and a six is 12×16=112\tfrac12 \times \tfrac16 = \tfrac{1}{12}, and knowing the coin shows heads leaves the probability of a six at 16\tfrac16. The events MM and McM^c are disjoint, and P(M) P(Mc)=0.40×0.60=0.24P(M)\,P(M^c) = 0.40 \times 0.60 = 0.24 is not 00, so they are not independent.

Law of total probability

Definition Let B1,…,BkB_1, \dots, B_k be disjoint, exhaustive events with P(Bi)>0P(B_i) > 0 for every ii. Then for every event AA,

P(A)=∑i=1kP(Bi) P(A∣Bi).P(A) = \sum_{i=1}^{k} P(B_i)\,P(A \mid B_i).

The events A∩BiA \cap B_i are disjoint with union AA, so the addition rule gives P(A)=∑iP(A∩Bi)P(A) = \sum_i P(A \cap B_i), and the multiplication rule turns each term into P(Bi) P(A∣Bi)P(B_i)\,P(A \mid B_i). With two groups BB and BcB^c, where 0<P(B)<10 < P(B) < 1, the sum has the two terms P(B) P(A∣B)P(B)\,P(A \mid B) and P(Bc) P(A∣Bc)P(B^c)\,P(A \mid B^c).

In plain words An overall rate is a weighted average of the rates within the groups, with each group weighted by its share of the population. So it lies between the smallest and the largest group rate. If the mix of groups changes, the overall rate can change even when every group rate stays the same.

Example For the visits, with the groups morning and not morning,

P(L)=0.40×0.25+0.60×0.20=0.22.\begin{aligned} P(L) &= 0.40 \times 0.25 \\[0.4em] &\quad + 0.60 \times 0.20 \\[0.4em] &= 0.22. \end{aligned}

The two terms 0.100.10 and 0.120.12 are the joint probabilities in the long-wait column. If the clinic shifted to 7070 percent morning visits and the two group rates stayed at 0.250.25 and 0.200.20, the overall rate would become 0.70×0.25+0.30×0.20=0.2350.70 \times 0.25 + 0.30 \times 0.20 = 0.235. Whether the group rates would really stay fixed after such a change is an assumption about the clinic, not a consequence of the formula.

Check yourself

  1. A constructed record of 200200 orders has 5050 express orders, 55 of which arrived late, and 150150 standard orders, 3030 of which arrived late. One order is chosen at random, with all 200200 equally likely. Find the probability that it is express and late, the probability that it is late, the probability that it is late given that it is express, and the probability that it is express given that it is late.
Show the answer

Let EE be the event of an express order and LL the event of a late one. The joint probability is P(E∩L)=5/200=0.025P(E \cap L) = 5/200 = 0.025, and the marginal probability is P(L)=35/200=0.175P(L) = 35/200 = 0.175. Within the 5050 express orders, P(L∣E)=5/50=0.10P(L \mid E) = 5/50 = 0.10. Within the 3535 late orders,

P(E∣L)=535=17,P(E \mid L) = \frac{5}{35} = \frac{1}{7},

about 0.1430.143. The two conditional probabilities share the numerator 55 but have different denominators, and swapping them is a common mistake. Ten percent of express orders arrived late, while about 14.314.3 percent of late orders were express.

  1. In a probability model, P(A)=0.3P(A) = 0.3, P(B)=0.5P(B) = 0.5 and P(A∩B)=0.15P(A \cap B) = 0.15. Are AA and BB independent? Are they disjoint? Find P(A∪B)P(A \cup B) and P(A∣Bc)P(A \mid B^c).
Show the answer

They are independent, since P(A) P(B)=0.3×0.5=0.15=P(A∩B)P(A)\,P(B) = 0.3 \times 0.5 = 0.15 = P(A \cap B). They are not disjoint, because their intersection has probability 0.150.15, not 00. The addition rule gives P(A∪B)=0.3+0.5−0.15=0.65P(A \cup B) = 0.3 + 0.5 - 0.15 = 0.65. Next, P(A∩Bc)=0.3−0.15=0.15P(A \cap B^c) = 0.3 - 0.15 = 0.15 and P(Bc)=0.5P(B^c) = 0.5, so

P(A∣Bc)=0.150.5=0.3,P(A \mid B^c) = \frac{0.15}{0.5} = 0.3,

which equals P(A)P(A), as the independence of AA and BcB^c requires. Independent events with positive probabilities always overlap, so they are never disjoint.

  1. A factory has three machines. Machine 1 makes 5050 percent of the parts with defect rate 0.010.01, machine 2 makes 3030 percent with defect rate 0.020.02, and machine 3 makes 2020 percent with defect rate 0.050.05. Find the probability that a randomly chosen part is defective. Why is the answer not the simple average of the three rates?
Show the answer

Let DD be the event that the part is defective. The machines split the parts into three disjoint, exhaustive groups, so the law of total probability gives

P(D)=0.5×0.01+0.3×0.02+0.2×0.05=0.021.\begin{aligned} P(D) &= 0.5 \times 0.01 \\[0.4em] &\quad + 0.3 \times 0.02 \\[0.4em] &\quad + 0.2 \times 0.05 \\[0.4em] &= 0.021. \end{aligned}

The simple average (0.01+0.02+0.05)/3≈0.0267(0.01 + 0.02 + 0.05)/3 \approx 0.0267 would treat the machines as if each made a third of the parts. Machine 3 has the highest rate but makes only 2020 percent of the parts, so its rate gets the weight 0.20.2. Even so, machine 3 supplies 0.010/0.021=10/210.010/0.021 = 10/21, about 0.480.48, of the defect probability, which shows again that a rate within a group and a share of a total are different quantities.

How this lesson connects