Multi-Media Content Developer job at JPMorgan Chase Bank - LMS Daily

Quant Interview Question - JP Morgan

This is a common interview question asked by investment banks, hedge funds, and trading firms for roles such as quantitative analyst, quantitative researcher, or similar positions.

To answer this question, it is essential to understand fundamental concepts related to random variables, correlation, variance, and covariance. These concepts form the foundation of portfolio risk management and optimization.

Question:

You have one share of stock A and you want to hedge it by shorting stock B. How many shares of B should you short to minimize the variance of hedged position ?  Assume the returns correlation is r

Solution:

Let’s say

Returns of stock A = \(R_a\)
Returns of stock B = \(R_b\)
Correlation between these returns = \(r\)

Variance of Ra is denoted by \(Var(R_a)\)
Variance of Rb is denoted by \(Var(R_b)\)

Let’s say we short h share of stock B to hedge the portolio.

We now have 1 share of stock A (return Ra) and h shorted shares of stock B (return Rb) in our portfolio.

Return of our portfolio is given by: 

\(R = R_a - h*R_b\)

Variance of this return is 
\(Var(R) = Var(R_a - h*R_b)\)

Recall that if we have 2 random variables A and B, then the Variance of A+B is given by,

 

\(Var(A+B) = Var(A)+Var(B) + 2*Cov(A,B)\)

 

where Cov(A,B) is the covariance between A and B

Correlation between (A,B) \(r = Cov(A,B)/(\sigma_a.\sigma_b)\)

Therefore, \(Cov(A,B) = r.\sigma_a. \sigma_b\)

Where \(\sigma_a\) is the standard deviation of A (square root of variance)

Also, for a constant m and random variable X

\(Var(mX) = m^2. Var(X)\)

And, 

\(Cov(mX,X) = m.Cov(X,X)\)

Using these two results in our portfolio variance 

\(Var(R) = Var(R_a - h.R_b)\)

\(= Var(R_a) + h^2.Var(R_b) - 2.Cov(R_a,h.R_b)\)
\(= Var(R_a) + h^2.Var(R_b) - 2.r.\sigma_{Ra}. \sigma_{hR_b}\)
\(= Var(R_a) + h^2. Var(R_b) - 2.r.h.\sigma_{Ra}.\sigma_{Rb}\)
\(= Var(R_a) + h^2.Var(R_b) - 2.r.h.\sqrt{Var(R_a).Var(R_b)}\)

To minimize this, we differentiate with respect to h and equate it to zero

\(\frac{dVar(R_b)}{dh} = 0\)

\(h = r. \frac{ \sqrt{Var(R_a)}} {\sqrt{Var(R_b)}}\)

The optimal number of shares of stock to short in order to minimize the variance of the hedged portfolio is given by the above expression.

This formula ensures that the portfolio's total risk is minimized by offsetting the fluctuations of stock using stock . This concept is widely used in pairs trading, risk hedging, and statistical arbitrage strategies in quantitative finance.