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

Interviews I: Maths, Probability and Speed

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

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

32Timed Test 9

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

Section A — 6 questions, 40 minutes

Question 32.1

Two fair coins are flipped together, round after round. A coin that has already shown heads may be set aside. What is the expected number of rounds until each coin has shown heads at least once?

Answer

Answer to Question 32.1.

The expected number is 83\frac83.

Let G1G_1 and G2G_2 be the rounds of each coin’s first head. We want Emax⁡(G1,G2)\mathbb{E}\max(G_1, G_2). Using max⁡+min⁡=G1+G2\max + \min = G_1 + G_2, the sum has mean 4.

The minimum is the first round in which either coin shows heads. A round has this with chance 34\frac34, so the minimum has mean 43\frac43. So the maximum has mean 4−43=834 - \frac43 = \frac83.

A second route is by states: from the start, E=1+14E+12⋅2E = 1 + \frac14E + \frac12 \cdot 2, which gives 34E=2\frac34E = 2, so E=83E = \frac83. A simulation agrees.

Classic wrong answer. Answering 4 by adding the two means, or 2 by saying that they run side by side. The true value lies between the two.

Question 32.2

Three different vertices of a cube are chosen at random. How likely are they to form an equilateral triangle?

Answer

Answer to Question 32.2.

The probability is 17\frac17.

There are (83)=56\binom83 = 56 triples. Any equilateral triangle must have three equal sides, and the distances between vertices are the edge, the face diagonal and the space diagonal.

Only the face diagonal works. Each vertex has 3 others at a face-diagonal distance, and these three are also mutually at that distance. So any two of them form an equilateral triangle with the vertex, and each vertex lies in (32)=3\binom32 = 3 triangles. Each triangle has 3 vertices, so there are 8×33=8\frac{8 \times 3}{3} = 8 triangles. Then 856=17\frac{8}{56} = \frac17.

An enumeration of the 56 triples confirms 8. No triple of edges closes up, as a cube has no triangle of its edges.

Classic wrong answer. Counting only 2 triangles, or the triangles of one tetrahedron, of which there are 4. The cube holds two such tetrahedra.

Question 32.3

A parameter has a prior N(0,1)N(0, 1). You observe a single measurement of 2, with independent normal noise of variance 1. What are the posterior mean and variance? What if the noise variance is 4?

Answer

Answer to Question 32.3.

The posterior mean is 1 and the variance is 12\frac12. With noise variance 4, they are 0.40.4 and 0.80.8.

Precisions add. The prior has precision 1, and the measurement has precision 1. So the posterior precision is 2, the variance is 12\frac12, and the mean is the precision-weighted average: 1⋅0+1⋅22=1\frac{1 \cdot 0 + 1 \cdot 2}{2} = 1.

With noise variance 4, the measurement has precision 14\frac14. Then the posterior precision is 54\frac54, the variance is 0.80.8, and the mean is 14⋅254=0.4\frac{\frac14 \cdot 2}{\frac54} = 0.4.

A numerical integration of the posterior agrees. Limit checks: with no noise, the mean is 2, and with infinite noise, it stays 0.

Classic wrong answer. Giving a posterior variance above the prior’s. A new measurement can only reduce it, in this normal case.

Question 32.4

A number is chosen uniformly from the divisors of 10610^6. What is the probability that it is a multiple of 10310^3?

Answer

Answer to Question 32.4.

The probability is 1649\frac{16}{49}.

Since 106=265610^6 = 2^6 5^6, the divisors are 2a5b2^a5^b with aa and bb each from 0 to 6, which gives 7×7=497 \times 7 = 49.

A multiple of 10310^3 needs a≥3a \ge 3 and b≥3b \ge 3. That is 4 values for each exponent, so 16 divisors. Hence 1649\frac{16}{49}.

A direct list of the divisors confirms the counts. The chance of a≥3a \ge 3 alone is 47\frac47, and the two exponents are independent, so the answer is its square. Note the pairing: a divisor dd matches 106/d10^6/d, and 10310^3 sits in the middle of the list.

Classic wrong answer. Using the chance 11000\frac{1}{1000}, as for a random whole number. Divisors are not spread evenly, so it is the exponents that must be counted.

Question 32.5

XX and YY are independent standard normals. What is the probability that X>Y+1X > Y + 1, given that P(Z<0.71)=0.76P(Z < 0.71) = 0.76 for a standard normal ZZ? What is E[X∣X+Y=2]\mathbb{E}[X \mid X + Y = 2]?

Answer

Answer to Question 32.5.

The probability is about 0.240.24, and the conditional mean is 1.

X−YX - Y is normal with mean 0 and variance 2. So P(X−Y>1)=P(Z>12)=P(Z>0.71)=0.24P(X - Y > 1) = P(Z > \frac{1}{\sqrt2}) = P(Z > 0.71) = 0.24.

Given X+Y=2X + Y = 2, symmetry gives E[X∣X+Y=2]=E[Y∣X+Y=2]\mathbb{E}[X \mid X + Y = 2] = \mathbb{E}[Y \mid X + Y = 2], and the two add up to 2. So each is 1.

The regression route agrees: the slope of XX on X+YX + Y is 12\frac12, and the mean of X+YX + Y is 0, so the value is 12×2\frac12 \times 2. A simulation gives both.

Limit check: for a target of 0 in place of 1, the chance is 12\frac12, as it should be.

Classic wrong answer. Using a variance of 1 for X−YX - Y. Variances add for a difference too, so the scale is 2\sqrt2.

Question 32.6

XX and YY are independent exponentials with mean 1. What are the means of the smaller and the larger? What is the probability that X>Y+1X > Y + 1?

Answer

Answer to Question 32.6.

The smaller has mean 12\frac12, the larger has mean 32\frac32, and the probability is 12e≈0.184\frac{1}{2e} \approx 0.184.

The minimum is exponential with rate 2, so its mean is 12\frac12. After it, the other variable has a fresh exponential life, by the memoryless property. So the gap has mean 1, and the maximum has mean 32\frac32.

The sum checks: 12+32=2=E(X+Y)\frac12 + \frac32 = 2 = \mathbb{E}(X + Y).

X>Y+1X > Y + 1 needs two things: XX outlasts YY, with chance 12\frac12, and then it lasts at least 1 more, with chance e−1e^{-1}. A simulation returns 0.1840.184.

Limit check: replacing 1 by 0 gives 12\frac12, and a large gap makes the chance vanish.

Classic wrong answer. Treating the gap as depending on the size of YY. The memoryless property makes it independent of how long the first has lasted.

Section B — 6 questions, 60 minutes

Question 32.7

NN is Poisson with mean 1. What is the probability that NN is even? Separately, customers arrive at a shop as a Poisson process at a rate of 6 per hour, and each buys with probability 12\frac12, independently. What is the probability of no sale in an hour?

Answer

Answer to Question 32.7.

P(N even)=1+e−22≈0.568P(N \text{ even}) = \frac{1 + e^{-2}}{2} \approx 0.568, and the chance of no sale is e−3≈0.050e^{-3} \approx 0.050.

Add the series for eλe^{\lambda} and e−λe^{-\lambda}: the odd terms cancel. So ∑k evenλkk!=cosh⁡λ\sum_{k \text{ even}}\frac{\lambda^k}{k!} = \cosh\lambda, and P(even)=e−λcosh⁡λ=1+e−2λ2P(\text{even}) = e^{-\lambda}\cosh\lambda = \frac{1 + e^{-2\lambda}}{2}. At λ=1\lambda = 1, this is 0.5680.568. As λ\lambda grows, it tends to 12\frac12, and at λ=0\lambda = 0 it is 1.

Thinning a Poisson process with a chance of 12\frac12 gives a Poisson process at rate 3. So no sale has chance e−3e^{-3}. Summing over the number of customers gives the same result: ∑e−66kk!2−k=e−6e3\sum e^{-6}\frac{6^k}{k!}2^{-k} = e^{-6}e^{3}. A simulation agrees.

Classic wrong answer. Using e−6e^{-6}, which is the chance of no customers at all. A customer who does not buy is still no sale.

Question 32.8

Five fair dice are rolled. What is the probability of exactly two pairs, meaning two values appear twice each and a third value appears once?

Answer

Answer to Question 32.8.

The probability is 18007776=25108≈0.231\frac{1800}{7776} = \frac{25}{108} \approx 0.231.

Choose the two values that pair up: (62)=15\binom62 = 15. Choose the single value: 4. Arrange the five dice: 5!2! 2! 1!=30\frac{5!}{2!\,2!\,1!} = 30. That gives 15×4×30=180015 \times 4 \times 30 = 1800, out of 65=77766^5 = 7776.

An enumeration over all the 7776 outcomes confirms the count.

Note that choosing the two pair values is unordered. Doing it in order would count each outcome twice.

Classic wrong answer. Using 6×5×4×30=36006 \times 5 \times 4 \times 30 = 3600, which treats (3, 3, 5, 5, 2) and (5, 5, 3, 3, 2) as different results.

Follow-up. Is this more or less likely than one pair? One pair has 6×(53)×5!2!=36006 \times \binom53 \times \frac{5!}{2!} = 3600 outcomes, or 0.4630.463, so it is twice as likely.

Question 32.9

Two uncorrelated assets have expected excess returns of 5% and 10% and volatilities of 10% and 20%. What portfolio maximises the Sharpe ratio, and what is that ratio?

Answer

Answer to Question 32.9.

The weights are 2 to 1, or 23\frac23 and 13\frac13, and the Sharpe ratio is about 0.7070.707.

The best portfolio is proportional to Σ−1μ\Sigma^{-1}\mu. With no correlation, the weights are proportional to μi/σi2\mu_i/\sigma_i^2: 0.050.01=5\frac{0.05}{0.01} = 5 and 0.100.04=2.5\frac{0.10}{0.04} = 2.5. That is 2 to 1.

Each asset alone has a Sharpe ratio of 12\frac12. For uncorrelated assets, the squared Sharpe ratios add, so the best is 14+14=0.707\sqrt{\frac14 + \frac14} = 0.707.

Direct check: the portfolio has a return of 23⋅5+13⋅10=6.67%\frac23 \cdot 5 + \frac13 \cdot 10 = 6.67\%, and a variance of 49⋅100+19⋅400=88.9\frac49 \cdot 100 + \frac19 \cdot 400 = 88.9, so the volatility is 9.43%9.43\%. The ratio is 6.679.43=0.707\frac{6.67}{9.43} = 0.707.

Classic wrong answer. Choosing equal weights, as the two Sharpe ratios match. Equal Sharpe calls for equal risk, not equal capital.

Question 32.10

A five-card hand is dealt from a standard 52-card deck, for which there are 2 598 9602\,598\,960 possible hands. What is the probability of exactly two pairs, meaning two cards of one rank, two of another, and one card of a third rank?

Answer

Answer to Question 32.10.

The probability is about 0.04750.0475.

Choose the two ranks: (132)=78\binom{13}{2} = 78. Choose the two suits in each: (42)2=36\binom42^2 = 36. Choose the fifth card from the 44 cards of other ranks. The count is 78×36×44=123 55278 \times 36 \times 44 = 123\,552. Divided by the number of hands, this is 0.04750.0475.

A simulation returns the same. Note the 44: only cards of the other 11 ranks are allowed, and each has 4 suits.

As a rough check, 78×36×44≈80×1600=128 00078 \times 36 \times 44 \approx 80 \times 1600 = 128\,000, and that over 2.62.6 million is about one hand in 20.

Classic wrong answer. Using 13×1213 \times 12 for the ranks, which counts each hand twice. The two pairs have no order, so the value doubles to about 0.0950.095.

Question 32.11

A plane has 10 seats and 10 passengers, each with an assigned seat. The first has lost the boarding card and sits at random. Each later passenger takes their own seat if it is free, and otherwise a random free seat. What is the probability that the last passenger gets their own seat? What is the probability that the ninth passenger does not?

Answer

Answer to Question 32.11.

The last passenger gets their own seat with probability 12\frac12, and the ninth is displaced with probability 13\frac13.

Whenever someone sits at random, three things can happen. They may choose the first passenger’s seat, and all is settled. They may choose the last person’s seat, and the last person is displaced. Or they may choose another seat, and the choice passes to someone else. The first and second are equally likely at each step, so the last passenger’s chance is 12\frac12.

For the ninth, the same holds with three seats left to matter: seat 1, seat 9, and seat 10. When a random choice first falls on one of these, each is equally likely. Only seat 9 displaces the ninth passenger. So the chance is 13\frac13. In general, passenger kk of nn is displaced with chance 1n−k+2\frac{1}{n - k + 2}.

A simulation confirms both. With k=10k = 10, this is 12\frac12, as before.

Classic wrong answer. Computing the full tree of 10 passengers. The answer for the last passenger does not depend on nn at all, and that is the clue to look for a symmetry.

Question 32.12

Using Stirling’s approximation ln⁡n!≈nln⁡n−n+12ln⁡(2πn)\ln n! \approx n\ln n - n + \frac12\ln(2\pi n), how many decimal digits does 100!100! have? You may use ln⁡10=2.303\ln 10 = 2.303. What does (n!)1/n/n(n!)^{1/n}/n tend to as nn grows?

Answer

Answer to Question 32.12.

100!100! has 158 digits, and the limit is 1e≈0.368\frac1e \approx 0.368.

With n=100n = 100, nln⁡n=100×4.605=460.5n\ln n = 100 \times 4.605 = 460.5. Subtracting 100 gives 360.5360.5. And 12ln⁡(628)=3.22\frac12\ln(628) = 3.22, so ln⁡100!≈363.7\ln 100! \approx 363.7. Dividing by 2.3032.303 gives about 157.9157.9. Its whole part is 157, so 100!100! has 158 digits. An exact product confirms it: 100!≈9.3×10157100! \approx 9.3 \times 10^{157}.

The answer is close to the next power of ten, so a careful estimate matters here: the 12ln⁡(2πn)\frac12\ln(2\pi n) term is essential.

For the limit, 1nln⁡n!≈ln⁡n−1\frac1n\ln n! \approx \ln n - 1. So (n!)1/n≈ne(n!)^{1/n} \approx \frac{n}{e}. This means that the geometric mean of 1,…,n1, \dots, n is about ne\frac{n}{e}, against the arithmetic mean of about n2\frac{n}{2}.

Classic wrong answer. Dropping the small term and getting 360.52.303=156.5\frac{360.5}{2.303} = 156.5, so 157 digits. This is too low by one.