Assignment 6: Exercises on Conditional Probability and Expected

Assignment 6: Exercises on Conditional
Probability and Expected Value
CS244-Randomness and Computation
Due March 23
March 18, 2015
1
Coins
A collection of 100 nickels is known to contain 99 ordinary nickels and one twoheaded nickel. Someone selects a coin at random from the collection and tosses it
six times, getting six heads in succession. What is the probability that this is the
two-headed nickel?
This problem is an application of conditional probability and Bayes’s Theorem. You can solve it either by setting up all the proper conditional probabilities
and applying Bayes’s Theorem, or by using a tree diagram, which really amounts
to the same calculation. However you solve it at first, I want you to present your
solution using Bayes’s Theorem.
2
Dice
Consider the roll of two standard fair dice, with outcomes {1, 2, . . . , 6}. As usual,
we define random variables X1 and X2 to denote the outcomes of the first and second dice, respectively. X1 and X2 are independent random variables with uniform
distribution, each with expected value 3.5.
We define two new random variables by
Xmin = min(X1 , X2 ), Xmax = max(X1 , X2 ).
Note that Xmin + Xmax = X1 + X2 . and Xmin Xmax = X1 X2 , facts that will
be important below.
1
(a) Compute the PMF of Xmin .
(b) Compute E(Xmin ).
(c) Use the result of (b) to compute E(Xmax ) (you don’t need to compute any
probabilities for this).
(d) Show that Xmin and Xmax are not independent by exhibiting values x, y such
that
P [Xmin = x and Xmax = y] 6= P [Xmin = x] · P [Xmax = y].
(e) What is E(Xmin Xmax )? If you’re smart about this and use some of the hints
above, you don’t need to compute any probabilities for this. Compare this to
E(Xmin )E(Xmax ).
3
Birthdays
Here we take a slightly different view of the birthday problem. We repeatedly
ask people for their birthdays until we find someone whose birthday has already
been given as an answer. The number of people we query is the value of a random
variable X. For example, the probabilty that X = 1 is 0 (we have to ask two
1
because this requires that the
people at least!) The probability that X = 2 is 365,
second person have the same birthday as the first person.
(a) Find a formula for P [X = k], where k varies from 2 to 366. (And why 366?)
(b) Now calculate E(X). You will need to write a little bit of code for this. Note
that this is a slightly different question from asking how many people need to be
in the room to have a probability of at least 0.5 of a birthday in common, and you
should expect a slightly different answer.
(c) Run 10000 simulations of this experiment of repeatedly asking people for their
birthdays and returning the number of queries, and find the average value. How
does it compare to your result in (b)?
4
Clusters
Sometimes the story behind this problem is told in terms of disease outbreaks,
sometimes in terms of rocket attacks. You can make up your own story. Four
2
hundred points are selected at random in the unit square, and we display the ’hits’
on a grid in which the unit square is divided into one hundred smaller sectors.
An illustration of one run of the simulation is shown below, and the code that
generated the figure is posted on the website. The point is, that to the untrained
eye, the totally random pattern of hits appears to exhibit significant clustering.
(a) Revise the program so that it displays a pair of plots (use the subplot command). The first will be identical to the one presently displayed, but the second
should be a histogram displaying the number of sectors that received no hits, 1 hit,
2 hits, etc.
(b) The background story suggests that the number of hits a sector receives ought
to have a Poisson distribution. The way the simulation is computed suggests a
binomial distribution, but this should be well approximated by a Poisson distribution. Use the Poisson approximation to estimate the number of sectors that receive
7 or more hits, and compare this to the results of the simulation.
5
Coupons
In class we analyzed the coupon collector’s problem under the assumption that
each of the n kinds of coupons was equally likely. We then computed the expected
number of coupons you would have to collect in order to have at least one of every
kind. The answer was
1
1 1
n(1 + + + · · · + ).
2 3
n
What if the n kinds of coupons are not equally likely? Here you are asked to
solve this problem for two coupons.
(a) Assume that there are two kinds of coupons, occurring with probabilites p
and q = 1 − p. What is the expected number of coupons that you need to collect
in order to have both kinds of coupons? (As you might imagine, the geometric
distribution plays a role in this problem.) Your answer should be an expression
involving the probability p
(b) Plot the expected value as a function of p, for p between 0 and 1. (You
should be able to guess the general shape of this plot just from a description of the
problem, with no calculation!)
3
Figure 1: Four hundred samples from a uniform distribution of points in the unit
square
4