Discrete MathematicsProbability, Conditioning and Expectation3 of 9
Probability, Conditioning and Expectation · 3

Conditional Probability and the Multiplication Rule

When we learn a new piece of information about an outcome, we need a way to update our probabilities to reflect what is still possible.

1

Shrinking the Universe

We want to find the probability of an event after we already know another event has happened.

Shrinking the Universe
even\htmlClass{lc-blue}{\text{even}}
11
22
33
44
55
6\htmlClass{lc-pink}{6}
P(6∣even)= ?P(\htmlClass{lc-pink}{6} \mid \htmlClass{lc-blue}{\text{even}}) = \,?
20\htmlClass{lc-green}{20}
5\htmlClass{lc-orange}{5}
Cloudy mornings\htmlClass{lc-blue}{\text{Cloudy mornings}}
(40)\htmlClass{lc-blue}{\text{(40)}}
100 days\text{100 days}
Rainy days\htmlClass{lc-pink}{\text{Rainy days}}
(25)\htmlClass{lc-pink}{\text{(25)}}
60 clear mornings\htmlClass{lc-orange}{\text{60 clear mornings}}
Text solution
Shrink the universe to the given conditionCrossing out the 60\crossed{60} clear mornings leaves only the 40\given{40} cloudy mornings as our new denominator:
New universe (Cloudy)\displaystyle \text{New universe (}\given{\text{Cloudy}}\text{)} =40\displaystyle = \given{40}
Keep only the overlap that remains inside the new universeOf the 25\target{25} rainy days, 5\crossed{5} happened on clear mornings and were crossed out, leaving the 20\overlap{20} days that were both cloudy and rainy on top:
P(R∣C)\displaystyle P(\target{R} \mid \given{C}) =2040\displaystyle = \frac{\overlap{20}}{\given{40}} =12\displaystyle = \frac{1}{2} =50%\displaystyle = 50\%

Whether we count the outcomes directly or divide both parts by all 100100 days to use probabilities, we are comparing the remaining overlap to the shrunken universe:

P(R∣⏟given thatC)\displaystyle P(\target{R} \underbrace{\mid}_{\text{given that}} \given{C}) =P(R and C)⏞overlap still insideP(C)⏟new universe\displaystyle = \frac{\overbrace{\overlap{P(R \text{ and } C)}}^{\text{overlap still inside}}}{\underbrace{\given{P(C)}}_{\text{new universe}}} =0.200.40\displaystyle = \frac{\overlap{0.20}}{\given{0.40}} =12\displaystyle = \frac{1}{2}

The vertical bar ∣\mid means "given that". It is not a division sign, and everything to the right of the bar is the condition that shrinks the universe.

Once we narrow down to cloudy mornings, rainy days outside the cloudy boundary never count toward P(R∣C)P(\target{R} \mid \given{C}). Only the overlap inside the shrunken universe counts.

Once the universe shrinks to the 40 cloudy mornings, only the rainy days inside that boundary count.
2

Counting the Shrunken Universe

When a problem gives us a group to choose from instead of pre-counted totals, we have to count the shrunken universe and the remaining overlap ourselves. Here we pick a 33-person committee from 66 Seniors and 44 Juniors (1010 students in total), and we are told that the committee has at least one Junior.

Counting the Shrunken Universe
6 Seniors\text{6 Seniors}
4 Juniors\htmlClass{lc-blue}{\text{4 Juniors}}
committee of 3\text{committee of 3}
P(2 Juniors∣at least 1 Junior)= ?P(\htmlClass{lc-pink}{\text{2 Juniors}} \mid \htmlClass{lc-blue}{\text{at least 1 Junior}}) = \,?
Text solution
Count the shrunken universe by crossing out the complementSubtract the C(6,3)\crossed{C(6, 3)} all-Senior committees (which have no Juniors) from the C(10,3)C(10, 3) total committees to get the new denominator:
New universe (at least 1 Junior)\displaystyle \text{New universe (}\given{\text{at least 1 Junior}}\text{)} =C(10,3)−C(6,3)\displaystyle = C(10, 3) - \crossed{C(6, 3)} =120−20\displaystyle = 120 - \crossed{20} =100\displaystyle = \given{100}
Question A: Count committees with exactly 2 Juniors inside the new universeEvery committee with 22 Juniors from the 44 and 11 Senior from the 66 already has at least one Junior, so none were crossed out:
P(2 Juniors∣at least 1 Junior)\displaystyle P(\target{\text{2 Juniors}} \mid \given{\text{at least 1 Junior}}) =C(4,2)×C(6,1)100\displaystyle = \frac{\overlap{C(4, 2) \times C(6, 1)}}{\given{100}} =6×6100\displaystyle = \frac{\overlap{6 \times 6}}{\given{100}} =36100\displaystyle = \frac{\overlap{36}}{\given{100}} =36%\displaystyle = 36\%
Question B: Count committees with Alex (a Senior) that remain inside the new universeAlex is on C(9,2)\target{C(9, 2)} committees in total, but we must subtract the C(5,2)\crossed{C(5, 2)} committees where Alex is paired with two other Seniors and zero Juniors:
P(Alex∣at least 1 Junior)\displaystyle P(\target{\text{Alex}} \mid \given{\text{at least 1 Junior}}) =C(9,2)−C(5,2)100\displaystyle = \frac{\target{C(9, 2)} - \crossed{C(5, 2)}}{\given{100}} =36−10100\displaystyle = \frac{\target{36} - \crossed{10}}{\given{100}} =26100\displaystyle = \frac{\overlap{26}}{\given{100}} =26%\displaystyle = 26\%
3

The Multiplication Rule

Sometimes we don't start with the overlap. Instead, events happen one step after another in a sequence, and we want to find the probability that every step in the chain happens. Here we draw marbles from a bag of 33 Green and 22 Red marbles (55 in total) and want the probability that our draws are all Green.

The Multiplication Rule
5 marbles\text{5 marbles}
Step 1\text{Step 1}
Step 2\text{Step 2}
P(1st Green and 2nd Green)= ?\htmlClass{lc-green}{P(\text{1st Green and 2nd Green})} = \,?
Text solution
Find the probability of the first stepOn the first draw, 33 of the 55 marbles in the bag are green:
P(1st Green)\displaystyle \given{P(\text{1st Green})} =35\displaystyle = \frac{3}{5}
Update the bag and find the probability of the second stepKeeping the first green marble leaves 44 marbles in the bag with 22 greens remaining:
P(2nd Green∣1st Green)\displaystyle P(\target{\text{2nd Green}} \mid \given{\text{1st Green}}) =24\displaystyle = \frac{2}{4}
Multiply along the chainWe get the second green marble on 24\frac{2}{4} of the 35\frac{3}{5} of the time we got the first green marble, so we multiply the step probabilities together:
P(1st Green and 2nd Green)\displaystyle \overlap{P(\text{1st Green and 2nd Green})} =35×24\displaystyle = \frac{3}{5} \times \frac{2}{4} =620\displaystyle = \frac{6}{20} =310\displaystyle = \frac{3}{10} =30%\displaystyle = 30\%
Extend the chain to a third green marble without replacementOne green marble is left out of the 33 remaining marbles in the bag, so we multiply by the third step:
P(all 3 Green)\displaystyle \overlap{P(\text{all 3 Green})} =35×24×13\displaystyle = \frac{3}{5} \times \frac{2}{4} \times \frac{1}{3} =660\displaystyle = \frac{6}{60} =110\displaystyle = \frac{1}{10}

Multiplying both sides of our conditional probability equation by P(A)\given{P(A)} gives the Multiplication Rule for any two events A\given{A} and B\target{B}:

P(A and B)\displaystyle \overlap{P(A \text{ and } B)} =P(A)×P(B∣A)\displaystyle = \given{P(A)} \times P(\target{B} \mid \given{A})

If we put the first marble back into the bag before drawing again, the bag still has 33 greens out of 55, so P(2nd Green∣1st Green)=35P(\target{\text{2nd Green}} \mid \given{\text{1st Green}}) = \frac{3}{5}. When the first event does not change the probability of the second event at all, the events are independent:

P(B∣A)=P(B)⏟independent events\displaystyle \underbrace{P(\target{B} \mid \given{A}) = \target{P(B)}}_{\holds{\text{independent events}}}
4

Reversing a Condition with a Tree

Now suppose we know the probability of a result given each starting branch, such as the defect rate at each factory, and want to flip the question around to find the probability that a defective item came from a specific factory. Factory A supplies 60%60\% of a company's laptop batteries with a 5%5\% defect rate, and Factory B supplies the remaining 40%40\% with a 10%10\% defect rate.

Reversing a Condition with a Tree
All\text{All}
laptops\text{laptops}
Factory A\htmlClass{lc-blue}{\text{Factory A}}
60%60\%
Factory B\text{Factory B}
40%40\%
5%5\%
Defective\htmlClass{lc-pink}{\text{Defective}}
95%95\%
Good\text{Good}
10%10\%
Defective\htmlClass{lc-pink}{\text{Defective}}
90%90\%
Good\text{Good}
P(A∣Defective)= ?P(\htmlClass{lc-blue}{\text{A}} \mid \htmlClass{lc-pink}{\text{Defective}}) = \,?
60%60\%
40%40\%
5%5\%
95%95\%
10%10\%
90%90\%
All\text{All}
laptops\text{laptops}
Factory A\htmlClass{lc-blue}{\text{Factory A}}
Factory B\text{Factory B}
Defective\htmlClass{lc-pink}{\text{Defective}}
0.60×0.05=3%0.60 \times 0.05 = \htmlClass{lc-green}{3\%}
Defective\htmlClass{lc-pink}{\text{Defective}}
0.40×0.10=4%0.40 \times 0.10 = \htmlClass{lc-green}{4\%}
Good\htmlStyle{background:linear-gradient(transparent 0.47em,var(--lc-orange) 0.47em,var(--lc-orange) 0.57em,transparent 0.57em)}{\htmlClass{lc-mute}{\text{Good}}}
Good\htmlStyle{background:linear-gradient(transparent 0.47em,var(--lc-orange) 0.47em,var(--lc-orange) 0.57em,transparent 0.57em)}{\htmlClass{lc-mute}{\text{Good}}}
Text solution
Question 1: Multiply along the top branch for Factory A and defectiveA laptop's battery must come from Factory A (60%60\%) and, given that, be defective (5%5\%):
P(A and Defective)\displaystyle \overlap{P(\text{A and Defective})} =0.60×0.05\displaystyle = 0.60 \times 0.05 =0.03\displaystyle = \overlap{0.03} =3%\displaystyle = \overlap{3\%}
Multiply along the other defective branch and add to find the defective universeFactory B contributes 0.40×0.10=4%0.40 \times 0.10 = \overlap{4\%} defective laptops, and because the two factory branches don't overlap, we add them to get all defective laptops:
P(Defective)\displaystyle \target{P(\text{Defective})} =3%+4%\displaystyle = \overlap{3\%} + \overlap{4\%} =7%\displaystyle = \target{7\%}
Question 2: Divide the Factory A defective branch by the total defective universeGiven that a battery is defective, we cross out the good branches and find Factory A's share of the 7%\target{7\%} defective pool:
P(A∣Defective)\displaystyle P(\given{\text{A}} \mid \target{\text{Defective}}) =P(A and Defective)P(Defective)\displaystyle = \frac{\overlap{P(\text{A and Defective})}}{\target{P(\text{Defective})}} =3%7%\displaystyle = \frac{\overlap{3\%}}{\target{7\%}} =37\displaystyle = \frac{3}{7}

Which factory produces more of the defective batteries depends on both its defect rate and its share of all batteries: here Factory B's higher defect rate (10%10\% vs. 5%5\%) outweighs Factory A's larger share of production (60%60\% vs. 40%40\%), so more defective batteries still come from Factory B (4%\overlap{4\%} vs. 3%\overlap{3\%}).

Even though Factory A has a lower defect rate than Factory B, giving Factory A a large enough share of total production makes most of the defective laptops come from Factory A.

Key concepts

Conditional probability and the multiplication rule use the same relationship between an overlap and a shrunken universe in two directions:

Shrinking the universe (Conditional Probability)

When a problem tells you that C\given{C} has happened, treat C\given{C} as the new denominator and keep only the part of R\target{R} that lies inside C\given{C}:

P(R∣C)\displaystyle P(\target{R} \mid \given{C}) =P(R and C)P(C)\displaystyle = \frac{\overlap{P(R \text{ and } C)}}{\given{P(C)}}
Out of 40\given{40} cloudy mornings, if 20\overlap{20} are both cloudy and rainy, P(Rain∣Cloudy)=2040=12P(\target{\text{Rain}} \mid \given{\text{Cloudy}}) = \frac{\overlap{20}}{\given{40}} = \frac{1}{2}. If you have to count the groups yourself, any outcome crossed out of the denominator must also be crossed out of the numerator.

Multiplying along a chain (The Multiplication Rule)

When events happen one after another and you want the probability that the whole sequence happens together, multiply the steps and update the universe after each step:

P(A and B)\displaystyle \overlap{P(A \text{ and } B)} =P(A)×P(B∣A)\displaystyle = \given{P(A)} \times P(\target{B} \mid \given{A})
Drawing 22 green marbles without replacement from 33 green and 22 red is 35×24=310\frac{3}{5} \times \frac{2}{4} = \frac{3}{10}.

When the universe does not change (Independence)

After the first event, check whether the universe changed for the next step. If the first outcome does not change the second probability (like putting the marble back in the bag, where P(2nd Green∣1st Green)P(\target{\text{2nd Green}} \mid \given{\text{1st Green}}) == 35\frac{3}{5} == P(2nd Green)\target{P(\text{2nd Green})}), the events are independent (P(B∣A)=P(B)P(\target{B} \mid \given{A}) = \target{P(B)}), and you do not adjust the second fraction when multiplying.

Reversing a condition with a tree (Bayes' Theorem)

When you know P(Defective∣A)P(\target{\text{Defective}} \mid \given{\text{A}}) on the branches of a tree but need the flipped probability P(A∣Defective)P(\given{\text{A}} \mid \target{\text{Defective}}), multiply along each branch to find the pieces that end at Defective (0.60×0.05=3%0.60 \times 0.05 = \overlap{3\%} and 0.40×0.10=4%0.40 \times 0.10 = \overlap{4\%}), add those non-overlapping pieces to get the shrunken defective universe (3%+4%=7%\overlap{3\%} + \overlap{4\%} = \target{7\%}), and divide the target branch by that total (3%7%=37\frac{\overlap{3\%}}{\target{7\%}} = \frac{3}{7}).

5

Practice

1

In a group of 8080 students, 3535 play an instrument, 2828 sing in the choir, and 1414 do both. If a randomly chosen student plays an instrument, what is the probability that they also sing in the choir?

Which group is the given condition that goes in the denominator, and how many choir students are inside that group?

Knowing the student plays an instrument shrinks the universe from 8080 students down to the 35\given{35} instrument players, which goes on the bottom. For the top, watch out for using all 28\target{28} choir students (which gives 2835=45\frac{28}{35} = \wrong{\frac{4}{5}}) or dividing by the 28\target{28} choir students instead of the instrument players (which gives 1428=12\frac{14}{28} = \wrong{\frac{1}{2}}). Only the 14\overlap{14} students in the overlap who play an instrument and sing in the choir remain inside the shrunken universe:
P(Choir∣Instrument)\displaystyle P(\target{\text{Choir}} \mid \given{\text{Instrument}}) =1435\displaystyle = \frac{\overlap{14}}{\given{35}} =25\displaystyle = \frac{2}{5}
2

At a software company, 45%45\% of all bug reports are marked high priority, and 18%18\% of all bug reports are both marked high priority and fixed within an hour. Given that a bug report is marked high priority, what is the probability that it is not fixed within an hour?

Within the 45%45\% of bug reports that are high priority, what percentage are not fixed within an hour?

The given condition shrinks our universe to the 45%\given{45\%} of bug reports marked high priority. Inside that high-priority universe, 18%\crossed{18\%} are fixed within an hour, which is a fraction of 0.180.45=25\frac{\crossed{0.18}}{\given{0.45}} = \frac{2}{5}. Be careful not to stop at 25\wrong{\frac{2}{5}} (40%\wrong{40\%}), which is the probability that a high-priority report is fixed within an hour. Subtracting the 18%\crossed{18\%} that are fixed from the 45%\given{45\%} high-priority group leaves 45%−18%=27%\given{45\%} - \crossed{18\%} = \overlap{27\%} that are high priority and not fixed within an hour:
P(Not Fixed∣High)\displaystyle P(\target{\text{Not Fixed}} \mid \given{\text{High}}) =0.45−0.180.45\displaystyle = \frac{\given{0.45} - \crossed{0.18}}{\given{0.45}} =0.270.45\displaystyle = \frac{\overlap{0.27}}{\given{0.45}} =35\displaystyle = \frac{3}{5}
3

A security team of 44 people is chosen at random from 55 engineers and 44 managers (99 people in total). Given that the team has at least one manager, what is the probability that Jordan (one of the 55 engineers) is on the team?

After you subtract the all-engineer teams from the total number of teams, check how many of Jordan's teams were also all-engineer teams.

There are C(9,4)=126C(9, 4) = 126 total teams of 44, and C(5,4)=5\crossed{C(5, 4)} = \crossed{5} of them have only engineers and no managers, so the shrunken universe is 126−5=121126 - \crossed{5} = \given{121} teams with at least one manager. In the full group of 99 people, Jordan is on C(8,3)=56\target{C(8, 3)} = \target{56} teams (choosing the other 33 teammates from the remaining 88 people). Don't put all 56\target{56} of Jordan's teams over 121\given{121} (which gives 56121\wrong{\frac{56}{121}}): when we crossed out the all-engineer teams, we also crossed out the C(4,3)=4\crossed{C(4, 3)} = \crossed{4} teams where Jordan was paired with 33 of the other 44 engineers and no managers. Crossing those 4\crossed{4} teams out of the numerator leaves 56−4=52\target{56} - \crossed{4} = \overlap{52} teams:
P(Jordan∣at least 1 Manager)\displaystyle P(\target{\text{Jordan}} \mid \given{\text{at least 1 Manager}}) =C(8,3)−C(4,3)C(9,4)−C(5,4)\displaystyle = \frac{\target{C(8, 3)} - \crossed{C(4, 3)}}{C(9, 4) - \crossed{C(5, 4)}} =56−4126−5\displaystyle = \frac{\target{56} - \crossed{4}}{126 - \crossed{5}} =52121\displaystyle = \frac{\overlap{52}}{\given{121}}
4

A box of 1212 flash drives contains 88 working drives and 44 corrupted drives. You pick 33 drives at random one after another without replacement. What is the probability that the first two drives you pick are corrupted and the third one works?

Write the fraction for each of the 33 draws in sequence, updating the total drives left and the count of the type you want after each pick.

On the first pick, 44 of the 1212 drives are corrupted (412\frac{4}{12}). Given that the first was corrupted, 33 corrupted drives remain out of 1111 drives on the second pick (311\frac{3}{11}). On the third pick, 1010 drives remain in the box. Watch out for leaving the denominator at 1212 as if drawing with replacement (which gives 412×412×812=227\frac{4}{12} \times \frac{4}{12} \times \frac{8}{12} = \wrong{\frac{2}{27}}) or reducing the number of working drives on top to 66 (which gives 355\wrong{\frac{3}{55}}): since the first two drives picked were corrupted, all 88 working drives are still in the box:
P(Corrupted, Corrupted, Working)\displaystyle \overlap{P(\text{Corrupted, Corrupted, Working})} =412×311×810\displaystyle = \frac{4}{12} \times \frac{3}{11} \times \frac{8}{10} =455\displaystyle = \frac{4}{55}
5

You roll a fair six-sided die once. Let AA be the event that the roll is even, BB be the event that the roll is at most 44, and CC be the event that the roll is at least 44. Which of BB or CC is independent of AA?

Find P(B)P(B) and P(C)P(C) on the full die first, then shrink the universe to A={2,4,6}A = \{2, 4, 6\} and check which probability stayed the same.

Before learning A\given{A}, the full die {1,2,3,4,5,6}\{1, 2, 3, 4, 5, 6\} gives P(B)=46=23\target{P(B)} = \frac{4}{6} = \frac{2}{3} for {1,2,3,4}\target{\{1, 2, 3, 4\}} and P(C)=36=12\third{P(C)} = \frac{3}{6} = \frac{1}{2} for {4,5,6}\third{\{4, 5, 6\}}. Shrinking the universe to the even rolls A={2,4,6}\given{A} = \given{\{2, 4, 6\}} leaves 3\given{3} outcomes: 2\overlap{2} of them (22 and 44) belong to B\target{B}, and 2\overlap{2} of them (44 and 66) belong to C\third{C}, so P(B∣A)=23P(\target{B} \mid \given{A}) = \frac{2}{3} and P(C∣A)=23P(\third{C} \mid \given{A}) = \frac{2}{3}. Don't assume B\target{B} and C\third{C} behave the same way just because both have 2\overlap{2} outcomes inside A\given{A}, and don't confuse independence with having zero overlap: we compare each conditional probability to its starting probability before knowing A\given{A}. Since P(B∣A)=23=P(B)P(\target{B} \mid \given{A}) = \frac{2}{3} = \target{P(B)} while P(C∣A)=23≠12=P(C)P(\third{C} \mid \given{A}) = \frac{2}{3} \neq \frac{1}{2} = \third{P(C)}, B\target{B} is independent of A\given{A}, and C\third{C} is not.
6

An online store ships 50%50\% of its orders with Carrier X, 30%30\% with Carrier Y, and 20%20\% with Carrier Z. Packages arrive late 4%4\% of the time with Carrier X, 5%5\% of the time with Carrier Y, and 10%10\% of the time with Carrier Z. Given that a customer's package arrives late, what is the probability that it was shipped with Carrier Z?

Multiply along each carrier's branch to find the percentage of all orders that are both from that carrier and late, then add all three late branches for the new denominator.

Multiplying along each carrier's late branch gives the share of all orders that are late from each carrier: 0.50×0.04=2%0.50 \times 0.04 = \overlap{2\%} from Carrier X, 0.30×0.05=1.5%0.30 \times 0.05 = \overlap{1.5\%} from Carrier Y, and 0.20×0.10=2%0.20 \times 0.10 = \overlap{2\%} from Carrier Z. Watch out for ignoring the order shares and just dividing Carrier Z's 10%10\% late rate by 4%+5%+10%4\% + 5\% + 10\% (which gives 1019\wrong{\frac{10}{19}}). We must weight each late rate by how often that carrier is used. Adding the three late branches gives a shrunken universe of 2%+1.5%+2%=5.5%\overlap{2\%} + \overlap{1.5\%} + \overlap{2\%} = \target{5.5\%} late packages in total, with 2%\overlap{2\%} coming from Carrier Z:
P(Carrier Z∣Late)\displaystyle P(\given{\text{Carrier Z}} \mid \target{\text{Late}}) =2%2%+1.5%+2%\displaystyle = \frac{\overlap{2\%}}{\overlap{2\%} + \overlap{1.5\%} + \overlap{2\%}} =2%5.5%\displaystyle = \frac{\overlap{2\%}}{\target{5.5\%}} =2055\displaystyle = \frac{\overlap{20}}{\target{55}} =411\displaystyle = \frac{4}{11}