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

Interviews I: Maths, Probability and Speed

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

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

27Timed Test 4

Take it in one sitting, without notes or a calculator.

Section A — 6 questions, 40 minutes

Question 27.1

A drawer holds 5 pairs of different socks. You take out 4 socks at random. What is the probability that no two of them match? What is the probability of exactly one matching pair?

Answer

Answer to Question 27.1.

No match has probability 821\frac{8}{21}, and exactly one pair has probability 47\frac47.

Taking the socks one at a time, the first can be anything. The second must avoid its partner: 8 of 9 remain. The third must avoid two partners: 6 of 8. The fourth must avoid three: 4 of 7. The product is 89⋅68⋅47=821\frac89 \cdot \frac68 \cdot \frac47 = \frac{8}{21}.

Exactly one pair: choose the pair, in 5 ways, then 2 of the other 4 pairs, and one sock from each: 5×(42)×4=1205 \times \binom42 \times 4 = 120, out of (104)=210\binom{10}{4} = 210. That gives 47\frac47.

Two pairs have (52)=10\binom52 = 10 ways, or 121\frac{1}{21}, and the three cases sum to 1, a useful check.

Classic wrong answer. Counting ordered draws in one place and unordered ones in another, which is the usual way to get the second figure wrong.

Question 27.2

XX, YY and ZZ are independent exponential variables with mean 1. What is the probability that X>Y+ZX > Y + Z?

Answer

Answer to Question 27.2.

The probability is 14\frac14.

Given Y+Z=sY + Z = s, we have P(X>s)=e−sP(X > s) = e^{-s}. So the answer is Ee−(Y+Z)=(Ee−Y)2\mathbb{E}e^{-(Y + Z)} = (\mathbb{E}e^{-Y})^2. And Ee−Y=∫0∞e−2y dy=12\mathbb{E}e^{-Y} = \int_0^\infty e^{-2y}\,dy = \frac12. The result is 14\frac14.

A second route uses a race. Think of three exponential clocks. The first ring among XX and YY is YY with chance 12\frac12. By the memoryless property, XX starts anew. Then ZZ must also beat it, again with chance 12\frac12. That gives 12×12\frac12 \times \frac12. A simulation confirms this.

Follow-up. What is P(X>2Y)P(X > 2Y)? Ee−2Y=∫0∞e−3y dy=13\mathbb{E}e^{-2Y} = \int_0^\infty e^{-3y}\,dy = \frac13.

Question 27.3

Fit a straight line by least squares to the three points (0,0)(0, 0), (1,1)(1, 1) and (2,1)(2, 1). Give the intercept, the slope and the R2R^2.

Answer

Answer to Question 27.3.

The slope is 12\frac12, the intercept is 16\frac16, and R2=34R^2 = \frac34.

The means are xˉ=1\bar{x} = 1 and yˉ=23\bar{y} = \frac23. Then Sxx=1+0+1=2S_{xx} = 1 + 0 + 1 = 2 and Sxy=(−1)(−23)+0+(1)(13)=1S_{xy} = (-1)(-\frac23) + 0 + (1)(\frac13) = 1. So the slope is 12\frac12. The line passes through the means, so the intercept is 23−12=16\frac23 - \frac12 = \frac16.

The total sum of squares is 49+19+19=23\frac49 + \frac19 + \frac19 = \frac23, and the explained part is b2Sxx=12b^2S_{xx} = \frac12. So R2=12/23=34R^2 = \frac12/\frac23 = \frac34.

The residuals are −16-\frac16, 13\frac13 and −16-\frac16. They sum to 0, and they are orthogonal to xx, as they must be. That catches any slip.

Classic wrong answer. Forcing the line through the origin, which gives a slope of 35\frac35. Nothing in the question drops the intercept.

Question 27.4

A token starts on square 0 of squares numbered 0 to 6. Each turn you roll a die and move forward by that amount, but if this would go past square 6, you stay where you are. On average, how many rolls does it take to land exactly on 6?

Answer

Answer to Question 27.4.

The expected number is 6, from any square below 6.

Let eke_k be the expected number of rolls from square kk. From 5, only a roll of 1 ends the game, so e5=6e_5 = 6.

From 4: a 1 goes to 5, a 2 finishes, and the other four rolls stay. So e4=1+16e5+46e4e_4 = 1 + \frac16e_5 + \frac46e_4, which gives e4=6e_4 = 6. By induction, if ek+1,…,e5e_{k + 1}, \dots, e_5 are all 6, then from kk we have 6−k6 - k useful rolls, of which one finishes and the rest lead to squares with value 6. Then

ek=1+5−k66+k6ek,e_k = 1 + \frac{5 - k}{6}6 + \frac{k}{6}e_k,

which gives ek=6e_k = 6.

The reason is simple: from any square, exactly one roll finishes the game on that turn. So each roll succeeds with chance 16\frac16, whatever the square, and the wait is geometric. A simulation agrees.

Classic wrong answer. Computing a long recursion and never noticing the pattern. A surprising answer of 6 should prompt a search for the simple reason.

Question 27.5

Two points are chosen independently and uniformly on a circle of radius 1. What is the expected straight-line distance between them?

Answer

Answer to Question 27.5.

The expected distance is 4π≈1.27\frac{4}{\pi} \approx 1.27.

Fix the first point. The angle θ\theta to the second is uniform on [0,2π][0, 2\pi]. The chord has length 2sin⁡(θ/2)2\sin(\theta/2). So

E=12π∫02π2sin⁡θ2 dθ=12π[−4cos⁡θ2]02π=82π.\mathbb{E} = \frac{1}{2\pi}\int_0^{2\pi}2\sin\frac{\theta}{2}\,d\theta = \frac{1}{2\pi}\left[-4\cos\frac{\theta}{2}\right]_0^{2\pi} = \frac{8}{2\pi}.

A sanity check: the distance is between 0 and 2, and a chord at a right angle has length 2=1.41\sqrt{2} = 1.41. The mean is below this since the short chords, at small θ\theta and near 2π2\pi, pull it down. A simulation confirms 1.2731.273.

Classic wrong answer. Using the root mean square. The mean squared distance is exactly 2, so the root is 1.411.41, which is too high. A mean of a root is not the root of a mean.

Question 27.6

Three players play rock, paper, scissors, all choosing at random. If all three throw the same or all differ, they replay. Otherwise losers are eliminated, and if two remain they play on. On average, how many rounds does it take to have one winner?

Answer

Answer to Question 27.6.

The average is 94\frac94 rounds.

With three players, there are 27 outcomes. All the same: 3. All different: 6. So a replay has chance 13\frac13. Otherwise exactly two symbols appear. Then one winner has chance 13\frac13 (9 outcomes), and two winners also has chance 13\frac13 (9 outcomes).

With two players, a tie has chance 13\frac13, so E2=32E_2 = \frac32.

For three,

E3=1+13E3+13E2=1+13E3+12,E_3 = 1 + \frac13E_3 + \frac13E_2 = 1 + \frac13E_3 + \frac12,

which gives 23E3=32\frac23E_3 = \frac32, so E3=94E_3 = \frac94. A simulation of the game returns 2.252.25.

Follow-up. With four players, how likely is a replay? Exactly two symbols appear in 3(24−2)=423(2^4 - 2) = 42 of the 81 outcomes, so a replay has chance 3981=1327\frac{39}{81} = \frac{13}{27}, nearly one in two. Larger groups stall.

Section B — 6 questions, 60 minutes

Question 27.7

A fair coin is flipped until either two heads in a row or three tails in a row appear. What is the probability that the two heads come first?

Answer

Answer to Question 27.7.

The probability is 710\frac{7}{10}.

Set up states for the current run: hh after one head, tt after one tail, uu after two tails, and the start. Let each symbol stand for the chance that heads wins from that state:

h=12+12t,t=12h+12u,u=12h.h = \frac12 + \frac12t, \qquad t = \frac12h + \frac12u, \qquad u = \frac12h.

Then t=12h+14h=34ht = \frac12h + \frac14h = \frac34h, and h=12+38hh = \frac12 + \frac38h, which gives h=45h = \frac45. So t=35t = \frac35.

From the start, the first flip leads to hh or tt with equal chance: 12(45+35)=710\frac12(\frac45 + \frac35) = \frac{7}{10}. An exact solve and a simulation agree.

So a target that is one flip shorter wins 70%70\% of the time, a little more than the raw chance of each run suggests. A limit case: against four tails in a row, the head run’s chance would be higher still.

Classic wrong answer. Comparing 14\frac14 and 18\frac18 directly, which gives 23\frac23. This ignores that a failed attempt at one run resets differently, and that a head run resets the tail run.

Question 27.8

You draw independent uniform numbers on [0,1][0, 1] and multiply them until the product falls below 12\frac12. What is the expected number of draws?

Answer

Answer to Question 27.8.

The expected number is 1+ln⁡2≈1.6931 + \ln 2 \approx 1.693.

Take logs. Ei=−ln⁡UiE_i = -\ln U_i is exponential with mean 1, and the product falls below 12\frac12 when ∑Ei\sum E_i passes ln⁡2\ln 2.

So the EiE_i are the gaps of a Poisson process at rate 1. The number of arrivals in [0,ln⁡2][0, \ln 2] is Poisson with mean ln⁡2\ln 2. The first arrival after ln⁡2\ln 2 is the stopping draw. So the number of draws is this Poisson count plus 1, whose mean is 1+ln⁡21 + \ln 2. A simulation gives 1.6931.693.

A second route: let m(x)m(x) be the expected number from threshold xx, so m(x)=1+∫x1m(x/u) dum(x) = 1 + \int_x^1m(x/u)\,du. This gives m(x)=1−ln⁡xm(x) = 1 - \ln x, and at 12\frac12 it is the same.

Classic wrong answer. Using E∏Ui=2−n\mathbb{E}\prod U_i = 2^{-n} and solving for n=1n = 1. That is a statement about means, not about the first passage.

Follow-up. What if the target is e−5e^{-5}? 1+5=61 + 5 = 6 draws, by the same argument.

Question 27.9

A bet wins with probability 12\frac12 and pays 2 to 1, independently each time. What fraction of wealth should you stake each time to maximise long-run growth? What is the growth rate per bet?

Answer

Answer to Question 27.9.

Stake 14\frac14 of wealth, for a log growth of about 0.0590.059 per bet.

A stake of ff multiplies wealth by 1+2f1 + 2f or 1−f1 - f. The expected log is

g(f)=12ln⁡(1+2f)+12ln⁡(1−f).g(f) = \frac12\ln(1 + 2f) + \frac12\ln(1 - f).

Setting the derivative to zero: 11+2f=12(1−f)\frac{1}{1 + 2f} = \frac{1}{2(1 - f)}, so f=14f = \frac14. The general form is edge over odds: (bp−q)/b=(1−12)/2(bp - q)/b = (1 - \frac12)/2.

Then g=12ln⁡1.5+12ln⁡0.75=12ln⁡1.125=0.0589g = \frac12\ln 1.5 + \frac12\ln 0.75 = \frac12\ln 1.125 = 0.0589. A direct search confirms the optimum.

Doubling to f=12f = \frac12 gives 12ln⁡(2×0.5)=0\frac12\ln(2 \times 0.5) = 0: no growth at all. So too much leverage on a good bet leaves nothing, even with a positive expected return per bet.

Classic wrong answer. Staking everything, because the expected return is positive. The first loss then ends the game.

Question 27.10

Two teams play a best-of-seven series, with independent games. If one team wins each game with probability 0.60.6, what is the chance that it wins the series? If the teams are equal, what is the expected number of games?

Answer

Answer to Question 27.10.

The stronger team wins with probability about 0.7100.710, and equal teams play 5.815.81 games on average.

Imagine all seven games are played. The team wins the series exactly when it wins at least 4 of the 7. That gives

∑k=47(7k)0.6k0.47−k=0.2903+0.2613+0.1306+0.0280=0.710.\sum_{k = 4}^7\binom7k0.6^k0.4^{7 - k} = 0.2903 + 0.2613 + 0.1306 + 0.0280 = 0.710.

For equal teams, the series ends after nn games when the winner takes game nn and 3 of the earlier n−1n - 1. With both teams counted:

P(n)=2(n−13)2−n,P(4)=18,P(5)=14,P(6)=P(7)=516.P(n) = 2\binom{n - 1}{3}2^{-n}, \qquad P(4) = \frac18, \quad P(5) = \frac14, \quad P(6) = P(7) = \frac{5}{16}.

The mean is 48+54+30+3516=5.8125\frac{4}{8} + \frac{5}{4} + \frac{30 + 35}{16} = 5.8125. An exact sum over games confirms both.

Classic wrong answer. Using (n4)\binom{n}{4} for a series that ends at game nn. The last game must be a win, so only the earlier n−1n - 1 games are free. Playing all seven games avoids this, as the extra games cannot change the winner.

Why it matters. Extending a stopped game to a fixed length often removes the hardest part of the calculation.

Question 27.11

Two fair dice are rolled. Let MM be the larger value and mm the smaller. What is the covariance of MM and mm?

Answer

Answer to Question 27.11.

The covariance is 12251296=(3536)2≈0.945\frac{1225}{1296} = (\frac{35}{36})^2 \approx 0.945.

Since MmMm is the product of the two dice, EMm=3.52=12.25\mathbb{E}Mm = 3.5^2 = 12.25.

The largest has P(M≤k)=k2/36P(M \le k) = k^2/36, which gives EM=16136\mathbb{E}M = \frac{161}{36}. By the symmetry x→7−xx \to 7 - x, Em=7−16136=9136\mathbb{E}m = 7 - \frac{161}{36} = \frac{91}{36}.

So the covariance is 12.25−161×911296=15 876−14 6511296=1225129612.25 - \frac{161 \times 91}{1296} = \frac{15\,876 - 14\,651}{1296} = \frac{1225}{1296}. An enumeration over the 36 outcomes confirms it.

It is positive, as high values of one come with high values of the other. Note how the identity Mm=XYMm = XY avoids a table of 36 products.

Classic wrong answer. Assuming that MM and mm are uncorrelated because the dice are independent. They are functions of the same two dice.

Question 27.12

The number of claims in a year is Poisson with mean 10, and each claim’s size is independent and exponential with mean 5. Find the mean of the total, and its standard deviation. What is the chance of a total of zero?

Answer

Answer to Question 27.12.

The mean is 50, the standard deviation is 500≈22.4\sqrt{500} \approx 22.4, and the chance of zero is e−10e^{-10}.

By the law of total expectation, ES=EN EX=50\mathbb{E}S = \mathbb{E}N\,\mathbb{E}X = 50.

By the law of total variance,

Var⁡S=ENVar⁡X+Var⁡N(EX)2=10×25+10×25=500.\operatorname{Var}S = \mathbb{E}N\operatorname{Var}X + \operatorname{Var}N(\mathbb{E}X)^2 = 10 \times 25 + 10 \times 25 = 500.

For a Poisson count, this simplifies to λEX2=10×50\lambda\mathbb{E}X^2 = 10 \times 50. Half of the variance comes from the number of claims, and half from their sizes. A simulation agrees.

The total is 0 only with no claims, so the chance is e−10≈4.5×10−5e^{-10} \approx 4.5 \times 10^{-5}.

Classic wrong answer. Giving Var⁡S=λVar⁡X=250\operatorname{Var}S = \lambda\operatorname{Var}X = 250. That leaves out the uncertainty in how many claims arrive.

Follow-up. How does the relative risk change with λ\lambda? λEX2/(λEX)\sqrt{\lambda\mathbb{E}X^2}/(\lambda\mathbb{E}X) falls as 1/λ1/\sqrt{\lambda}. A book that is four times the size has half the relative risk.