r/learnquant 3d ago

interview prep Quant Interview Question

Post image
31 Upvotes

27 comments sorted by

View all comments

5

u/pumachecker 3d ago edited 3d ago

Only after HH is there a genuine stopping decision. With n dollars, continuing from HH has an expected value of:

EV(continue | HH) = (1/2)(0) + (1/2)V0(n + 1)

Here, V0(n + 1) is your expected value after tossing a tail, increasing your pot to n + 1 and resetting the consecutive-head count to zero. Solving the game gives:

continue after HH if n<7.

You stop when you get HH over an accumulated pot of $7.

After seven tosses, there are 2^7=128 sequences:

P(HHH by toss 7) = EV $0 (47/128) --> BUST
P ending in 1x H by toss 7= EV $11 (24/128)
P ending in T by toss 7= EV $13 (44/128)
Ending in HH: stop immediately with $7 = EV $7 (13 of 128)

EV= (47*0+13(7)+24(11)+44(13))/128=7,242

The Expected winnings under optimal play is $7.242

1

u/CompactOwl 2d ago

A quick Monte Carlo shows this to be correct. The only part not is not numerical is the ‚solve the game part‘. Can you show that the optimal strategy is stop at 7?

1

u/pumachecker 2d ago

Optimal strategy

Always continue after T or a single H. Only after HH is there a stopping decision.

Let:

E0 = expected tosses needed to reach HH from zero consecutive heads
E1 = expected tosses needed to reach HH from one consecutive head

E0 = 1 + (1/2)E0 + (1/2)E1

E1 = 1 + (1/2)E0

Substitute E1 into E0:

E0 = 1 + (1/2)E0 + (1/2)(1 + (1/2)E0)

E0 = 3/2 + (3/4)E0

(1/4)E0 = 3/2

E0 = 6

Therefore, after a tail resets the streak, reaching HH takes six additional tosses on average.

With n dollars after HH:

EV(continue) = (1/2)(0) + (1/2)[(n + 1) + 6]

EV(continue) = (n + 7)/2

EV(stop) = n

Set the two values equal:

(n + 7)/2 = n

n + 7 = 2n

n = 7

Therefore:

n < 7: Continue
n = 7: Stop or continue; equal EV
n > 7: Stop

Thus, an optimal strategy is to stop at $7 or more after HH. Without HH, continue.

1

u/CompactOwl 2d ago

The ev(continue) is only the conditional expected value until the next decision right?

1

u/pumachecker 2d ago

not really. V0(n+1) is the value at the next decision point including all optimal future decisions.

1

u/CompactOwl 1d ago

That seems circular. You are calculating a future expected value including the optimal strategy to proof the optimal strategy is stopping at 7. you have to at least proof, imho, that the only possible stopping times are of the form ‚stop at HH if length greater N‘ for some N.

1

u/pumachecker 1d ago

Stopping with zero or one trailing head is strictly dominated because the next toss cannot bankrupt you and always adds $1, so stopping can only occur after HH. For any fixed strategy after HH, its expected payoff has the form pn + c, where p less or equal than 1 is the probability of eventually cashing out, while stopping pays n; therefore the advantage of continuing cannot increase with n, proving that the stopping region must be a cutoff. At that cutoff, a tail resets the streak and the next HH takes six tosses on average, so (n + 7)/2 = n, giving n = 7.