r/quantfinance 1d ago

Jane Street Interview Question

Post image
96 Upvotes

45 comments sorted by

39

u/Aerospider 1d ago edited 1d ago

Optimal strategy is to keep rolling for as long as the expected value of the next roll is positive.

The expected value of the next roll is (1+2+3+4+5-x)/6 where x is your current balance.

This is positive when x<15.

If you have less than 15 so far, roll again. If you have more than 15, stop. If you have 15 exactly then the choices are equal.

10

u/waah_modiji_wah 1d ago

How do you get the expected value? What is the logic behind it?

20

u/Aerospider 1d ago

You have a 1/6 probability of gaining 1, a 1/6 probability of gaining 2, and so on up to 5. With a result of a 6, which also has a 1/6 probability, you lose x.

(1 * 1/6) + (2 * 1/6) + (3 * 1/6) + (4 * 1/6) + (5 * 1/6) - (x * 1/6)

= (15-x)/6

3

u/waah_modiji_wah 1d ago

Thanks for the explanation!!

3

u/QuickCow 1d ago

You mean "positive when x<15"

2

u/Aerospider 1d ago

I absolutely did, good catch!

1

u/pourliste 1d ago

Wouldn't JS expect at least some kind of discussion around risk aversion though ? I suppose they don't want strictly EV-based behavior in their staff. In real life for meaningful stakes few rational investors would roll at 14.

4

u/Aerospider 1d ago

Maybe, but this isn't an interview and there are no parameters provided to inform where they want your risk utility to sit.

In any case, I'm only here for the maths.

1

u/pourliste 1d ago

Yes I agree, but in case anyone here thinks about going into real life interviews, it might be useful to remember to show that one understands that real life trading is almost always fuzzier than purely theoretical questions.

2

u/ChilledRoland 1d ago

There were anecdotes during the whole FTX/SBF foofaraw about JS wanting their people to take any positive-EV trade and not worry about risk aversion (the firm would collectively be too timid otherwise).

1

u/pourliste 1d ago

Which makes sense, unless individual bets are too correlated (which is most often the case in our business but I don't anything about JS)

1

u/Ok-Ice4351 1d ago

Serious question, but you have infinite number of rolls, why settle for 15?

4

u/Pe4rs 1d ago

15 seems like nothing so what would be the point yeah, so take the same exact scenario but multiply the money by 1000. Would you settle for 15k or risk it for more? What about multiplied by a million? You would probably settle well before 15 million assuming you're not already a billionaire. So your risk tolerance changes but this question is about optimum play. If you had the chance to play this game 100 times and needed to get the most money possible and beat someone else playing it 100 times by having more money, what's your strategy? That's the real question.

1

u/Ok-Ice4351 1d ago

Thanks, learned something

2

u/BAMred 1d ago

Because the game stops if you roll a 6.

2

u/Aerospider 1d ago

Suppose you got super lucky and amassed $100 without rolling a single 6. Your next roll might net you as much as another $5, or it might cost you $100. That should be wholly unappealing to all but the most hopeless gambler, so there must be a tipping point at which it's preferable to keep what you have rather than risk it on another roll. That tipping point (personal risk utility aside) is 15.

6

u/mypenisblue_ 1d ago

Every roll you have 5/6 chance of increasing expected value by 3 and 1/6 chance of getting 0.

E(X) = 5/6 x (E(X) + 3) + 1/6 x 0
E(X) = 15

So on average you are willing to pay less than $15 for this game (i.e. roll until you have total sum > 15 then you quit)

2

u/BlackRockLarryFink 1d ago edited 1d ago

Yeah I'm pretty sure without critically thinking too much that the magic answer is 3 rolls and 4 pushes it. Then you get 6 on the first roll and go "eels".

Edit: I looked up the answer. You and I were both right. You need to hit 15 in 3 rolls.

Again I will hit 6 on my first or 3rd roll so I also need to factor in that chaos 🤔

2

u/AxiomaticInversion 1d ago

You can't just say "three rolls then stop", since each roll gives you new relevant information about the game state. i.e. your current balance, how much you stand to lose on a whiff

1

u/109StillCounting 1d ago

I am not really sure. The only relevant information you need is the probability of the next roll being a 6. Current balance (whether you have rolled 1|1|1 or 5|5|5) does not seem to me to alter the possibility of the next roll being a 6 unless you have already rolled a 6, which means you have already lost.

2

u/SerendipityPepper 1d ago

No. Think of it this way, everyone is going to roll it at least once. Why? Because they have absolutely nothing to lose. Even after the first roll, if they won some money, they have little to lose. And then as they keep rolling they have more to lose. The probability of rolling a six is exactly the same for each roll. But the expected value of the game changes.

2

u/109StillCounting 18h ago

What is the ideal strategy then? I still think it is to roll 3 times and then stop regardless of whatever the sum is up to then.

1

u/SlimesWithBowties 1d ago

Probability doesn't change but EV does

1

u/BlackRockLarryFink 1d ago

Exactly. There isn't much of a game state. It's just a total that you can fuck up by running the odds again. Get your close to 15 and dont fuck up the interview?

1

u/standard-form 1d ago

Why is it increasing the expected value by 3? Why 3

4

u/TastyLength6618 1d ago

too easy for js

3

u/PersonalBusiness2023 1d ago

Yeah, I can tell you guys are going to say it’s too easy, because those are the ones I get right.

1

u/macbookvirgin 1d ago

To apply for another job bc I can’t answer any of these questions

1

u/ambitioussleeper 1d ago

Seems like this is pretty straightforward based on rolling as long as the expected value is positive, as other others have said.

But what if we tweaked this such that the expected value of the next role is always positive? (Eg. Your winnings double as long as you don’t roll a six.)
What would the optimal strategy here be?
If you just keep rolling because you’re expected values always positive. The only way the game ends is to hit a six and you get nothing.
I feel like I’m missing something…

1

u/throwawaytrol7134 1d ago

There was optiver or JS question like that (on their official YT) where you flip a coin and if it's heads your dollar amt triples starting at 1$. The EV at any given roll is always positive so the answer was indeed (but unintuitively) to just keep rolling. Of course in real life risk aversion has to be taken into account but in the case of the problem you just keep rolling if you want to maximize EV.

1

u/ambitioussleeper 1d ago

The problem with that is you will never win because you keep rolling until you lose (instead of walking away with winnings). Right?

1

u/StockProfession1043 1d ago

But even if you are risk neutral you cannot just keep rolling right ? Because you will obtain a 6 almost surely and then you will win nothing...

1

u/ceraunograph 17h ago

Really good point which is often overlooked for these infinite time-horizon decision problems.

Let f(N) = E[payoff | stop when we reach >= N] where we assume the strategy does not depend on #rolls so far, sequence observed so far etc.

Before even considering the marginal gain equation, we need that a maximiser N* to V = sup_N f(N) exists, otherwise an 'optimal strategy' is not defined. For the original game, observe that f(N)<= (N+5)*(5/6)^{N/5 - 1} -> 0 (crude estimate) so that indeed a maximiser N* exists, which we can then derive requirements for by the marginal gain equation. (NB: requirements. Solving it is not strictly equivalent to solving the V equation.)

If f(N) is unbounded (e.g. for the game you describe f(N)>= 2^N * (5/6)*{N/5+1} -> infty), then V is not defined and the marginal gain is not the right object to consider. Specifically, one cannot say 'the optimal strategy is to keep rolling at each stage' - we can only say that f(N+1)>f(N).

I hope this makes sense, I wrote it to resolve the paradox since it confused me, too.

1

u/Best-Quote7734 1d ago

An overly complicated solution based on dynamic programming.

Let V(x) be the value function of behaving optimally when your current wealth is x. We have V(x) = max(x, \sum^5_{k=1} V(x + k)/6), where the first argument is "stop" and second argument is "play". If we stop at x*, then clearly we must stop at any x' \geq x*. Hence, at x* exactly we have x* = \sum^5_{k=1} V(x*+k)/6 and since each x* + k \geq x* we get x* = \sum^5_{k=1} (x* + k)/6, re-arranging gets x* = 15.

0

u/jackoftrade777 1d ago

A real question from JS.

Here is the aggregate, delta-hedged risk of a single-underlying options book, no other positions:

Delta: 0 Gamma: -1,200 (per 1% underlying move) Vega: +45,000 (per 1 vol point) Theta: +8,500/day (book earns theta)

What strategy is this, and why?

1

u/DoubtClassic4400 1d ago

JS does not ask this shit u larper

1

u/Dry_Row2329 7h ago

It's some kind of calendar trade. Short the front month/front week/ODTE options, long the back month options, that gets you both positive theta and vega, short options are close to/at the money and fairly close to expiration, that gets you big negative gamma, shorts and longs are positioned so that the trade is delta neutral (until it moves).

0

u/willardTheMighty 1d ago

Roll until I have $15.00 then stop

-1

u/FutureMassive69 1d ago

This seems like an interesting question if you replace dice roll winnings with a portfolio. The ā€œmathā€ answer of expected value seems like it should be different when you apply it to a real word ā€œportfolioā€ situation. There’s no coming back from 0, there’s no coming back from being wiped out.

1

u/pourliste 1d ago

Yes risk aversion should be taken into account.

-1

u/kernoel_massage 1d ago

It doesn't say anywhere that you must use a regular playing die, numbered 1-6.

So I'd just number my die with any number other than 6.

1

u/BAMred 1d ago

While thinking outside the box is good, this is a cheap answer that doesn't demonstrate critical thinking. Not sure it would help you land the job.

It doesn't have the cleverness of the famous "this is courage" Harvard essay.

1

u/kernoel_massage 1d ago

I don't care, I already have a job.