Problem Set 2 Solutions
Samyak Sheersh, Vishwaksen Reddy Dhareddy,
Ananya Sikdar, Abhinandh Payyan
February 9, 2025
Question 1
You just rented a large house and the realtor gave you 5 keys, one for each of the 5 doors of the
house. Unfortunately, all keys look identical. So to open the front door, you try them at random.
a) Find the PMF of the number of trials you will need to open the door, under the following alternative
assumptions:
i) After an unsuccessful trial, you mark the corresponding key so that you never try it again,
and
ii) At each trial you are equally likely to choose any key.
b) Repeat part a) for the case where the realtor gave you an extra duplicate key for each of the 5
doors
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
a) We have 5 identical keys in this part:
i) Since we are marking each key in this part, at some point we will end up marking all the
wrong keys, and thus get the right key. Thus, X will take only finite values, specifically
X ∈ {1, 2, . . . , 5}(X is a random variable which denotes the number of trials).
1 4 1 1 4 3 1 1
P (X = 1) = ; P (X = 2) = × = ; P (X = 3) = × × = ;
5 5 4 5 5 4 3 5
4 3 2 1 1 4 3 2 1 1 1
P (X = 4) = × × × = ; P (X = 5) = × × × × = ;
5 4 3 2 5 5 4 3 2 1 5
which is expected.
ii) This case is literally memoryless and follows a classic geometric distribution since we learn
nothing from each trial. Thus X ∈ N and
Final Answer
1 k−1 1
P (X = k) = 1 −
5 5
b) We have ten keys in this part:
i) Since we are marking each case down, we’ll eventually mark all the wrong keys in the worst
case scenario and unlock the door with the ninth key. Thus X ∈ {1, 3, . . . , 9}
2 1 8 2 8 8 7 2 7
P (X = 1) = = ; P (X = 2) = × = ; P (X = 3) = × × =
10 5 10 9 45 10 9 8 45
1
In a similar fashion, we calculate the values as:
8 7 6 2 2 8 7 6 5 2 1
P (X = 4) = × × × = ; P (X = 5) = × × × × =
10 9 8 7 15 10 9 8 7 6 9
8 7 6 5 4 2 4
P (X = 6) = × × × × × =
10 9 8 7 6 5 45
1 2 1
P (X = 7) = ; P (X = 8) = ; P (X = 9) =
15 45 45
ii) Since we learn nothing from any trial, and the proportion of the right keys is the same, it’s
the same geometric distribution as case a) ii). Thus X ∈ N and
Final Answer
4 k−1 1
P (X = k) =
5 5
Question 2
Let X be a random variable that takes values from 0 to 9 with equal probability 1/10.
a) Find the PMF of the random variable Y= X mod 3
b) Find the PMF of the random variable Y= 5 mod (X+1)
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
a)
1
P (Y = 0) = P (X = 0, 3, 6, 9) = 4 × = 0.4
10
1
P (Y = 1) = P (X = 1, 4, 7) = 3 × = 0.3
10
1
P (Y = 2) = P (X = 2, 5, 8) = 3 × = 0.3
10
b)
P (Y = 0) = P (X = 0, 4) = 0.2
P (Y = 1) = P (X = 1, 3) = 0.2
P (Y = 2) = P (X = 2) = 0.1
P (Y = 5) = P (X = 5, 6, 7, 8, 9) = 0.5
Question 3
Let a and b be positive integers with a ≤ b , and let X be a random variable that takes as values,
with equal probability, the powers of 2 in the interval [2a , 2b ]. Find the expected value and the variance
of X
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
2
Since the random variable X is uniformly distributed over {2a , . . . , 2b },
1
P (X = 2k ) =
b−a+1
b b
X
x x
X 2x 1
⇒ E(X) = 2 P (X = 2 ) = = (2b+1 − 2a )
x=a x=a
b − a + 1 b − a +1
We know that V(X) = E(X 2 ) − (E(X))2
b b
X 1 X 1 4b+1 − 4a
⇒ E(X 2 ) = 22x P (X = 2x ) = 4x =
x=a
b − a + 1 x=a b−a+1 3
1 4b+1 − 4a 1 2
⇒ V(X) = E(X 2 ) − (E(X))2 = − (2b+1 − 2a )
b−a+1 3 b−a+1
2(b+1) 2a b+1
2 −2 2 − 2a 2
⇒ V(X) = −
3(b − a + 1) b−a+1
Final Answer
1
E(X) = (2b+1 − 2a )
b−a+1
;
22(b+1) − 22a 2b+1 − 2a 2
V(X) = −
3(b − a + 1) b−a+1
Question 4
Two coins are simultaneously tossed until one of them comes up a head and the other a tail. The
first coin comes up a head with probability p and the second with probability q. All tosses are assumed
independent
a) Find the PMF, the expected value, and the variance of the number of tosses.
b) What is the probability that the last toss of the first coin is a head?
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
If the two coins are simultaneously tossed, there are four outcomes, only two of which are favourable.
The probability of favourable outcomes is:
r = p(1 − q) + q(1 − p) = p + q − 2pq
a) Let T be the number of tosses to acheive the desired outcome ⇒ T ∈ {2, 4, 6, . . . }, and behaves as
a geometric distribution, with
Final Answer
n n
P (X = n) = (1 − r) 2 −1 r = (1 − p − q + 2pq) 2 −1 (p + q − 2pq)
n
X
E(T ) = n(1 − r) 2 −1 r
n=2,4,6,...
let n = 2k, then
3
Final Answer
∞
X 1 2r 2 2
E(T ) = 2r k(1 − r)k−1 = 2r = 2 = =
n=1
(1 − (1 − r))2 r r p + q − 2pq
And since this is the geometric distribution on K = X/2 with parameter r:
Final Answer
1−r 1 − p − q + 2pq
V(X) = 22 × V(K) = 4 =4
r2 (p + q − 2pq)2
b) If the first coin is to come up as head at the last pair of tosses, it means it is a case of HT. Thus
the probability, given the last pair of tosses are different(i.e. HT or TH) is:
Final Answer
p(1 − q)
P (HT ) =
p(1 − q) + q(1 − p)
Question 5
A stock market trader buys 100 shares of stock A and 200 shares of stock B. Let X and Y be the
price changes of A and B, respectively. over a certain time period, and assume that the joint PMF of X
and Y is uniform over the set of integers x and y satisfying:
−2 ≤ x ≤ 4, −1 ≤ y − x ≤ 1
a) Find the marginal PMFs and the means of X and Y.
b) Find the mean of the trader’s profits.
Answer:
Solved by: Samyak, Vishwaksen, Abhinandh, Ananya
Since X and Y take integral values only, there are only 21 pairs of poins satifying the inequalities (7
integers between and including −2 and 4, and y = x, x − 1 or x + 1 ) And since they follow a uniform
distribution over their support, thus
1
P (X = x, Y = y) =
21
Now to find the marginal distribution of X:
X
P (X = x) = P (X = x, Y = y) = P (X = x, Y = x) + P (X = x, Y = x − 1) + P (X = x, Y = x + 1)
y
Final Answer
3 1
⇒ P (X = x) = =
21 7
And
4
Final Answer
4 + (−2)
EX (X) = =1
2
Now, for Y : Y can be -3 and 5 in one case (when X = −2 and X = 4 respectively). Y can be -2
and 4 in 2 cases (when X = −2, −1 and X = 3, 4 respectively), while it can take all the other values
({−1, 0, 1, 2, 3}) in 3 cases. Thus:
Final Answer
1
21 ,
y = −3, 5
2
P (Y = y) = 21 , y = −2, 4
3
21 , y = −1, 0, 1, 2, 3
and
−3 + 5 2(−2 + 4) 3(−1 + 0 + 1 + 2 + 3) 21
EY (Y ) = + + = =1
21 21 21 21
Final Answer
EY (Y ) = 1
Let Q = 100X + 200Y be the profit of the trader. Then
EXY (Q) = EXY (100X + 200Y ) = 100EXY (X) + 200EXY (Y ) = 100EX (X) + 200EY (Y )
where EXY (X) = EX (X) due to law of iterated expectations.
Final Answer
E(Q) = 100 × 1 + 200 × 1 = 300
Question 6
Alice passes through four traffic lights on her way to work, and each light is equally likely to be green
or red, independent of the others.
a) What is the PMF, the mean and the variance of the number of red lights that Alice encounters.
b) Suppose that each red light delays Alice by exactly two minutes. What is the variance of Alice’s
commuting time?
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
The number of red lights encountered (random variable X) clearly follows the Binomial distribution
with n = 4 and p = 12 i.e. X ∼ Bin(4, 0.5)
a) PMF:
Final Answer
4 1 4
P (X = k) =
k 2
5
where X ∈ {0, 1, . . . , 4}.
Thus, mean:
Final Answer
1
E(X) = np = 4 × =2
2
and variance:
Final Answer
1 1
V(X) = np(1 − p) = 4 × × =1
2 2
b) The time of delay T = 2X is another random variable, and thus its variance is:
Final Answer
V(T ) = 22 × V(X) = 4 × 1 = 4
Thus the variance in delay is 4 minutes.
Question 7
A particular professor is known for his arbitrary grading policies. Each paper receives a grade from
the set {A, A−, B+, B, B−, C+}, with equal probability, independent of other papers. How many papers
do you expect to hand in before you receive each possible grade at least once?
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
The solution to the problem has been largely inspired by the Wikipedia article on the Coupon Col-
lector’s Problem [1]
Let T be the number of papers we need to submit before we get all grades and ti be the number of
papers to get the first ith grade after we’ve got the first (i − 1)th grade. Then, T = t1 + t2 + · · · + t6 .
Now, given that we have already got the (i − 1)th grade, the probability that we get a new it h grade
is pi = n−(i−1)
n where n is the total number of grades i.e. n = 6
Thus each variable ti follows a geometric distribution with parameter pi .
Thus:
Et1,...,t6 (T ) = Et1,...,t6 (t1 + t2 + · · · + t6 ) = Et1,...,t6 (t1 ) + · · · + Et1,...,t6 (t6 )
Now by law of iterated expectations Et1,...,tn (ti ) = Eti (ti )
Now since each ti follows a geometric distribution with parameter pi we have
1
Eti (ti ) =
pi
Thus, we have
1 1 1 n n n
Et1,...,t6 (T ) = + + ··· + = + + ··· +
p1 p2 p6 n n−1 1
Thus 1 1 1
Et1,...,t6 (T ) = n + + ··· +
1 2 n
In our case:
6
Final Answer
1 1 1
E(T ) = 6 + + ··· + = 14.7
1 2 6
Rounding up, we would expect to submit about 15 papers.
Question 8
Consider a sequence of i.i.d. Bernoulli trials {Xi }∞
i=1 with parameter p. Let us define a new sequence
{Zi }∞
i=1 of binary variables where Zi = 0 when Xi = 0, ∀i. However, when Xi = 1, we have Zi = 0 or
Zi = 1 with probability (1 − q) and q respectively, where q ∈ [0, 1], and q is a fixed parameter. Zi is
obviously a sequence of binary variables but does it qualify to called an i.i.d. sequence of trials? Argue
for either yes or no.
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
We have not been given that the transformation from Xi to Zi happens independently in each case.
For example there can be a case where A coin toss with distribution Bernoulli(q) has already been
performed and that outcome is assigned to every i where Xi is one. Thus because explicit dependence
of Zi on a certain Zj is not given, we can not say that it is independent in all cases(Although in most
cases, the model where this transformation happens independently is gonna give us better way to model
for eg. gene and disease studies.)
Question 9
Suppose that the number of people who visit a yoga studio each day is a Poisson random variable
with mean λ. Suppose further that each person who visits is, independently, female with probability p
or male with probability 1 − p. Find the joint probability that exactly n women and m men visit the
academy today.
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
First of all, we can decompose this process as number of women coming as a Poisson process with
parameter λf = λp and number of men coming as a Poisson process with parameter λm = λ(1 − p). This
is because any time a person arrives, we have a decision with probability p to assign them as women
or 1 − p to assign them male, and the arrival of a man and a woman are independent. This situation
is indistinguishable for the two populations independently following the Poisson distribution with the
arrivals interspersed with each other.
Thus the number of men: Nm ∼ P oisson(λm ) and the number of women: Nf ∼ P oisson(λf ).
Therefore:
e−λm λm
m
e−λf λnf
P (Nm = m, Nf = n) = P (Nm = m)P (Nf = n) =
m! n!
e−(λm +λf ) λm n
m λf e−λ λ(m+n) (1 − p)m pn
⇒ P (Nm = m, Nf = n) = =
m!n! m!n!
Final Answer
e−λ λm+n n + m m
⇒ P (Nm = m, Nf = n) = p (1 − p)n
(m + n)! n
7
Which is what we would intuitively get too: A poisson distribution multiplied with the binomial
distribution
Question 10
Let U1 , U2 , . . . be a sequence of independent uniform U [0, 1] random variables, and let
N = min{n ≥ 2 : Un > Un−1 }.
Find the distribution of N , and then, find the mean of N
Answer:
Solved by: Samyak, Vishwaksen, Ananya, Abhinandh
For N = n, we have Un > Un−1 and U1 ≥ U2 ≥ · · · ≥ Un−1 . Thus:
P (N = n) = P (U1 > U2 , U2 > U3 , . . . , Un−2 > Un−1 ; Un > Un−1 )
Thus, for each i before i = n:Ui ≤ Ui−1 Since all Ui are iid U [0, 1], ⇒ P (Ui ≤ Ui−1 ) = P (Uj ≤ Uj−1 )
Z 1 Z 1 Z 1
1
P (Ui ≤ Ui−1 ) = P (Ui ≤ u)fUi−1 (u)du = P (Ui ≤ u) × 1 du = udu =
0 0 0 2
Thus:
1 n−2
P (N = n) = P (U1 > U2 )P (U2 > U3 ) . . . P (Un−2 > Un−1 )P (Un > Un−1 ) = (1 − P (Un ≤ Un−1 ))
2
1 n−2 1 1 n−1
P (N = n) = 1− =
2 2 2
1
Thus N basically follows a geometric distribution with parameter 2 starting from 2 instead of 1
∞
X X∞ 1 n−1
EN (N ) = nP (N = n) = n (1)
n=2 n=2
2
which using telescoping we get:
Final Answer
X∞ 1 n−1
EN (N ) = n =3
n=2
2
References
[1] Wikimedia Foundation. Coupon Collector’s problem. Wikipedia. Accessed: 2025-02-09. Dec. 2024.
url: [Link]