Conditional Probability, the Law of Total Probability, and Bayes' Formula

Conditional Probability

Definition of Conditional Probability

Conditional Probability

Let AA and BB be two events with P(B)>0P(B) > 0. The probability that event AA occurs given that event BB has occurred is called the conditional probability, denoted by P(A∣B)P(A|B), and is defined as: P(A∣B)=P(A∩B)P(B)P(A|B) = \frac{P(A \cap B)}{P(B)}

Intuitive Understanding of Conditional Probability

Understanding: the conditional probability P(A∣B)P(A|B) gives the probability that event AA occurs given that event BB has occurred. It reflects the influence of the occurrence of event BB on the probability of occurrence of event AA.

Properties of Conditional Probability

Property 1: 0≤P(A∣B)≤10 \leq P(A|B) \leq 1

Property 2: P(Ω∣B)=1P(\Omega|B) = 1, P(∅∣B)=0P(\varnothing|B) = 0

Property 3: if A1,A2,…,AnA_1, A_2, \dots, A_n are pairwise mutually exclusive, then: P(A1∪A2∪⋯∪An∣B)=P(A1∣B)+P(A2∣B)+⋯+P(An∣B)P(A_1 \cup A_2 \cup \dots \cup A_n|B) = P(A_1|B) + P(A_2|B) + \dots + P(A_n|B)

Property 4: P(A‾∣B)=1−P(A∣B)P(\overline{A}|B) = 1 - P(A|B)

Multiplication Formula for Conditional Probability

Multiplication Formula

For any two events AA and BB: P(A∩B)=P(B)P(A∣B)=P(A)P(B∣A)P(A \cap B) = P(B)P(A|B) = P(A)P(B|A)

Generalization: for any nn events A1,A2,…,AnA_1, A_2, \dots, A_n: P(A1∩A2∩⋯∩An)=P(A1)P(A2∣A1)P(A3∣A1∩A2)…P(An∣A1∩A2∩⋯∩An−1)P(A_1 \cap A_2 \cap \dots \cap A_n) = P(A_1)P(A_2|A_1)P(A_3|A_1 \cap A_2) \dots P(A_n|A_1 \cap A_2 \cap \dots \cap A_{n-1})

Examples of Conditional Probability

Example 1: drawing one card at random from a deck

  • Let A={a heart is drawn}A = \{\text{a heart is drawn}\}
  • Let B={a red card is drawn}B = \{\text{a red card is drawn}\}
  • P(A)=1352=14P(A) = \frac{13}{52} = \frac{1}{4}
  • P(A∣B)=P(A∩B)P(B)=13522652=12P(A|B) = \frac{P(A \cap B)}{P(B)} = \frac{\frac{13}{52}}{\frac{26}{52}} = \frac{1}{2}

Example 2: rolling two dice

  • Let A={the first die shows 6}A = \{\text{the first die shows 6}\}
  • Let B={the sum of the two dice is 8}B = \{\text{the sum of the two dice is 8}\}
  • P(A)=16P(A) = \frac{1}{6}
  • P(B)=536P(B) = \frac{5}{36} (there are 5 cases: (2,6), (3,5), (4,4), (5,3), (6,2))
  • P(A∩B)=136P(A \cap B) = \frac{1}{36} (only the case (6,2))
  • P(A∣B)=136536=15P(A|B) = \frac{\frac{1}{36}}{\frac{5}{36}} = \frac{1}{5}

The Law of Total Probability

Definition of the Law of Total Probability

Law of Total Probability

Let A1,A2,…,AnA_1, A_2, \dots, A_n be a partition of the sample space Ω\Omega (that is, Ai∩Aj=∅A_i \cap A_j = \varnothing for i≠ji \neq j, and A1∪A2∪⋯∪An=ΩA_1 \cup A_2 \cup \dots \cup A_n = \Omega), and let P(Ai)>0P(A_i) > 0 for i=1,2,…,ni = 1, 2, \dots, n. Then for any event BB: P(B)=∑i=1nP(Ai)P(B∣Ai)P(B) = \sum_{i=1}^n P(A_i)P(B|A_i)

Intuitive Understanding of the Law of Total Probability

Understanding: the law of total probability decomposes the probability of a complex event BB into a weighted sum of the probabilities of occurrence under different conditions. It embodies the idea of “divide and conquer”.

Proof of the Law of Total Probability

Proof:

  1. B=B∩Ω=B∩(A1∪A2∪⋯∪An)B = B \cap \Omega = B \cap (A_1 \cup A_2 \cup \dots \cup A_n)
  2. =(B∩A1)∪(B∩A2)∪⋯∪(B∩An)= (B \cap A_1) \cup (B \cap A_2) \cup \dots \cup (B \cap A_n)
  3. Since A1,A2,…,AnA_1, A_2, \dots, A_n are pairwise mutually exclusive, (B∩A1),(B∩A2),…,(B∩An)(B \cap A_1), (B \cap A_2), \dots, (B \cap A_n) are also pairwise mutually exclusive
  4. Therefore P(B)=∑i=1nP(B∩Ai)P(B) = \sum_{i=1}^n P(B \cap A_i)
  5. By the multiplication formula, P(B∩Ai)=P(Ai)P(B∣Ai)P(B \cap A_i) = P(A_i)P(B|A_i)
  6. Hence P(B)=∑i=1nP(Ai)P(B∣Ai)P(B) = \sum_{i=1}^n P(A_i)P(B|A_i)

Example of the Law of Total Probability

Example 3: there are three boxes containing 2, 3, and 5 balls respectively; one box is chosen at random and one ball is drawn from it

  • Let Ai={box i is chosen}A_i = \{\text{box } i \text{ is chosen}\}, i=1,2,3i = 1, 2, 3
  • Let B={a white ball is drawn}B = \{\text{a white ball is drawn}\}
  • P(A1)=P(A2)=P(A3)=13P(A_1) = P(A_2) = P(A_3) = \frac{1}{3}
  • Suppose box 1 contains only white balls, box 2 contains only white balls, and box 3 contains 3 white and 2 black balls
  • P(B∣A1)=1P(B|A_1) = 1, P(B∣A2)=1P(B|A_2) = 1, P(B∣A3)=35P(B|A_3) = \frac{3}{5}
  • P(B)=13×1+13×1+13×35=13+13+15=1115P(B) = \frac{1}{3} \times 1 + \frac{1}{3} \times 1 + \frac{1}{3} \times \frac{3}{5} = \frac{1}{3} + \frac{1}{3} + \frac{1}{5} = \frac{11}{15}

Bayes’ Formula

Definition of Bayes’ Formula

Bayes' Formula

Under the conditions of the law of total probability, for any event BB with P(B)>0P(B) > 0: P(Ai∣B)=P(Ai)P(B∣Ai)∑j=1nP(Aj)P(B∣Aj)P(A_i|B) = \frac{P(A_i)P(B|A_i)}{\sum_{j=1}^n P(A_j)P(B|A_j)}

Intuitive Understanding of Bayes’ Formula

Understanding: Bayes’ formula is used to compute the probability that event AiA_i occurs given that event BB has occurred. It embodies the idea of “inverse probability”, that is, inferring the cause from the result.

Proof of Bayes’ Formula

Proof:

  1. By the definition of conditional probability, P(Ai∣B)=P(Ai∩B)P(B)P(A_i|B) = \frac{P(A_i \cap B)}{P(B)}
  2. By the multiplication formula, P(Ai∩B)=P(Ai)P(B∣Ai)P(A_i \cap B) = P(A_i)P(B|A_i)
  3. By the law of total probability, P(B)=∑j=1nP(Aj)P(B∣Aj)P(B) = \sum_{j=1}^n P(A_j)P(B|A_j)
  4. Therefore P(Ai∣B)=P(Ai)P(B∣Ai)∑j=1nP(Aj)P(B∣Aj)P(A_i|B) = \frac{P(A_i)P(B|A_i)}{\sum_{j=1}^n P(A_j)P(B|A_j)}

Examples of Bayes’ Formula

Example 4: continuing the problem of Example 3, find the probability that the ball comes from box 3 given that a white ball is drawn

  • P(A3∣B)=P(A3)P(B∣A3)P(B)P(A_3|B) = \frac{P(A_3)P(B|A_3)}{P(B)}
  • =13×351115=151115=311= \frac{\frac{1}{3} \times \frac{3}{5}}{\frac{11}{15}} = \frac{\frac{1}{5}}{\frac{11}{15}} = \frac{3}{11}

Example 5: the products of a factory are produced by three workshops. The first workshop produces 40%, the second 35%, and the third 25%. The defective rate is 2% in the first workshop, 1% in the second, and 3% in the third. One product is drawn at random and is found to be defective. Find the probability that it comes from the first workshop.

Solution:

  1. Let Ai={the product comes from the i-th workshop}A_i = \{\text{the product comes from the } i \text{-th workshop}\}, i=1,2,3i = 1, 2, 3
  2. Let B={the product is defective}B = \{\text{the product is defective}\}
  3. P(A1)=0.4P(A_1) = 0.4, P(A2)=0.35P(A_2) = 0.35, P(A3)=0.25P(A_3) = 0.25
  4. P(B∣A1)=0.02P(B|A_1) = 0.02, P(B∣A2)=0.01P(B|A_2) = 0.01, P(B∣A3)=0.03P(B|A_3) = 0.03
  5. P(B)=0.4×0.02+0.35×0.01+0.25×0.03=0.008+0.0035+0.0075=0.019P(B) = 0.4 \times 0.02 + 0.35 \times 0.01 + 0.25 \times 0.03 = 0.008 + 0.0035 + 0.0075 = 0.019
  6. P(A1∣B)=0.4×0.020.019=0.0080.019≈0.421P(A_1|B) = \frac{0.4 \times 0.02}{0.019} = \frac{0.008}{0.019} \approx 0.421

Independence of Events

Definition of Independence of Events

Independence of Events

If events AA and BB satisfy: P(A∩B)=P(A)P(B)P(A \cap B) = P(A)P(B)

then events AA and BB are said to be independent.

Equivalent Condition for Independence of Events

Equivalent condition: events AA and BB are independent if and only if: P(A∣B)=P(A)orP(B∣A)=P(B)P(A|B) = P(A) \quad \text{or} \quad P(B|A) = P(B)

Properties of Independence of Events

Property 1: if AA and BB are independent, then AA and B‾\overline{B} are independent, A‾\overline{A} and BB are independent, and A‾\overline{A} and B‾\overline{B} are independent.

Property 2: if AA and BB are independent and P(B)>0P(B) > 0, then P(A∣B)=P(A)P(A|B) = P(A).

Property 3: the impossible event is independent of any event.

Independence of Several Events

Mutual Independence

Events A1,A2,…,AnA_1, A_2, \dots, A_n are said to be mutually independent if for any kk events Ai1,Ai2,…,AikA_{i_1}, A_{i_2}, \dots, A_{i_k}: P(Ai1∩Ai2∩⋯∩Aik)=P(Ai1)P(Ai2)…P(Aik)P(A_{i_1} \cap A_{i_2} \cap \dots \cap A_{i_k}) = P(A_{i_1})P(A_{i_2}) \dots P(A_{i_k})

Example of Independence

Example 6: rolling two dice

  • Let A={the first die shows 6}A = \{\text{the first die shows 6}\}
  • Let B={the second die shows 6}B = \{\text{the second die shows 6}\}
  • P(A)=16P(A) = \frac{1}{6}, P(B)=16P(B) = \frac{1}{6}
  • P(A∩B)=136=16×16=P(A)P(B)P(A \cap B) = \frac{1}{36} = \frac{1}{6} \times \frac{1}{6} = P(A)P(B)
  • Therefore AA and BB are independent

Exercises

Exercise 1

Given P(A)=0.3,P(B∣A)=0.5P(A) = 0.3, P(B|A) = 0.5, find P(A∩B)P(A \cap B).

conditional probabilitymultiplication formulaintersection probability

Approach: Compute with the multiplication formula.

Steps:

  1. P(A∩B)=P(A)P(B∣A)P(A \cap B) = P(A)P(B|A)
  2. =0.3×0.5=0.15= 0.3 \times 0.5 = 0.15
  3. Here we multiply by the probability P(A)=0.3P(A)=0.3 that AA has already occurred, while P(B∣A)P(B|A) is meaningful only under the condition that AA occurs.

Answer: P(A∩B)=0.15P(A \cap B) = 0.15, that is, the probability that events AA and BB occur together is 0.150.15.

Exercise 2

There are three boxes containing 2, 3, and 5 balls respectively; one box is chosen at random and one ball is drawn from it. Find the probability that the ball comes from box 3 given that a white ball is drawn (box 3 contains 3 white and 2 black balls, and the others contain only white balls).

Bayes' formulalaw of total probabilityconditional probability

Approach: Compute with Bayes’ formula.

Steps:

  1. Let Ai={box i is chosen}A_i = \{\text{box } i \text{ is chosen}\}, i=1,2,3i = 1, 2, 3
  2. Let B={a white ball is drawn}B = \{\text{a white ball is drawn}\}
  3. P(A1)=P(A2)=P(A3)=13P(A_1) = P(A_2) = P(A_3) = \frac{1}{3}
  4. P(B∣A1)=1P(B|A_1) = 1, P(B∣A2)=1P(B|A_2) = 1, P(B∣A3)=35P(B|A_3) = \frac{3}{5}
  5. P(B)=13×1+13×1+13×35=1115P(B) = \frac{1}{3} \times 1 + \frac{1}{3} \times 1 + \frac{1}{3} \times \frac{3}{5} = \frac{11}{15}
  6. P(A3∣B)=P(A3)P(B∣A3)P(B)=13×351115=311P(A_3|B) = \frac{P(A_3)P(B|A_3)}{P(B)} = \frac{\frac{1}{3} \times \frac{3}{5}}{\frac{11}{15}} = \frac{3}{11}

Answer: 311\frac{3}{11}

Exercise 3

Given P(A)=0.6,P(B)=0.5,P(A∩B)=0.3P(A) = 0.6, P(B) = 0.5, P(A \cap B) = 0.3, determine whether A and B are independent.

independence of eventsindependence criterionconditional probability

Approach: Check whether the condition for independence is satisfied.

Steps:

  1. P(A)P(B)=0.6×0.5=0.3P(A)P(B) = 0.6 \times 0.5 = 0.3
  2. P(A∩B)=0.3P(A \cap B) = 0.3
  3. Therefore P(A∩B)=P(A)P(B)P(A \cap B) = P(A)P(B)
  4. Hence AA and BB are independent

Answer: AA and BB are independent

Exercise 4

The products of a factory are produced by two workshops. The first workshop produces 60% and the second 40%. The defective rate is 1% in the first workshop and 2% in the second. One product is drawn at random and is found to be defective. Find the probability that it comes from the first workshop.

Bayes' formulalaw of total probabilityconditional probability

Approach: Compute with Bayes’ formula.

Steps:

  1. Let A1={the product comes from the first workshop}A_1 = \{\text{the product comes from the first workshop}\}, A2={the product comes from the second workshop}A_2 = \{\text{the product comes from the second workshop}\}
  2. Let B={the product is defective}B = \{\text{the product is defective}\}
  3. P(A1)=0.6P(A_1) = 0.6, P(A2)=0.4P(A_2) = 0.4
  4. P(B∣A1)=0.01P(B|A_1) = 0.01, P(B∣A2)=0.02P(B|A_2) = 0.02
  5. P(B)=0.6×0.01+0.4×0.02=0.006+0.008=0.014P(B) = 0.6 \times 0.01 + 0.4 \times 0.02 = 0.006 + 0.008 = 0.014
  6. P(A1∣B)=0.6×0.010.014=0.0060.014=37P(A_1|B) = \frac{0.6 \times 0.01}{0.014} = \frac{0.006}{0.014} = \frac{3}{7}

Answer: 37\frac{3}{7}

Exercise 5

Roll two dice. Let A={the first die shows an even number}A = \{\text{the first die shows an even number}\} and B={the sum of the two dice is 7}B = \{\text{the sum of the two dice is 7}\}. Determine whether AA and BB are independent.

independence of eventsprobability calculationdetermination

Approach: Compute the relevant probabilities and check independence.

Steps:

  1. P(A)=36=12P(A) = \frac{3}{6} = \frac{1}{2}
  2. P(B)=636=16P(B) = \frac{6}{36} = \frac{1}{6} (there are 6 cases: (1,6), (2,5), (3,4), (4,3), (5,2), (6,1))
  3. A∩B={the first die is even and the sum is 7}={(2,5),(4,3),(6,1)}A \cap B = \{\text{the first die is even and the sum is 7}\} = \{(2,5), (4,3), (6,1)\}
  4. P(A∩B)=336=112P(A \cap B) = \frac{3}{36} = \frac{1}{12}
  5. P(A)P(B)=12×16=112P(A)P(B) = \frac{1}{2} \times \frac{1}{6} = \frac{1}{12}
  6. Therefore P(A∩B)=P(A)P(B)P(A \cap B) = P(A)P(B), and AA and BB are independent

Answer: AA and BB are independent

Found an issue with this content?

Tell us what could be improved.