এই বইটি এখনো বাংলা ভাষায় পাওয়া যায় না। সংস্করণ: English, Français।
Interviews I: Maths, Probability and Speed · ক্যারিয়ার
14Optimal Stopping
Deciding when to stop, by working backwards from the last decision. A threshold is the value of continuing, and most of these questions come down to finding that one number. The later ones ask what information is worth, and when no stopping rule can help at all.
Question 14.1 ★ QR, QT, Trader, Analyst • any • junior
You roll a fair die and are paid its value in dollars, but you may reject the roll and roll again, taking the new value. With one possible re-roll, when should you keep and what is the game worth? And with two possible re-rolls?
Answer
Answer to Question 14.1.
With one re-roll, keep 4, 5 or 6, and the game is worth . With two re-rolls, keep 5 or 6 at first, and the game is worth .
Work backwards. The last roll is worth , so with one re-roll left you keep anything above . The value is then . With two re-rolls left, you compare the roll with , so you keep 5 and 6 only. The value is . With many re-rolls the value climbs towards 6.
Classic wrong answer. Using the same threshold at every stage. The threshold is the value of what you would be giving up, and that value is higher when you have more rolls left.
Question 14.2 ★ QR, QT, Trader • any • junior
You draw a uniform number on and may keep it or reject it for a new draw. What is the game worth with one possible rejection? With two? With three? What is the threshold at each stage?
Answer
Answer to Question 14.2.
The values are , and . At each stage the threshold is the value of the game that you would move to: , then , then .
If the game is worth after a rejection, you keep any draw above . So the new value is
Start from , the value of a last draw that you must keep.
The recursion has its only fixed point at , so with many draws the value tends to the top of the range, as it should.
Classic wrong answer. Giving for one rejection, which is the mean of the larger of two draws. That is what you get with hindsight. Here you have to decide before you see the second draw.
Question 14.3 ★ QR, QT, Trader • any • junior
A bag holds 100 tickets, numbered 1 to 100. You draw one and see it. You may keep it and be paid its number in dollars, or you may draw a second ticket from the remaining 99 and be paid that instead. What should you do, and what is the game worth?
Answer
Answer to Question 14.3.
Keep 51 or higher, and the game is worth about .
If you hold a ticket with number , the second draw is uniform on the other 99, so its mean is . You keep when
The threshold is exactly the plain mean, . Removing a low ticket raises the mean of the rest, removing a high one lowers it, and the two effects balance there.
The value is . The continuous version, with a threshold of , is worth , which is close to this on a scale of 100.
Classic wrong answer. Thinking that you should switch only for tickets far below the middle, because of “the risk of losing what you have”. You are paid a mean, and a risk-neutral player should use the threshold at the mean.
Question 14.4 ★ QR, QT, Trader, Analyst • any • junior
You turn over the cards of a shuffled standard deck, one by one. At any moment you may say “stop”, and you win if the next card is red; if you never speak you are forced to bet on the last card. What rule gives you the best chance of winning?
Answer
Answer to Question 14.4.
No rule does better than , and every rule achieves exactly .
The fraction of red among the remaining cards is a martingale. If of the remaining cards are red, the expected fraction after the next card is
Your win chance when you stop is the current fraction. Optional stopping says that the expected value at any stopping rule is the starting value, .
A shorter proof: given what you have seen, the next card and the very last card are exchangeable. So stopping and betting on the next card has the same chance as betting on the last card of the deck, and that card is red with chance , whatever your rule.
Classic wrong answer. Waiting until more black cards have gone by, because then the deck is richer in red. It does get richer when that happens, but it might never happen, and on average those paths balance. A backward induction shows that every state is exactly indifferent.
Why it matters. This is the simplest example of “no timing rule beats a fair game”. Anyone who shows you a rule that seems to get an edge from timing a fair process has made an error, or they are selecting their sample.
Question 14.5 ★★ QR, QT, Trader, DS • any • junior
You interview candidates in random order. After each interview you can compare the candidate only with those already seen, and you must hire on the spot or reject for good. You win only by hiring the best of all . Find the best rule and the win chance for , then the best rule for , then the limit for large .
Answer
Answer to Question 14.5.
For : reject the first, and then take the first candidate better than all before, for a win chance of . For : reject the first 3, for a win chance of about . For large : reject a fraction , for a win chance tending to .
A good rule rejects the first and then takes the next candidate who beats all before. You win if the best overall is at position , with chance for each , and if the best of the first lies in the first , with chance . So
For and , this is . Taking anyone at a fixed position wins with chance only . For large , with , the sum is about , so you maximise , which peaks at with value .
The threshold form need not be assumed. At position , a candidate who beats all before is the overall best with chance , and that rises with , while the value of going on falls. A backward induction on gives the same answer, for .
Classic wrong answer. Assuming the win chance falls to 0 as grows, because the best is ever harder to find. The win chance tends to a constant, however many candidates there are.
Question 14.6 ★★ QR, QT, Trader, Analyst • any • junior
You may draw uniform numbers on as many times as you like, paying for each draw, the first included, and you keep the last number drawn. When do you stop, how many draws do you make on average, and what is the game worth? What happens as the cost rises and as it falls to 0?
Answer
Answer to Question 14.6.
Stop at the first number above . You make 5 draws on average, and the game is worth . In general the threshold is .
Let be the value of the game before a draw that you must pay for. The future looks the same after any rejection, so a draw is kept when . The value equation is , which says
With , you get . The number of draws is geometric with success chance , so its mean is 5. As a second route: you end up with a number averaging , and you pay , which leaves .
The threshold falls as the cost rises. At the threshold is 0 and the game is worth nothing, because the first draw is worth just its cost. At the threshold is 1, and you go on forever.
Classic wrong answer. Lowering the threshold as the costs pile up. The money already spent is gone, and the future looks the same after every draw, so there is one threshold for the whole game.
Why it matters. Going on is an option with a price. This same equation appears when you decide how long to search for a better price, or when to stop collecting data.
Question 14.7 ★★ QR, QT, Trader • any • junior
You roll a fair 20-sided die for free, and you are paid the number shown. You may re-roll as often as you like, paying $1 for each re-roll, and only the last number counts. When do you stop, and what is the game worth?
Answer
Answer to Question 14.7.
Keep 15 or higher. The game is worth .
Let be the value of the game when you are about to make a free roll. A re-roll therefore gives you , so you keep any number above . A threshold rule “keep at least ” has a kept number averaging , and rolls on average, of which all but the first cost $1. Its value is
This gives at , at , and at . So is best. It agrees with the condition: , so you keep what beats , which is 15 or more. Value iteration on reaches the same value.
Limits: with a free re-roll the value would be 20. With a very high cost you keep the first roll, for a value of .
Classic wrong answer. Comparing the roll with itself, which gives a threshold of 16 and a value of only 15. A re-roll costs $1, so the number to beat is .
Question 14.8 ★★ QR, QT, Analyst, DS • any • junior
You are selling a block of stock. Each day one offer arrives, uniform on , and a rejected offer is gone. Money received a day later is worth times as much. Which offers do you accept, how long does it take on average, and what is the block worth just before the first offer arrives?
Answer
Answer to Question 14.8.
Accept anything at or above . It takes 2 days on average, and the block is worth just before the first offer.
Let be the value before an offer arrives. A rejected offer gives you , with , so you accept when the offer beats . Then
Solving this gives , and the threshold is . Half of the offers are accepted, so the wait is geometric, with mean 2 days. A simulation with this rule gives the same value.
The limits make sense. At you take any offer, which is worth . At you wait for an offer of nearly 1, and the value tends to 1.
Classic wrong answer. Waiting for , the value of the block, a rule worth only about . What you give up by refusing is that value a day later, so the threshold is , not . That the threshold equals the mean offer, , is a coincidence of .
Question 14.9 ★★ QR, QT, Trader • any • junior
You roll a fair die repeatedly and add up the results. You may stop at any time and take the total in dollars, but if you roll a 6, the game ends and you get nothing. When should you stop? About what is the game worth?
Answer
Answer to Question 14.9.
Keep rolling below 15, and stop at 15 or more (you are indifferent at exactly 15). The game is worth about .
Holding a total of , one more roll gives an expected
This beats exactly when . A rule that compares stopping with one more step and then stopping is often called one-step look-ahead. It is optimal here, because once it says “stop”, it continues to do so at every higher total, and totals only go up.
For the value, use backward induction from totals of 15 and up, where the value is the total. For the value is . Working down gives . A simulation of the rule matches.
Note how much the risk of a zero costs. Even if you follow the rule, you fail to reach 15 about 62% of the time, and all of the value comes from the paths that do.
Classic wrong answer. Stopping when the total reaches , or after a set number of rolls. The rule depends on what you hold, because what you risk is the total, whereas the gain is a fixed on average, so the risk and reward come into balance at 15.
Question 14.10 ★★ QR, QT, Trader • any • junior
A fair coin is flipped up to 4 times, and you may stop after any flip, including before the first. You are paid heads minus tails so far, which may be negative. What is the best rule, and what is it worth? How does the answer change if you are paid heads minus tails or nothing, whichever is greater?
Answer
Answer to Question 14.10.
With negative payoffs allowed, every rule is worth 0. With the floor at 0, going to the end is optimal: the game is worth .
Heads minus tails, , is a fair random walk, hence a martingale. For a bounded stopping time, . So all rules are worth the same: stopping when ahead brings gains offset by the losses of the paths that had to run to the end.
With a floor, the payoff is , a convex function of a martingale, hence a submartingale. Its expectation can only rise with time, so waiting until the end is optimal. Then
from with chance , and with chance . For large , this grows like .
Classic wrong answer. Stopping at a gain of 1 on the first flip to lock in a profit, with the floor in place. Stopping pays 1, and going on pays , because the floor protects you from the fall. (Stopping at 2 after two heads happens to cost nothing, since the walk can no longer go below 0.)
Why it matters. This is why it is not optimal to exercise an American call on a stock with no dividends and zero rates early. The call’s payoff is convex in a martingale, so early exercise only gives away the option’s remaining value.
Question 14.11 ★★ QR, QT, Trader, Analyst • hedge fund • junior
A trade costs 40 and pays 100 if a deal closes, which you believe has a 50% chance, and nothing otherwise. A research report will say “yes” or “no”, and it is right 80% of the time whichever way the truth lies. What is the most you would pay for this report? What would you pay for a perfect report?
Answer
Answer to Question 14.11.
The report is worth at most 10. A perfect report is worth at most 20.
Without a report, you trade, with an expected .
With the report, “yes” and “no” are equally likely, by symmetry. After “yes”, the chance of a deal is , so trading is worth . After “no”, the chance is , so trading is worth , and you pass, which gives 0. So the value is , which is 10 above the original.
With a perfect report you trade only when the deal will close, and you make 60. So it is worth , which is 20 more.
The value comes only from changing a decision. A report that is right 60% of the time is worth nothing here: after “no” you would have a chance of , which is worth 0, so it saves you nothing. That is an important check: accuracy above does not mean that information has value.
Classic wrong answer. Paying for the higher expected profit after “yes”, . You do not get “yes” every time, and you must commit to the price before you know what the report says.
Question 14.12 ★★ QR, QT, DS, Trader • any • junior
Coin A has a known heads chance of , and coin B has an unknown heads chance, uniform on . You flip one coin at a time, choosing each time after seeing past results, and you are paid $1 per head. With two flips, which do you flip first, and what is the game worth? Why flip a coin that has the same average chance as the other?
Answer
Answer to Question 14.12.
Flip coin B first, then stay with B after a head and switch to A after a tail. The game is worth , against 1 for coin A twice.
Coin B has the same chance on the first flip, . But it also tells you something. After a head, the chance for B is by Laplace’s rule; after a tail it is , so you go to A. So the value is
The extra is the value of learning. With only one flip left there is nothing to learn from, and both coins are worth . With three flips, the value is , against for coin A, so an edge of . The value of exploring grows with the time left to use what you learn.
Classic wrong answer. Saying you are indifferent because the two coins have the same mean. The unknown coin has the same mean, but it has variance in what you will know next, and you can exploit that.
Why it matters. Given two strategies with equal expected return, allocate the first capital to the one you know less about, as long as you will have time to act on what you learn.
Question 14.13 ★★ QR, QT, Trader • market maker • junior
You draw uniform numbers on and add them up. You may stop at any time and take the total, but if the total goes over 1 you get nothing. When should you stop, and what is the game worth at the start?
Answer
Answer to Question 14.13.
Stop once the total is at least . The game is worth at the start.
With a total of , one more draw and then stopping has an expected payoff of
This beats exactly when , so when . Once you exceed this, the total only goes up, so the rule stays “stop”.
For the value at below the threshold , the value function satisfies , where above . Differentiating gives , so , and . So . A simulation of the rule gives the same, and scanning other thresholds confirms the maximum at .
Classic wrong answer. Stopping once the total is above , by symmetry. There is no symmetry, because going over costs you everything you have, and at that is a lot for a low chance of a modest gain.
Question 14.14 ★★★ QR, QT, Trader • market maker, hedge fund • junior, experienced
A deck is dealt face up, one card after another. Each red card pays you $1, each black card costs you $1, and you may stop at any time. Work out the value of a deck of 2 red and 2 black by hand, and describe the method for a full deck of 26 and 26. About how much is the full deck worth?
Answer
Answer to Question 14.14.
The deck of 2 and 2 is worth , and the full deck is worth about $2.62.
Let be the value with red and black left. Then , and
This is a table, and you fill it in from the small corner. You stop when the second term is not positive.
By hand: . has continuation value . And . So
The whole deck is worth 0 if you never start, and the full deck ends at zero if you do not stop, so all of the value lies in having the option to stop. Note that the deck has a value even though every card is a fair bet. A prophet who stops at the top of the walk would make about 4 on a full deck, and the game gets about two-thirds of that with no foresight.
Classic wrong answer. Saying that the value is 0, by the optional stopping theorem. The running total is not a martingale: when you are ahead, more black cards than red remain, so the next card has a negative expected value. That is exactly when you stop.
Question 14.15 ★★★ QR, QT, Trader • hedge fund • junior, experienced
You drive along a long straight street towards a restaurant. Parking spaces lie one unit apart along the whole street, one of them exactly at the restaurant, and each is free with probability , independently. You see whether a space is free only when you reach it, and you cannot turn back. If you park units from the restaurant, before it or past it, you walk units. Which free spaces do you take, and what is your expected walk? What is the rule for a general chance that a space is free?
Answer
Answer to Question 14.15.
Take the first free space that is at most 6 units before the restaurant, or failing that the first free space at or past it. The expected walk is about . In general, with , take a free space units before the restaurant exactly when .
Use backward induction. Past the restaurant, your walk only grows, so you take the first free space, which is units past on average. Let be the expected walk on arriving units before the restaurant, before seeing that space. Then
If you take every free space from inwards, this solves to . At units, taking costs , and passing costs . So you take the space when , which is . In words: take it when it is at least even money that all spaces from here up to and including the restaurant’s are occupied.
With , we have and , so the limit is 6 units, and . Limits of 5 and 7 units give and .
Classic wrong answer. Taking the first free space within 10 units, because the average gap between free spaces is . This costs . The right test compares a chance with one half, not a distance with the average gap. Refusing everything before the restaurant costs .
Why it matters. Once you would stop at some point, you would also stop at every point closer, so comparing stopping now with stopping at the next chance is enough. Rules of this monotone kind turn up in working an order before a deadline, and they save solving the whole recursion.
Question 14.16 ★★★ QR, QT, DS, Trader • hedge fund • junior, experienced
A coin has an unknown heads chance, uniform on . You will place one bet on the next flip, at even money and for $1, on the side of your choice. Before that, you may see free flips. What is your expected profit for , 1, 2 and 3? What does the second flip add, and what is the limit as grows?
Answer
Answer to Question 14.16.
The profits are 0, , and . The second free flip adds nothing, and the limit is . For odd , the value is , and each even has the same value as the odd number before it.
With heads in flips, the chance of heads next is , by Laplace’s rule. You bet on the likelier side, so your profit is . With a uniform prior, is uniform on . So the value is the average of that absolute value over .
For : chances , and profit .
For : chances , and profits , so the mean is .
For : profits , so the mean is .
Betting on the side of the first flip is still an optimal rule after the second flip. If the two agree, you bet that way anyway, and if they disagree, you are indifferent. So the second flip changes no decision, and it adds no value. The limit is , which is what knowing exactly would be worth.
Classic wrong answer. Assuming that the value of data grows smoothly with . It is flat here between an odd and an even step, because only a change in decision has value. Further data that sharpens your estimate without changing your bet adds nothing to a one-shot bet of fixed size.
Question 14.17 ★★★ QR, QT, Trader • market maker, hedge fund • junior, experienced
Player A draws a uniform number on and may reject it once for a new draw, which must then be kept. Player B sees A’s final number, and then does the same, with one possible rejection. The higher number wins. When should A keep the first draw, and what is A’s chance of winning?
Answer
Answer to Question 14.17.
A should keep a first draw of at least , and A’s chance of winning is about .
Start with B. Given A’s final number , B wins unless both of B’s draws are below , because B redraws exactly when behind. So A wins with chance .
Now, A has a draw . Keeping gives . Redrawing gives a uniform number, and so . So A keeps when . With threshold , the chance that A wins is
which is maximised at , and has value . As a check, and both mean that A has effectively one draw, which gives . A simulation of the game gives the same.
Classic wrong answer. Using as the threshold, which is what maximises the expected number. A is not trying to get a high number on average; A has to survive B’s two tries. The payoff is , not . Convexity favours a riskier choice.
Question 14.18 ★★★ QR, QT, Trader, DS • hedge fund • junior, experienced
There are 30 independent trials in order, each a success with chance . You watch them one at a time, and you may stop once, at a success. You win if that success turns out to be the last of the 30. Which rule is best, and what is the win chance? How is this linked to hiring the best of candidates?
Answer
Answer to Question 14.18.
Stop at the first success in the last 9 trials. The win chance is . Hiring is the same problem with success chance at trial .
Stopping at a success on trial wins if the remaining are all failures. So a success is worth more the later it comes, and the rule is a threshold on the trial number. For a rule that accepts any success in the last trials, you win when exactly one success occurs among them:
Comparing with , the chance rises while . Here , so gives exactly 1, and and tie, at . For it is .
This is the odds algorithm: sum the odds of success from the end backwards, and start accepting when the sum reaches 1. In the hiring problem, “candidate beats all before” is a success with chance , these events are independent, and the last success is the overall best. The odds are . For , summing from the end reaches 1 at , so you reject the first 3, as found by direct calculation. The win chance is at least about when the sum of the odds reaches 1.
Classic wrong answer. Waiting until the expected number of remaining successes is about 1, which is the last 10 trials here. It is nearly right, and it gives the same win chance in this tied case. In general use the odds, not the probabilities, which matters when the chances are not small.
Question 14.19 ★★★★ QR, QT • hedge fund, market maker • experienced
You flip a fair coin as many times as you like, and when you stop you are paid the fraction of flips that were heads. There is no cost and no limit. Show that the game is worth at least . Find what the rule “stop the first time heads lead” is worth in closed form. Would you ever stop with heads level with tails, or even behind?
Answer
Answer to Question 14.19.
The rule “stop at the first lead” is worth exactly . Backward induction with a long horizon gives about for the best rule, so that rule is not optimal. You should never stop when level or behind.
For the lower bound: a head on the first flip pays 1. After a first tail, the fair walk comes back to level with probability 1, so you can always reach a fraction of . This gives at least .
For the first lead: the first lead comes at flip with chance , with the Catalan numbers, and the fraction then is . So the value is
using and the arcsine series.
Never stop when level or behind. From any state you can get back to at least almost surely, because the walk is recurrent, so stopping below loses. At exactly you have a positive chance of getting a lead, and you can still come back, so continuing is strictly better.
The first lead is not always a good moment to stop either. After tail, head, head, you have , but going on is worth about . So the optimal rule demands a bigger lead at some points, and the required lead grows like . The value comes from a backward induction from 5000 flips, using a low and a high guess for the terminal value, and both round to . It is the output of that calculation, not of a formula.
Classic wrong answer. Saying that the game is worth 1 because a fair walk gets ahead by any amount eventually. It gets ahead, but the fraction is what pays, and as the number of flips grows, any given lead is worth less. Being ahead by a fixed amount at a late time has a value close to .
Question 14.20 ★★★★ QR, QT • hedge fund • experienced
Independent non-negative prizes with known distributions are shown in order. You can take a prize when it is shown, or lose it for good. A prophet, who sees all of them in advance, earns . Show that a single fixed threshold lets you earn at least half of this, whatever the distributions, and show by example that you cannot guarantee more than a half.
Answer
Answer to Question 14.20.
Take the threshold , with , and accept the first prize that is at least . That earns at least . An example with one prize of 1 for sure, followed by one of with chance , shows that you cannot do better than a half in general.
Let , the chance that you accept something. Your reward has two parts. Each time you accept you get at least , which gives . On top of that, you get the excess when you accept prize . You reach prize with no acceptance so far with chance at least , and that event depends only on the prizes before , so it is independent of . So
where the sum is above because the largest excess is one of the terms. With , both and equal , and cancels:
For the example, the first prize is 1 for sure. The second prize is with chance , so its mean is 1 too. So anything you do is worth 1. But the prophet takes the second prize when it comes, and otherwise the first, for . The ratio tends to .
Classic wrong answer. Trying for a threshold that depends on all of the distributions in a complicated way. A single number already gets the best guarantee possible over all distributions, and the proof uses nothing about the order in which they arrive.
Why it matters. This gives the true value of hindsight in selection problems. Backtests that pick the best moment after the fact can show up to twice what any real rule can earn, even when the distributions are perfectly known.