intermediate 25 minutes

Conditional Probability and Independence

Learn to calculate probabilities when conditions are known. Understand independent vs dependent events and master conditional probability.

On This Page
Advertisement

What is Conditional Probability?

Conditional probability answers the question: “What’s the probability of A, given that B has occurred?”

Conditional Probability

P(AB)=P(AB)P(B)P(A|B) = \frac{P(A \cap B)}{P(B)}

Read as: “Probability of A given B”

Where:

  • P(AB)P(A|B) = probability of A given B occurred
  • P(AB)P(A \cap B) = probability of both A and B
  • P(B)P(B) = probability of B (must be greater than 0)
Drawing Cards

Draw one card from a standard deck.

A = card is a Queen B = card is a face card (J, Q, K)

What’s P(Queen | Face card)?

Without condition: P(Queen) = 4/52 = 1/13

With condition: Given it’s a face card (12 cards), what’s P(Queen)? P(AB)=P(Queen and Face)P(Face)=4/5212/52=412=13P(A|B) = \frac{P(\text{Queen and Face})}{P(\text{Face})} = \frac{4/52}{12/52} = \frac{4}{12} = \frac{1}{3}

Or directly: 4 queens among 12 face cards = 1/3

Multiplication Rule

Rearranging the conditional probability formula gives us the multiplication rule:

General Multiplication Rule

P(AB)=P(B)×P(AB)P(A \cap B) = P(B) \times P(A|B)

Or equivalently: P(AB)=P(A)×P(BA)P(A \cap B) = P(A) \times P(B|A)

Drawing Without Replacement

A bag has 5 red and 3 blue marbles. Draw 2 without replacement.

P(both red)?

A = first marble is red B = second marble is red

P(A)=5/8P(A) = 5/8 (5 red out of 8 total) P(BA)=4/7P(B|A) = 4/7 (after removing one red: 4 red out of 7)

P(AB)=P(A)×P(BA)=58×47=2056=514P(A \cap B) = P(A) \times P(B|A) = \frac{5}{8} \times \frac{4}{7} = \frac{20}{56} = \frac{5}{14}

Independent Events

Two events are independent if knowing one occurred doesn’t change the probability of the other.

Independence Definition

Events A and B are independent if:

P(AB)=P(A)P(A|B) = P(A)

Or equivalently: P(BA)=P(B)P(B|A) = P(B)

Or equivalently: P(AB)=P(A)×P(B)P(A \cap B) = P(A) \times P(B)

Coin Flips

Flip a fair coin twice.

A = first flip is heads B = second flip is heads

Are these independent?

P(A)=0.5P(A) = 0.5 P(BA)=0.5P(B|A) = 0.5 (second flip doesn’t “know” about the first)

Since P(BA)=P(B)P(B|A) = P(B), the events are independent.

P(both heads)=P(A)×P(B)=0.5×0.5=0.25P(\text{both heads}) = P(A) \times P(B) = 0.5 \times 0.5 = 0.25

Dependent Events

Events are dependent if one event affects the probability of the other.

Drawing Without Replacement

A bag has 6 red and 4 green balls.

A = first draw is red B = second draw is red

P(A)=6/10=0.6P(A) = 6/10 = 0.6 P(BA)=5/90.556P(B|A) = 5/9 \approx 0.556 (only 5 red left among 9 balls) P(Bnot A)=6/90.667P(B|\text{not }A) = 6/9 \approx 0.667 (all 6 red still among 9 balls)

Since P(BA)P(Bnot A)P(B|A) \neq P(B|\text{not }A), these events are dependent.

Testing for Independence

To check if events are independent, verify any one of:

  1. P(AB)=P(A)P(A|B) = P(A)
  2. P(BA)=P(B)P(B|A) = P(B)
  3. P(AB)=P(A)×P(B)P(A \cap B) = P(A) \times P(B)
Testing Independence

Survey of 200 people:

Coffee DrinkerNot CoffeeTotal
Morning Person6040100
Night Owl5050100
Total11090200

Are “morning person” and “coffee drinker” independent?

P(Coffee)=110/200=0.55P(\text{Coffee}) = 110/200 = 0.55

P(CoffeeMorning)=60/100=0.60P(\text{Coffee}|\text{Morning}) = 60/100 = 0.60

Since 0.600.550.60 \neq 0.55, these events are dependent.

Morning people are more likely to drink coffee than night owls (60% vs 50%).

The Chain Rule

For multiple events, we can chain conditional probabilities:

Chain Rule

P(ABC)=P(A)×P(BA)×P(CAB)P(A \cap B \cap C) = P(A) \times P(B|A) \times P(C|A \cap B)

Three Cards Without Replacement

Draw 3 cards from a deck without replacement. P(all hearts)?

P(3 hearts)=1352×1251×1150P(\text{3 hearts}) = \frac{13}{52} \times \frac{12}{51} \times \frac{11}{50}

=13×12×1152×51×50=17161326000.013= \frac{13 \times 12 \times 11}{52 \times 51 \times 50} = \frac{1716}{132600} \approx 0.013

About 1.3% chance of drawing 3 hearts in a row.

Tree Diagrams

Tree diagrams visualize sequential events and their probabilities.

Medical Testing

A disease affects 1% of the population. A test is:

  • 95% accurate for people WITH disease (sensitivity)
  • 90% accurate for people WITHOUT disease (specificity)

Tree structure:

Population
├── Disease (0.01)
│   ├── Test + (0.95) → True Positive
│   └── Test - (0.05) → False Negative
└── No Disease (0.99)
    ├── Test + (0.10) → False Positive
    └── Test - (0.90) → True Negative

P(Test positive)? P(+)=P(D)×P(+D)+P(Dˉ)×P(+Dˉ)P(+) = P(D) \times P(+|D) + P(\bar{D}) \times P(+|\bar{D}) =(0.01)(0.95)+(0.99)(0.10)= (0.01)(0.95) + (0.99)(0.10) =0.0095+0.099=0.1085= 0.0095 + 0.099 = 0.1085

About 10.85% of all people test positive!

Law of Total Probability

The probability of an event can be calculated by summing over all possible conditions.

Law of Total Probability

If B1,B2,,BnB_1, B_2, \ldots, B_n are mutually exclusive and exhaustive events:

P(A)=i=1nP(Bi)×P(ABi)P(A) = \sum_{i=1}^{n} P(B_i) \times P(A|B_i)

For two conditions: P(A)=P(B)P(AB)+P(Bˉ)P(ABˉ)P(A) = P(B)P(A|B) + P(\bar{B})P(A|\bar{B})

Defective Products

Factory has 3 machines producing widgets:

  • Machine A: 50% of production, 2% defect rate
  • Machine B: 30% of production, 3% defect rate
  • Machine C: 20% of production, 5% defect rate

What’s P(randomly selected widget is defective)?

P(D)=P(A)P(DA)+P(B)P(DB)+P(C)P(DC)P(D) = P(A)P(D|A) + P(B)P(D|B) + P(C)P(D|C) =(0.50)(0.02)+(0.30)(0.03)+(0.20)(0.05)= (0.50)(0.02) + (0.30)(0.03) + (0.20)(0.05) =0.01+0.009+0.01=0.029= 0.01 + 0.009 + 0.01 = 0.029

2.9% of all widgets are defective.

Common Conditional Probability Mistakes

P(A|B) ≠ P(B|A)

A = It’s raining B = Ground is wet

P(wetrain)0.99P(\text{wet}|\text{rain}) \approx 0.99 (rain almost always makes ground wet) P(rainwet)0.40P(\text{rain}|\text{wet}) \approx 0.40 (ground might be wet from sprinklers, hose, etc.)

These are very different probabilities!

Applications of Conditional Probability

1. Medical Diagnosis

Interpreting test results requires understanding false positive/negative rates.

2. Quality Control

Tracking defect rates by machine, shift, or supplier.

3. Risk Assessment

Insurance companies calculate conditional risks based on demographics.

4. Machine Learning

Naive Bayes classifiers are based entirely on conditional probability.

DNA matching, fingerprint analysis, and forensic statistics.

Summary

In this lesson, you learned:

  • Conditional probability: P(AB)=P(AB)/P(B)P(A|B) = P(A \cap B) / P(B)
  • Multiplication rule: P(AB)=P(A)×P(BA)P(A \cap B) = P(A) \times P(B|A)
  • Independence: P(AB)=P(A)P(A|B) = P(A) or P(AB)=P(A)×P(B)P(A \cap B) = P(A) \times P(B)
  • Dependent events: Probability of one changes based on the other
  • Tree diagrams: Visualize sequential conditional probabilities
  • Law of Total Probability: Sum probabilities over all conditions
  • P(AB)P(BA)P(A|B) \neq P(B|A) in general

Practice Problems

1. A deck has 52 cards. Find: a) P(King | Red card) b) P(Red | King) c) P(King and Red)

2. Box contains 4 white and 6 black balls. Two are drawn without replacement. a) P(both white) b) P(second is white | first is black) c) P(at least one white)

3. 60% of emails are spam. A filter catches 90% of spam but also flags 5% of legitimate emails. a) P(email is flagged)? b) P(email is spam | flagged)?

4. Are A and B independent if P(A) = 0.4, P(B) = 0.5, and P(A ∩ B) = 0.2?

Click to see answers

1. a) P(King | Red) = P(King and Red) / P(Red) = (2/52) / (26/52) = 2/26 = 1/13 b) P(Red | King) = P(King and Red) / P(King) = (2/52) / (4/52) = 2/4 = 1/2 c) P(King and Red) = 2/52 = 1/26

2. a) P(both white) = (4/10) × (3/9) = 12/90 = 2/15 b) P(2nd white | 1st black) = 4/9 ≈ 0.444 c) P(at least one white) = 1 - P(both black) = 1 - (6/10)(5/9) = 1 - 30/90 = 2/3

3. a) P(flagged) = P(spam)P(flagged|spam) + P(not spam)P(flagged|not spam) = (0.6)(0.9) + (0.4)(0.05) = 0.54 + 0.02 = 0.56 b) P(spam|flagged) = P(spam and flagged) / P(flagged) = (0.6)(0.9) / 0.56 = 0.54 / 0.56 ≈ 0.964 (96.4%)

4. Check: P(A) × P(B) = 0.4 × 0.5 = 0.2 = P(A ∩ B) Yes, A and B are independent.

Next Steps

Continue your probability journey:

Advertisement

Was this lesson helpful?

Help us improve by sharing your feedback or spreading the word.