A Summary for Quant Interview Questions
Honglin Qian
2024-08-30
1
1 Week 1
1.1 Behavior Question
Please discuss a recent global market event and its implications on individuals or businesses. (Blackrock)
solution:
The recent surge in artificial intelligence (AI) investments, especially in large language models like Ope-
nAI’s GPT-4, carries profound influence for both individuals and businesses. For individuals, this trend can
result in job displacement in routine and repetitive tasks, making a shift towards more complex and creative
roles. However, it also opens new career opportunities in AI-related fields such as data analysis, machine
learning, while simultaneously raising significant privacy and data security concerns. For businesses, AI
adoption enhances operational efficiency by automating processes and analyzing vast amounts of data to
make informed decisions. It provides a competitive edge by enabling the development of innovative prod-
ucts and services tailored to customer needs. However, the rapid integration of AI technologies introduces
regulatory challenges, including compliance with evolving data protection laws and ethical considerations.
This dynamic environment demands continuous learning and adaptation from all financial workers to stay
relevant and competitive in the AI-driven economy. Therefore, fostering a culture of lifelong learning and
upskilling is crucial for both individuals and businesses to thrive in this transformative era.
1.2 calculus
How do you differentiate xx with respect to x? (JPM)
solution:
Let y = xx , then take logs, differentiate implicitly, use the product rule, and then use the definition of y
to recover the answer:
ln(y) = x ln(x)
1 dy
= ln(x) + 1
y dx
dy
= xx (1 + ln(x))
dx
1.3 linear algebra
There are 3 random variables x, y and z. The correlation between x and y is 0.8 and the correlation between
x and z is 0.8. What is the maximum and minimum correlation between y and z? (JPM)
Solution:
The problem can be solved using the positive semidefiniteness property of the correlation matrix.
Let the correlation between y and z be ρ, then the correlation matrix for x, y and z is
1 0.8 0.8
P = 0.8 1 ρ .
0.8 ρ 1
1 ρ 0.8 0.8 0.8 0.8
det(P ) = 1 × det − 0.8 × det + 0.8 × det
ρ 1 ρ 1 1 ρ
= (1 − ρ2 ) − 0.8 × (0.8 − 0.8ρ) + 0.8 × (0.8ρ − 0.8)
= −0.28 + 1.28ρ − ρ2 ≥ 0
2
⇒ (ρ − 1)(ρ − 0.28) ≤ 0 ⇒ 0.28 ≤ ρ ≤ 1
So the maximum correlation between y and z is 1, the minimum is 0.28.
1.4 Probability
A particle starts at (4, 4). Each turn, it moves either 1 unit in the −x direction, 1 unit in the −y direction,
or 1 unit in each of the −x and −y directions. During a turn, the particle decides how it will move randomly
such that the probability of each option is 31 . The particle repeatedly takes turns until it hits the x or y axes
for the first time. Compute the probability that the particle hits the origin. (GS)
solution:
In order to hit the origin, the particle must arrive at (1, 1). To do so, the particle can (1) move 3 left and
3 down, (2) move 2 left, 2 down, and 1 diagonal, (3) move 1 left, 1 down, and 2 diagonal, or (4) move down
3 consecutive diagonals. The probability that the particle arrives at (1, 1) is then
1 6 1 5 1 4 1 245
6
· + 5· + 4· + 3 = 6
3 3 3 2, 2, 1 3 1, 1, 2 3 3
Finally, there is a 31 chance that the particle reaches the origin from (1, 1), as it has to move diagonally
from (1, 1), so our answer is
245 1 245
· =
36 3 2187
1.5 Probability
Suppose we have that σX = 4, σY = 7, and σX+Y = 11. What is ρ(X, Y )? (MS)
Solution:
We are going to generalize this to when σX = a, σY = b, and σX+Y = a + b. We know that
1
Var(X + Y ) = Var(X) + Var(Y ) + 2Cov(X, Y ) =⇒ Cov(X, Y ) = ((a + b)2 − a2 − b2 ) = ab
2
After, we know that
Cov(X, Y ) ab
ρ(X, Y ) = = =1
σX σY ab
1.6 Statistics
Consider the following ordered pairs (x, y): (−2, 3), (−1, 2), (0, 1), (1, 1), (2, 0.5). Compute the sum of the
least-squares estimators for the parameters β0 , β1 in the model Y = β0 + β1 x + ϵ, where E[ϵ] = 0. (JPM)
solution:
Sxy Pn Pn
Recall β̂0 = ȳ − β̂1 x̄ and β̂1 = Sxx , where Sxy = i=1 (xi − x̄)(yi − ȳ) and Sxx = i=1 (xi − x̄)2 . We find
x̄ = 0, ȳ = 1.5. Plugging in values, we find:
Sxy = −6, Sxx = 10, β̂1 = −0.6, β̂0 = 1.5
We conclude E[Y ] = ŷ = 1.5 − 0.6x, so our answer is 1.5 − 0.6 = 0.9.
1.7 Finance
How do vanilla European/American option prices change when S, K, τ, σ, r, or D changes?
solution:
3
Variable European call European put American call American Put
Stock price ↑ ↑ ↓ ↑ ↓
Strike price ↑ ↓ ↑ ↓ ↑
Time to maturity ↑ ? ? ↑ ↑
Volatility ↑ ↑ ↑ ↑ ↑
Risk-free rate ↑ ↑ ↓ ↑ ↓
Dividends ↑ ↓ ↑ ↓ ↑
1.8 Machine Learning
Briefly Describe the Principles and Differences Between L1 Regularization and L2 Regularization
solution:
The purpose of L1 regularization and L2 regularization is to prevent model overfitting. The main differ-
ence between them lies in their different penalty terms.
L1 regularization refers to adding the sum of the absolute values of all parameters (multiplied by a
constant) to the loss function, which is used to penalize large parameters and encourage the model to be
more sparse. L1 regularization makes most of the parameters equal to 0, achieving a feature selection effect.
In some cases requiring feature selection, it performs better. However, the derivative of L1 regularization is
not continuous when it is equal to 0, making optimization more complicated.
L2 regularization refers to adding the sum of the squares of all parameters (multiplied by a constant)
to the loss function, which is used to penalize overly large parameters and make the model smoother. L2
regularization retains more parameters, making it more continuous and stable. Moreover, the derivative
of L2 regularization is continuous everywhere, making optimization simpler and more common than L1
regularization.
It is important to note that there is no absolute superiority between L1 regularization and L2 regular-
ization; the choice of regularization method should depend on the specific problem and empirical results.
1.9 Code
Leetcode 509 (Green Book) (basic dynamic programming)
1.10 Code
Leetcode 70 (Green Book) (basic dynamic programming)
4
2 Week 2
2.1 Behavior Question
Please share an instance where you encountered conflicting data or information. What steps or measures
did you take to get the correct information? (Blackrock)
solution:
During my previous internships or projects, such as predicting stock returns or forecasting volatility using
machine learning, I encountered conflicting data from various sources. To address this, I rigorously verified
the reliability of each data source, checking their consistency and cross-referencing with expert validation.
This meticulous process ensured the dataset’s integrity. After cleaning and preparing the data, I trained
models like gradient boost decision trees using LightGBM. I focused on parameter optimization and feature
engineering to enhance the models’ performance. Continuous monitoring and updating of the data were
crucial to maintaining the reliability of predictions, as financial markets are dynamic, and data can rapidly
change. This experience underscored the paramount importance of data quality and validation in financial
forecasting. It taught me that accurate predictions depend not only on advanced algorithms but also on the
thoroughness of data preprocessing and the ongoing validation of data sources.
2.2 calculus
R∞ 2
What is the value of −∞
e−x dx? (red book)
solution:
1. This is a great integration question that, to solve from scratch, involves a nice trick. First, we will
consider deducing the solution by a less direct manner. If you have studied any probability theory at all,
you will have seen that the density of the N (0, 1) random variable is given by
2
1 x
f (x) = √ exp − ,
2π 2
for x ∈ R. You would also be aware that the integral of the density of a proper random variable gives 1, so
with a bit of manipulation, we can use this to solve our problem:
Z ∞ Z ∞ 2 Z ∞
1 x 1
1= f (x) dx = √ exp − dx = √ exp(−y 2 ) dy,
−∞ −∞ 2π 2 π −∞
√
using the substitution y = x/ 2. Thus Z ∞
2 √
e−x dx = π.
−∞
The alternative method of solution is as follows. Denote by I the integral in question,
Z ∞
2
I= e−x dx.
−∞
Then we have Z ∞ Z ∞ Z ∞ Z ∞
−x2 −y 2 2
+y 2 )
2
I = e dx e dy = e−(x dx dy.
−∞ −∞ −∞ −∞
By considering this as an integral over the entire plane, we change to polar coordinates setting x = r cos(θ)
and y = r sin(θ), r > 0, 0 ≤ θ ≤ 2π. Remembering to include the Jacobian, we then have
Z ∞ Z 2π Z ∞ Z 2π Z ∞ Z ∞
−r 2 (cos2 (θ)+sin2 (θ)) −r 2 −r 2
2
I = e r dθ dr = e r dθ dr = 2π e r dr = π e−z dz = π,
0 0 0 0 0 0
√
which gives I = π and confirms our previous conclusion.
5
2.3 linear algebra
Why is the covariance matrix semi-definite? (JPM)
Solution: Covariance matrix C is calculated by the formula
C ≜ E{(x − x̄)(x − x̄)T }.
For an arbitrary real vector u we can write
uT Cu = uT E{(x − x̄)(x − x̄)T }u
= E{uT (x − x̄)(x − x̄)T u}
= σs2 .
Where σs is the variance of the zero-mean scalar random variable S and it is a scalar real number whose
value equals to.
σs = uT (x − x̄) = (x − x̄)T u.
Square of any real number is equal to or greater than zero. That is
σs2 ≥ 0.
Thus,
uT Cu = σs2 ≥ 0.
Which implies that the covariance matrix of any real random vector is always semi-definite.
2.4 probability
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. (green book)
A. 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?
B. 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 =
PN
X1 + X2 + · · · + XN = i=1 Xi .
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.
N N
X X N 1 1 1
∴ E[X] = E[Xi ] = =N + + ··· + .
i=1 i=1
N −i+1 N N −1 1
For part B, let Y be the number of distinct types of coupons in the set of n coupons. We introduce
indicator random variables Ii , i = 1, 2, · · · , N , where
(
1, if at least one coupon of the i-th type is in the set of n coupons
Ii =
0, otherwise
6
PN
So we have Y = I1 + I2 + · · · + IN = i=1 Ii .
For each collected coupon, the probability that it is not the i-th coupon type is NN−1 .
Since all n coupons
n are independent, the probability that noneof the n coupons is the i-th coupon type
n
is P (Ii = 0) = NN−1 and we have E[Ii ] = P (Ii = 1) = 1 − NN−1 .
N n
X N −1
∴ E[Y ] = E[Ii ] = N − N .
i=1
N
2.5 probability
On average, how many cards in a normal deck of 52 playing cards do you need to flip over to observe your
first ace? (Two sigma)
solution:
The four aces are dispersed throughout the deck and cut the 48P5remaining cards into 5 distinct sections,
each of some random length Xi ∈ [0, 48] where 1 ≤ i ≤ 5; that is, i=1 Xi = 48. Furthermore, by symmetry,
E[X1 ] = E[X2 ] = · · · = E[X5 ], as in the absence of any additional information, none of the sections is
expected to be any larger or smaller than any other. Thus, by linearity of expectation:
" 5 #
X 48
E Xi = 5 × E[X1 ] = 48 =⇒ E[X1 ] =
i=1
5
We have found that the expected number of cards in the first section is 48 5 , so we will observe the first
ace on the next card. Hence, we expect to flip 48
5 + 1 = 10.6 cards to observe the first ace.
2.6 Statistics
Given the following data, (x, y) : (−2, 0), (−1, 0), (0, 1), (1, 1), (2, 3), Bob does a simple linear regression
modeling Y as
Y = β0 + β1 x + ϵ,
where E[ϵ] = 0 and Var[ϵ] = σ 2 . Estimate σ 2 .
solution:
SSE
It can be shown that s2 = n−2 is an unbiased estimator for σ 2 in the case where there are 2 β parameters.
First, let’s determine the least-squares estimators for the β parameters. We know that
Sxy
β̂1 = ,
Sxx
β̂0 = ȳ − β̂1 x̄.
Pn Pn
For our data, we easily find Sxy = i=1 (xi − x̄)(yi − ȳ) = 7, and Sxx = i=1 (xi − x̄)2 = 10. Hence
7
β̂1 = 10 , and β̂0 = 1 − 0 = 1. We can now compute the sum of squared estimate of errors (SSE) with the
following formula:
SSE = Syy − β̂1 Sxy
7 11
=6− ·7=
10 10
11
SSE 11
⇒ = 10 =
n−2 5−2 30
7
2.7 Finance
Can you write down the put-call parity for European options on non-dividend paying stocks and prove it?
(GREEN BOOK)
solution:
Put-call parity: c + Ke−rT ≡ p + S, where the European call option and the European put option have
the same underlying security, the same maturity T and the same strike price K.
To simplify the problem, we will focus on underlying assets that do not pay dividends. To prove this
relationship, we can consider an investment portfolio consisting of the following assets:
• Buy a put option;
• Buy one unit of the underlying asset;
• Sell a call option.
The value of the investment portfolio at time t is:
Vportfolio (t) = P (t) + S(t) − C(t).
The option values at maturity are:
C(T ) = max(S(T ) − K, 0), P (T ) = max(K − S(T ), 0).
Therefore, regardless of whether S(T ) < K or S(T ) ≥ K, the value of the portfolio at time T will always
be equal to K.
If S(T ) < K, then P (T ) = K − S(T ) and C(T ) = 0, hence:
Vportfolio (T ) = P (T ) + S(T ) − C(T ) = (K − S(T )) + S(T ) = K.
If S(T ) ≥ K, then P (T ) = 0 and C(T ) = S(T ) − K, hence:
Vportfolio (T ) = P (T ) + S(T ) − C(T ) = 0 + S(T ) − (S(T ) − K) = K.
Therefore, no matter how the stock price fluctuates,
Vportfolio (T ) = P (T ) + S(T ) − C(T ) = K.
According to the principle of no arbitrage, the value of the portfolio at time t must be equal to the present
value of K at time t, i.e.,
Vportfolio (t) = Ke−r(T −t) .
Thus:
P (t) + S(t) − C(t) = Ke−r(T −t) .
Rewriting this, we get:
C(t) − P (t) = S(t) − Ke−r(T −t) .
2.8 machine learning
Derivation of the analytical solution for the Least Squares Linear Regression: (citadel)
solution:
8
Objective Function
The objective is to minimize the sum of squared errors:
J(w) = ∥y − Xw∥2
This can be expanded as:
J(w) = (y − Xw)T (y − Xw)
Derivation
To find the minimum, we take the derivative of J(w) with respect to w and set it to zero:
∂J(w) ∂
yT y − 2yT Xw + wT X T Xw = 0
=
∂w ∂w
Calculating the partial derivatives:
∂
(yT y) = 0
∂w
∂
(−2yT Xw) = −2X T y
∂w
∂
(wT X T Xw) = 2X T Xw
∂w
Setting the derivative to zero:
−2X T y + 2X T Xw = 0
Simplifying, we get the normal equation:
X T Xw = X T y
Solution
The normal equation can be solved for w (assuming X T X is invertible):
w = (X T X)−1 X T y
2.9 Code
Leetcode 62 (GS)
2.10 Code
Leetcode 63 (GS)
9
3 Week 3
3.1 Behavior Question
1. What experience do you hope to gain at . . . . . . ? (Blackrock)
Solution:
At BlackRock, I aim to gain comprehensive experience in quantitative investment by developing my skills
in key areas. I am excited to work on real-world investment projects, conduct market analysis, evaluate
different asset classes, construct portfolios, and risk management. Learning about BlackRock’s diverse
quantitative investment strategies, including active and passive investing, and specialized areas like ESG
(Environmental, Social, and Governance) investing is particularly appealing. I am keen to understand how
BlackRock leverages technology to enhance investment decision-making and risk management. Finally, I look
forward to mentorship and professional development opportunities, learning from experienced professionals,
and participating in training programs. Being part of a collaborative team on dynamic projects is something
I highly value, as it fosters continuous learning and improvement.
3.2 calculus
Show that the normal density integrates to one. (JPM)
Solution:
The normal density is
1 2
N ′ (x) = √ e−x /2 .
2π
We have to show that Z ∞
I= N ′ (x) dx = 1.
−∞
The standard way to do this is to show that the square is one. First, note that the integrand is exponentially
decaying and smooth, so there is no issue with the integral existing. We can write
Z ∞ Z ∞ ZZ
1 (x2 +y 2 )
I2 = N ′ (x) dx N ′ (y) dy = e− 2 dx dy.
−∞ −∞ 2π
We now change to polar coordinates:
x = r cos(θ),
y = r sin(θ).
We then have dxdy = r drdθ. We deduce
Z 2π Z ∞
1 2
I2 = re−r /2
drdθ.
2π 0 0
Since
d −r2 /2 2
e = −re−r /2 ,
dr
the integral is now straightforward, and we get
1 h 2
i∞
I2 = 2π −e−r /2 = 1.
2π 0
10
3.3 linear algebra
3 1 3
Let A = . Find A10 v, where v = . The answer is in the form
4 3 2
a · bp + c
d · bp − g
For integers a, b, c, d, p. Find bp + a + c + d + g. (Two sigma)
solution:
We first need to find the eigenvalues of A. The characteristic polynomial is p(λ) = λ2 − tr(A)λ + det(A).
It is easy to see that tr(A) = 6 and det(A) = 5, so we need to solve λ2 − 6λ + 5 = 0. This easily factors to
(λ − 5)(λ − 1) = 0, so λ = 1, 5 are the eigenvalues.
Next, we want the eigenvectors corresponding to each eigenvalue. We do this by solving (A − λI2 )x = 0.
For λ = 1, this becomes
2 1 0
x=
4 2 0
1 1
The solution set to this is x = t for t ∈ R. Our eigenvector is therefore e1 = .
−2 −2
For λ = 5, this equation becomes
−2 1 0
x=
4 −2 0
1 1
The solution set to this is x = t for t ∈ R. Our eigenvector is therefore e5 = .
2 2
We now need to write v in terms of our eigenvector basis. However, it is fairly clear to see that v = e1 +2e5 .
By the fact that e1 and e5 are eigenvalues of A, we have that
2 · 510 + 1
A10 v = A10 (e1 + 2e5 ) = A10 e1 + 2A10 e5 = 110 · e1 + 2 · 510 e5 =
4 · 510 − 2
This means our answer is 5 · 10 + 1 + 1 + 4 + 2 + 2 = 59.
3.4 Probability
Let X1 , X2 , . . . be IID Unif(0, 1) random variables and let N = min{n : X1 + · · · + Xn > ln(2)}. Find E[N ].
(citadel)
solution:
∞
X ∞
X
E(N ) = P (N > k) = 1 + P (N > k)
k=0 k=1
k
!
X
P (N ≥ k) = P Xi ≤ ln2
i=1
Let Sn = X1 + X2 + · · · + Xn ,
n
Prove: P (Sn ≤ t) = tn!
P (S1 ≤ t) = t
t t
t2
Z Z
P (S2 ≤ t) = f (X2 ) · P (S1 ≤ t − X2 ) dX2 = (t − X2 ) dX2 =
0 0 2
11
···
t t t
(t − Xn+1 )n (t − Xn+1 )n+1 tn+1
Z Z
1
P (Sn+1 ≤ t) = f (Xn+1 )P (Sn ≤ t−Xn+1 ) dXn+1 = dXn+1 = − =
0 0 n! n! n+1 0 (n + 1)!
∞
X (ln 2)k
So, E(N ) = 1 + = eln 2 = 2
k!
k=1
3.5 Probability
3.5.1 Chess tournament
(JPM)
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:
There are at least two approaches to solve the problem. The standard approach applies the multiplica-
tion rule based on conditional probability, while a counting approach is far more efficient. (We will cover
conditional probability in detail in the next section.)
Let’s begin with the conditional probability approach, which is easier to grasp. Since there are 2n players,
the tournament will have n rounds (including the final). For round 1, players 2, 3, . . . , 2n each have 2n1−1
probability to be 1’s rival, so the probability that 1 and 2 do not meet in round 1 is
2n − 2 2 × (2n−1 − 1)
= .
2n − 1 2n − 1
Condition on that 1 and 2 do not meet in round 1, 2n−1 players proceed to the 2nd round and the conditional
probability that 1 and 2 will not meet in round 2 is
2n−1 − 2 2 × (2n−2 − 1)
n−1
= .
2 −1 2n−1 − 1
We can repeat the same process until the (n − 1)th round, in which there are 22 (= 2n /2n−2 ) players left and
the conditional probability that 1 and 2 will not meet in round (n − 1) is
22 − 2 2 × (22 − 1)
= .
22 − 1 22 − 1
Let E1 be the event that 1 and 2 do not meet in round 1;
E2 be the event that 1 and 2 do not meet in rounds 1 and 2;
..
.
En−1 be the event that 1 and 2 do not meet in rounds 1, 2, . . . , n − 1.
Apply the multiplication rule, we have
P (1 and 2 meet in the nth game) = P (E1 ) × P (E2 | E1 ) × · · · × P (En−1 | E1 E2 · · · En−2 )
2 × (2n−1 − 1) 2 × (2n−2 − 1) 2 × (22 − 1) 2n−1
= × × · · · × = .
2n − 1 2n−1 − 1 22 − 1 2n − 1
12
3.6 Statistics
You use OLS regression model the relationship between news sentiment, X, and AAPL share price, Y, and
find that Y = 156.3 + 10.21X with a correlation coefficient of 0.78. You duplicate the data and re-run the
OLS regression. How much did the correlation coefficient, ρ, increase by?
solution:
Correlation is not a function of sample size, and thus correlation increases by 0.
3.7 Machine learning
What is gradient desent algorithm?
solution
Gradient Descent is a type of iterative optimization algorithm for machine learning and deep learning
that is used to solve optimization problems. The goal is to minimize the value of an objective function (often
the loss function). In many problems, such as linear regression, logistic regression, and neural networks,
we aim to find a set of parameters that will make the value of the objective function as small as possible,
thereby improving the model’s predictive accuracy.
The basic idea behind gradient descent is to use the slope (gradient) of the objective function to determine
the direction in which to update the parameters. At each iteration, the parameters are updated in the
opposite direction of the gradient because the slope indicates the direction of the steepest increase of the
objective function. The steps of gradient descent are as follows:
1. Initialize parameters: Select an initial value for the model parameters.
2. Compute the gradient: Calculate the gradient (slope) of the objective function with respect to each
parameter.
3. Update parameters: Adjust the parameters in the opposite direction of the gradient.
4. Repeat steps 2 and 3 until convergence (e.g., when the gradient approaches zero or the change in the
objective function is smaller than a predefined threshold).
3.8 Machine learning
what is learning rate?
solution
The learning rate, denoted by α, is a hyperparameter in Gradient Descent, and it is crucial for controlling
the step size during parameter updates. In each iteration, we update the parameters in the opposite direction
of the gradient, and the step size of this update is determined by multiplying the gradient by the learning
rate. The learning rate has a significant impact on both the speed of convergence and the final outcome of
the algorithm. Therefore, choosing an appropriate learning rate is very important.
The learning rate must be a positive number because we need to update the parameters in the opposite
direction of the gradient. If the learning rate is negative, the parameters will be updated in the direction
of the gradient, causing the loss function to increase rather than decrease, which leads to divergence. If the
learning rate is too large, the parameters may oscillate around the optimal value or even diverge, causing
the loss function to fail to converge to a minimum value. On the other hand, if the learning rate is too small,
the parameters will update very slowly, and the convergence speed will become extremely slow. It may take
a long time to reach the optimal solution, or the algorithm may get stuck in a local minimum, failing to
reach the global minimum efficiently.
3.9 Finance
Since American options can be exercised at any time before maturity, they are often more valuable than
European options with the same characteristics. But when the stock pays no dividend, the theoretical price
for an American call and European call should be the same since it is never optimal to exercise the American
call. Why should you never exercise an American call on a non-dividend paying stock before maturity?
13
(GREEN BOOK)
solution:
Let us use a numerical argument based on risk-neutral pricing and Jensen’s inequality—if f (X) is a
convex function, then E[f (X)] ≥ f (E[X]). the payoff of a call option (if exercised when S > K)
is given by C(S) = (S − K)+ , which is a convex function of the stock price and has the following
property.
C(λS1 + (1 − λ)S2 ) ≤ λC(S1 ) + (1 − λ)C(S2 ), 0 < λ < 1.
Let S1 = S and S2 = 0, then C(λS) ≤ λC(S) + (1 − λ)C(0) = λC(S) since C(0) = 0.
C(λS1 ) + (1 − λ)C(S2 ) ≤ C(λS1 + (1 − λ)S2 )
If the option is exercised at time t, the payoff at t is C(St − K). If it is not exercised until maturity,
the discounted expected payoff (to t) is Ẽ[e−rT C(ST )] under risk-neutral measure. Under risk-neutral
probabilities, we also have Ẽ[ST ] = St er(T −t) .
Ẽ[e−rT C(ST )] = e−rT Ẽ[C(ST )] ≥ e−rT C(Ẽ[ST ]) = e−rT C(er(T −t) St ),
where the inequality is from Jensen’s inequality.
Let S = er(T −t) St , and λ = e−r(T −t) , we have C(λS) = C(St ) ≤ e−r(T −t) C(er(T −t) St ) ≤ e−rT Ẽ[C(ST )].
Since the discounted payoff e−rT Ẽ[C(ST )] is no less than C(St ) for any t ≤ T under the risk-neutral
measure, it is never optimal to exercise the option before expiration.
3.10 Finance
European put option on a non-dividend paying stock with strike price 80 is currently priced at 8 and a put
option on the same stock with strike price 90 is priced at 9. Is there an arbitrage opportunity existing in
these two options? (GREEN BOOK)
solution:
In the last problem, we mentioned that the payoff of a put is a convex function in stock price. The price
of a put option as a function of the strike price is a convex function as well. Since a put option with strike
0 is worthless, we always have P (0) + λP (K) > P (λK).
For this specific problem, we should have 8/9 × P (90) = 8/9 × 9 = 8 > P (80). Since the put option with
strike price 80 is currently priced at 8, it is overpriced and we should short it. The overall arbitrage portfolio
is to short 9 units of put with K = 80 and long 8 units of put with K = 90. At time 0, the initial cash flow
is 0. At the maturity date, we have three possible scenarios:
1. ST ≥ 90, payoff = 0 (No put is exercised.)
2. 90 > ST ≥ 80, payoff = 8 × (90 − ST ) > 0 (Puts with K = 90 are exercised.)
3. ST < 80, payoff = 8 × (90 − ST ) − 9 × (80 − ST ) = ST > 0 (All puts are exercised.)
The final payoff ≥ 0 with positive probability that payoff > 0. So it is clearly an arbitrage opportunity.
3.11 Code
best time to buy and sell stock 1, NO.121, Citadel
3.12 Code
best time to buy and sell stock 2, NO.122, Citadel
14
4 Week 4
4.1 Behavior Question
We have a lot of interest in this position. Why should we hire you? (Blackrock)
solution: I bring a unique blend of relevant skills, experience, and dedication. My background in
quantitative finance has equipped me with the necessary technical knowledge and competencies for this
role. I excel in both team environments and individual tasks, consistently demonstrating a proactive and
collaborative approach. My commitment to continuous learning ensures I stay updated with industry trends.
Additionally, my strong work ethic, attention to details, and passion for quantitative investments and risk
management make me a competitive candidate. I am excited about the opportunity to contribute to your
team’s success.
4.2 calculus
What is ii ? (Green Book)
solution:
The solution to this problem uses Euler’s formula, eiθ = cos θ + i sin θ, which can be proven using Taylor’s
series. Let’s look at the proof. Applying Taylor’s series to eiθ , cos θ, and sin θ, we have
(iθ)2 (iθ)3 (iθ)4 θ θ2 θ3 θ4 θ5
eiθ = 1 + iθ + + + + ··· = 1 + i − −i + + i + ···
2! 3! 4! 1! 2! 3! 4! 5!
θ2 θ4 θ6
cos θ = 1 − + − + ···
2! 4! 6!
θ3 θ5 θ7 θ3 θ5 θ7
sin θ = θ − + − + · · · ⇒ i sin θ = iθ − i + i − i + · · ·
3! 5! 7! 3! 5! 7!
Combining these three series, it is apparent that eiθ = cos θ + i sin θ.
When θ = π, the equation becomes eiπ = cos π + i sin π = −1. When θ = π/2, the equation becomes
iπ/2
e = cos(π/2) + i sin(π/2) = i. So ln i = ln(eiπ/2 ) = iπ/2.
Hence, ln(ii ) = i ln i = i(iπ/2) = −π/2 ⇒ ii = e−π/2 .
4.3 Linear algebra
Find trace(eA ) to 3 decimal points, where A is defined as
3 0
A=
0 6
The answer will be in the form ea + eb for integers a and b. Find ab. (Jane street)
solution:
Recall that eA can be rewritten as
∞
X 1 k
eA = A
k!
k=0
In addition, note the following:
15
∞
!
X 1
trace(eA ) = trace Ak
k!
k=0
∞
X 1 k
= trace A
k!
k=0
"P #!
∞ 3k
k=0 k! 0
= trace P∞ 6k
0 k=0 k!
= e3 + e6
Therefore, our answer is 3 · 6 = 18.
4.4 Probability
Monty Hall problem is a probability puzzle based on an old American show Let’s Make a Deal. The problem
is named after the show’s host. Suppose you’re on the show now, and you’re given the choice of 3 doors.
Behind one door is a car; behind the other two, goats. You don’t know ahead of time what is behind each
of the doors. You pick one of the doors and announce it. As soon as you pick the door, Monty opens one of
the other two doors that he knows has a goat behind it. Then he gives you the option to either keep your
original choice or switch to the third door. Should you switch? What is the probability of winning a car if
you switch? (Green Book)
Solution:
Using a switching strategy, you win the car if and only if you originally pick a door with a goat, which
has a probability of 2/3 (You pick a door with a goat, Monty shows a door with another goat, so the one you
switch to must have a car behind it. If you originally picked the door with the car, which has a probability
of 1/3, you will lose by switching. So your probability of winning by switching is actually 2/3.
Bayes method:
A: guest chooses door 1, car is in door 1
B: guest chooses door 1, car is in door 2
C: guest chooses door 1, car is in door 3
D: host opens door 2
1
P (D|A) = , P (D|B) = 0, P (D|C) = 1
2
∴ P (D) = P (D|A)P (A) + P (D|B)P (B) + P (D|C)P (C)
1 1 1 1 1 1 1
= × +0× +1× = + =
2 3 3 3 6 3 2
1 1
P (D|A)P (A) × 1
∴ P (A|D) = = 2
1
3
= (don′ tSwitch)
P (D) 2
3
1
P (D|C)P (C) 1× 3 2
P (C|D) = = 1 = (Switch)
P (D) 2
3
16
4.5 Probability
Let’s play a traditional version of Russian roulette. A single bullet is put into a 6- chamber revolver. The
barrel is randomly spun so that each chamber is equally likely to be under the hammer. Two players take
turns to pull the trigger–with the gun unfortunately pointing at one’s own head without further spinning
until the gun goes off and the person who gets killed loses. If you, one of the players, can choose to go first
or second, how will you choose? And what is your probability of loss? (Green Book)
Solution:
Many people have the wrong impression that the first person has a higher probability of loss. After all,
the first player has a 16 chance of getting killed in the first round before the second player starts. Unfor-
tunately, this is one of the few times that intuition is wrong. Once the barrel is spun, the position of the
bullet is fixed. If you go first, you lose if and only if the bullet is in chambers 1, 3, and 5. So the probability
that you lose is the same as the second player, 12 . In that sense, whether to go first or second does not matter.
Now, let’s change the rule slightly. We will spin the barrel again after every trigger pull. Will you choose
to be the first or the second player? And what is your probability of loss?
Solution:
The difference is that each run now becomes independent. Assume that the first player’s probability of
losing is p, then the second player’s probability of losing is 1 − p. Let’s condition the probability on the first
person’s first trigger pull. He has 16 probability of losing in this run. Otherwise, he essentially becomes the
second player in the game with new (conditional) probability of losing 1 − p. That happens with probability
5
6 . That gives us
1 5 6
p=1× + (1 − p) × =⇒ p = .
6 6 11
5
So you should choose to be the second player and have 11 probability of losing.
If instead of one bullet, two bullets are randomly put in the chamber. Your opponent played the first
and he was alive after the first trigger pull. You are given the option whether to spin the barrel. Should you
spin the barrel?
Solution:
If you spin the barrel, the probability that you will lose in this round is 26 . If you don’t spin the barrel,
there are only 5 chambers left and your probability of losing in this round (conditioned on that your opponent
survived) is 25 . So you should spin the barrel.
What if the two bullets are randomly put in two consecutive positions? If your opponent survived his
first round, should you spin the barrel?
Solution:
Now we have to condition our probability on the fact that the positions of the two bullets are consecutive.
Let’s label the empty chambers as 1, 2, 3, and 4; label the ones with bullets 5 and 6. Since your opponent
survived the first round, the possible position he encountered is 1, 2, 3, or 4 with equal probability. With
1 3
4 chance, the next one is a bullet (the position was 4). So if you don’t spin, the chance of survival is 4 . If
you spin the barrel, each position has equal probability of being chosen, and your chance of survival is only
2
3 . So you should not spin the barrel.
]
4.6 Statistics
Suppose that you run OLS regression on some dataset and obtain an R2 value of 0.56. If you were to run
linear regression again on the dataset where you duplicate each point in your original dataset, what would
17
R2 be? If it cannot be determined, enter −1. (JPM)
solution:
Recall that R2 = 1 − SSE
SST . With twice the data that is identical to the original, the new SSE is exactly
twice what it was before, as we have duplicated every data point and the mean is unchanged. For this
same reason, SST also doubles. Therefore, the ratio SSE 2
SST is unchanged, meaning that R is unchanged from
before.
4.7 Finance
What is binomial tree?(JPM)
solution:
We can generalize the no-arbitrage argument just presented by considering a stock whose price is S0 and
an option on the stock (or any derivative dependent on the stock) whose current price is f . We suppose that
the option lasts for time T and that during the life of the option the stock price can either move up from S0
to a new level, S0 u, where u > 1, or down from S0 to a new level, S0 d, where d < 1.
If the stock price moves up to S0 u, we suppose that the payoff from the option is fu ; if the stock price
moves down to S0 d, we suppose the payoff from the option is fd .
As before, we imagine a portfolio consisting of a long position in ∆ shares and a short position in one
option. We calculate the value of ∆ that makes the portfolio riskless. If there is an up movement in the
stock price, the value of the portfolio at the end of the life of the option is
S0 u∆ − fu
S0 u, fu
S0 , f
S0 d, fd
Figure 1: Stock and option prices in a general one-step tree.
If there is a down movement in the stock price, the value becomes
S0 d∆ − fd
The two are equal when
S0 u∆ − fu = S0 d∆ − fd
or
fu − fd
∆= (1)
S0 u − S0 d
In this case, the portfolio is riskless and, for there to be no arbitrage opportunities, it must earn the risk-free
interest rate. Equation (1) shows that ∆ is the ratio of the change in the option price to the change in the
stock price as we move between the nodes at time T .
If we denote the risk-free interest rate by r, the present value of the portfolio is
(S0 u∆ − fu )e−rT
18
The cost of setting up the portfolio is
S0 ∆ − f
It follows that
S0 ∆ − f = (S0 u∆ − fu )e−rT
or
f = S0 ∆(1 − ue−rT ) + fu e−rT
Substituting from equation (13.1) for ∆, we obtain
fu − fd
f = S0 (1 − ue−rT ) + fu e−rT
S0 u − S0 d
or
fu (1 − de−rT ) + fd (ue−rT − 1)
f=
u−d
or
f = e−rT [pfu + (1 − p)fd ]
where
erT − d
p=
u−d
4.8 Finance
A stock is currently priced at 50 USD. In three months, the stock price will either rise to 52 USD or fall to
47 USD, with a volatility of 50%. Assume the stock does not pay dividends, and the interest rate is 0%.
Compute the price of an at-the-money put option. (150 Questions)
Solution:
We first use the risk-neutral binomial model to calculate the option price. In this case, the interest rate
r is zero, so we use the following equation to compute the present value of the put option:
P (0) = pup Pup + pdown Pdown ,
where P (0) is the present value of the option, Pup and Pdown are the option values when the stock price
rises and falls, respectively, and pup and pdown are the risk-neutral probabilities of the stock price going up
or down, respectively.
The risk-neutral probabilities are calculated as follows:
1−d u−1
pup = , pdown = ,
u−d u−d
where u = 52
50 = 1.04 and d =
47
50 = 0.94.
Thus, we have:
1 − 0.94 1.04 − 1
pup = = 0.6, pdown = = 0.4.
1.04 − 0.94 1.04 − 0.94
Now, we calculate the option payoffs. If the stock price goes up to 52 USD, the payoff of the put option
will be:
Pup = max(50 − 52, 0) = 0.
If the stock price falls to 47 USD, the payoff of the put option will be:
Pdown = max(50 − 47, 0) = 3.
Now, we can calculate the present value of the option:
P (0) = 0.6 × 0 + 0.4 × 3 = 1.2.
Therefore, the fair price of the put option is 1.20 USD.
19
4.9 Machine learning
What is Gradient Descent? (JPM)
Solution:
Gradient Descent is an optimization algorithm used in machine learning and deep learning to find the
minimum value of a target function (usually a loss function) by continuously updating the parameters.
The goal is to find a set of parameters that minimize the value of the loss function, thereby improving
the predictive accuracy of the model in problems such as linear regression, logistic regression, and neural
networks.
The basic idea of gradient descent is to use the gradient (i.e., partial derivative) of the target function
to determine the direction for updating the parameters. In each iteration, the parameters are updated in
the opposite direction of the gradient, because the negative gradient points in the direction of the fastest
decrease of the function. The general steps of gradient descent are as follows:
1. Initialize Parameters: Choose an initial value for the model parameters.
2. Compute Gradient: Calculate the gradient (partial derivative) of the target function with respect
to the parameters.
3. Update Parameters: Update the parameters in the direction of the negative gradient according to
the learning rate.
4. Repeat Steps 2 and 3: Repeat until a stopping condition is met (e.g., the gradient approaches zero,
the maximum number of iterations is reached, or the change in the loss function is smaller than a
certain value).
Gradient Descent has multiple variants, such as Batch Gradient Descent, Stochastic Gradient
Descent (SGD), and Mini-Batch Gradient Descent. These variants mainly differ in the amount of
data used to update the parameters in each iteration. Batch Gradient Descent uses the entire training set,
Stochastic Gradient Descent uses a single training sample, and Mini-Batch Gradient Descent uses a small
subset of training samples. Depending on the problem and dataset characteristics, the appropriate variant
of gradient descent can be selected to achieve better optimization results.
4.10 Code
best time to buy and sell stock III, NO.123, Citadel
4.11 Code
best time to buy and sell stock IV, NO.188, Citadel
20