Discrete MathematicsProbability, Conditioning and Expectation1 of 9
Probability, Conditioning and Expectation · 1

Probability from Counting

We know how to count outcomes using slots, subsets, complements, and overlaps, and now we want to use those counts to find the probability that a specific result happens.

1

Equally Likely Outcomes and the Sample Space

Suppose we roll two fair six-sided dice and add them together. We want to find the probability that their sum is 77:

P(sum is 7)\displaystyle P(\event{\text{sum is } 7})
Equally Likely Outcomes and the Sample Space
P(sum is 7)= ?P(\htmlClass{lc-green}{\text{sum is }7}) = \,?
Text solution
Count the sample space of ordered dice pairsColoring one die red and one die blue gives 6\reddie{6} options for the red die and 6\bluedie{6} options for the blue die, so the product rule gives every equally likely pair.
6×6\displaystyle \reddie{6} \times \bluedie{6} =36\displaystyle = 36
Count the event of pairs that add up to 77Listing the matching (Red,Blue)(\reddie{\text{Red}}, \bluedie{\text{Blue}}) pairs, (1,6)(\reddie{1}, \bluedie{6}), (2,5)(\reddie{2}, \bluedie{5}), (3,4)(\reddie{3}, \bluedie{4}), (4,3)(\reddie{4}, \bluedie{3}), (5,2)(\reddie{5}, \bluedie{2}), and (6,1)(\reddie{6}, \bluedie{1}), gives 6\event{6} outcomes inside the event.
outcomes in the event\displaystyle \text{outcomes in the event} =6\displaystyle = \event{6}
Divide the event size by the sample space sizePut the 6\event{6} winning pairs over the 3636 equally likely pairs in the sample space SS to get the probability.
P(sum is 7)=6⏞event:subset of Swe want36⏟sample space S:all equally likelyoutcomes=16\displaystyle \begin{aligned} P(\event{\text{sum is } 7}) &= \frac{\overbrace{\event{6}}^{\begin{gathered}\text{event:} \\ \text{subset of } S \\ \text{we want}\end{gathered}}}{\underbrace{36}_{\begin{gathered}\text{sample space } S: \\ \text{all equally likely} \\ \text{outcomes}\end{gathered}}} \\ &= \frac{1}{6} \end{aligned}

Whenever every outcome in the sample space SS has the exact same chance of happening, the probability of an event is a single fraction of two counts:

P(event)\displaystyle P(\event{\text{event}}) =number of outcomes in the eventnumber of outcomes in S\displaystyle = \frac{\event{\text{number of outcomes in the event}}}{\text{number of outcomes in } S}

Every event for two dice is a subset of the 3636 equally likely (Red,Blue)(\reddie{\text{Red}}, \bluedie{\text{Blue}}) pairs in the grid, and a sum like 77 is more likely than 22 or 1212 because more pairs add up to it.

Every event is a subset of the same 36 equally likely dice pairs, and its probability is how many pairs are in that subset over 36.
2

Counting Ordered Outcomes with Slots

When the sample space has too many outcomes to draw as a grid, we count the bottom and the top of the probability fraction using slots. Suppose a random 33-digit PIN is formed using only the digits 11 through 55, and we want to find the probability that the PIN has no repeated digits:

P(no repeated digits)\displaystyle P(\event{\text{no repeated digits}})
Counting Ordered Outcomes with Slots
1,  2,  3,  4,  51,\ \ 2,\ \ 3,\ \ 4,\ \ 5
1st digit1\text{st}\text{ digit}
2nd digit2\text{nd}\text{ digit}
3rd digit3\text{rd}\text{ digit}
P(no repeated digits)= ?P(\htmlClass{lc-green}{\text{no repeated digits}}) = \,?
Text solution
Count all 33-digit PINs in the sample spaceAny of the 55 digits can go in each of the 33 slots when repeats are allowed.
5×5×5\displaystyle 5 \times 5 \times 5 =125\displaystyle = 125
Count the PINs with no repeated digitsEach slot has one fewer digit left to choose from than the slot before it.
5×4×3\displaystyle 5 \times 4 \times 3 =60\displaystyle = \event{60}
Divide the event size by the sample space sizePut the 60\event{60} repeat-free PINs over the 125125 total PINs.
P(no repeated digits)\displaystyle P(\event{\text{no repeated digits}}) =60125\displaystyle = \frac{\event{60}}{125} =1225\displaystyle = \frac{12}{25}
3

Counting Subsets and Why Order Cancels Out

Now suppose we grab a handful of items all at once, where the order we grab them in doesn't change the handful. A box holds 1010 lightbulbs, of which 3\groupone{3} are broken and 7\grouptwo{7} work. If we grab 44 bulbs at random, we want to find the probability of getting a handful with 1\groupone{1} broken bulb and 3\grouptwo{3} working bulbs:

P(exactly 1 broken bulb)\displaystyle P(\event{\text{exactly } 1 \text{ broken bulb}})

To count unordered subsets of kk items chosen from nn distinct items, we multiply kk slots down from nn and divide out the k!\orders{k!} ways to order the chosen items:

(nk)⏟n choose k\displaystyle \underbrace{\binom{n}{k}}_{n\text{ choose }k} =n×(n−1)×⋯×(n−k+1)⏞k slotsk×(k−1)×⋯×1⏟orders of the k items\displaystyle = \frac{\overbrace{n \times (n - 1) \times \dots \times (n - k + 1)}^{k\text{ slots}}}{\underbrace{\orders{k \times (k - 1) \times \dots \times 1}}_{\text{orders of the }k\text{ items}}}
Counting Subsets and Why Order Cancels Out
3 broken\htmlClass{lc-blue}{3\text{ broken}}
7 working\htmlClass{lc-pink}{7\text{ working}}
grab 4 bulbs\text{grab }4\text{ bulbs}
P(exactly 1 broken bulb)= ?P(\htmlClass{lc-green}{\text{exactly }1\text{ broken bulb}}) = \,?
Text solution
Count all unordered handfuls of 44 bulbs in the sample spaceChoose 44 bulbs out of the 1010 distinct bulbs in the box.
(104)\displaystyle \binom{10}{4} =10×9×8×74×3×2×1\displaystyle = \frac{10 \times 9 \times 8 \times 7}{\orders{4 \times 3 \times 2 \times 1}} =210\displaystyle = 210
Count the handfuls with 1\groupone{1} broken bulb and 3\grouptwo{3} working bulbsChoose 1\groupone{1} of the 3\groupone{3} broken bulbs and 3\grouptwo{3} of the 7\grouptwo{7} working bulbs, then multiply the two counts by the product rule.
(31)×(73)=3×7×6×53×2×1=3×35=105\displaystyle \begin{aligned} \groupone{\binom{3}{1}} \times \grouptwo{\binom{7}{3}} &= \groupone{3} \times \frac{7 \times 6 \times 5}{\orders{3 \times 2 \times 1}} \\ &= \groupone{3} \times \grouptwo{35} = \event{105} \end{aligned}
Divide the event size by the sample space sizePlace the 105\event{105} winning handfuls over the 210210 total handfuls.
P(exactly 1 broken bulb)\displaystyle P(\event{\text{exactly } 1 \text{ broken bulb}}) =105210\displaystyle = \frac{\event{105}}{210} =12\displaystyle = \frac{1}{2}

If we instead write each unordered handful of 44 bulbs in all 4×3×2×1=24\orders{4 \times 3 \times 2 \times 1} = \orders{24} possible orders, the event on top and the sample space on the bottom both get multiplied by the exact same factor of 24\orders{24}, leaving the simplified probability at 12\frac{1}{2}.

Unpacking every handful into its ordered draws multiplies the top and bottom of the fraction by the same amount, so the probability stays the same.
4

Finding Probability with the Complement

When an event splits into too many separate cases to count one by one, it is faster to count the outcomes outside the event and subtract them from the sample space. Suppose we roll a fair six-sided die 44 times in a row, and we want to find the probability of getting at least one 66:

P(at least one 6)\displaystyle P(\event{\text{at least one } 6})
Finding Probability with the Complement
P(at least one 6)= ?P(\htmlClass{lc-green}{\text{at least one }6}) = \,?
S: 1296 outcomesS\text{: }1296\text{ outcomes}
E\htmlClass{lc-green}{E}
at least one 6\htmlClass{lc-green}{\text{at least one }6}
671 outcomes\htmlClass{lc-green}{671\text{ outcomes}}
zero 6s\htmlClass{lc-orange}{\text{zero }6\text{s}}
625 outcomes\htmlClass{lc-orange}{625\text{ outcomes}}
Text solution
Count all 44-roll sequences in the sample spaceEach of the 44 rolls has 66 possible outcomes.
6×6×6×6\displaystyle 6 \times 6 \times 6 \times 6 =1296\displaystyle = 1296
Count the sequences outside the event with zero 66sEach roll must land on 1,2,3,4,1, 2, 3, 4, or 55, giving 55 options per roll.
5×5×5×5\displaystyle 5 \times 5 \times 5 \times 5 =625\displaystyle = \outside{625}
Subtract the outside outcomes from the sample space and divideRemove the 625\outside{625} sequences with no 66s from the 12961296 total sequences.
P(at least one 6)=1296−6251296=6711296=1−6251296\displaystyle \begin{aligned} P(\event{\text{at least one } 6}) &= \frac{1296 - \outside{625}}{1296} \\ &= \frac{\event{671}}{1296} \\ &= 1 - \frac{\outside{625}}{1296} \end{aligned}
5

Overlapping Events and the Limits of Counting

Next, suppose we want the probability that one event or another event happens, where a single outcome can belong to both events at once. If we draw 11 card at random from a standard 5252-card deck, we want to find the probability that the card is a Heart or a King:

P(Heart or King)\displaystyle P(\groupone{\text{Heart}} \text{ or } \grouptwo{\text{King}})
Overlapping Events and the Limits of Counting
A2345678910JQKA2345678910JQKA2345678910JQKA2345678910JQK
SS
P(Heart or King)= ?P(\htmlClass{lc-blue}{\text{Heart}}\text{ or }\htmlClass{lc-pink}{\text{King}}) = \,?
Text solution
Add the two events and subtract their overlapAdding the 13\groupone{13} Hearts and 4\grouptwo{4} Kings counts the King of Hearts twice, so subtract that 1\overlap{1} shared card once.
13+4−1\displaystyle \groupone{13} + \grouptwo{4} - \overlap{1} =16\displaystyle = \event{16}
Divide by the 5252 cards in the sample spacePut the 16\event{16} winning cards over the 5252 equally likely cards in the deck.
P(Heart or King)\displaystyle P(\groupone{\text{Heart}} \text{ or } \grouptwo{\text{King}}) =1652\displaystyle = \frac{\event{16}}{52} =413\displaystyle = \frac{4}{13}

Subtracting the overlap makes sure every card in the event is counted once.

Any suit row and rank column cross at one shared card, so subtracting that overlap counts every matching card once.

Dividing the two counts works only when every outcome in the sample space SS is equally likely. For a bent coin that lands on Heads 70%70\% of the time and Tails 30%30\% of the time, the sample space still has 22 outcomes, but P(Heads)P(\text{Heads}) is not 12\wrong{\frac{1}{2}} because the outcomes do not have equal chances.

Key concepts

To find a probability by counting, first make sure every outcome in the sample space SS is equally likely by treating identical-looking items as distinct, and then count the top and bottom using the same rule for order:

P(event)\displaystyle P(\event{\text{event}}) =number of outcomes in the eventnumber of outcomes in S\displaystyle = \frac{\event{\text{number of outcomes in the event}}}{\text{number of outcomes in } S}
Ordered sequences (`slots`)

When outcomes are built step by step in order, multiply the choices for each slot, such as 5×4×35×5×5\dfrac{\event{5 \times 4 \times 3}}{5 \times 5 \times 5} for a 33-digit PIN from {1,2,3,4,5}\{1, 2, 3, 4, 5\} with no repeats.

Unordered handfuls (`combinations`)

When grabbing a subset all at once, use (nk)\binom{n}{k} on both top and bottom, such as (31)(73)(104)\dfrac{\groupone{\binom{3}{1}}\grouptwo{\binom{7}{3}}}{\binom{10}{4}} for grabbing 1\groupone{1} broken and 3\grouptwo{3} working bulbs out of 1010.

"At least one" (`complement`)

Instead of splitting into cases for 1,2,3,…1, 2, 3, \dots, subtract the outcomes with none from the sample space, such as 64−5464\dfrac{6^4 - \outside{5^4}}{6^4} for rolling at least one 66 in 44 rolls.

Event A\groupone{A} or Event B\grouptwo{B} (`overlap`)

Add the sizes of both events and subtract the outcomes in both so shared outcomes are counted once, such as 13+4−152\dfrac{\groupone{13} + \grouptwo{4} - \overlap{1}}{52} for drawing a Heart or a King.

When not to just count outcomes

If the individual outcomes have different chances of happening, like a bent coin with 70%70\% Heads and 30%30\% Tails, or summing two dice into the 1111 totals 22 through 1212, dividing the number of outcomes by the size of the list gives the wrong probability.

6

Practice

1

You roll two fair six-sided dice that look completely identical. What is the probability that the two dice land on different numbers and add up to 88?

Color one die red and one die blue: how many total (Red,Blue)(\reddie{\text{Red}}, \bluedie{\text{Blue}}) pairs are in the sample space, and which of the pairs that add up to 88 must be left out?

Coloring one die red and one die blue gives 6×6=36\reddie{6} \times \bluedie{6} = 36 equally likely ordered pairs in the sample space. Five (Red,Blue)(\reddie{\text{Red}}, \bluedie{\text{Blue}}) pairs add up to 88:
(2,6), (3,5), (4,4), (5,3), (6,2)\displaystyle (\reddie{2}, \bluedie{6}),\ (\reddie{3}, \bluedie{5}),\ \wrong{(4, 4)},\ (\reddie{5}, \bluedie{3}),\ (\reddie{6}, \bluedie{2})
(Watch out: forgetting to remove (4,4)\wrong{(4, 4)} where both dice land on the same number gives the wrong answer 536\wrong{\frac{5}{36}}, and counting only the unordered pairs {2,6}\{2, 6\} and {3,5}\{3, 5\} over the 3636 ordered pairs gives 236=118\wrong{\frac{2}{36}} = \wrong{\frac{1}{18}}.) Removing (4,4)\wrong{(4, 4)} leaves 4\event{4} winning outcomes:
P(different numbers and sum is 8)\displaystyle P(\event{\text{different numbers and sum is } 8}) =436\displaystyle = \frac{\event{4}}{36} =19\displaystyle = \frac{1}{9}
2

A random 44-letter code is formed using only the 66 letters A, B, C, D, E, and F, with repeated letters allowed. What is the probability that the code starts with a vowel (A or E) and has no repeated letters?

In the sample space on the bottom, any of the 66 letters can fill any of the 44 slots; for the event on top, how many choices do you have for the first slot, and how many letters remain for the second?

In the sample space, repeats are allowed, so there are 6×6×6×6=12966 \times 6 \times 6 \times 6 = 1296 possible codes (forbidding repeats on the bottom too would use 6×5×4×3=3606 \times 5 \times 4 \times 3 = \wrong{360} and give the wrong answer 13\wrong{\frac{1}{3}}).
For the event, the first slot must be A or E (2\groupone{2} choices). Only the 1\groupone{1} vowel actually placed in the first slot is used up, leaving 5\grouptwo{5} remaining letters (including the unchosen vowel) for the second slot, 4\grouptwo{4} for the third, and 3\grouptwo{3} for the fourth (excluding both vowels from the remaining slots would use 2×4×3×2=482 \times 4 \times 3 \times 2 = \wrong{48} and give 127\wrong{\frac{1}{27}}):
2×5×4×3\displaystyle \groupone{2} \times \grouptwo{5 \times 4 \times 3} =120\displaystyle = \event{120}
P(starts with a vowel and no repeats)\displaystyle P(\groupone{\text{starts with a vowel}} \text{ and } \grouptwo{\text{no repeats}}) =1201296\displaystyle = \frac{\event{120}}{1296} =554\displaystyle = \frac{5}{54}
3

A committee of 55 people is chosen at random from a group of 66 engineers and 55 designers. What is the probability that the committee has exactly 33 engineers and 22 designers?

How many total people are available to choose the 55-person committee from on the bottom, and how do you combine the choices for the 33 engineers and the 22 designers on top?

There are 6+5=11\groupone{6} + \grouptwo{5} = 11 people in total, so the sample space has (115)\binom{11}{5} committees of 55:
(115)\displaystyle \binom{11}{5} =11×10×9×8×75×4×3×2×1\displaystyle = \frac{11 \times 10 \times 9 \times 8 \times 7}{\orders{5 \times 4 \times 3 \times 2 \times 1}} =462\displaystyle = 462
For the event, choose 3\groupone{3} of the 6\groupone{6} engineers and 2\grouptwo{2} of the 5\grouptwo{5} designers, and multiply the two counts by the product rule (adding 20+10=30\groupone{20} + \grouptwo{10} = \wrong{30} instead of multiplying gives the wrong answer 30462=577\wrong{\frac{30}{462}} = \wrong{\frac{5}{77}}):
(63)×(52)\displaystyle \groupone{\binom{6}{3}} \times \grouptwo{\binom{5}{2}} =20×10\displaystyle = \groupone{20} \times \grouptwo{10} =200\displaystyle = \event{200}
P(3 engineers and 2 designers)\displaystyle P(\groupone{3\text{ engineers}}\text{ and }\grouptwo{2\text{ designers}}) =200462\displaystyle = \frac{\event{200}}{462} =100231\displaystyle = \frac{100}{231}
4

A drawer holds 88 blue socks and 44 black socks. If you reach in and grab 33 socks at random, what is the probability that you get at least one black sock?

Instead of counting 11, 22, or 33 black socks separately, how many handfuls of 33 socks have zero black socks?

There are 8+4=12\groupone{8} + 4 = 12 socks in total, giving (123)\binom{12}{3} total handfuls in the sample space:
(123)\displaystyle \binom{12}{3} =12×11×103×2×1\displaystyle = \frac{12 \times 11 \times 10}{\orders{3 \times 2 \times 1}} =220\displaystyle = 220
A handful with zero black socks must be chosen entirely from the 8\groupone{8} blue socks:
(83)\displaystyle \groupone{\binom{8}{3}} =8×7×63×2×1\displaystyle = \frac{8 \times 7 \times 6}{\orders{3 \times 2 \times 1}} =56\displaystyle = \outside{56}
Subtracting those 56\outside{56} all-blue handfuls from the 220220 total handfuls (stopping before subtracting gives 56220=1455\wrong{\frac{56}{220}} = \wrong{\frac{14}{55}}, the probability of getting no black socks):
P(at least one black sock)=220−56220=164220=4155\displaystyle \begin{aligned} & P(\event{\text{at least one black sock}}) \\ &= \frac{220 - \outside{56}}{220} \\ &= \frac{\event{164}}{220} = \frac{41}{55} \end{aligned}
5

One integer is chosen at random from the integers 11 through 6060. What is the probability that it is a multiple of 44 or a multiple of 66?

After counting the multiples of 44 and the multiples of 66, which integers from 11 to 6060 got counted in both lists?

Out of the 6060 integers in the sample space, there are 604=15\frac{60}{\groupone{4}} = \groupone{15} multiples of 4\groupone{4} and 606=10\frac{60}{\grouptwo{6}} = \grouptwo{10} multiples of 6\grouptwo{6}.
The integers counted in both lists are the common multiples of 4\groupone{4} and 6\grouptwo{6}, which are the multiples of 12\overlap{12} (12,24,36,48,\overlap{12}, \overlap{24}, \overlap{36}, \overlap{48}, and 60\overlap{60}), giving 6012=5\frac{60}{\overlap{12}} = \overlap{5} overlapping integers (forgetting to subtract the overlap gives 2560=512\wrong{\frac{25}{60}} = \wrong{\frac{5}{12}}, and only subtracting multiples of 4×6=244 \times 6 = 24 leaves out 12,36,12, 36, and 6060 to give 2360\wrong{\frac{23}{60}}):
15+10−5\displaystyle \groupone{15} + \grouptwo{10} - \overlap{5} =20\displaystyle = \event{20}
P(multiple of 4 or 6)\displaystyle P(\text{multiple of }\groupone{4}\text{ or }\grouptwo{6}) =2060\displaystyle = \frac{\event{20}}{60} =13\displaystyle = \frac{1}{3}
6

A 55-card hand is dealt at random from a standard 5252-card deck. What is the probability that the hand contains at least one Spade or at least one Ace?

How many single cards in the 5252-card deck are neither a Spade nor an Ace, and how many 55-card hands can be dealt using only those cards?

First, count how many cards in the 5252-card deck are a Spade or an Ace. With 13\groupone{13} Spades, 4\grouptwo{4} Aces, and 1\overlap{1} Ace of Spades in both, there are 13+4−1=16\groupone{13} + \grouptwo{4} - \overlap{1} = 16 such cards, leaving 52−16=3652 - 16 = \outside{36} cards that are neither a Spade nor an Ace (forgetting the Ace of Spades overlap subtracts 17\wrong{17} instead of 1616 and leaves 35\wrong{35} cards, giving 23892730\wrong{\frac{2389}{2730}}).
There are (525)=2,598,960\binom{52}{5} = 2{,}598{,}960 total 55-card hands in the sample space, and (365)=376,992\outside{\binom{36}{5}} = \outside{376{,}992} hands with zero Spades and zero Aces. Subtracting the complement from 11:
P(at least one Spade or Ace)=1−(365)(525)=1−376,9922,598,960=1−66455=389455\displaystyle \begin{aligned} & P(\event{\text{at least one Spade or Ace}}) \\ &= 1 - \frac{\outside{\binom{36}{5}}}{\binom{52}{5}} \\ &= 1 - \frac{\outside{376{,}992}}{2{,}598{,}960} \\ &= 1 - \frac{\outside{66}}{455} = \frac{389}{455} \end{aligned}