Count only within the group you have been told about
In a class of $30$ students, $12$ wear glasses. Of those $12$, $5$ are left-handed. A student is chosen at random.
The extra information "given that they wear glasses" has cut the group from $30$ down to $12$.
Two-way tables make conditional probability almost mechanical: the condition tells you which row or column to use as the denominator.
- Read the condition β the part after "given that".
- Find the row or column total for that condition. This is your denominator.
- Find the single cell that satisfies both conditions. This is your numerator.
- Write the fraction and simplify.
The table shows $200$ people and whether they own a pet.
| Owns a pet | No pet | Total | |
|---|---|---|---|
| Adults | $54$ | $66$ | $120$ |
| Children | $48$ | $32$ | $80$ |
| Total | $102$ | $98$ | $200$ |
Find (a) $P(\text{owns a pet})$, (b) $P(\text{owns a pet} \mid \text{child})$, (c) $P(\text{child} \mid \text{owns a pet})$.
Using the diagram above, find (a) $P(F)$, (b) $P(F \mid G)$, (c) $P(G \mid F)$, (d) $P(F' \mid G')$.
A bag has $5$ red and $3$ blue counters. Two are taken without replacement. What is the probability the second is red, given the first was red?
This number is written directly on the upper second-stage branch of the tree.
A factory has two machines. Machine A makes $60\%$ of items, machine B makes $40\%$. $3\%$ of A's items are faulty and $7\%$ of B's are faulty. An item is chosen at random and found to be faulty. Find the probability it came from machine B.
Conditional probability becomes much easier if you convert the probabilities into numbers of people first. Choose a convenient total and build a table.
- Pick a friendly total β usually $100$, $1000$ or a number that makes all the percentages whole.
- Work out how many fall into each category.
- Build a two-way table of counts.
- Read the conditional probability straight off, using the appropriate row or column total.
$1\%$ of a population has a disease. A test is $90\%$ accurate for those who have it, and gives a false positive for $5\%$ of those who do not. A person tests positive. What is the probability they actually have the disease?
| Tests positive | Tests negative | Total | |
|---|---|---|---|
| Has disease | $90$ | $10$ | $100$ |
| No disease | $495$ | $9405$ | $9900$ |
| Total | $585$ | $9415$ | $10\,000$ |
Only about $15\%$ β surprisingly low, because the disease is rare and there are far more false positives than true ones. This is why real screening programmes always retest.
equivalently, if $P(A \cap B) = P(A) \times P(B)$
In a group of $80$ people, $32$ play a musical instrument and $20$ speak a second language. Of these, $8$ do both. Are "plays an instrument" and "speaks a second language" independent?
Check with the product rule: $P(\text{both}) = \dfrac{8}{80} = 0.1$, and $P(A) \times P(B) = 0.4 \times 0.25 = 0.1$ β
Notation
$P(A \mid B)$ is "$A$ given $B$".
The main idea
"Given that" shrinks the denominator to the stated group.
Two-way table
Use one row or one column total as the denominator.
Venn diagram
Overlap $\div$ the whole condition circle.
Formula
$P(A \mid B) = \dfrac{P(A \cap B)}{P(B)}$.
Order matters
$P(A \mid B) \neq P(B \mid A)$ in general.
Trees
Second-stage branches are already conditional.
Reversing
Wanted path $\div$ sum of all paths meeting the condition.
Expected frequencies
Convert to counts out of $100$ or $10\,000$ β far easier.
Independent?
Check whether $P(A \mid B) = P(A)$.
In a class of $25$, $10$ play football. Of those, $4$ also play tennis. Find $P(\text{plays tennis} \mid \text{plays football})$.
βΆ Show solution
Restrict to the $10$ footballers, of whom $4$ play tennis.
$P = \dfrac{4}{10} = 0.4$
Use this table to find (a) $P(\text{male})$, (b) $P(\text{drives} \mid \text{male})$, (c) $P(\text{male} \mid \text{drives})$.
| Drives | Does not drive | Total | |
|---|---|---|---|
| Male | $45$ | $15$ | $60$ |
| Female | $35$ | $25$ | $60$ |
| Total | $80$ | $40$ | $120$ |
βΆ Show solution
(a) $\dfrac{60}{120} = 0.5$
(b) Male row: $\dfrac{45}{60} = 0.75$
(c) Drives column: $\dfrac{45}{80} = 0.5625$
A bag has $6$ red and $4$ green counters. Two are taken without replacement. Find $P(\text{2nd is green} \mid \text{1st is green})$.
βΆ Show solution
After removing one green, $3$ green remain out of $9$ counters.
$P = \dfrac{3}{9} = \dfrac{1}{3}$
A Venn diagram shows: only $A$ = $12$, both = $8$, only $B$ = $15$, neither = $5$. Find (a) $P(A \mid B)$, (b) $P(B \mid A)$.
βΆ Show solution
$n(A) = 12 + 8 = 20$; $n(B) = 8 + 15 = 23$; total $= 40$.
(a) $P(A \mid B) = \dfrac{8}{23}$
(b) $P(B \mid A) = \dfrac{8}{20} = 0.4$
$P(A) = 0.5$, $P(B) = 0.3$ and $P(A \cap B) = 0.15$. Are $A$ and $B$ independent?
βΆ Show solution
$P(A) \times P(B) = 0.5 \times 0.3 = 0.15$
This equals $P(A \cap B)$, so yes, they are independent.
Check the other way: $P(A \mid B) = \dfrac{0.15}{0.3} = 0.5 = P(A)$ β
Of $150$ people surveyed, $90$ own a car. Of the car owners, $54$ also own a bike. Of the non-car-owners, $18$ own a bike. Find $P(\text{owns a car} \mid \text{owns a bike})$.
βΆ Show solution
Bike owners altogether $= 54 + 18 = 72$.
Of these, $54$ also own a car.
$P = \dfrac{54}{72} = 0.75$
Two machines make bolts. Machine X makes $70\%$ and $2\%$ of them are faulty; machine Y makes $30\%$ and $6\%$ are faulty. A bolt is faulty. Find the probability it came from machine X.
βΆ Show solution
$P(\text{X and faulty}) = 0.7 \times 0.02 = 0.014$
$P(\text{Y and faulty}) = 0.3 \times 0.06 = 0.018$
$P(\text{faulty}) = 0.014 + 0.018 = 0.032$
$P(\text{X} \mid \text{faulty}) = \dfrac{0.014}{0.032} = 0.4375$
Explain, with an example, why $P(A \mid B)$ is not usually the same as $P(B \mid A)$.
βΆ Show solution
They use different denominators: one restricts to group $B$, the other to group $A$. Unless the two groups happen to be the same size, the answers differ.
Example: $P(\text{is a professional footballer} \mid \text{owns football boots})$ is tiny, because millions of people own boots.
But $P(\text{owns football boots} \mid \text{is a professional footballer})$ is essentially $1$.
A bag contains $4$ white and $6$ black balls. Two are drawn without replacement.
(a) Find $P(\text{both white})$. (b) Find $P(\text{2nd white})$. (c) Find $P(\text{1st white} \mid \text{2nd white})$.
βΆ Show solution
(a) $\dfrac{4}{10} \times \dfrac{3}{9} = \dfrac{12}{90} = \dfrac{2}{15}$
(b) Two paths give a white second ball:
WW: $\dfrac{4}{10} \times \dfrac{3}{9} = \dfrac{12}{90}$; BW: $\dfrac{6}{10} \times \dfrac{4}{9} = \dfrac{24}{90}$
$P(\text{2nd white}) = \dfrac{12 + 24}{90} = \dfrac{36}{90} = \dfrac{2}{5}$
(c) $P(\text{1st white} \mid \text{2nd white}) = \dfrac{P(\text{WW})}{P(\text{2nd white})} = \dfrac{12/90}{36/90} = \dfrac{12}{36} = \dfrac{1}{3}$
A screening test for a condition affecting $2\%$ of a population detects it correctly $95\%$ of the time. For people without the condition, it wrongly gives a positive result $8\%$ of the time.
(a) Using a population of $10\,000$, build a two-way table. (b) Find $P(\text{positive test})$. (c) Find $P(\text{has the condition} \mid \text{positive test})$. (d) Comment on what this means for the usefulness of the test.
βΆ Show solution
(a) With the condition: $2\%$ of $10\,000 = 200$; without: $9800$.
True positives: $95\%$ of $200 = 190$; so $10$ false negatives.
False positives: $8\%$ of $9800 = 784$; so $9016$ true negatives.
| Positive | Negative | Total | |
|---|---|---|---|
| Has condition | $190$ | $10$ | $200$ |
| No condition | $784$ | $9016$ | $9800$ |
| Total | $974$ | $9026$ | $10\,000$ |
(b) $P(\text{positive}) = \dfrac{974}{10\,000} = 0.0974$
(c) $P(\text{has condition} \mid \text{positive}) = \dfrac{190}{974} = 0.195$ (3 d.p.)
(d) Only about $20\%$ of people who test positive actually have the condition β four out of five positives are false alarms.
This happens because the condition is rare: even a small false-positive rate applied to the very large healthy group ($784$ people) swamps the true positives ($190$). The test is still useful as a first screen, since it catches $95\%$ of real cases, but a positive result must always be followed up with a more accurate second test.