Expected value, variance and covariance are indispensable in estimating returns and risks of any investments. Naturally, they are a popular test subject in interviews as well. The basic knowledge includes the following:
If E[xi] is finite for all i=1,⋯,n, then E[X1+⋯+Xn]=E[X1]+⋯+E[Xn]. The relationship holds whether the xi’s are independent of each other or not.
If X and Y are independent, then E[g(X)h(Y)]=E[g(x)]E[h(Y)].
You have 100 noodles in your soup bowl. Being blindfolded, you are told to take two ends of some noodles (each end on any noodle has the same probability of being chosen) in your bowl and connect them. You continue until there are no free ends. The number of loops formed by the noodles this way is stochastic. Calculate the expected number of circles.
Solution: Again do not be frightened by the large number 100. If you have no clue how to start, let’s begin with the simplest case where n=1. Surely you have only one choice (to connect both ends of the noodle), so E[f(1)]=1. How about 2 noodles? Now you have 4 ends (2×2) and you can connect any two of them. There are (24)=24×3=6 combinations. Among them, 2 combinations will connect both ends of the same noodle together and yield 1 circle and 1 noodle. The other 4 choices will yield a single noodle. So the expected number of circles is
We now move on to 3 noodles with (26)=26×5=15 choices. Among them, 3 choices will yield 1 circle and 2 noodles; the other 12 choices will yield 2 noodles only, so
See the pattern? For any n noodles, we will have E[f(n)]=1+1/3+1/5+⋯+1/(2n−1), which can be easily proved by induction. Plug 100 in, we will have the answer.
94
Actually after the 2-noodle case, you probably have found the key to this question. If you start with n noodles, among (22n)=n(2n−1) possible combinations, we have n(2n−1)n=2n−11 probability to yield 1 circle and n−1 noodles and 2n−12n−2 probability to yield n−1 noodles only, so E[f(n)]=E[f(n−1)]+2n−11. Working backward, you can get the final solution as well.
Optimal hedge ratio
You just bought one share of stock A and want to hedge it by shorting stock B. How many shares of B should you short to minimize the variance of the hedged position? Assume that the variance of stock A’s return is σA2; the variance of B’s return is σB2; their correlation coefficient is ρ.
Solution: Suppose that we short h shares of B, the variance of the portfolio return is
var(rA−hrB)=σA2−2ρhσAσB+h2σB2
The best hedge ratio should minimize var(rA−hrB). Take the first order partial derivative with respect to h and set it to zero:
∂h∂var=−2ρσAσB+2hσB2=0⇒h=ρσBσA.
To confirm it’s the minimum, we can also check the second-order partial derivative: ∂h2∂2var=2σB2>0. So Indeed when h=ρσBσA, the hedge portfolio has the minimum variance.
Dice game
Suppose that you roll a dice. For each roll, you are paid the face value. If a roll gives 4, 5 or 6, you can roll the dice again. Once you get 1, 2 or 3, the game stops. What is the expected payoff of this game?
Solution: This is an example of the law of total expectation. Clearly your payoff will be different depending on the outcome of first roll. Let E[X] be your expected payoff and Y be the outcome of your first throw. You have 1/2 chance to get Y∈{1,2,3}, in which case the expected value is the expected face value 2, so E[X∣Y∈{1,2,3}]=2; you have
95
1/2 chance to get Y∈{4,5,6}, in which case you get expected face value 5 and extra throw(s). The extra throw(s) essentially means you start the game again and have an extra expected value E[X]. So we have E[X∣Y∈(4,5,6)]=5+E[X]. Apply the law of total expectation, we have
What is the expected number of cards that need to be turned over in a regular 52-card deck in order to see the first ace?
Solution: There are 4 aces and 48 other cards. Let’s label them as card 1,2,⋯,48. Let
Xi={1,0,if card i is turned over before 4 acesotherwise
The total number of cards that need to be turned over in order to see the first ace is X=1+∑i=148Xi, so we have E[X]=1+∑i=148E[Xi]. As shown in the following sequence, each card i is equally likely to be in one of the five regions separated by 4 aces:
1A2A3A4A5
So the probability that card i appears before all 4 aces is 1/5, and we have E[Xi]=1/5.
Therefore, E[X]=1+∑i=148E[Xi]=1+48/5=10.6.
This is just a special case for random ordering of m ordinary cards and n special cards. The expected position of the first special card is 1+∑i=1mE[Xi]=1+n+1m.
Sum of random variables
Assume that X1,X2,⋯, and Xn are independent and identically-distributed (IID) random variables with uniform distribution between 0 and 1. What is the probability that Sn=X1+X2+⋯+Xn≤1?28
96
Solution: This problem is a rather difficult one. The general principle to start with the simplest cases and try to find a pattern will again help you approach the problem; even though it may not give you the final answer. When n=1, P(S1≤1) is 1. As shown in Figure 4.6, when n=2, the probability that X1+X2≤1 is just the area under X1+X2≤1 within the square with side length 1 (a triangle). So P(S2≤1)=1/2. When n=3, the probability becomes the tetrahedron ABCD under the plane X1+X2+X3≤1 within the cube with side length 1. The volume of tetrahedron ABCD is 1/6.29 So P(S3≤1)=1/6. Now we can guess that the solution is 1/n!. To prove it, let’s again resort to induction. Assume P(Sn≤1)=1/n!. We need to prove that P(Sn+1≤1)=1/(n+1)!.
Figure 4.6 Probability that Sn≤1 when n=2 or n=3.
Here we can use probability by conditioning. Condition on the value of Xn+1, we have
P(Sn+1≤1)=∫01f(Xn+1)P(Sn≤1−Xn+1)dXn+1,
where f(Xn+1) is the probability density function of Xn+1, so f(Xn+1)=1. But how do we calculate P(Sn≤1−Xn+1)? The cases of n=2 and n=3 have provided us with some clue. For Sn≤1−Xn+1 instead of Sn≤1, we essentially need to shrink every dimension of the n-dimensional simplex30 from 1 to
97
1−Xn+1. So its volume should be n!(1−Xn+1)n instead of n!1. Plugging in these results, we have
So the general result is true for n+1 as well and we have P(Sn≤1)=1/n!.
Coupon collection
There are N distinct types of coupons in cereal boxes and each type, independent of prior selections, is equally likely to be in a box.
If a child wants to collect a complete set of coupons with at least one of each type, how many coupons (boxes) on average are needed to make such a complete set?
If the child has collected n coupons, what is the expected number of distinct coupon types?31
Solution: For part A, let Xi,i=1,2,⋯,N, be the number of additional coupons needed to obtain the i-th type after (i−1) distinct types have been collected. So the total number of coupons needed is X=X1+X2+⋯+XN=∑i=1NXi.
For any i, i−1 distinct types of coupons have already been collected. It follows that a new coupon will be of a different type with probability 1−(i−1)/N=(N−i+1)/N. Essentially to obtain the i-th distinct type, the random variable Xi follows a geometric distribution with p=(N−i+1)/N and E[Xi]=N/(N−i+1). For example, if i=1, we simply have Xi=E[Xi]=1.
For part B, let Y be the number of distinct types of coupons in the set of n coupons. We introduce indicator random variablesIi,i=1,2,⋯,N, where
{Ii=1,Ii=0,if at least one coupon of the i-th type is in the set of n couponsotherwise
So we have Y=I1+I2+⋯+IN=∑i=1NIi
For each collected coupon, the probability that it is not the i-th coupon type is NN−1. Since all n coupons are independent, the probability that none of the n coupons is the i-th coupon type is P(Ii=0)=(NN−1)n and we have E[Ii]=P(Ii=1)=1−(NN−1)n.
If there is a 50% probability that bond A will default next year and a 30% probability that bond B will default. What is the range of probability that at least one bond defaults and what is the range of their correlation?
Solution: The range of probability that at least one bond defaults is easy to find. To have the largest probability, we can assume whenever A defaults, B does not default; whenever B defaults, A does not default. So the maximum probability that at least one bond defaults is 50%+30%=80%. (The result only applies if P(A)+P(B)≤1). For the minimum, we can assume whenever A defaults, B also defaults. So the minimum probability that at least one bond defaults is 50%.
To calculate the corresponding correlation, let IA and IB be the indicator for the event that ‘bond A/B defaults next year’ and ρAB be their correlation. Then we have E[IA]=0.5,E[IB]=0.3,var(IA)=pA×(1−pA)=0.25,var(IB)=0.21.
99P(A or B defaults)=E[IA]+E[IB]−E[IAIB]=E[IA]+E[IB]−(E[IA]E[IB]−cov(IA,IB))=0.5+0.3−(0.5×0.3−ρABσAσB)=0.65−0.21/2ρAB
For the maximum probability, we have 0.65−0.21/2ρAB=0.8⇒ρAB=−3/7.
For the minimum probability, we have 0.65−0.21/2ρAB=0.5⇒ρAB=3/7.
In this problem, do not start with P(A or B defaults)=0.65−0.21/2ρAB and try to set ρAB=±1 to calculate the maximum and minimum probability since the correlation cannot be ±1. The range of correlation is restricted to [−3/7,3/7].