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

Interviews I: Maths, Probability and Speed

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

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

30Timed Test 7

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

Section A — 6 questions, 40 minutes

Question 30.1

You keep rolling a fair die. On average, how many rolls does it take to see both a 1 and a 2? What is it until you have seen all three even faces?

Answer

Answer to Question 30.1.

The first is 9 rolls, and the second is 11.

The wait splits into stages. At first, either of the 2 wanted faces will do, so the wait is 62=3\frac62 = 3. Then one face is left, and the wait is 6. The sum is 9.

For three faces, the stages are 63+62+61=2+3+6=11\frac63 + \frac62 + \frac61 = 2 + 3 + 6 = 11.

An exact recursion and a simulation agree. The last face takes more than half of the wait here. It takes the largest single share in any collecting problem, though less than half once you want four faces or more.

A second route for the first figure uses inclusion–exclusion on the maximum of two waits: 6+6−3=96 + 6 - 3 = 9, where 3 is the wait for the first of the two.

Classic wrong answer. Adding the separate waits, 6+6=126 + 6 = 12, which double-counts the rolls during which both faces are still missing.

Question 30.2

A coin with probability of heads 0.10.1 is flipped 10 times. What is the probability of an even number of heads? You may use 0.810≈0.1070.8^{10} \approx 0.107.

Answer

Answer to Question 30.2.

The probability is about 0.5540.554.

Expand (q+p)n(q + p)^n and (q−p)n(q - p)^n. Adding them cancels the odd powers of pp, so

P(even)=1+(1−2p)n2=1+0.8102=0.5537.P(\text{even}) = \frac{1 + (1 - 2p)^n}{2} = \frac{1 + 0.8^{10}}{2} = 0.5537.

Limits: at p=12p = \frac12 the formula gives exactly 12\frac12, and at p=0p = 0 it gives 1, since 0 heads is even. As nn grows, it tends to 12\frac12 for any pp strictly between 0 and 1. An exact binomial sum confirms the value.

The same result follows from a recursion: a parity bias of bn=P(even)−P(odd)b_n = P(\text{even}) - P(\text{odd}) satisfies bn+1=(1−2p)bnb_{n + 1} = (1 - 2p)b_n, with b0=1b_0 = 1.

Classic wrong answer. Summing the even binomial terms by hand and stopping after a few, which is slow and stops short of the value: the terms for 0 and 2 heads give only 0.540.54.

Question 30.3

XX and YY each have variance 1, and their correlation is 12\frac12. What is the variance of X+2YX + 2Y? What is the slope in a regression of YY on X+YX + Y?

Answer

Answer to Question 30.3.

The variance is 7, and the slope is 12\frac12.

Expanding,

Var⁡(X+2Y)=1+4+2×2×12=7.\operatorname{Var}(X + 2Y) = 1 + 4 + 2 \times 2 \times \frac12 = 7.

The slope is Cov⁡(Y,X+Y)/Var⁡(X+Y)\operatorname{Cov}(Y, X + Y)/\operatorname{Var}(X + Y). The covariance is 12+1=32\frac12 + 1 = \frac32, and the variance is 1+1+1=31 + 1 + 1 = 3. So the slope is 12\frac12.

There is a second route by symmetry. The slopes of XX and of YY on X+YX + Y add up to 1, since X+YX + Y regressed on itself has slope 1. And XX and YY have the same variance, so the two slopes are equal. That gives 12\frac12 for any correlation. A simulation confirms it.

Classic wrong answer. Leaving a factor out of the cross term. It is 2Cov⁡(X,2Y)=2×2×12=22\operatorname{Cov}(X, 2Y) = 2 \times 2 \times \frac12 = 2, and an answer of 6 means that a factor of 2 was dropped.

Question 30.4

Two fair dice show XX and YY. What is the expected value of max⁡(X−Y,0)\max(X - Y, 0)?

Answer

Answer to Question 30.4.

The expected value is 3536≈0.97\frac{35}{36} \approx 0.97.

By symmetry, Emax⁡(X−Y,0)=12E∣X−Y∣\mathbb{E}\max(X - Y, 0) = \frac12\mathbb{E}|X - Y|. The differences of 1, 2, 3, 4 and 5 have 10, 8, 6, 4 and 2 of the 36 outcomes. So

E∣X−Y∣=10+16+18+16+1036=7036.\mathbb{E}|X - Y| = \frac{10 + 16 + 18 + 16 + 10}{36} = \frac{70}{36}.

Half of this is 3536\frac{35}{36}. An enumeration of the 36 outcomes confirms it.

This is the value of a very small option: you receive the excess of one die over the other, and at the money it has a positive value even though E(X−Y)=0\mathbb{E}(X - Y) = 0.

Classic wrong answer. Answering 0, because X−YX - Y has mean 0. The maximum drops the negative values, and so a mean of 0 gives no such shortcut.

Why it matters. It is the plain form of the point behind every option: convexity turns variance into value.

Question 30.5

Two fair dice are rolled. Given that at least one shows a 6, what is the probability that both do? If instead you know that the first die shows a 6, what is the probability that both do?

Answer

Answer to Question 30.5.

The first is 111\frac{1}{11}, and the second is 16\frac16.

Out of the 36 outcomes, 11 have at least one 6, and only one has two. That gives 111\frac{1}{11}.

If the first die is known, the other is independent, and the chance is 16\frac16.

The difference lies in what is known: “at least one” keeps 11 equally likely outcomes, and “this one” keeps 6. An enumeration gives the same.

Which reading applies depends on how the information came. If you asked someone “is there a 6?”, the first applies. If you saw one die, the second does. In practice, that step decides the answer, so it is worth asking aloud.

Classic wrong answer. Saying 16\frac16 for both, on the grounds that the other die is independent. In the first case, there is no “other die” to point to.

Question 30.6

A 2 by 2 matrix has four entries, each independently 0 or 1 with equal probability. What is the probability that it is invertible over the real numbers?

Answer

Answer to Question 30.6.

The probability is 38\frac38.

The determinant ad−bcad - bc is zero when ad=bcad = bc. Each product is 1 in one case out of 4.

Both products are 0 in 3×3=93 \times 3 = 9 of the 16 matrices, and both are 1 in 1 more. So 10 matrices are singular, and 6 are invertible, which gives 616\frac{6}{16}.

An enumeration of all 16 gives the same. Over the reals, the 6 are those with exactly one of the two products equal to 1. As the size grows, the chance of singularity for random binary matrices goes to 0, so this low chance is a small-size effect.

Classic wrong answer. Assuming that random matrices are almost always invertible. That holds for continuous entries. With binary entries, the coincidence ad=bcad = bc is common.

Section B — 6 questions, 60 minutes

Question 30.7

A bag holds three coins: one fair, one with two heads, and one with heads probability 34\frac34. You draw one at random and flip it twice, getting two heads. What is the probability that the next flip of the same coin is a head?

Answer

Answer to Question 30.7.

The probability is 99116≈0.853\frac{99}{116} \approx 0.853.

The likelihoods of two heads are 14\frac14, 1 and 916\frac{9}{16}. Multiplied by 16, they are 4, 16 and 9, for a total of 29. So the posterior weights are 429\frac{4}{29}, 1629\frac{16}{29} and 929\frac{9}{29}.

The next flip is a head with chance

4⋅12+16⋅1+9⋅3429=24.7529=99116.\frac{4 \cdot \frac12 + 16 \cdot 1 + 9 \cdot \frac34}{29} = \frac{24.75}{29} = \frac{99}{116}.

A simulation agrees. Before any flips, the chance was 2.253=34\frac{2.25}{3} = \frac34. Two heads raise it to 0.8530.853, a sensible move because evidence favours the two-headed coin but cannot rule the others out.

Classic wrong answer. Taking the most likely coin and answering 1. The posterior is a weighting of all three coins.

Follow-up. What if the two flips were H, T? The two-headed coin is out. The weights are 14\frac14 and 316\frac{3}{16}, so 4 and 3, and the next head has chance 4⋅12+3⋅347=1728\frac{4 \cdot \frac12 + 3 \cdot \frac34}{7} = \frac{17}{28}.

Question 30.8

A light bulb’s life is uniform on [0,2][0, 2] years. Each bulb is replaced as soon as it fails, and this has gone on for a long time. At a random moment, what is the expected age of the bulb in use? What is the expected total life of that bulb?

Answer

Answer to Question 30.8.

The expected age is 23\frac23, and the expected total life is 43\frac43.

A random moment is more likely to fall in a long life. A bulb with life ℓ\ell is seen with weight proportional to ℓ\ell. So the bulb in use has an expected life of

EL2EL=4/31=43,\frac{\mathbb{E}L^2}{\mathbb{E}L} = \frac{4/3}{1} = \frac43,

which is above the plain mean of 1.

Within that bulb’s life, the moment is uniform, so the expected age is half the life: 23\frac23. And the expected remaining life is also 23\frac23. A simulation of a long series of bulbs agrees.

Classic wrong answer. Answering 1 and 12\frac12. These use a typical bulb, but sampling at a random moment picks the longer ones.

Why it matters. The same effect makes a passenger wait longer than half of the average bus gap.

Question 30.9

ZZ is standard normal. Using φ(1)=0.242\varphi(1) = 0.242 and P(Z>1)=0.159P(Z > 1) = 0.159, find E[Z∣Z>1]\mathbb{E}[Z \mid Z > 1]. A loss distribution is normal with mean 0 and volatility 1. Given the 99% quantile 2.3262.326 and φ(2.326)=0.0267\varphi(2.326) = 0.0267, what is the expected shortfall at 99%?

Answer

Answer to Question 30.9.

E[Z∣Z>1]≈1.52\mathbb{E}[Z \mid Z > 1] \approx 1.52, and the expected shortfall is about 2.672.67.

For a standard normal, φ′(z)=−zφ(z)\varphi^\prime(z) = -z\varphi(z), which gives ∫a∞zφ(z) dz=φ(a)\int_a^\infty z\varphi(z)\,dz = \varphi(a). So

E[Z∣Z>a]=φ(a)P(Z>a).\mathbb{E}[Z \mid Z > a] = \frac{\varphi(a)}{P(Z > a)}.

At a=1a = 1, this is 0.2420.159=1.52\frac{0.242}{0.159} = 1.52.

The expected shortfall is the same formula at the quantile: 0.02670.01=2.67\frac{0.0267}{0.01} = 2.67. It is only about 15%15\% above the value at risk here, as the tail thins fast. A fatter tail gives a larger gap. A numerical integral confirms both.

A check at a=0a = 0: the formula gives 0.3990.5=0.80\frac{0.399}{0.5} = 0.80, which is the mean of ∣Z∣|Z|, as it should be.

Classic wrong answer. Dividing by the wrong tail, or quoting the quantile itself. The answer must be above aa, and that check catches the first error.

Question 30.10

A permutation of {1,2,3,4}\{1, 2, 3, 4\} is chosen at random. An inversion is a pair of positions i<ji < j whose values are out of order. Find the mean number of inversions, and its variance.

Answer

Answer to Question 30.10.

The mean is 3, and the variance is 136\frac{13}{6}.

Each of the (42)=6\binom42 = 6 pairs is out of order with chance 12\frac12. So the mean is 3.

For the variance, build the permutation by inserting elements in order. Element kk lands in one of kk positions, and adds a uniform number on {0,…,k−1}\{0, \dots, k - 1\} of inversions, independent of the earlier ones. A uniform on {0,…,k−1}\{0, \dots, k - 1\} has variance k2−112\frac{k^2 - 1}{12}. So

Var⁡=0+3+8+1512=2612=136.\operatorname{Var} = \frac{0 + 3 + 8 + 15}{12} = \frac{26}{12} = \frac{13}{6}.

An enumeration of the 24 permutations confirms it. The general result is n(n−1)(2n+5)/72n(n - 1)(2n + 5)/72. The insertion step removes all the covariances from the indicator route.

Classic wrong answer. Adding the pair variances, 6×14=326 \times \frac14 = \frac32. The pairs that share a position are not independent.

Question 30.11

XX and YY are standard normals with correlation 12\frac12. What is Emax⁡(X,Y)\mathbb{E}\max(X, Y)?

Answer

Answer to Question 30.11.

The expected value is 0.5π≈0.399\sqrt{\frac{0.5}{\pi}} \approx 0.399.

Write max⁡(X,Y)=X+Y2+∣X−Y∣2\max(X, Y) = \frac{X + Y}{2} + \frac{|X - Y|}{2}. The first term has mean 0. The difference X−YX - Y is normal with variance 2−2ρ=12 - 2\rho = 1.

For a normal with variance s2s^2, E∣⋅∣=s2/π\mathbb{E}|\cdot| = s\sqrt{2/\pi}. So the mean of the maximum is 122/π2−2ρ=(1−ρ)/π\frac12\sqrt{2/\pi}\sqrt{2 - 2\rho} = \sqrt{(1 - \rho)/\pi}. At ρ=12\rho = \frac12, this is 0.3990.399.

Limit checks: at ρ=1\rho = 1, the two are equal and the maximum has mean 0. At ρ=0\rho = 0, it is 1π=0.564\frac{1}{\sqrt\pi} = 0.564, the known value for two independent normals. A simulation returns 0.3990.399.

Classic wrong answer. Scaling the independent answer by 1−ρ1 - \rho, which gives 0.2820.282. The dependence runs through 1−ρ\sqrt{1 - \rho}.

Question 30.12

You roll 100 fair dice. Estimate the probability that the sum is at least 380, given that one die has variance 3512\frac{35}{12} and that P(Z>1.73)=0.042P(Z > 1.73) = 0.042 for a standard normal ZZ.

Answer

Answer to Question 30.12.

The probability is about 0.040.04.

The sum has mean 350 and variance 100⋅3512=291.7100 \cdot \frac{35}{12} = 291.7, so its standard deviation is about 17.117.1.

With the continuity correction, the threshold is 379.5379.5, and z=29.517.1=1.73z = \frac{29.5}{17.1} = 1.73. So P≈0.042P \approx 0.042. The sum of 100 dice is close enough to normal at this level, and an exact convolution gives the same to within 0.0010.001.

Without the correction, z=1.75z = 1.75, and the tail is 0.0400.040. For a quick answer, that is close enough, though the correction costs one extra step for the extra digit.

Classic wrong answer. Using a variance of 25, as for 100 coin flips. A die’s variance is near 3, which is a benchmark worth knowing.