量化金融 · 第 18 册 · 职业发展

Interviews I: Maths, Probability and Speed

本书暂未推出简体中文版。现有版本:English, Français。

Interviews I: Maths, Probability and Speed · 职业发展

11Random Walks and Martingales

Hitting probabilities, durations and extremes of walks, usually without solving any recursion: find what stays fair, stop it, and read off the answer. The later questions ask you to invent the martingale yourself, or to say why optional stopping fails.

Question 11.1 ★ QR, QT, Trader, Risk • any • junior

You stand at position 3 on a line numbered 0 to 10. Each step moves you one place left or right with equal probability, and you stop on reaching 0 or 10. What is the probability that you end at 10, and how many steps do you take on average?

Answer

Answer to Question 11.1.

You end at 10 with probability 0.30.3, and you take 21 steps on average.

Use optional stopping. Your position is a martingale, a process whose expected next value is its current value, so its expected value at the end equals where you started: 10p=310p = 3, so p=0.3p = 0.3.

For the time, St2−tS_t^2 - t is also a martingale, because one step adds 1 to the square on average. At the end, E[ST2]−E[T]=32E[S_T^2] - E[T] = 3^2, and E[ST2]=0.3⋅100=30E[S_T^2] = 0.3 \cdot 100 = 30. So E[T]=30−9=21E[T] = 30 - 9 = 21, which is the general k(n−k)k(n - k).

Classic wrong answer. Solving nine linear equations, which is correct but slow. Using the two martingales saves that work, and they extend to harder questions.

Question 11.2 ★ QR, QT, Trader, Risk • any • junior

You bet $1 at a time at even money and win each bet with probability 0.60.6. You start with $5 and stop on reaching $10 or $0. What is the probability that you reach $10, and how many bets does it take on average?

Answer

Answer to Question 11.2.

You reach $10 with probability about 0.8840.884, and it takes about 19.219.2 bets on average.

With an uneven coin, rStr^{S_t} is a martingale, where r=q/p=2/3r = q/p = 2/3: over one step, pr+q/r=q+p=1p r + q/r = q + p = 1. Starting at 5, and with PP the chance of reaching 10, optional stopping gives

r5=Pr10+(1−P)soP=1−r51−r10=11+r5≈0.8836.r^5 = P r^{10} + (1 - P) \quad\text{so}\quad P = \frac{1 - r^5}{1 - r^{10}} = \frac{1}{1 + r^5} \approx 0.8836.

For the time, use Wald’s identity. Your average gain per bet is 0.20.2, and your average final gain is 10P−5≈3.8410P - 5 \approx 3.84, so the number of bets is 3.84/0.2≈19.23.84/0.2 \approx 19.2.

Classic wrong answer. Assuming that the 60% win rate means a 60% chance of doubling. The edge compounds over many bets, so the chance is much higher.

Why it matters. A small edge gets close to certainty once the target is many bets away. This is what makes position sizing, and not forecasting alone, decide risk.

Question 11.3 ★ QT, Trader, Analyst, Risk • any • junior

You play a fair game, betting $1 each time at even money, and you stop as soon as you are up $1 or down $9. How often do you win the $1? What is your average profit, and how many bets does a session take on average?

Answer

Answer to Question 11.3.

You win the $1 in 90% of sessions. The average profit is 0, and a session takes 9 bets on average.

A fair game stays fair when stopped, as long as the stopping is bounded like this. So 0=P⋅1+(1−P)(−9)0 = P \cdot 1 + (1 - P)(-9), which gives P=0.9P = 0.9. With a=1a = 1 and b=9b = 9 the general result for the time is ab=9ab = 9.

Classic wrong answer. Thinking that a 90% win rate shows a good strategy. The rare loss is exactly large enough to cancel all the wins. A high hit rate says nothing about whether a game is fair, or about what it is worth.

Why it matters. Selling insurance looks like this: many small wins, one large loss. A track record with a 90% hit rate may be nothing but the walk between two stops.

Question 11.4 ★ QR, QT, Trader • any • junior

A walk starts at 0 and moves +1+1 or −1-1 with equal probability at each step. What is the probability that it is back at 0 after 10 steps? How far from 0 is it after 100 steps, on average? Give an exact formula and the quick approximation.

Answer

Answer to Question 11.4.

Back at 0 after 10 steps has probability 252/1024≈0.246252/1024 \approx 0.246. After 100 steps, the average distance is about 7.967.96, and 2N/π\sqrt{2N/\pi}, with N=100N = 100 steps, gives 7.987.98.

To be at 0 after 2n2n steps, exactly nn of them must go up, so u2n=(2nn)/4nu_{2n} = \binom{2n}{n}/4^n.

For the distance, there is an exact formula: E∣S2n∣=2n u2nE|S_{2n}| = 2n\,u_{2n}, here 100⋅0.0796100 \cdot 0.0796. The approximation comes from a normal with variance NN, whose mean absolute value is σ2/π\sigma\sqrt{2/\pi}.

Classic wrong answer. Answering 10, the standard deviation. The average distance is smaller, by a factor of 2/π≈0.8\sqrt{2/\pi} \approx 0.8.

Question 11.5 ★★ QR, QT, Trader, Risk • any • junior

A walk moves +1+1 with probability 0.60.6 and −1-1 with probability 0.40.4 at each step. On average, how long does it take to go from 0 to +10+10 for the first time? What identity gives you this without any equations?

Answer

Answer to Question 11.5.

It takes 50 steps on average.

Use Wald’s identity: if a walk with independent steps of mean μ\mu stops at a stopping time TT with finite mean, then E[ST]=μE[T]E[S_T] = \mu E[T]. Here each step has mean 0.20.2, and the walk stops exactly at +10+10, because it moves one place at a time. So E[T]=10/0.2=50E[T] = 10/0.2 = 50.

A second route checks the identity. Let xx be the mean time to go up one level. The first step goes up with 0.60.6. Otherwise you must climb two levels: x=1+0.4⋅2xx = 1 + 0.4 \cdot 2x, so x=5x = 5, and ten levels take 50.

Classic wrong answer. Using 10/0.610/0.6, by counting only the up steps. The down steps have to be recovered, and it is the net drift that sets the rate.

Follow-up. And as the drift goes to zero? The time grows as 10/μ10/\mu without limit: at zero drift it is infinite, even though the walk still reaches +10+10 with certainty.

Question 11.6 ★★ QR, QT, Risk • any • junior

A walk moves +1+1 with probability 0.40.4 and −1-1 with probability 0.60.6 at each step, forever. What is the probability that it ever reaches +10+10? What is the average of the highest point it ever reaches?

Answer

Answer to Question 11.6.

It reaches +10+10 with probability (2/3)10≈0.0173(2/3)^{10} \approx 0.0173, and its highest point averages 2.

Let xx be the chance of ever going up one level. Using first-step analysis, you go up at once, or go down and must rise two levels: x=0.4+0.6x2x = 0.4 + 0.6 x^2. The roots are 2/32/3 and 1. The walk drifts downward, so it is not certain to rise, and the small root is right. To reach +10+10, you have to rise one level ten times in a row, and each level is a new, independent problem, so the chance is x10x^{10}.

So the highest point MM has P(M≥k)=(2/3)kP(M \ge k) = (2/3)^k, a geometric distribution, and

E[M]=∑k≥1(2/3)k=2/31−2/3=2.E[M] = \sum_{k \ge 1} (2/3)^k = \frac{2/3}{1 - 2/3} = 2.

Classic wrong answer. Taking the root x=1x = 1 because the equation allows it. With a negative drift, the walk heads off to minus infinity, so a limit on the maximum must exist.

Why it matters. This gives the distribution of the deepest loss below your starting capital for a positive-edge strategy on a fixed bet: look at it from the other side, and it is the highest point of a negative walk. It is not the maximum drawdown, which measures from each new peak and keeps growing the longer you trade.

Question 11.7 ★★ QT, Trader, Risk, Analyst • any • junior

You have $1 023 and play a fair even-money game by doubling: bet $1, and after each loss double the bet, stopping as soon as you win or cannot make the next bet. What is the probability you end up $1 ahead? What is your expected profit? If a win ends the session, how many bets do you make on average?

Answer

Answer to Question 11.7.

You end $1 ahead with probability 1−2−10≈0.9991 - 2^{-10} \approx 0.999. The expected profit is 0, and a session has about 1.9981.998 bets on average.

The bets 1,2,4,…,5121, 2, 4, \dots, 512 add up to $1 023, so you can make 10 bets. You lose them all with probability 2−102^{-10}, and then you lose all $1 023. Otherwise you win $1, because any win covers all the earlier losses plus one. So E[profit]=(1−2−10)−2−10⋅1023=0E[\text{profit}] = (1 - 2^{-10}) - 2^{-10} \cdot 1023 = 0.

The number of bets is capped at 10, and adding up P(bet k happens)=2−(k−1)P(\text{bet } k \text{ happens}) = 2^{-(k - 1)} gives 2−2−92 - 2^{-9}.

Classic wrong answer. “Nearly always a profit, so this must be good.” By optional stopping, no stopping rule makes a fair game profitable when capital is finite. The tiny loss chance carries a loss of a thousand times the win.

Follow-up. And with unlimited capital? You always win $1, in about 2 bets, but the capital you may need has an infinite mean. The system needs what no one has.

Question 11.8 ★★ QR, QT, Risk • hedge fund, market maker • junior

A fair walk starts at 0 and stops the first time it reaches +1+1. It reaches +1+1 with probability one, so its final value is always 1, yet it is a fair game that started at 0. Why does this not contradict the claim that a fair game cannot be beaten by stopping? What is the median stopping time, and how does the mean behave?

Answer

Answer to Question 11.8.

It does not contradict the claim, because the theorem needs conditions that fail here: the stopping time has infinite mean, and the walk is unbounded below. The median stopping time is 1, while the mean is infinite.

Optional stopping holds for a bounded time, or for a bounded martingale. Here neither holds. At any fixed horizon the game is fair: in the paths that have not stopped, the average position is well below 0, and this balances the paths that stopped at +1+1.

The time TT is 1 with probability 1/21/2, which fixes the median. By reflection, P(T>2n)=u2n=(2nn)/4n≈1/πnP(T > 2n) = u_{2n} = \binom{2n}{n}/4^n \approx 1/\sqrt{\pi n}. For example, P(T≤100)≈0.92P(T \le 100) \approx 0.92. The tail falls too slowly for the sum ∑nP(T>n)\sum_n P(T > n) to converge, so E[T]=∞E[T] = \infty. You would have to survive arbitrarily large losses in the meantime.

Classic wrong answer. Concluding that the walk cannot be certain to reach +1+1, because the game is fair. It is certain to reach it, and fairness at every fixed time does not prevent that.

Why it matters. A strategy that holds losers until they recover is this walk. It shows a profit every time it stops, and the cost is hidden in the unbounded time and the unbounded loss you have to carry.

Question 11.9 ★★ QR, QT, QD • any • junior

A walk on the numbers 0 to 10 moves left or right with equal probability, except that at 0 it always moves to 1. On average, how many steps does it take to go from 0 to 10 for the first time? From 4 to 10? Find a process that stays fair and gives this at once.

Answer

Answer to Question 11.9.

From 0 to 10 takes 100 steps on average, and from 4 to 10 takes 84.

Use St2−tS_t^2 - t. On the interior, one step adds 1 to S2S^2 on average, so this stays fair. At 0, the forced step takes S2S^2 from 0 to 1, which also adds exactly 1, so the same process stays fair at the reflecting point. Stopping at 10 gives E[ST2]−E[T]=k2E[S_T^2] - E[T] = k^2, and so E[T]=100−k2E[T] = 100 - k^2.

For k=0k = 0 that is 100, and for k=4k = 4 it is 84.

Classic wrong answer. Using 24 steps from 4, the k(n−k)k(n - k) of a walk with an exit at 0. That walk would stop at 0, while this one bounces back and carries on.

Follow-up. In general? Reaching a level nn from a reflecting wall takes n2n^2 steps. Time grows as the square of the distance, the signature of a diffusion.

Question 11.10 ★★ QR, QT, Trader • any • junior

At each step a walk moves +1+1 with probability 0.50.5, −1-1 with probability 0.30.3, and stays where it is with probability 0.20.2. From 0, what is the probability that it reaches +5+5 before −5-5? How long does that take on average?

Answer

Answer to Question 11.10.

The probability is about 0.9280.928, and it takes about 21.421.4 steps on average.

The steps at which the walk stays put change nothing about where it goes next, so ignore them. The moving steps go up with probability 0.5/0.8=5/80.5/0.8 = 5/8. So r=3/5r = 3/5, and the exit formula gives

P=11+r5=11+0.65≈0.9279.P = \frac{1}{1 + r^5} = \frac{1}{1 + 0.6^5} \approx 0.9279.

The time does change. By Wald’s identity, the final position averages 5P−5(1−P)≈4.2795P - 5(1 - P) \approx 4.279. The mean step, including the zero, is 0.5−0.3=0.20.5 - 0.3 = 0.2. So the time is 4.279/0.2≈21.44.279/0.2 \approx 21.4.

Classic wrong answer. Leaving the stay-put steps out of the duration, or letting them change the exit probability. They are irrelevant for where you exit, but not for how long you take.

Why it matters. Quote-update data often has many unchanged steps. Filtering those out changes the clock but not the direction, and it is cleaner to separate these two effects.

Question 11.11 ★★ QT, Trader, Risk, QR • market maker, hedge fund, crypto • junior

A price moves one tick up with probability 0.550.55 or one tick down with probability 0.450.45, independently. You buy, with a profit target 20 ticks up and a stop 10 ticks down. What is the probability that the target is hit first, and how many ticks does the trade take on average? What is your expected profit in ticks? With a fair walk, what would it be?

Answer

Answer to Question 11.11.

The target is hit first with probability about 0.8680.868, the trade lasts about 160 ticks, and it earns about 16.0316.03 ticks on average. A fair walk would give a chance of 1/31/3 and an expected profit of 0.

With r=0.45/0.55=9/11r = 0.45/0.55 = 9/11, the exit formula from 10 ticks above the stop and with 30 between stop and target is

P=1−r101−r30≈0.8677.P = \frac{1 - r^{10}}{1 - r^{30}} \approx 0.8677.

The expected profit is 20P−10(1−P)=30P−10≈16.0320P - 10(1 - P) = 30P - 10 \approx 16.03 ticks. Each tick earns 0.10.1 on average, so Wald’s identity gives 16.03/0.1≈16016.03/0.1 \approx 160 ticks.

With a fair walk, P=10/30=1/3P = 10/30 = 1/3, and the profit is zero whichever stop and target you choose. Stops and targets change the shape of the outcome, not its mean. A trader’s edge comes from the tick probabilities, and these exits only harvest it.

Classic wrong answer. “A target twice the stop, so I need only a third of the trades to win.” That is a statement about break-even, not an edge. It can be true of a fair walk, and it earns nothing.

Follow-up. How long does a fair walk take? From the martingale St2−tS_t^2 - t, the fair-walk time is the product of the distances to the two exits: 10⋅20=20010 \cdot 20 = 200 ticks on average. Longer than with the drift, because you get no help moving towards the target.

Question 11.12 ★★ QT, Trader, Risk, Analyst • hedge fund, market maker, bank • junior

You have $100 and an even-money bet that you win with probability 0.550.55, repeated as often as you like. You always bet the same dollar amount. What is the probability of ever going broke if you bet $1 each time? $10? $50?

Answer

Answer to Question 11.12.

About 1.9×10−91.9 \times 10^{-9} for $1 bets, 0.1340.134 for $10, and 0.6690.669 for $50.

Scale the walk. With stakes of ss, your capital is 100/s100/s bets, and the chance of ever losing them is r100/sr^{100/s}, with r=q/p=0.45/0.55=9/11r = q/p = 0.45/0.55 = 9/11: it is the chance of a walk with a positive drift ever falling that many levels. So you need r100r^{100}, r10r^{10} and r2r^2.

Note what does not change: each bet has the same edge in percent. Expected profit per dollar bet is the same, but ruin rises from impossible to likely as the stake grows, because your capital measured in bets is what protects you.

Classic wrong answer. Thinking of ruin as depending on the edge alone. With an edge you still go broke if your stake is too large, and a fair coin goes broke for certain at any stake.

Why it matters. Risk of ruin decays exponentially in capital measured in bets. Hence stake size matters more than almost anything else for survival: doubling the bet replaces the chance of ruin by its square root, which is far larger.

Question 11.13 ★★ QR, QT, Trader • any • junior

A fair walk starts at 0. What is the probability that it stays strictly above 0 for the first 20 steps? What is the probability that it first returns to 0 exactly at step 2? At step 4? At step 6?

Answer

Answer to Question 11.13.

It stays strictly above 0 for 20 steps with probability 12u20≈0.0881\tfrac12 u_{20} \approx 0.0881. It first returns at step 2, 4 and 6 with probability 1/21/2, 1/81/8 and 1/161/16.

Here u2n=(2nn)/4nu_{2n} = \binom{2n}{n}/4^n is the chance of being at 0 at time 2n2n. By the ballot theorem, the paths that stay positive for 2n2n steps number exactly half of those ending at 0, and that gives 12u2n\tfrac12 u_{2n}. So u20≈0.176u_{20} \approx 0.176 is the chance of no return at all in 20 steps, in either direction.

For the first return, the same ideas give f2n=u2n/(2n−1)f_{2n} = u_{2n}/(2n - 1). So f2=1/2f_2 = 1/2, f4=(3/8)/3=1/8f_4 = (3/8)/3 = 1/8 and f6=(5/16)/5=1/16f_6 = (5/16)/5 = 1/16. Listing all the paths confirms this. The walk returns with certainty, but the mean of the time is infinite.

Classic wrong answer. Using 2−202^{-20}, which treats “stays above 0” as needing every step to go up. Most paths that stay above 0 go up and down a lot.

Why it matters. A fair process can stay on one side for a long time with quite a high probability. A run of good P&L that lasts 20 periods is only about 1 in 11.

Question 11.14 ★★ QR, QT, Trader, Analyst • hedge fund, market maker • junior

You believe an event has probability 1/31/3. Each day brings news that either doubles or halves your odds for the event, and your belief is always the correct conditional probability. What is the probability that your belief ever reaches 8/98/9? Why do you need neither the news’s reliability nor the number of days?

Answer

Answer to Question 11.14.

The probability is (1/3)/(8/9)=3/8(1/3)/(8/9) = 3/8. The answer relies only on the fact that a correct belief is a martingale.

If your belief is the correct conditional probability, then its expected next value is its current value: otherwise you would already believe something else. So stop the first time it reaches 8/98/9. The odds move in factors of 2, so it lands exactly on 8/98/9. If it never gets there, it heads to 0 in the end, because it converges to the truth. Optional stopping gives

13=P⋅89+(1−P)⋅0,soP=38.\tfrac13 = P \cdot \tfrac89 + (1 - P) \cdot 0, \quad\text{so}\quad P = \tfrac38.

Neither the news’s reliability nor the number of days appears, because a correct belief moves so that this holds in any case. Odds running from 1:21 : 2 up to 8:18 : 1 make it a clean walk, and a simulation with a true state drawn from the prior gives the same result.

Classic wrong answer. Giving 8/98/9, or thinking that because the event is unlikely, the belief cannot rise. A belief at 1/31/3 will often rise and then fall back, because an event at 1/31/3 fails two times in three.

Why it matters. A price of a binary contract is such a belief. At 30 cents, it can touch 90 at most a third of the time, whatever happens.

Question 11.15 ★★ QR, QT, Trader • hedge fund, market maker • junior

Two tokens sit on a ring of 12 positions, 4 places apart. At each step both tokens move at the same time, each independently one place clockwise or anticlockwise with equal probability. On average, how many steps until they are on the same position?

Answer

Answer to Question 11.15.

On average they take 16 steps.

Track only their separation. It starts at 4 on a ring of 12. At each step, each token moves ±1\pm 1, so the separation changes by −2-2 with probability 1/41/4, +2+2 with probability 1/41/4, and 0 with probability 1/21/2. Since separations stay even, measure in units of 2: the separation lives on a ring of 6 positions, starts 2 from the meeting point, and is a walk that stays put half of the time.

A walk on a ring from distance 2 of 6 is the same as a gambler’s ruin on a line from 2 between 0 and 6, so it takes 2⋅4=82 \cdot 4 = 8 moves. Half of the time nothing moves, so that doubles to 16 steps.

Classic wrong answer. Using 4⋅8=324 \cdot 8 = 32, by treating the separation as one simple walk on 12 positions. The two tokens move together, which makes the separation move two places at a time, and half the time not at all.

Follow-up. What if they begin 3 apart? They never meet, because the parity of the separation never changes when both move.

Question 11.16 ★★★ QR, QT, Risk • hedge fund, market maker • junior, experienced

A fair walk runs for 20 steps. At which time is its last visit to 0 most likely, and what are the probabilities that it is at time 0, time 10 and time 20? In the long-run limit, what is the probability that the last visit falls in the first quarter of the run?

Answer

Answer to Question 11.16.

The last visit to 0 is most likely at the very start or the very end: at time 0 and at time 20, each with probability about 0.1760.176, and time 10 is the least likely, at about 0.0610.061. In the limit, the last visit falls in the first quarter with probability 1/31/3.

The chance that the last visit is at time 2k2k is the chance of being at 0 then, times the chance of no return during the remaining time, and the second is also a uu value: P=u2k u2n−2kP = u_{2k}\, u_{2n - 2k}. So the distribution is symmetric, and it has large values at both ends, because uu falls with time. For n=10n = 10: u20≈0.176u_{20} \approx 0.176, at both ends, and u102≈0.061u_{10}^2 \approx 0.061 in the middle.

In the limit this becomes the arcsine law: the fraction xx of the run at which the last visit occurs has

P(last visit before x)=2πarcsin⁡x,P(\text{last visit before } x) = \frac{2}{\pi} \arcsin\sqrt{x},

which gives 1/31/3 at x=1/4x = 1/4. So with chance 2/32/3 the last quarter or the first quarter contains it.

Classic wrong answer. Thinking of the last visit as coming near the middle of the run, or that a fair walk should spend about half the time on each side. In truth, a fair walk typically stays on one side for most of its life.

Why it matters. A flat strategy with a long winning stretch or a long losing stretch is exactly what chance produces. The arcsine law warns you not to infer regime changes from long runs of one sign in cumulative P&L.

Question 11.17 ★★★ QR, QT, Trader • hedge fund, market maker • junior, experienced

Three players hold aa, bb and cc coins. In each round, one ordered pair of players is chosen uniformly among the six ordered pairs, and the first gives one coin to the second. On average, how many rounds until someone has no coins, starting from 10, 20 and 30 coins? If the game goes on between the two left, with the same rule, how long on average until one player holds all 60?

Answer

Answer to Question 11.17.

The first player runs out after 300 rounds on average, and one player holds all 60 after 1 100 rounds on average. The general formulas are 3abc/(a+b+c)3abc/(a + b + c) and ab+bc+caab + bc + ca.

Find quantities that go down steadily. When player xx gives a coin to player yy, with zz the third player, the product abcabc changes by z(x−y−1)z(x - y - 1). Over the six ordered pairs the x−yx - y parts cancel, and the average change is −(a+b+c)/3-(a + b + c)/3, a constant, because the total stays fixed. So abc+t(a+b+c)/3abc + t(a + b + c)/3 is a martingale. It ends at the moment someone has no coins, when the product is 0, so

abc=E[T]⋅a+b+c3,soE[T]=3abca+b+c=3⋅600060=300.abc = E[T] \cdot \frac{a + b + c}{3}, \quad\text{so}\quad E[T] = \frac{3abc}{a + b + c} = \frac{3 \cdot 6000}{60} = 300.

For the second part, use ab+bc+caab + bc + ca. Any move changes it by x−y−1x - y - 1, and the average is −1-1, for three players and for two. So it falls by one per round on average, and it reaches 0 when one player holds everything. So E[T]=200+600+300=1100E[T] = 200 + 600 + 300 = 1100.

Solving the full linear system confirms both formulas for small starts, such as 3 and 11 from (1,2,3)(1, 2, 3).

Classic wrong answer. Trying to write down the recursion for the state. There are many states, and the point of the question is that a good quantity gives the answer in one line.

Follow-up. And with two players, aa and bb? The product abab falls by one per round, which recovers the abab of the gambler’s ruin.

Question 11.18 ★★★ QR, QT, Risk, DS • hedge fund, market maker • junior, experienced

An urn starts with one red and one blue ball. Each time you draw one at random, then return it with one more of the same colour. Show that the fraction of red balls is a martingale. Give the best upper bound you can, without simulation, on the probability that this fraction ever reaches 3/43/4 or more, and a lower bound from what the fraction does in the long run. What is the true value, roughly?

Answer

Answer to Question 11.18.

The upper bound is 2/32/3, the lower bound from the long run is 1/41/4, and a direct calculation gives about 0.440.44.

Martingale: if red is a fraction f=r/(r+b)f = r/(r + b), the next fraction has expected value

f⋅r+1r+b+1+(1−f)⋅rr+b+1=r2+r+br(r+b)(r+b+1)=f.f \cdot \frac{r + 1}{r + b + 1} + (1 - f) \cdot \frac{r}{r + b + 1} = \frac{r^2 + r + br}{(r + b)(r + b + 1)} = f.

Doob’s maximal inequality for a non-negative martingale gives P(sup⁡≥c)≤f0/cP(\sup \ge c) \le f_0/c, here (1/2)/(3/4)=2/3(1/2)/(3/4) = 2/3. This is just optional stopping, with the fraction at least cc on that event.

Lower bound: the fraction converges, and its limit is uniform on [0,1][0, 1]. So it ends above 3/43/4 with chance 1/41/4, and that counts among the times it reached it. A simple sharper floor comes from two red draws in a row, which already give 3/43/4: 12⋅23=1/3\tfrac12 \cdot \tfrac23 = 1/3.

A dynamic programme over the urn’s counts up to 4 000 balls gives about 0.440.44, which a simulation confirms. The fraction often passes 3/43/4 early, when few balls are in the urn, and later falls back. That is why the limit’s chance is well below the chance of ever touching.

Classic wrong answer. Using the bound as the answer. Doob’s bound is attained only when the path hits the level exactly and otherwise ends at 0, and here the fraction cannot fall to 0.

Question 11.19 ★★★ QR, QT, Risk • hedge fund, bank • junior, experienced

A fair walk runs for 100 steps. What is the average of its highest point, counting the start at 0? Use the reflection principle to reduce it to the distribution of the final value, and compare the result with a continuous approximation.

Answer

Answer to Question 11.19.

The average is about 7.507.50. The continuous value 2n/π\sqrt{2n/\pi} is 7.987.98, and the correction of 12\tfrac12 gives 7.487.48.

The reflection principle gives, for a≥1a \ge 1,

P(M≥a)=P(Sn≥a)+P(Sn>a),P(M \ge a) = P(S_n \ge a) + P(S_n > a),

because each path that reaches aa and ends below it can be reflected after its first touch of aa to one ending above it. Then E[M]=∑a≥1P(M≥a)E[M] = \sum_{a \ge 1} P(M \ge a), and adding the binomial tails gives 7.507.50, which a full enumeration matches on shorter walks. Paths at aa itself are counted once, not twice, and this creates the difference from the Brownian formula.

In the continuous limit, MM has the same distribution as ∣Wn∣|W_n|, whose mean is 2n/π\sqrt{2n/\pi}. The discrete walk takes steps of a whole unit, so it falls about half a step short of the limit, and the correction of 12\tfrac12 comes from that.

Classic wrong answer. Giving 10, or doubling E[Sn+]E[S_n^+] with no correction. The walk’s standard deviation is not the mean of its maximum. In short walks and for barriers, the half-step correction is material.

Why it matters. A discretely monitored barrier sits effectively further away than the same continuous barrier. The usual correction shifts the barrier by a fraction of one step’s standard deviation, which reflects this same fact.

Question 11.20 ★★★ QR, QT, Risk • hedge fund, market maker • junior, experienced

A walk moves +1+1 with probability 0.60.6 and −1-1 with probability 0.40.4. The first time it reaches +10+10 takes 50 steps on average. What is the standard deviation of that time? Find it from a martingale, not a recursion.

Answer

Answer to Question 11.20.

The variance is 1 200, so the standard deviation is about 34.634.6 steps.

Each step has mean μ=0.2\mu = 0.2 and variance σ2=1−μ2=0.96\sigma^2 = 1 - \mu^2 = 0.96. The process (St−μt)2−σ2t(S_t - \mu t)^2 - \sigma^2 t is a martingale. Stop it at TT, when ST=10S_T = 10 exactly:

E[(10−μT)2]=σ2E[T].E[(10 - \mu T)^2] = \sigma^2 E[T].

Since E[T]=10/μE[T] = 10/\mu, the left side is μ2 Var(T)\mu^2\,\mathrm{Var}(T). So

Var(T)=σ2E[T]μ2=10 σ2μ3=10⋅0.960.008=1200.\mathrm{Var}(T) = \frac{\sigma^2 E[T]}{\mu^2} = \frac{10\,\sigma^2}{\mu^3} = \frac{10 \cdot 0.96}{0.008} = 1200.

A simulation of 20 000 walks gives the same result. As you would expect, the variance grows linearly with the distance, because each level is a separate independent wait.

Classic wrong answer. Using a variance of 0.96⋅50=480.96 \cdot 50 = 48, the variance of the position at a fixed time. The wait is much more variable, since the variance is divided by μ3\mu^3, and a small drift gives a huge spread.

Why it matters. For a strategy with a small edge, the time to reach a target has a very wide distribution: here a standard deviation of 70% of the mean. You should expect long periods with no progress, even when the edge is real.

Question 11.21 ★★★ QR, QT, QD • any • junior, experienced

A fair walk moves on the integer lattice, choosing one of the neighbouring points with equal probability at each step, in one, two and three dimensions. In which dimensions does it return to its start with probability one? Give the argument, and the return probability in three dimensions, to two decimal places.

Answer

Answer to Question 11.21.

It returns with probability one in one and two dimensions, and with probability about 0.340.34 in three dimensions. This is Pólya’s theorem.

The number of visits to the start is a geometric count: with return chance RR, its mean is U=1/(1−R)U = 1/(1 - R). So the walk returns with certainty exactly when U=∑nunU = \sum_n u_n diverges.

In one dimension u2n=(2nn)/4n∼1/πnu_{2n} = \binom{2n}{n}/4^n \sim 1/\sqrt{\pi n}, and the sum diverges. In two dimensions, rotating the lattice by 45 degrees turns the walk into two independent one-dimensional walks, so u2nu_{2n} is the square of the 1-d value, about 1/(πn)1/(\pi n), and the sum still diverges, only just. In three dimensions, u2nu_{2n} falls as about n−3/2n^{-3/2}, and the sum converges.

The value uses the Fourier form of UU, the average of 1/(1−13(cos⁡a+cos⁡b+cos⁡c))1/(1 - \tfrac13(\cos a + \cos b + \cos c)) over the cube of angles, which comes to about 1.5161.516. So R=1−1/1.516≈0.34R = 1 - 1/1.516 \approx 0.34. A direct simulation gives the same result.

Classic wrong answer. Thinking that a walk must come back because it has infinite time. In a high enough dimension, there are too many places to go.

Follow-up. What are the odds in four dimensions? Lower still, about 0.190.19 on the same reasoning. The return probability falls steadily with dimension.

Question 11.22 ★★★ QR, QT, Trader • hedge fund, market maker • junior, experienced

A walk goes up 2 with probability 1/31/3 and down 1 with probability 2/32/3. From 0, you stop on first being at 10 or more, or at −5-5 or less. What is the probability that you stop at the top, and how many steps does it take on average? Why is one-third, the answer you would get for steps of 1, not quite right?

Answer

Answer to Question 11.22.

You stop at the top with probability about 0.3260.326, in about 25.925.9 steps. One-third is close, but the upper exit can overshoot to 11.

The walk has mean step 0, and it moves down one place at a time, so it lands exactly on −5-5. Going up, though, it lands on 10 or 11. Let aa and bb be the chances of stopping at 10 and at 11. Optional stopping says 10a+11b−5(1−a−b)=010a + 11b - 5(1 - a - b) = 0, which gives 15a+16b=515a + 16b = 5. This has two unknowns, so you need one more fact, and a linear system on the positions supplies it, with a≈0.218a \approx 0.218 and b≈0.108b \approx 0.108. Their total is 0.3260.326.

For the time, each step has variance 2 (it is 13⋅4+23⋅1\tfrac13 \cdot 4 + \tfrac23 \cdot 1), so St2−2tS_t^2 - 2t is a martingale. Then E[T]=12E[ST2]=12(100a+121b+25(1−a−b))≈25.9E[T] = \tfrac12 E[S_T^2] = \tfrac12(100a + 121b + 25(1 - a - b)) \approx 25.9.

If the walk landed exactly on 10, as a walk with unit steps does, you would get 5/15=1/35/15 = 1/3; with this walk’s step variance of 2, the time would be 5⋅10/2=255 \cdot 10/2 = 25. (Unit steps, with variance 1, take 50.) Overshooting means the top is on average a bit further than 10. So you exit there a little less often.

Classic wrong answer. Ignoring overshoot because the answer looks close. A one-third answer is off by only about 2%, but it is wrong, and with larger jumps it can be wrong by much more. Wald’s identity needs the position at the stop, and this is not the barrier when jumps can pass it.

Why it matters. A stop order filled through a gap is an overshoot. Your actual stop is not the barrier, and a jump in the price is what breaks the textbook calculation.

Question 11.23 ★★★★ QR, QT • hedge fund, market maker • experienced

A fair walk starts at 0 and stops on first reaching +n+n or −n-n. Its average duration is n2n^2. What is its variance? Give a formula and the value for n=10n = 10.

Answer

Answer to Question 11.23.

The variance is 23n2(n2−1)\tfrac23 n^2(n^2 - 1), which is 6 600 for n=10n = 10, so the standard deviation is about 81 against a mean of 100.

Use a fourth-power martingale. Over one step, E[(S+1)4+(S−1)4]/2=S4+6S2+1E[(S + 1)^4 + (S - 1)^4]/2 = S^4 + 6S^2 + 1. Correcting for this, you can check that

Mt=St4−6tSt2+3t2+2tM_t = S_t^4 - 6tS_t^2 + 3t^2 + 2t

stays fair over one step. Stop it at TT, with ∣ST∣=n|S_T| = n:

0=n4−6n2E[T]+3E[T2]+2E[T].0 = n^4 - 6n^2 E[T] + 3E[T^2] + 2E[T].

Since E[T]=n2E[T] = n^2, this gives 3E[T2]=5n4−2n23E[T^2] = 5n^4 - 2n^2. So E[T2]=13(5n4−2n2)E[T^2] = \tfrac13(5n^4 - 2n^2), and subtracting n4n^4,

Var(T)=2n4−2n23=23n2(n2−1).\mathrm{Var}(T) = \frac{2n^4 - 2n^2}{3} = \frac23 n^2(n^2 - 1).

Check: at n=1n = 1, you exit after one step for certain, and the formula gives 0. Second-moment first-step equations give the same value for nn up to 10, and a simulation matches.

Classic wrong answer. Assuming that the relative spread shrinks as nn grows. The ratio of standard deviation to mean tends to 2/3\sqrt{2/3}, so this stays a very variable wait.

Follow-up. Why is the ratio fixed? By scaling. A walk at scale nn behaves like Brownian motion on [−1,1][-1, 1], with time rescaled by n2n^2, so all of the moments of T/n2T/n^2 have a limit.

Question 11.24 ★★★★ QR, QT • hedge fund, market maker • experienced

A fair walk starts at 0 and runs until it first returns to 0. It is certain to return, although the average time is infinite. On average, how many times does it visit the point +k+k before it returns, for k=1k = 1? For k=100k = 100? Why is that not absurd?

Answer

Answer to Question 11.24.

It visits +k+k exactly once on average, for every kk, including 100.

For the proof, think about how the walk reaches kk. Step first to +1+1, with chance 1/21/2. Then reach kk before 0, by gambler’s ruin, with chance 1/k1/k. Now count the visits to kk before 0. From kk a step goes one way or the other. Going up, it always returns. Going down, it reaches 0 before returning with chance 1/k1/k. So each visit has an escape chance of 12⋅1k\tfrac12 \cdot \tfrac1k, and the number of visits is geometric, with mean 2k2k. Overall:

12⋅1k⋅2k=1.\tfrac12 \cdot \tfrac1k \cdot 2k = 1.

This is what is expected from the stationary measure. The counting measure is stationary for the walk, and between returns to any state the expected number of visits to another state is the ratio of stationary masses, here 11. On a finite ring this holds exactly, for all kk, as solving the linear system confirms.

It is not absurd, since the walk reaches +100+100 only about once in 200 excursions. But when it does, it visits about 200 times. Rare excursions make up for it, and because every level contributes 11, the total time is infinite.

Classic wrong answer. Saying that the far level must be visited much less often, because most returns occur quickly. Most excursions never get there, but the few that do stay around for a long time.

Why it matters. Rare and long excursions dominate means. A mean over many short excursions misses them in a small sample, and it may even be undefined. That is a warning about what a small backtest tells you about a heavy-tailed process.

Question 11.25 ★★★★ QR, QT, Trader, Risk • hedge fund, market maker • experienced

You have $25 and need $100. You can stake any whole number of dollars on each round of an even-money bet that you win with probability 0.40.4, and you stop on reaching $100 or $0. What is your chance if you bet $1 at a time? What if you bet as much as you can without passing $100 each time? Is that the best plan? What changes if the win probability is 0.60.6 or 0.50.5?

Answer

Answer to Question 11.25.

At $1 a bet your chance is about 6.2×10−146.2 \times 10^{-14}, and betting boldly gives 0.160.16, which is the best possible. At a win rate of 0.60.6 the small bets are best, with a chance near 1. At 0.50.5 every plan gives 1/41/4.

Betting $1 is a gambler’s ruin with r=q/p=3/2r = q/p = 3/2, starting at 25 with a target of 100:

P=1.525−11.5100−1≈6.2×10−14.P = \frac{1.5^{25} - 1}{1.5^{100} - 1} \approx 6.2 \times 10^{-14}.

Bold play stakes all $25, then $50: two wins in a row, which has chance 0.42=0.160.4^2 = 0.16. Value iteration over all whole-dollar stakes gives 0.160.16 as the best value too.

Why? Each bet at p<1/2p < 1/2 costs you in expectation, in proportion to the amount staked. Small bets force you to stake a large total before you can reach the target, and each dollar you stake loses money on average. Bold play puts up the smallest total stake that could reach the target.

At p=0.6p = 0.6 the logic reverses: each bet earns, so stake a lot in total. The chance with small bets is (1−r25)/(1−r100)(1 - r^{25})/(1 - r^{100}) with r=2/3r = 2/3, which is about 0.999960.99996, compared with a bold 0.360.36. At p=0.5p = 0.5, your wealth is a martingale, so optional stopping says the chance is 25/10025/100 under any plan.

Classic wrong answer. Saying that small bets reduce risk, so they must be safer here. Small bets reduce the variance, and when you need to reach a target against a negative edge, variance is what you are buying.

Why it matters. This applies to a trader who is behind on a target with no real edge: the only way to reach it is by raising size, and this is exactly why risk limits exist. Conversely, a positive edge is destroyed by betting as if it were a lottery.