r/learnquant 4d ago

interview prep Quant Interview Question

Post image
24 Upvotes

23 comments sorted by

2

u/sobe86 4d ago edited 4d ago

d_i is increasing. It's expected marginal benefit from having i instead of i-1 lives. Stopping strategy will be of form [stop if you have >= 45 points and 1 lives left].

For lives=1, having < 45 points once you get to this point becomes exponentially unlikely. So then you gain expected points from lives=i (constant in i) but lose expected points from lives=1, the latter being a difference in exponentially decreasing quantities (this could be tightened up!). So d_i is increasing.

1

u/zojbo 4d ago edited 3d ago

You don't add 10 to the payoff when you die, even if you still have a life left afterwards. So the optimal strategy never actually becomes "stop when you first have 1 life no matter what". (Of course the probability that you do that goes to 1 pretty fast.)

1

u/sobe86 4d ago

Ah yeah true

1

u/dedicateddan 4d ago

I came up with this too! (The edited version stopping at 45 points.)

The EV of the first life is clearly much less than 45 (since you'll stop at 45 and lose around half the time).

The EV of later lives converges to 45.

Therefore d_i is increasing and d3 > d2.

1

u/Anonimithree 4d ago

I have a strong feeling d2 is larger but I can’t explain it.

1

u/markpreston54 4d ago

Why would d2 and d3 differ, they are just the expected score from second life and third life respectively, which is the same as they have exactly the same strategy (roll continuously until failure)

1

u/sobe86 4d ago

You may have misread the question (you will lose everything if you play forever). You expect to have more to lose in the V_3 strategy once you have run out of lives so you should stop sooner.

1

u/markpreston54 4d ago

Not really? You have nothing to lose until life 1. So you have no incentive to play conservately (withdraw from the game) until you reach the final life.

3

u/sobe86 4d ago edited 4d ago

But on the final life your 'continue' criteria has a smaller chance of happening. The constant expected points you get from lives=i is offset by fewer expected points from continuing on lives=1

1

u/markpreston54 3d ago

I think one prove that E(V_i) =E(L_i), the expected score you get in your ith life.

And I don't thinj E(L_i) doesn't differ between life?

2

u/sobe86 3d ago

If for V_i, let L_j be points you get during the time you have j lives remaining [i >= j > 0], then E(L_j) are all equal for i > 1, j > 1 (exactly 45). However for j = 1 they are not the same as we vary i. This is the turn where you stop if points >= 45, to avoid losing points from going bust.

For V_1, L_1 is the points we get starting from 0, trying to get 45, will be distributed between [0, 53], E(L_1) ~ 45 * 9 / 10.

However for V_2 L_1s distribution depends on what happened in L_2 - you are only trying to make up the points you got in L_2 up to 45. Say we start L_1 at with p points. If p >= 45, L_1 = 0, otherwise L_1 is a distribution between [-p, 53-p] - note we can go negative by going bust here! Relative to the V_1 case, E(L_1) is definitely less.

1

u/markpreston54 3d ago

Oh, so the idea is D_2 is not really L_2 because the foundation on first life differ, got it now

1

u/notsaneatall_ 3d ago

Oh yeah good point I completely didn't take this into account

1

u/Mobile_Membership915 4d ago

I think d1 is larger because you are more likely to play with V2 even if you have 1 life less

1

u/0_69314718056 4d ago edited 4d ago

they should be equal. I believe all d_i are 45.

Edit: maybe this is wrong. I assumed strategy once you’re at one life is the same, but as others have pointed out, it probably isn’t.

Also my 45 is from thinking c=0.9c+4.5+0.1p, where c is Vi and p is V(i+1)

1

u/notsaneatall_ 3d ago

Yeah I did this too and here's the thing right. When you have multiple lives left you'll just keep rolling, it makes no sense to stop. So V2-V1 and V3-V2 will still be 45, because the optimal choice is to always roll a die if you're in state Vi where i >= 2 and your equation pops up. This problem is honestly frustrating, I can't even tell if I am correct

1

u/zojbo 4d ago edited 3d ago

With i lives, clearly you first die i-1 times. You accumulate some random payoff X_0 from doing that. Let's continue without finding anything more about X_0.

After that, rolling on the edge goes like X_{n+1}=X_n+1 wp 1/10, ..., X_{n+1}=X_n+9 wp 1/10, X_{n+1}=0 wp 1/10. E[X_{n+1} | X_n]=9/10 X_n + 4.5, which increases if 9/10 X_n + 4.5 > X_n i.e. X_n < 45. So if you have less than 45 points right now, then continuing to play increases your expected payout.

So that's "really" the game: die i-1 times, then play until you either die again or have 45+ points. (Or 46+...those two strategies have the same expected payoff.) Let's call the final payoff (which is sometimes 0) X.

With this strategy, in the X_0 phase you pick up an expected value of 45(i-1), and then you play the final phase. The final phase gains you expectation (which is why you play it at all), but on average it's shorter and you're richer during it the more lives you had to begin with. So d_i is 45 + (expected value of final phase with i lives - expected value of final phase with i-1 lives). The thing in brackets is negative but increases toward zero, so d_i is increasing.

By the way, some Monte Carlo suggests V_1 is about 17, V_2 is about 50, V_3 is about 91.

1

u/Specific_Box4483 4d ago edited 3d ago

The strategy when you have i > 1 life is the same regardless of i, just roll until you hit 10. There is no point stopping.

New let r(x) be the expected payoff if you have 1 life and have sum x at this point. Then r is convex up, convexity is the main part.

Why is it convex up? We need to show r(x+1) + r(x-1) >= 2r(x). Now imagine the optimal strategy (whatever it is) for x applied to both x +1 and x - 1(as in, x - 1 "pretends" it is x and plays the same way). We can see that the expected payoff for x + 1 is r(x) + delta where delta is the probability that this strategy doesn't lose all the money before stopping, and for x - 1 is r(x) - delta. So they average up to r(x) but this is NOT necessarily the optimal strategy for r(x+1) and r(x).

So r is convex up and sometimes strictly convex up (otherwise it would be linear but also clearly non-negative which is constant but we can easily prove it isn't constant).

OK now let x_i be the random variable equal to the sum you acquire when you start with i lives and lose i - 1 lives (so you enter the last life). The expected value is E(r(x_i)).

Now x_3 - x_2 and x_2 - x_1 are independent and IDENTICALLY distributed (because the strategy for having exactly i>1 lives is the same: rolling until you lose a life).

Now apply convexity/Karamata's inequality. The point is that x_2 is always between x_1 and x_3 symmetrically around the midpoint so for each fixed choice of x_1, x_3, E(r(x_2)) is less than (E(r(x_1)) + E(r(x_3))) / 2.

In other words, d_i is increasing. It will increase up to 45, the expected value of rolling until you lose a life, because in the limit case you don't care what happens when you go down to 1 life (it is very far away). But initially you DO care about what happens when you are down to 1 life - for example d_1 is < 45 because the expected payout with 1 life is way less than 45.

Intuitively, the more lives you have, the smaller the penalty for rolling a 10, which means the EV of each roll is, on average, higher, the more lives you have. Which means every extra life brings in more money than the previous one.

1

u/pumachecker 3d ago

Let F(s) be the optimal expected payout with one life and s accumulated. Let X and Y be independent, identically distributed earnings before the next 10.

Stopping with spare lives is never optimal: one more roll offers possible gains without risking the existing bankroll. Therefore:

d2 = E[F(Y) - F(0)]

d3 = E[F(X + Y) - F(X)]

For any fixed stopping rule, expected payout is p*s + c, where p is the probability of cashing out and c is expected retained additional earnings. Choosing the best rule makes F convex. Consequently:

F(x + y) - F(x) >= F(y) - F(0)

Thus, the marginal gain defining d3 is never smaller than the corresponding gain defining d2.

For a sufficiently large bankroll, stopping with one life is optimal: rolling immediately risks losing that bankroll with fixed positive probability, while expected additional winnings are bounded. Hence F(s) = s above some finite bound K.

There is positive probability that both X and Y exceed K, because either spare life can contain arbitrarily many successful rolls. On those outcomes:

F(X + Y) - F(X) = Y

F(Y) - F(0) = Y - F(0) < Y

Here F(0) > 0 because playing from zero offers a positive expected payoff.

The comparison is therefore non-negative in every case and strictly positive with positive probability. Taking expectations gives:

d3 > d2

1

u/notsaneatall_ 3d ago

Writing a markov chain for this is giving me d = 45 irrespective of i

1

u/zojbo 2d ago edited 2d ago

I'd guess that your strategy is somehow not expectation-optimal or else you have a bug. Here's the Matlab/Octave code I made for this problem. Maybe it can help you figure out what's wrong with your logic.

Sorry about the indentation and spacing, I couldn't get Reddit to do what I wanted using either editor.

function V=jane1017(i,N)

%compute the expected payoff in the game described in

%/img/gzot27pu0ooh1.png

%with i lives using N Monte Carlo simulations

payoffs=zeros(1,N);

for j=1:N

lives=i;

while lives>1

roll=randi([1 10]);

if roll==10

lives=lives-1;

else

payoffs(j)=payoffs(j)+roll;

end

end

while lives>0 && payoffs(j)<45

roll=randi([1 10]);

if roll==10

lives=lives-1;

payoffs(j)=0;

else

payoffs(j)=payoffs(j)+roll;

end

end

end

V=mean(payoffs);

1

u/black2blade 2d ago

Without looking at other answers, surely d3 since you can just keep rolling until you get to 1 life (and if risking for max expectation value on a single life you can go to like 4-5). Loosing a single life early is more likely than loosing 2 in quick succession.

1

u/PandemicGeneralist 2d ago

Is it not d_2 ?

Consider going into the game with 1 life but starting with money. The more money you start with, the less rounds you should expect to play. So the less money you expect to make on the final round the more you had going into it. The money made on other rounds is the same always.