05-02: Exercises — Probability Rules and Conditional Probability¶
Notes reference: 05-02: Probability Rules and Conditional Probability
Q1: Mutually exclusive or not?¶
State whether each pair is mutually exclusive, then compute P(A or B).
A= draw a king,B= draw a queenA= draw a king,B= draw a heartA= roll an even number,B= roll a 5A= roll an even number,B= roll a number > 3
Solution
1. MUTUALLY EXCLUSIVE (a card cannot be both)
P(K or Q) = 4/52 + 4/52 = 8/52 = 0.1538
2. NOT mutually exclusive — the king of hearts is both
P(K or ♥) = 4/52 + 13/52 − 1/52 = 16/52 = 0.3077
3. MUTUALLY EXCLUSIVE (5 is odd)
P(even or 5) = 3/6 + 1/6 = 4/6 = 0.6667
4. NOT mutually exclusive — 4 and 6 are in both
P(even or >3) = 3/6 + 3/6 − 2/6 = 4/6 = 0.6667
The tell: if the events can happen together, you must subtract the overlap.
Q2: With and without replacement¶
An urn holds 6 red and 4 blue marbles. Draw two.
Find P(both red):
(a) with replacement, (b) without replacement.
Solution
(a) WITH replacement — INDEPENDENT
P(R₁ and R₂) = P(R₁) × P(R₂) = (6/10)(6/10) = 36/100 = 0.3600
(b) WITHOUT replacement — DEPENDENT
P(R₁ and R₂) = P(R₁) × P(R₂ | R₁) = (6/10)(5/9) = 30/90 = 0.3333
The second draw's probability changed from 6/10 to 5/9 because one red
marble is gone. That is exactly what "dependent" means.
Also find P(one of each colour) without replacement:
Q3: Conditional probability from a table¶
A company surveys 400 employees:
| Satisfied | Neutral | Dissatisfied | Total | |
|---|---|---|---|---|
| Remote | 110 | 40 | 20 | 170 |
| Hybrid | 85 | 35 | 30 | 150 |
| On-site | 30 | 25 | 25 | 80 |
| Total | 225 | 100 | 75 | 400 |
Find:
P(Satisfied)P(Remote)P(Remote and Satisfied)P(Satisfied | Remote)P(Remote | Satisfied)P(Remote or Satisfied)- Are work mode and satisfaction independent?
Solution
1. P(Satisfied) = 225/400 = 0.5625 (marginal)
2. P(Remote) = 170/400 = 0.4250 (marginal)
3. P(Remote and Satisfied) = 110/400 = 0.2750 (joint)
4. P(Satisfied | Remote) = 110/170 = 0.6471 ← divide by the ROW total
5. P(Remote | Satisfied) = 110/225 = 0.4889 ← divide by the COLUMN total
6. P(Remote or Satisfied) = 0.4250 + 0.5625 − 0.2750 = 0.7125
(or directly: (170 + 225 − 110)/400 = 285/400)
7. INDEPENDENCE CHECK
P(Satisfied | Remote) = 0.6471
P(Satisfied) = 0.5625
0.6471 ≠ 0.5625 → DEPENDENT
Equivalently, the expected count if independent would be
170 × 225 / 400 = 95.6, but 110 was observed.
That gap is what the chi-square test of 12-02 formalises.
Note how 4 and 5 differ. P(A|B) and P(B|A) are different questions with different denominators — 0.647 vs. 0.489.
Q4: Build the table in software¶
Reproduce the Q3 probabilities from raw data.
Solution
' Counts in B2:D4, totals in E and row 5
=SUM(B2:D2) ' E2 row total
=SUM(B2:B4) ' B5 column total
=B2/$E$5 ' joint P(Remote and Satisfied) -> 0.275
=E2/$E$5 ' marginal P(Remote) -> 0.425
=B2/$E2 ' row-cond P(Satisfied | Remote) -> 0.6471
=B2/B$5 ' col-cond P(Remote | Satisfied) -> 0.4889
=E2*B5/$E$5 ' expected if independent -> 95.625
' From raw data: Insert ▸ PivotTable
' Rows = mode, Columns = satisfaction, Values = Count
' Show Values As ▸ % of Grand Total → joint
' Show Values As ▸ % of Row Total → P(column | row)
' Show Values As ▸ % of Column Total → P(row | column)
tab <- matrix(c(110,40,20, 85,35,30, 30,25,25), nrow = 3, byrow = TRUE,
dimnames = list(mode = c("Remote","Hybrid","Onsite"),
sat = c("Satisfied","Neutral","Dissatisfied")))
addmargins(tab)
prop.table(tab) # joint
margin.table(tab, 1) / sum(tab) # marginal by row
prop.table(tab, 1) # P(sat | mode) — rows sum to 1
prop.table(tab, 2) # P(mode | sat) — cols sum to 1
outer(rowSums(tab), colSums(tab)) / sum(tab) # expected if independent
tab = pd.DataFrame([[110,40,20],[85,35,30],[30,25,25]],
index=["Remote","Hybrid","Onsite"],
columns=["Satisfied","Neutral","Dissatisfied"])
n = tab.values.sum()
tab / n # joint
tab.sum(axis=1) / n # marginal
tab.div(tab.sum(axis=1), axis=0) # P(sat | mode)
tab.div(tab.sum(axis=0), axis=1) # P(mode | sat)
np.outer(tab.sum(axis=1), tab.sum(axis=0)) / n # expected if independent
Q5: Tree diagram¶
A factory has two suppliers. Supplier A provides 70% of parts with a 3% defect rate; supplier B provides 30% with a 6% defect rate.
- Draw the tree and find all four joint probabilities.
P(defective)P(good)
Solution
0.03 Defective P = 0.70 × 0.03 = 0.021
0.70 A ─┤
┌─────────┘ 0.97 Good P = 0.70 × 0.97 = 0.679
Start ─┤
└─────────┐ 0.06 Defective P = 0.30 × 0.06 = 0.018
0.30 B ─┤
0.94 Good P = 0.30 × 0.94 = 0.282
───────────────────────
Total 1.000 ✓
2. P(defective) = 0.021 + 0.018 = 0.039 (3.9%)
3. P(good) = 0.679 + 0.282 = 0.961 (or 1 − 0.039 ✓)
Multiply along a branch, add across branch endings. Step 2 is the Law of Total Probability.
Q6: Independence, three ways¶
P(A) = 0.4, P(B) = 0.5, P(A and B) = 0.2.
- Are
AandBindependent? Show it three ways. - Find
P(A | B)andP(B | A). - Find
P(A or B).
Solution
1. TEST 1: P(A and B) = P(A)·P(B)?
0.2 =? 0.4 × 0.5 = 0.2 ✓ YES
TEST 2: P(A | B) = P(A)?
0.2/0.5 = 0.4 =? 0.4 ✓ YES
TEST 3: P(B | A) = P(B)?
0.2/0.4 = 0.5 =? 0.5 ✓ YES
A and B are INDEPENDENT.
2. P(A | B) = 0.2/0.5 = 0.40
P(B | A) = 0.2/0.4 = 0.50
3. P(A or B) = 0.4 + 0.5 − 0.2 = 0.70
Q7: Mutually exclusive vs. independent¶
P(A) = 0.3, P(B) = 0.4, and A and B are mutually exclusive.
- Find
P(A and B). - Find
P(A or B). - Are they independent?
Solution
1. Mutually exclusive → P(A and B) = 0
2. P(A or B) = 0.3 + 0.4 − 0 = 0.70
3. Independence requires P(A and B) = P(A)·P(B) = 0.3 × 0.4 = 0.12
But P(A and B) = 0 ≠ 0.12
→ NOT independent. They are DEPENDENT.
Intuition: if A occurs, B definitely did NOT — knowing A tells you
everything about B. That is the opposite of independence.
GENERAL RULE: two events with non-zero probability that are mutually
exclusive are ALWAYS dependent. "Mutually exclusive" and "independent"
are not synonyms — they are close to opposites.
Q8: A three-stage problem¶
A student answers three multiple-choice questions by guessing. Each has 4 options.
P(all three correct)P(none correct)P(at least one correct)P(exactly one correct)
Solution
Each question: P(correct) = 0.25, P(wrong) = 0.75, independent
1. P(all 3) = (0.25)³ = 0.015625 (1.6%)
2. P(none) = (0.75)³ = 0.421875 (42.2%)
3. P(at least one) = 1 − P(none)
= 1 − 0.421875 = 0.578125 (57.8%) ← complement rule
4. Exactly one correct — THREE arrangements (CWW, WCW, WWC):
P = 3 × (0.25)(0.75)(0.75) = 3 × 0.140625 = 0.421875 (42.2%)
The binomial machinery behind #4 is developed in 06-02.
⬅️ Previous: 05-01: Exercises — Probability Basics ➡️ Next: 05-03: Exercises — Bayes' Theorem and Counting Rules