Download Harvard University

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Statistics wikipedia , lookup

History of statistics wikipedia , lookup

Inductive probability wikipedia , lookup

Birthday problem wikipedia , lookup

Ars Conjectandi wikipedia , lookup

Probability interpretations wikipedia , lookup

Probability wikipedia , lookup

Transcript
Harvard University
Computer Science 20
In-Class Problems 27
Friday April 8, 2016
Author: Tom Silver, Edited by Michelle Danoff
Executive Summary
• Finite Probability in a nutshell: we carry out an “experiment” (like rolling a pair of dice)
that has a finite number N of possible outcomes, each an element of the sample space S. A
subset of the sample space is called an “event” A. There are 2N possible events.
• A probability function P calculates the probability of any event occuring. It has the following
properties:
– P (A) ≥ 0 for all events A.
– P (S) = 1.
– If A and B are disjoint events (their intersection is the empty set), P (A ∪ B) = P (A) +
P (B).
– P (A) = 1 − P (A)
• Probability of multiple events:
– For n disjoint events, P (A1 ∪ A2 ∪ · · · An ) = P (A1 ) + P (A2 ) + · · · + P (An ).
– Inclusion-exclusion: for any n events (not necessarily disjoint): P (A ∪ B) = P (A) +
P (B) − P (A ∩ B).
– Inclusion-exclusion for 3 events: P (A ∪ B ∪ C) = P (A) + P (B) + P (C) − P (A ∩ B) −
P (A ∩ C) − P (B ∩ C) + P (A ∩ B ∩ C).
– If A ⊂ B, then P (A) ≤ P (B).
• Independence of events
– Events A and B are called independent if P (A ∩ B) = P (A)P (B).
– n events are called mutually independent if each is independent of the intersection of
any subset of the remaining events.
PROBLEM 1
Consider two events, A and B, with probabilities 0 < P (A) < 1 and 0 < P (B) < 1.
(A) Give an example where P(A ∩ B) 6= P(A)P(B) for two events A and B. What does this say
about events A and B?
(B) Give an example where P(A ∪ B) = P(A) + P(B) for two events A and B. What does this say
about events A and B?
1
Solution.
(A) Example: Consider a die roll. If P (A) is the probability of rolling a 2, P (A) = 1/6. P (B)
is the probability of rolling an even number, P (B) = 1/2. In this case, P (A)P (B) = 1/12 but
P (A ∩ B) = 1/6. This tells us the events are not independent.
(B) Example: Consider a die roll. If P (A) is the probability of rolling a 2, P (A) = 1/6. If P (B) is
the probability of rolling a 3, P (B) = 1/6 also. The probability of rolling a 2 or a 3 is 1/3, which
is 1/6 + 1/6. This tells us that the events are disjoint.
PROBLEM 2
In the game of Craps, you start by rolling two dice.
(A) If the total roll is 7 or 11, you win immediately. Calculate the probability of this event.
(B) If the total roll is 2, 3, or 12, you lose immediately. Calculate the probability of this event.
(C) If the total roll is 4 then keep rolling the dice until the total is again 4 (in which case you
win) or the total is 7 (in which case you lose). By restricting the sample space S to rolls of 4 or 7,
calculate the probability that you will win after rolling a 4 for the first time.
Solution.
(A) 8/36 = 2/9
(B) 4/36 = 1/9
(C) After rolling a 4 for the first time, we throw away every roll not equal to 4 or 7, so we only
consider events that result in a 4 or 7. Of these 9 possible scenerios, 3 will lead to a win for an
overall 1/3 chance of win, and 6 will lead to a loss, for an overall 2/3 chance of loss.
PROBLEM 3
You have two fair 20-sided dice and one loaded 6-sided die with probabilities P (1) = P (3) = P (5) =
1
3 and P (2) = P (4) = P (6) = 0. You roll all three dice together.
(A) What is the probability of rolling two 5s and one 20?
(B) What is the probability of rolling one 5 and two 20s
(C) What is the probability that the sum of the rolls is 43?
(D) What is the probability that the sum of the rolls is greater than 4?
Solution.
(A) 1/600. There are two possible scenerios (either of the fair dies can roll the 20, the other rolls
2
the 5). Each has probability 1/1200
(B) 1/1200
(C) 1/300
(D) 1199/1200. There is only one possible way to have a sum less than 4, which is when you get a
1 on each die.
PROBLEM 4
[BONUS] You have a biased coin (the probability of it landing on each side is not necessarily equal).
Devise a strategy to simulate fair coin flips with a biased coin.
Solution.
One solution: the probability of the coin landing HT and TH is equal, since each is equal to
P (h)P (t). Consider HT to be a heads, and TH to be a tails: these now have equal probability. If
we get HH or TT, simply restart the process until we get either TH or HT.
3