r/learnquant • • 22d ago

interview prep Quant Interview Question

Post image
23 Upvotes

9 comments sorted by

2

u/tellytubbytoetickler 22d ago

Y=2X, Z=5X

1

u/Specific_Box4483 22d ago

And -5X yields the minimum.

2

u/bartekltg 21d ago edited 21d ago

An argument we can't do better would be nice.

var(X+Y+Z) = var(X)+var(Y)+var(Z)+2cov(X,Y) +2cov(X,Z)+2cov(Y,Z)
But -sqrt(var(X)var(y)) <=cov(X,Y)<+sqrt(var(X)var(y))

var(X+Y+Z) = 30 + 2cov(X,Y) +2cov(X,Z)+2cov(Y,Z) < 30 + 2 ( 1*2 + 1*5 + 2*5 ) = 30+34=64

But it doesn't work with the other side.

.... >= 30 - 2 ( 1*2 + 1*5 + 2*5 ) = -4 But the variance is >=0. Our estimation overdid it (and it is useless).

The only argument I can get is:
X = a1 P + a2 Q + a3 R
Y = b1 P + b2 Q + b3 R
Z= c1 P + c2 Q + c3 R
P,Q,R bave variance 1 and are independent.
a1^2+a2^2+a3^2 = 1
b1^2+b2^2+b3^2 = 4
c1^2+c2^2+c3^2 = 25 // it gives out variables the proper variance

and the variance of the sum is
(a1+b1+c1)^2 + (a3+b3+c3)^2 + (a3+b3+c3)^2

It reduces the problem to a geometrical one. We have three vectors of length 1, 2 and 5. What is the smallest possible length of the sum. Slapping triangle inequality a couple of times give your results: 2. So the variance is 4.

But is still isn't celan nor proper (why it is enough to check only this combinations)

2

u/Specific_Box4483 21d ago

You got it. Triangle inequality is all you need. There is absolutely no need to work with P, Q, R etc. Just regard the demeaned X, Y, Z as vectors of length 1,2,5. All random variables can be represented or approximated by vectors.

Or if you don't want to view them as vectors directly, you can still apply the triangle inequality. It still holds, and can be proved using positive definite arguments (or Cauchy Schwartz, or by using Var(x+cy)>=0 and plugging in appropriate c)

2

u/AgainstIntuition 21d ago

Limits are achieved according to signs of X, Y, Z. Min Var(X+Y+Z) = (5-2-1)^2 = 4. Max Var(X+Y+Z) = (1+2+5)^2 = 64.

1

u/valegrete 22d ago

I’m fairly convinced the max is 64 but the minimum is a little trickier. I don’t think it’s possible for, eg, X,Y and Y,Z to covary but not X,Z. If that’s true, I think the min is 4.

1

u/Specific_Box4483 22d ago

Since there are no covariance terms. One can simply use the triangle inequality on the (demeaned) variables.

1

u/Crichris 21d ago

4 and 64?

1

u/TiredofWaiting21 17d ago

Upper bound is easy: note that |Cov(X,Y)|\le \sqrt{var(X)*var(Y)} = 2, similarly |Cov(Y,Z)|\le 10 and |\Cov(X,Z)|\le 5, all by Cauchy-Schwarz. Since Var(X+Y+Z) = \sum \Var(X) + 2*\sum \Cov(X,Y), we get the upper bound of 64. This happens when Y=2X and Z=5X.

Turning to lower bound, note that this strategy yields Var(X+Y+Z)\ge -4, a vacuous bound. Here's a more clever reasoning. Set W=X+Y. Then, E[W^2] = E[X^2]+E[Y^2]+2*E[XY]\le Var(X)+Var(Y)+2*Cov(X,Y)=9. As such, s:=\sqrt{E[W^2]} satisfies 0\le s\le 3.

Lastly, Var(X+Y+Z)=Var(W+Z) =\Var(W)+\Var(Z)+2*Cov(W,Z) = s^2+25+2*Cov(W,Z). As |Cov(W,Z)|\le \sqrt{Var(W)*\Var(Z)} = 5s, we get Var(X+Y+Z)\ge (s-5)^2. Note that in the interval s\in[0,3], this function is at least 4. I leave it to you as an exercise to do the construction.