Lemonmath
Tiếng Việt

Conditional probability

Lesson 6.1 · 18 min read · Updated

A school surveys 200200 grade-12 students about joining a sports club:

Joined Not joined Total
Boys 6060 4040 100100
Girls 3030 7070 100100
Total 9090 110110 200200

One student is chosen at random. The probability that the student has joined the club is 90200=0.45\dfrac{90}{200}=0.45. But if we also know that the student chosen is a girl, what is the probability that she has joined the club?

Conditional probability

Explore: shrinking the sample space

Once we know that the student is a girl, we only look at the 100100 girls in the second row. Of these, 3030 have joined, so the probability we want is

30100=0.3.\frac{30}{100}=0.3.

This is not 0.450.45: the information "is a girl" has changed the probability. We can also write it with probabilities over all 200200 students:

30100=30/200100/200=P(girl and joined)P(girl)=0.150.5=0.3.\frac{30}{100}=\frac{30/200}{100/200}=\frac{P(\text{girl and joined})}{P(\text{girl})}=\frac{0.15}{0.5}=0.3.

Why this formula? Knowing that BB has happened means only the outcomes in BB are still possible, so BB acts as a new sample space. Inside it, the outcomes that make AA happen are exactly A∩BA\cap B. We divide by P(B)P(B) so that the probabilities in the "new space" add up to 11.

The definition gives P(A‾∣B)=1−P(A∣B)P(\overline{A}\mid B)=1-P(A\mid B), just as for ordinary probabilities.

The order of the two events in P(A∣B)P(A\mid B) matters a great deal, as the next example shows.

The multiplication rule and tree diagrams

Multiplying both sides of the definition by P(B)P(B) gives a formula for the probability of an intersection.

This rule is especially useful when an experiment happens in stages. On a tree diagram, each branch carries the conditional probability of that stage, and the probability of a path is the product of the numbers along it.

5/83/84/73/75/72/7StartRedBlueRed: 20/56Blue: 15/56Red: 15/56Blue: 6/56
Tree diagram for drawing two balls without replacement

The four numbers at the ends add up to 20+15+15+656=1\dfrac{20+15+15+6}{56}=1, a quick check.

Independent events

In grade 11, two events were called independent when whether one happens does not change the probability of the other. With conditional probability we can write this as a formula: when P(B)>0P(B)>0,

A and B are independent  ⟺  P(A∣B)=P(A)  ⟺  P(A∩B)=P(A)⋅P(B).A \text{ and } B \text{ are independent}\iff P(A\mid B)=P(A)\iff P(A\cap B)=P(A)\cdot P(B).

The second equivalence follows from the multiplication rule. In the drawing example, P(D2∣D1)=47P(D_2\mid D_1)=\dfrac47 but P(D2∣D1‾)=57P(D_2\mid\overline{D_1})=\dfrac57, so D1D_1 and D2D_2 are not independent.

The last example is a medical one, where mixing up P(A∣B)P(A\mid B) and P(B∣A)P(B\mid A) can cause serious misunderstanding.

Key terms

Summary

  • P(A∣B)=P(A∩B)P(B)P(A\mid B)=\dfrac{P(A\cap B)}{P(B)} (with P(B)>0P(B)>0); for equally likely outcomes, n(A∩B)n(B)\dfrac{n(A\cap B)}{n(B)}.
  • Knowing that BB happened shrinks the sample space to BB; in a two-way table, read only the row or column of BB.
  • P(A∣B)P(A\mid B) and P(B∣A)P(B\mid A) are usually different.
  • Multiplication rule: P(A∩B)=P(B)⋅P(A∣B)P(A\cap B)=P(B)\cdot P(A\mid B); on a tree diagram, multiply along a path.
  • AA, BB independent   ⟺  P(A∣B)=P(A)  ⟺  P(A∩B)=P(A)P(B)\iff P(A\mid B)=P(A)\iff P(A\cap B)=P(A)P(B).

Practice

Each exercise comes with what you need and some steps to start. Try it yourself first, then open the solution.

Exercise 1

A fair die is rolled. Given that the result is odd, find the probability that it is at most 33.

What you need and how to start

What you need: P(A∣B)=n(A∩B)n(B)P(A\mid B)=\dfrac{n(A\cap B)}{n(B)} when outcomes are equally likely.

Steps:

  1. List B={1,3,5}B=\{1, 3, 5\}.
  2. Count the elements of BB that are at most 33.
Show solution

A∩B={1,3}A\cap B=\{1, 3\}, so P(A∣B)=23P(A\mid B)=\dfrac23.

Answer. 23\dfrac23.

Exercise 2

A class has 4040 students: 2020 boys, 1414 of whom like maths, and 2020 girls, 1010 of whom like maths. One student is chosen at random. Find the probability that the student likes maths given that she is a girl, and the probability that the student is a boy given that the student likes maths.

What you need and how to start

What you need: make a two-way table; read only the row (or column) of the condition.

Steps:

  1. The number who like maths is 14+10=2414+10=24.
  2. Compute 1020\dfrac{10}{20} and 1424\dfrac{14}{24}.
Show solution

P(likes maths∣girl)=1020=12P(\text{likes maths}\mid\text{girl})=\dfrac{10}{20}=\dfrac12; P(boy∣likes maths)=1424=712P(\text{boy}\mid\text{likes maths})=\dfrac{14}{24}=\dfrac{7}{12}.

Answer. 12\dfrac12 and 712\dfrac7{12}.

Exercise 3

Given P(A)=0.5P(A)=0.5, P(B)=0.4P(B)=0.4 and P(A∩B)=0.2P(A\cap B)=0.2, find P(A∣B)P(A\mid B) and P(B∣A)P(B\mid A), and decide whether AA and BB are independent.

What you need and how to start

What you need: the definition of conditional probability; independence means P(A∣B)=P(A)P(A\mid B)=P(A).

Steps:

  1. Divide P(A∩B)P(A\cap B) by P(B)P(B), then by P(A)P(A).
  2. Compare P(A∣B)P(A\mid B) with P(A)P(A).
Show solution

P(A∣B)=0.20.4=0.5P(A\mid B)=\dfrac{0.2}{0.4}=0.5 and P(B∣A)=0.20.5=0.4P(B\mid A)=\dfrac{0.2}{0.5}=0.4. Since P(A∣B)=P(A)P(A\mid B)=P(A), AA and BB are independent.

Answer. 0.50.5; 0.40.4; independent.

Exercise 4

A box holds 44 white balls and 66 black balls. Two balls are drawn one after the other without replacement. Find the probability that both are black, and the probability that the second is white given that the first is black.

What you need and how to start

What you need: the multiplication rule P(A∩B)=P(A)⋅P(B∣A)P(A\cap B)=P(A)\cdot P(B\mid A); after the first draw, 99 balls remain.

Steps:

  1. P(black first)=610P(\text{black first})=\dfrac{6}{10} and P(black second∣black first)=59P(\text{black second}\mid\text{black first})=\dfrac59.
  2. If the first is black, 44 white remain out of 99.
Show solution

P(both black)=610⋅59=13P(\text{both black})=\dfrac{6}{10}\cdot\dfrac59=\dfrac13. P(white second∣black first)=49P(\text{white second}\mid\text{black first})=\dfrac49.

Answer. 13\dfrac13 and 49\dfrac49.

Exercise 5

A box holds 1010 cards numbered 11 to 1010. One card is drawn at random. Let AA be "the number is even" and BB be "the number is at least 77". Is each claim true or false?

a) P(B)=0.4P(B)=0.4.

b) P(A∣B)=12P(A\mid B)=\dfrac12.

c) P(B∣A)=25P(B\mid A)=\dfrac25.

d) AA and BB are not independent.

What you need and how to start

What you need: P(A∣B)=n(A∩B)n(B)P(A\mid B)=\dfrac{n(A\cap B)}{n(B)}; independence means P(A∣B)=P(A)P(A\mid B)=P(A).

Steps:

  1. List B={7,8,9,10}B=\{7, 8, 9, 10\} and A∩B={8,10}A\cap B=\{8, 10\}.
  2. Compare P(A∣B)P(A\mid B) with P(A)=12P(A)=\dfrac12.
Show solution

a) True: P(B)=410=0.4P(B)=\dfrac4{10}=0.4.

b) True: P(A∣B)=24=12P(A\mid B)=\dfrac24=\dfrac12.

c) True: AA has 55 elements, of which 88 and 1010 are in BB, so P(B∣A)=25P(B\mid A)=\dfrac25.

d) False: P(A∣B)=12=P(A)P(A\mid B)=\dfrac12=P(A), so AA and BB are independent.

Answer. a) True; b) True; c) True; d) False.

Exercise 6

Two fair dice are rolled. Given that at least one die shows a 66, find the probability that the total is at least 1010. Give your answer to 2 decimal places.

What you need and how to start

What you need: counting in the shrunken sample space.

Steps:

  1. Count the outcomes with at least one 66: 36−25=1136-25=11.
  2. Among them, count those with total ≥10\ge10.
Show solution

The outcomes with a 66 and total ≥10\ge10 are (4,6)(4, 6), (6,4)(6, 4), (5,6)(5, 6), (6,5)(6, 5), (6,6)(6, 6). The probability is 511≈0.4545\dfrac5{11}\approx0.4545.

Answer. 0.450.45.

Exercise 7

In a café, 70%70\% of customers order a coffee drink, and 40%40\% of those also order a cake. Also, 35%35\% of all customers order a cake. Find the probability that a customer orders both coffee and cake, and the probability that a customer ordered coffee given that the customer ordered cake.

What you need and how to start

What you need: "40%40\% of those" is the conditional probability P(cake∣coffee)=0.4P(\text{cake}\mid\text{coffee})=0.4.

Steps:

  1. Use the multiplication rule.
  2. Divide by P(cake)=0.35P(\text{cake})=0.35.
Show solution

P(coffee and cake)=0.7⋅0.4=0.28P(\text{coffee and cake})=0.7\cdot0.4=0.28. P(coffee∣cake)=0.280.35=0.8P(\text{coffee}\mid\text{cake})=\dfrac{0.28}{0.35}=0.8.

Answer. 0.280.28 and 0.80.8.

Exercise 8 Review

Two marksmen fire independently at a target, one shot each, hitting with probabilities 0.80.8 and 0.70.7. Given that the target is hit at least once, find the probability that both hit it. Give your answer to 2 decimal places.

What you need and how to start

What you need: the multiplication rule for independent events (grade 11) and the complementary event: P(at least one)=1−P(nobody hits)P(\text{at least one})=1-P(\text{nobody hits}).

Steps:

  1. P(both hit)=0.8⋅0.7P(\text{both hit})=0.8\cdot0.7.
  2. P(at least one hit)=1−0.2⋅0.3P(\text{at least one hit})=1-0.2\cdot0.3; "both hit" lies inside "at least one hit".
Show solution

P(both)=0.56P(\text{both})=0.56 and P(at least one)=1−0.06=0.94P(\text{at least one})=1-0.06=0.94. Since "both hit" implies "at least one hit", their intersection is "both hit", so the probability is 0.560.94=2847≈0.596\dfrac{0.56}{0.94}=\dfrac{28}{47}\approx0.596.

Answer. ≈0.60\approx0.60.

Exercise 9 Review

A group has 55 boys and 44 girls. Three of them are chosen at random. Given that at least one girl is chosen, find the probability that exactly one girl is chosen.

What you need and how to start

What you need: counting with combinations (see permutations, arrangements and combinations).

Steps:

  1. The number of choices with at least one girl is (93)−(53)\binom{9}{3}-\binom{5}{3}.
  2. The number with exactly one girl is (41)⋅(52)\binom{4}{1}\cdot\binom{5}{2}.
Show solution

(93)−(53)=84−10=74\binom{9}{3}-\binom{5}{3}=84-10=74 and (41)⋅(52)=4⋅10=40\binom{4}{1}\cdot\binom{5}{2}=4\cdot10=40. The probability is 4074=2037\dfrac{40}{74}=\dfrac{20}{37}.

Answer. 2037\dfrac{20}{37}.

Exercise 10 Challenge

A fair coin is tossed three times. Let AA be "the first toss is heads" and BB be "at least two tosses are heads". Find P(A∣B)P(A\mid B) and P(B∣A)P(B\mid A), and decide whether AA and BB are independent.

What you need and how to start

What you need: list the 88 equally likely outcomes; independence means P(A∣B)=P(A)P(A\mid B)=P(A).

Steps:

  1. Write BB (H for heads, T for tails): HHT, HTH, THH, HHH.
  2. Count A∩BA\cap B, then divide by n(B)n(B) and by n(A)=4n(A)=4.
Show solution

A∩B={HHT,HTH,HHH}A\cap B=\{\text{HHT}, \text{HTH}, \text{HHH}\} has 33 elements. P(A∣B)=34P(A\mid B)=\dfrac34 and P(B∣A)=34P(B\mid A)=\dfrac34. Since P(A)=12≠34P(A)=\dfrac12\neq\dfrac34, the events are not independent: knowing the first toss is heads makes at least two heads more likely.

Answer. 34\dfrac34; 34\dfrac34; not independent.

Mini test

Mini test

Marked like the Vietnamese graduation exam: Part I 0.25 points per question; Part II up to 1 point per question (1, 2, 3, 4 correct statements give 0.1, 0.25, 0.5, 1 point); Part III 0.5 points per question.

Part I. Multiple choice

Question 1. Given P(A)=0.6P(A)=0.6, P(B)=0.5P(B)=0.5 and P(A∩B)=0.2P(A\cap B)=0.2, the value of P(A∣B)P(A\mid B) is
Question 2. A fair die is rolled. Given that the result is even, the probability that it is a 66 is
Question 3. A box holds 33 red and 22 blue balls. Two balls are drawn one after the other without replacement. The probability that both are red is
Question 4. Of 100100 people asked, 4040 use app X and 3030 of those are satisfied; 6060 do not use X and 3030 of those are satisfied. A satisfied person is chosen at random. The probability that this person uses app X is

Part II. True or false

Question 1. AA and BB are independent events with P(A)=0.4P(A)=0.4 and P(B)=0.5P(B)=0.5.
a) P(A∩B)=0.2P(A\cap B)=0.2.
b) P(A∣B)=0.4P(A\mid B)=0.4.
c) P(A‾∣B)=0.4P(\overline{A}\mid B)=0.4.
d) P(A∪B)=0.7P(A\cup B)=0.7.

Part III. Short answer

Question 1. Two fair dice are rolled. Given that the total is 77, find the probability that one die shows a 11. Give your answer to 2 decimal places.

Question 2. Of 500500 people tested, 2020 have a disease and 1818 of them test positive; 480480 do not have it and 2424 of them test positive. A person who tests positive is chosen at random. Find the probability that this person has the disease. Give your answer to 2 decimal places.

Show answers and explanations
  1. Part I, question 1: B. P(A∣B)=0.20.5=0.4P(A\mid B)=\dfrac{0.2}{0.5}=0.4. A is P(A)P(B)P(A)P(B), C divides by P(A)P(A) (that is P(B∣A)P(B\mid A)), and D multiplies P(A∩B)P(A\cap B) by P(B)P(B).
  2. Part I, question 2: C. The shrunken sample space is {2,4,6}\{2, 4, 6\}, so the probability is 13\dfrac13. A ignores the condition, B is the probability of an even number, and D multiplies 16⋅12\dfrac16\cdot\dfrac12.
  3. Part I, question 3: B. 35⋅24=310\dfrac35\cdot\dfrac24=\dfrac3{10}. A treats the draws as with replacement, C is only the probability that the first is red, and D is only P(red second∣red first)P(\text{red second}\mid\text{red first}).
  4. Part I, question 4: C. There are 6060 satisfied people, 3030 of whom use X: 3060=12\dfrac{30}{60}=\dfrac12. A is P(satisfied∣uses X)P(\text{satisfied}\mid\text{uses X}), B divides by all 100100 people, and D is the probability of being satisfied.
  5. Part II, question 1: a) True; b) True; c) False; d) True. a) True: 0.4⋅0.50.4\cdot0.5. b) True: independence gives P(A∣B)=P(A)P(A\mid B)=P(A). c) False: P(A‾∣B)=1−0.4=0.6P(\overline{A}\mid B)=1-0.4=0.6. d) True: 0.4+0.5−0.2=0.70.4+0.5-0.2=0.7.
  6. Part III, question 1: 0.33. A total of 77 has 66 outcomes, of which (1,6)(1, 6) and (6,1)(6, 1) contain a 11: 26=13≈0.33\dfrac26=\dfrac13\approx0.33.
  7. Part III, question 2: 0.43. There are 18+24=4218+24=42 positive results, 1818 of them from people with the disease: 1842=37≈0.43\dfrac{18}{42}=\dfrac37\approx0.43.