Section 2.4: Conditional Probability

Section 2.4: Conditional Probability 1 Definition For any two events A and B with P (B) > 0, the conditional probability of A given that B has occu...
3 downloads 0 Views 58KB Size
Section 2.4: Conditional Probability

1

Definition For any two events A and B with P (B) > 0, the conditional probability of A given that B has occured is

P (A|B) =

P (A ∩ B) . P (B)

2

Rules for Conditional Probability

• Multiplication Rule P (A ∩ B) = P (A|B)P (B). • The law of total probability: assume A1, · · · , Ak are mutually exclusive and exhaustive events. That is, there is no paired overlap and their union is S, or Ai ∩ Aj = φ, i 6= j and A1 ∪ A2 ∪ · · · ∪ Ak = S. Then P (B) =P (B|A1)P (A1) + P (B|A2)P (A2) + · · · + P (B|Ak )P (Ak ) =

k X

P (B|Ai)P (Ai).

i=1

A special case: P (B) = P (B|A)P (A) + P (B|A0)P (A0).

3

• Bayes’s Theorem: assume A1, · · · , Ak are mutually exclusive and exhaustive events. For any B with P (B) > 0, P (B|Aj )P (Aj )

P (Aj |B) = Pk

i=1 P (B|Ai )P (Ai)

for j = 1, · · · , k. A special case: P (B|A)P (A) P (A|B) = . P (B|A)P (A) + P (B|A0)P (A0)

4

First example of Section 2.4: 2.25 on textbook. • Digital camera, 60% include an optional memory card, 40% include an extra battery, and 30% include both. • Then, P (A) = 0.6, P (B) = 0.40 and P (A ∩ B) = 0.30. • Thus, P (A ∩ B) 0.3 P (A|B) = = = 0.75. P (B) 0.4 and P (B|A) =

P (A ∩ B) 0.3 = = 0.5. P (A) 0.6

5

Second example of Section 2.4: 2.26 on textbook. • Suppose P (A) = 0.14, P (B) = 0.23, P (C) = 0.37, P (A∩B) = 0.08, P (A∩C) = 0.09, P (B ∩ C) = 0.13 and P (A ∩ B ∩ C) = 0.05. • The, we have P (A ∩ B) 0.08 P (A|B) = = = 0.348. P (B) 0.23 P (A|B ∪ C) P (A ∩ (B ∪ C)) = P (B ∪ C) P (A ∩ B) + P (A ∩ C) − P (A ∩ B ∩ C) = P (B) + P (C) − P (B ∩ C) 0.08 + 0.09 − 0.05 = 0.23 + 0.37 − 0.13 =0.2553.

6

P (A ∪ B ∪ C) =P (A) + P (B) + P (C) − P (A ∩ B) − P (A ∩ C) − P (B ∩ C) + P (A ∩ B ∩ C) =0.14 + 0.23 + 0.37 − 0.08 − 0.09 − 0.13 + 0.05 =0.49. P (A|at least one) =P (A|A ∪ B ∪ C) P (A ∩ (A ∪ B ∪ C)) = P (A ∪ B ∪ C) P (A) = P (A ∪ B ∪ C) 0.14 = 0.49 =0.2857. and P (A ∪ B|C) P ((A ∪ B) ∩ C) = P (C) P (A ∩ C) + P (B ∩ C) − P (A ∩ B ∩ C) = P (C) 0.09 + 0.13 − 0.05 = 0.37 =0.4595. 7

Third example of Section 2.4: 2.29 on textbook. • Let A1 = {brand 1}, A2 = {brand 2}, A3 = {brand 3}, and B = {warranty}. • P (A1) = 0.5, P (A2) = 0.3 and P (A3) = 0.2. • P (B|A1) = 0.25, P (B|A2) = 0.2, and P (B|A3) = 0.1. • Then, P (A1 ∩ B) = P (B|A1)P (A1) = 0.125. P (A2 ∩ B) = P (B|A2)P (A2) = 0.060 and P (A3 ∩ B) = P (B|A3)P (A3) = 0.02. • P (B) = 0.125 + 0.060 + 0.02 = 0.205. • Thus, we have P (A1 ∩ B) 0.125 = = 0.6098 P (B) 0.205 P (A2 ∩ B) 0.06 P (A2|B) = = = 0.2927 P (B) 0.205 P (A3 ∩ B) 0.02 P (A3|B) = = = 0.0976. P (B) 0.205 P (A1|B) =

8

Fourth example of Section 2.4: 2.31 on textbook.

• Let A = {has the disease} and B = {test is positive}. • Suppose P (A) = 0.001, P (B|A) = 0.99, and P (B|A0) = 0.02.

• Then, we have P (A|B) P (B|A)P (A) P (B|A)P (A) + P (B|A0)P (A0) 0.99 × 0.001 = 0.99 × 0.001 + 0.02 × 0.999 =0.0472. =

• Q: What does this imply?

9

Fifth example of Section 2.4. Let A, B, C be events and S be sample space. Suppose P (A) = 0.4, P (B) = 0.3, P (C) = 0.2, P (A ∩ B) = 0.11, P (A ∩ C) = 0.05, P (B ∩ C) = 0.06, P (A ∩ B ∩ C) = 0.01. (a) Compute P (A0 ∪B 0), P (B 0 ∪C 0), P (A0 ∪C 0) and P (A0 ∪ B 0 ∪ C 0). P (A0 ∪ B 0) = 1 − P (A ∩ B) = 1 − 0.11 = 0.89, P (B 0 ∪ C) = 1 − P (B ∩ C) = 1 − 0.06 = 0.94, P (A0 ∪ C 0) =1 − P (A ∩ C) = 0.95, and P (A0 ∪ B 0 ∪ C 0) =1 − P (A ∩ B ∩ C) =1 − 0.01 =0.99.

10

(b) Compute P (A0 ∩B 0), P (B 0 ∩C 0), P (A0 ∩C 0) and P (A0 ∩ B 0 ∩ C 0). First, we have P (A ∪ B) = 0.4 + 0.3 − 0.11 = 0.59, P (A ∪ C) = 0.4 + 0.2 − 0.05 = 0.55, P (B ∪ C) = 0.3 + 0.2 − 0.06 = 0.54, and P (A ∪ B ∪ C) =0.4 + 0.3 + 0.2 − 0.11 − 0.05 − 0.06 + 0.01 =0.69. Thus, we have Note that P (A0 ∩ B 0) = 1 − P (A ∪ B)1 − 0.59 = 0.41, P (A0 ∩ C 0) = 1 − P (A ∪ C) = 1 − 0.55 = 0.45, P (B 0 ∩ C 0) = 1 − P (B ∪ C) = 1 − 0.44 = 0.56, and P (A0∩B 0∩C 0) = 1−P (A∪B∪C) = 1−0.69 = 0.31.

11

(c) Compute P (B|A), P (B|A0), P (B 0|A), P (B 0|A0). P (B|A) = P (B|A0)

P (A ∩ B) 0.11 = = 0.275 P (A) 0.4 P (B ∩ A0) = P (A0) P (B) − P (A ∩ B) = 1 − P (A) 0.3 − 0.11 = = 0.3167. 0.6

P (B 0|A)

P (B 0 ∩ A) = P (A) P (A) − P (A ∩ B) = P (A) 0.4 − 0.11 = = 0.725. 0.4

P (B 0 ∩ A0) = P (A0) 0.41 = = 0.6833. 0.6 From this problem, we can find P (B 0|A0)

P (B|A) + P (B 0|A) = 1 and P (B|A0) + P (B 0|A0) = 1. 12

(d) Compute P (C|A∩B), P (C|A∩B 0), P (C|A0 ∩B) and P (C|A0 ∩ B 0). P (A ∩ B ∩ C) P (C|A ∩ B) = P (A ∩ B) 0.01 = 0.0909. = 0.11 P (C|A ∩ B 0)

P (A ∩ B 0 ∩ C) = P (A ∩ B 0) P (A ∩ C) − P (A ∩ B ∩ C) = P (A) − P (A ∩ B) 0.05 − 0.01 = = 0.1379. 0.4 − 0.11

P (C|A0 ∩ B) =

P (C|A0

∩ B 0)

0.06 − 0.01 = 0.2632. 0.3 − 0.11

P (A0 ∩ B 0 ∩ C) = P (A0 ∩ B 0) P (A0 ∩ B 0) − P (A0 ∩ B 0 ∩ C 0) = P (A0 ∩ B 0) 0.41 − 0.31 = 0.2439. = 0.41 13

(e) Compute P (C 0|A ∩ B), P (C 0|A ∩ B 0), P (C 0|A0 ∩ B) and P (C 0|A0 ∩ B 0). We use formulae P (C|A ∩ B) + P (C 0|A ∩ B) = 1 P (C|A ∩ B 0) + P (C 0|A ∩ B 0) = 1 P (C|A0 ∩ B) + P (C 0|A0 ∩ B) = 1 P (C|A0 ∩ B 0) + P (C 0|A0 ∩ B 0) = 1 Then, P (C 0|A ∩ B) = 1 − 0.0909 = 0.9091. P (C 0|A ∩ B 0) = 1 − 0.1379 = 0.8621. P (C 0|A0 ∩ B) = 1 − 0.2632 = 0.7368. P (C 0|A0 ∩ B 0) = 1 − 0.2439 = 0.7541.

14

Sixth example of Section 2.4. A box has three bags. The first bag has 10 blue balls and 10 red balls. The second bag has 8 blue balls and 2 red balls. The third bag has 12 blue balls and 18 red balls. You are asked to randomly pick up one bag from the box and then randomly pick up one ball from the bag you have just picked up. Let A1 = {first bag}, A2 = {second bag}, A3 = {third bag}, and B = {red ball}.

15

(a) If the selected bag is the first one, what it the probability of the color of the ball you see is red. Answer: P (B|A1) =

10 = 0.5. 20

(b) If the selected bag is the second one, what it the probability of the color of the ball you see is red. Answer: P (B|A2) =

2 = 0.2. 10

(c) If the selected bag is the third one, what it the probability of the color of the ball you see is red. Answer: 18 = 0.6. P (B|A3) = 30

16

(d) Overall, what is the probability of the color of the ball you see is red. Answer: first P (A1) = P (A2) = P (A3) = 1/3. Then, by total law of probability, we have P (B) =P (B|A1)P (A1) + P (B|A2)P (A2) + P (B|A3)P (A3) =(0.5 + 0.2 + 0.6)/3 =0.4333. (e) If you saw the color was red, what is the probability that the selected ball was from the first bag, the second bag, and the third bag. By Bayes Theorem, we have P (A1|B) =

P (B|A1)P (A1) 0.5/3 = = 0.3846. P (B) 0.4333

P (B|A2)P (A2) 0.2/3 P (A2|B) = = = 0.1538. P (B) 0.4333

P (A3|B) =

P (B|A3)P (A3) 0.6/3 = = 0.4615. P (B) 0.4333

17

Seventh example of Section 2.4. About 70% for student A and 30% for student B were at the computer labs today and it is known that only one of them was there. It is known that with probability for A to forget to turn off the lights when he left is 50% and the probability for B to forget to turn off the lights when he left is 30%. (a) What is the probability of the light not being turned off. Answer: by law of total probability, 0.7 × 0.5 + 0.3 × 0.3 = 0.44.

(b) If the light is not turned off, what is the probability of A using the lab. Answer 0.7 × 0.5 = 0.7955. 0.44

18

Eighth example of Section 2.4. Three companies provide a kind of machine in the market. It is known that the defect rate of machines that provided by company A is 0.1%, the defect rate of machines that provided by company B is 0.3% and the defect rate of machines that provided by company C is 0.5%. It is known that company A provides about 80% of the machines, company B provides about 15% of the machines and company C provides about 5% of the machines.

(a) Compute the overall defect rate of machines. Let D = {defect}. Then, we have P (D) =P (D|A)P (A) + P (D|B)P (B) + P (D|C)P (C) =0.001 × 0.8 + 0.003 × 0.15 + 0.005 × 0.05 =0.0015 = 0.15%.

19

(b) If a machine has defects, compute the probability of the machine from company A, B and C respectively.

P (A|D) =

0.001 × 0.8 = 0.5333 0.0015

0.003 × 0.15 P (B|D) = = 0.3 0.0015 and 0.005 × 0.05 P (C|D) = = 0.1667. 0.0015 (c) Q: how do you evaluate the statement: a survey of the machine says “since more than 50% percent machines with defects are from company A, the quality of company A is worse than the quality of company B or C”.

20