Quant Exercises
Quant Exercises
Probability
1.1. You have a bag with two coins. One will come up heads 40% of the time
and the other will come up heads 60%. You pick a coin randomly, flip it and
get a head. What is the probability it will be heads on the next flip?
Tag: Bayes Formula
Solution: Notations of events:
H – Get a head;
Ei – Picked coin i;
H 0 – Get a head next time.
From Bayes formula, we have:
1.2. What is the Law of Large Numbers and The Central Limit Theorem? What
are the differences between them?
Solution: The Law of Large Numbers:
For a infinite sequence of i.i.d Lebesgue integrable random variables {X1 , X2 , · · · }
with E(Xi ) = µ. Then the sample mean X¯n := X1 +···+X n
n
converge in proba-
bility to µ. i.e. for any small > 0,
1
and V ar(Xi ) = σ 2 . Denote the sample mean by X¯n := X1 +···+X
n
n
. Then the
¯
Xn√−µ
random variable σ/ n converge in distribution to N (0, 1), i.e. the cumulative
distribution function Fn converge to the normal cumulative distribution Φ.
The law of large number tells us that the sample mean is an unbiased estimator
of expected value while the central limit theorem tells us about the asymptotic
distribution of the same mean, concluding that it is also consistent.
1.3. Suppose you have a fair coin, and you flip it a million times. Estimate the
probability that you get fewer than 499,000 heads.
Tag: Central Limit Theorem, Normal Distribution
Solution: From the CLT, the outcome distribution is closed to N (0.5M, 0.25M ).
The standard deviation is 0.5k = 500. So P (N < 499, 000) = Φ( 499,000−500,000
500 )=
Φ(−2) = 0.02275. (The number is checked from the table, should be acceptable
to use Φ(−2 as the final answer.)
1.4 (Unfair coin). In front of you is a jar of 1000 coins. One of the coins has
two heads,and the rest are fair coins. You choose a coin at random, and flip it
ten times, getting all heads. What is the probability it is one of the fair coins?
P (H|F )P (F )
P (F |H) =
P (H|F )P (F ) + P (H|S)P (S)
= 0.510 ∗ 0.999/(0.510 ∗ 0.999 + 1 ∗ 0.001) ≈ 0.5
1.5. Starting at one vertex of a cube, and moving randomly from vertex to
adjacent vertices, what is the expected number of moves until you reach the
vertex opposite from your starting point?
Tag: Markov Process
Solution: Notation of states: (By the distance to the origin)
S0 – the origin;
S1 – the vertices next to origin;
S2 – the vertices next to opposite;
S3 – the opposite.
Denote E(Si ) to be the expected moves to get to the opposite. Suppose we
are in S0 , then after one move, we are in S1 . Now suppose we are in S1 , then
we have 1/3 chance we will move back to S0 and 2/3 chances to move to S2 .
2
Similar for analysis on S2 . Finally if we are in S3 , then E(S3 ) = 0. Therefor,
we have the equations:
E(S0 ) = 1 + E(S1 )
1 2
E(S1 ) = 1 + E(S0 ) + E(S2 )
3 3
1 2
E(S2 ) = 1 + E(S3 ) + E(S1 )
3 3
E(S3 ) = 0
Cov(X, Y ) Cov(X, Y )
X = (X − Y)+ Y
V ar(X) V ar(X)
3
2
Cov(X, Z) = Cov(X, X)+Cov(X, Y ) = σX . We need to calculate E(X|Z = s).
Cov(X, Z) Cov(X, Z)
E(X|Z = s) = E(X − Z) + Z|Z = s)
V ar(X) V ar(X)
Cov(X, Z) Cov(X, Z)
= E(X − Z|Z = s) + E( Z|Z = s)
V ar(X) V ar(X)
Cov(X, Z) Cov(X, Z)
= E(X − Z) + s
V ar(X) V ar(X)
(By independence)
2 2
σX σX
= µX − 2 (µX + µY ) + 2 s
σX σX
= s − µY
1.8. You have a spinner that generates random numbers that are uniform be-
tween 0 and 1. You sum the spins until the sum is greater than one. What is
the expected number of spins?
E(n) = P (n = 1) + 2P (n = 2) + 3P (n = 3) + · · ·
= P (n ≥ 1) + P (n ≥ 2) + P (n ≥ 3)
Then we need to find the formula for P (n ≥ i) for all i ∈ N . The event
n ≥ k + 1 is equivalent to X1 + X2 + · · · Xk ≤ 1, where Xi are i.i.d. uniform on
[0, 1]. (X1 , X2 , · · · , Xk ) are uniform in the area [0, 1]k and we need to calculate
4
k
P
the volume bounded by Xi ≥ 0 and Xi ≤ 1.
i=1
1.9. A stick is broken randomly into 3 pieces. Two broken points are uniformly
distributed on [0, 1]. What is the probability of three pieces being able to form a
triangle?
Solution: The whole probability space is [0, 1] × [0, 1], which has area 1. Denote
the event that three pieces are able to form a triangle by E. Then the probability
of E is just the area of E.
Let’s determine the tuples (x, y) that belong to E. If x < y, then forming a
triangle need to satisfy three conditions: x < (y−x)+(1−y), (y−x) < x+(1−y),
(1 − y) < x + (y − x), which is equivalent to x < 21 , y − x < 12 , y > 12 . The
space by these three constraints is a right triangle above the diagonal. (Image
in your head or draw it down on paper.) The area is 18 . Similar analysis apply
to the situation x > y and the space is just the reflection from the line y = x,
(as you just exchange x with y!) so it also has area 81 . So the total probability
is 14 .
1.10. A stick is broken randomly into two pieces, i.e. the broken point is uniform
random variable on [0, 1]. The larger piece is then broken randomly into two
pieces, i.e. the second broken points are uniform random variable on [0, X],
where X is the length of the longer piece. What is the probability of the pieces
being able to form a triangle?
5
Solution: It is obviously a variation of the previous problem, but the problem
here is what is changed and what is not. A little thought may lead to the
conclusion that the space of E is the same but the total probability space has
change. Given x = 13 , y are just random number from 13 to 1. Now the total
probability space is [0, 1] × [0, 1] removing [0, x] for x ∈ [0, 12 ) and removing [x, 1]
for x ∈ [ 12 , 1]. The area of the total probability space is 43 , so P (E) = 1/4 3/4 =
1/3.
1.11. You play a game where you toss two fair coins in the air. You always
win 1 dollar. However, if you have tossed 2 heads at least once, and 2 tails at
least once, you surrender all winnings, and cannot play again. You may stop
playing at anytime. What’s your strategy?
Solution: If you have never tossed 2 heads or 2 tails, then next toss will guar-
antee you 1 dollar. After your first toss of 2 heads or 2 tails, then the next toss
will have 43 chance of 1 dollar and 14 chance of −n dollar, where n is the dollars
already wined. Just continue if expected value is greater than 0, i.e. n < 3,
otherwise just stop.
1.12 (St. Petersburg Paradox). Consider the following game played by flipping
a fair coin. The pot begins at a 1 dollar, and the pot doubles until a tail is
flipped, at which point you receive the pot. Assume you can play as many times
as you want. What would you pay to play this game?
Tag: Default Risk
Solution: The price should be equal to the expected payoff as it can be played
many times.P It can be deducedPthat the probability of getting 2i−1 dollars is 21i .
∞ ∞
So E(X) = i=1 2i−1 × 21i = i=1 1/2 = ∞. So that is the theoretical answer,
which seems a bit unrealistic.
Assuming in the real world, a bank is try to pricing a product like this, it
is obviously no way charge the clients infinitely dollars. So what can be done
to make it more realistic? A possible idea here is to consider the default risk of
the game host. Assume the total available money of the host is 23 0 dollar, then
if you toss 31 head, the host will default and cannot pay you anything. Given
such upper bound, the game may be priced with finite amount.
1.13 (Monte Hall Problem). You are on a game show, and there are 3 doors.
Two of the doors conceal nothing, and one door conceals a prize. The game
show host, Monte Hall, knows where the prize is. He lets you pick a door. You
picked, say, door 1. If you pick the door of prize, he will randomly open one
remaining door. If you pick the door of nothing, then he opens the other door
of nothing. Suppose he open the door 2. Finally he then offers you the chance
to switch doors. What should you do? Please justify your action. (If you have
completely no idea, you may just say ”Toss a coin and let the god guide me!”.
LOL)
Tag: Bayes formula
6
Solution: Notations of events:
Di – the price are inside door i;
O2 – the host open the door 2.
Similarly, we can have P (D2 |O2 ) = 0 and P (D3 |O2 ) = 32 . So you should switch
to door 3.
1.14. What is the expected number of rolls of a fair die needed to get all six
numbers?
Solution: The problem may seems complicated at the first glance but once for-
mulated in the correct way, it is relatively easy to solve. The right way to
decompose the process is by getting a new number one by one until we get 6.
The first roll will give a new number whichever the number it is. Given we
have 1 number, getting the next number number is just a geometric process of
success rate 65 . Similarly, given the condition that we have i numbers, getting
a new number is a geometric process of success rate 6−i 6 , which has expected
6
trials of 6−i . So the total expected rolls is just 1 + 65 + · · · + 61 = 14.7.
1.15. You have a bucket of unfair coins. Each coin has a probability of getting
heads, p, which is uniformly distributed between zero and one. You pick a coin,
and flip it 64 times, getting 48 heads. What is the expected value of p for your
coin?
Solution: At the first glance, it seems complicated as the event that A draw her
own business card will affect the event that B draw B’s card. (Because if A
draw B’s card, then B can not draw his own, but if not, then B has a chance
to draw his own.) It will be hard to calculate directly by summing n times the
probability of n people draw their own card.
Denote X to be the number of people who draw their own card and we need
to calculate E(X). Denote Xi to be a random variable that equals to 1 if guest
i get her own card else 0, (Note here that Xi , Xj are not independent.) and
P100
we have X = i=1 Xi . Even Xi ’s are dependent on each other, we still have
P100 1
E(X) = i=0 E(Xi ) = 100 × 100 = 1.
7
1.17. A red ant and a black ant are at opposite vertices of a cube. Each randomly
picks an edge to traverse and moves to the next vertex. They continue this until
they meet. What is the expected number of edges each ant traverses?
Solution:
1.18. If you roll a die repeatedly, what is the expected number of rolls until you
see consecutive sixes?
Tag: Markov Process
Solution:
1.19. Alex and Beth take turns flipping a pair of coins. The first person to flip
a pair of heads wins the game. Alex flips first. Beth eventually wins. What is
the probability she flipped a pair of heads on her second turn?
Tag: Bayes Formula
Solution:
1.20 (Coin toss game). A flips a fair coin 11 times, and B flips the coin 10
times. How likely is it that A flipped more heads than B?
Source: Practical Guide
Solution:
1.21 (Card game). A casino offers a simple card game. There are 52 cards in
a deck with 4 cards for each value 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A. Each
time the cards are thoroughly shuffled (so each card has equal probability of being
selected). You pick up a card from the deck and the dealer picks another one
without replacement. If you have a larger number, you win; if the numbers are
equal or yours is smaller, the house wins. What is your probability of winning?
Source: Practical Guide
Solution:
1.22 (Drunk passenger). A line of 100 airline passengers are waiting to board
a plane. They each hold a ticket of one of the 100 seats on the flight. For
convenience, the n-th passenger holds the ticket for seat n. Being drunk, the
first person in line picks a random seat (equal probability for all seats). All
other passengers are sober. They will go to their seats unless it is occupied. In
such case, they will pick a free seat randomly (also equal probability for all free
seats). Suppose you hold ticket for seat 100, what is the probability that you end
up in your seat (i.e. seat 100)?
Source: Practical Guide
Solution:
8
1.23 (N points on a circle). Given N points drawn randomly on the circumfer-
ence of a circle, what is the probability that they are all within a semicircle?
Source: Practical Guide
Solution:
1.26 (Grid Jumping). You are on the grid (0, 0). You may move right or up by
1 grid each step. How many ways are there for you to move to (10, 10)?
Solution:
1.27 (Balls to boxes). You have 5 balls label 1 to 5 and 5 boxes label 1 to 5.
The balls are randomly put into the boxes. What is the probability of all balls
are put to a box with a different number?
Source: Practical Guide
Solution:
1.28 (Same birthday). What is the minimum number n that, among a group
of n people, the probability of two people have the same birthday is greater than
1/2? (Assume a year always has 365 days)
Source: Practical Guide
Solution:
9
1.2 Conditional Probability
1.29 (Order Dice). Roll 3 dice one by one, what is the probability that the
outcome is strictly increasing?
Source: Practical Guide
Solution:
1.30 (Population die out). In a planet with 1 creature, this creature will die,
stay the same, split into two or split into three with equal chance (0.25 for each).
Each creature behave the same and independently. What is the probability that
the creature will die out?
Source: Practical Guide
Solution:
1.31 (Candies in a jar). Given a jar with 10 red candies, 20 blue candies, 30
green candies, what is the probability that the jar still have blue and green candies
after you have out all 10 red candies? (You are taking without replacement.)
Solution:
1.32 (Russian roulette).
Source: Practical Guide
Solution:
1.33 (Aces). A poker of 52 cards is distributed to 4 players with each getting
13 card randomly. What is the probability that each play has an ace?
Source: Practical Guide
Solution:
1.34 (GRE scores). A student is taking GRE exams with 100 questions, each
for 1 point. She is getting first question right and the second question wrong.
In the following questions, the difficulty will adjust to her previous performance.
k
For the i-th question, she has probability i−1 to get the correct answer if she
has got k points in the previous i − 1 questions. What is the probability that she
ends up with 50 points after she completes all 100 questions?
Source: Practical Guide
Solution:
1.35 (Cars on road). Assume that it has probability p to observe at least one
car on the road during a period of 20 minutes, what is the probability to observe
at least one car on the road during a period of 5 minutes? You can assume that
on a fix length period, the probability is fixed and on two non-overlap periods,
the events are independent.
10
Source: Practical Guide
Solution:
1.36 (Meeting Probability). A and B will arrive at the park at a random time
from 17:00 to 18:00 and stay for 5 minutes. What is the probability that A meets
B?
Source: Practical Guide
Solution:
Solution:
1.39 (Dice game). Consider a game that you roll a dice at get the face value.
If you roll a 6, you can roll again. What is the fair price to enter the game?
Source: Practical Guide
Solution:
1.40 (First ace). Each time, you draw a card from a regular 52 poker without
replacement. What is the expected number of draws to get the first ace?
Source: Practical Guide
Solution:
1.41 (N balls in a jar). Assuming that there are N distinct balls in a jar and
each draw will be replaced with the same ball. What is the expected number of
draws to get a complete set of N balls? After k draws, what is the expected
numbers of distinct balls?
Source: Practical Guide
Solution:
11
1.42 (Range of default). Assume A has default probability 50% and B has default
probability 30% but the correlation is unknown. What is the range of probability
that A or B default? What is the range of correlation of the event A defaults
and the events B defaults?
1.44.
Solution:
1.45.
Solution:
1.46.
Solution:
1.47.
Solution:
1.48.
Solution:
1.49.
Solution:
1.50.
Solution:
1.51.
Solution:
12
1.52 (Gambler’s Ruin). A gambler start with i dollars and has probability p
to win 1 dollar each time. He will stop if he has N(¿i) dollars or loses all his
money. What is the probability that he end up losing all money?
Source: Practical Guide
Solution:
13
Chapter 2
Calculus
14
Chapter 3
Linear Algebra
15
Chapter 4
Brain Teasers
4.1 (Chess tournament). A chess tournament has 2n players with skills 1 > 2 >
· · · > 2n . It is organized as a knockout tournament, so that after each round
only the winner proceeds to the next round. Except for the final, opponents in
each round are drawn at random. Let’s also assume that when two players meet
in a game, the player with better skills always wins. What’s the probability that
players 1 and 2 will meet in the final?
Solution:
16