Quantitative Finance · Book 18 · Careers

The Interview Book

The Interview Book · Careers

8Mental Arithmetic

Across the desk: “Seven per cent of 340 million, spread over 250 trading days, per day?” The answer, about 95 thousand, comes back in five seconds from the candidate who turned seven per cent over 250 days into 2.8 basis points a day, and 2.8 basis points of 340 million into 340 times 280; the one who started long multiplication in her head is still carrying digits. Speed in arithmetic is not a talent for carrying digits; it is a small set of rewrites that turn a hard calculation into an easy one, practised until they are automatic, and a habit of checking the result.

8.1 Products and squares

Most fast products use one of four rewrites. Each replaces a multiplication by one that is done in a step.

Method 8.1 (Four rewrites for products)

  1. Difference of squares: (a+d)(a−d)=a2−d2(a+d)(a-d) = a^2 - d^2 when the factors are equally spaced around a round number: 43×37=402−32=1 59143 \times 37 = 40^2 - 3^2 = 1\,591.
  2. Near a hundred: (100+a)(100+b)=100(100+a+b)+ab(100+a)(100+b) = 100(100 + a + b) + ab, valid for negative a,ba, b too: 103×108=11 100+24=11 124103 \times 108 = 11\,100 + 24 = 11\,124.
  3. Squares ending in 5: (10n+5)2=100 n(n+1)+25(10n + 5)^2 = 100\,n(n+1) + 25: 852=7 200+25=7 22585^2 = 7\,200 + 25 = 7\,225.
  4. Friendly factors: multiply by 25 as by 100 then divide by 4, by 125 as by 1000 then divide by 8, by 5 as by 10 then halve: 48×25=4 800/4=1 20048 \times 25 = 4\,800/4 = 1\,200.

A product of two numbers that fit none of these is split: 67×38=67×40−67×2=2 680−134=2 54667 \times 38 = 67 \times 40 - 67 \times 2 = 2\,680 - 134 = 2\,546. The choice of split is the skill: subtract from the nearest round number rather than add partial products.

8.2 Fractions, percentages and reciprocals

Desk arithmetic is mostly percentages of large numbers and conversions between rates. Three facts make it fast. A percentage is symmetric: a%a\% of bb equals b%b\% of aa, so 18% of 50 is 50% of 18, which is 9. A basis point is 10−410^{-4}, so a rate in basis points times a notional in millions is a number of hundreds of currency units: 2.8 basis points of 340 million is 2.8×340×100=95 2002.8 \times 340 \times 100 = 95\,200. And a small table of reciprocals turns every division by a small integer into a multiplication.

nn67891112131617
1/n1/n0.16670.14290.1250.11110.09090.08330.07690.06250.0588
Reciprocals worth knowing; 1/7=0.142857‾1/7 = 0.\overline{142857} repeats with period six and 1/19≈0.05261/19 \approx 0.0526 is the next one to learn.

8.3 Roots, logarithms and compounding

A square root near a known square is linear to first order: a2+d≈a+d/(2a)\sqrt{a^2 + d} \approx a + d/(2a), with an error below d2/(8a3)d^2/(8a^3) for d≥0d \ge 0. 103≈10+3/20=10.15\sqrt{103} \approx 10 + 3/20 = 10.15, against the true 10.1489. For logarithms, three values and one series cover most questions: ln⁡2≈0.693\ln 2 \approx 0.693, ln⁡3≈1.099\ln 3 \approx 1.099, ln⁡10≈2.303\ln 10 \approx 2.303, and ln⁡(1+x)=x−x2/2+x3/3−…\ln(1 + x) = x - x^2/2 + x^3/3 - \dots for small xx.

Definition 8.2 (Rule of 72)

The rule of 72 approximates the number of periods an amount takes to double at a rate of rr per cent a period, compounded once a period, by 72/r72/r. The exact doubling time is ln⁡2/ln⁡(1+r/100)\ln 2 / \ln(1 + r/100).

Proposition 8.3 (Where the rule of 72 is exact)

The rule of 72 is exact at a rate of about 7.85%, overestimates the doubling time below it and underestimates above it. The rule of 70 is exact near 2%. The rule of 69.3 is exact for continuously compounded rates (100ln⁡2≈69.3100\ln 2 \approx 69.3) and always underestimates for rates compounded once a period.

Proof. ln⁡(1+x)<x\ln(1 + x) < x for x>0x > 0, so ln⁡2/ln⁡(1+x)>ln⁡2/x\ln 2/\ln(1+x) > \ln 2/x, which is the last statement. The numerator 72 exceeds 100ln⁡2100 \ln 2 to compensate for ln⁡(1+x)<x\ln(1+x) < x; the two effects balance where 72/(100x)=ln⁡2/ln⁡(1+x)72/(100x) = \ln 2/\ln(1+x), solved numerically at x≈0.0785x \approx 0.0785, and the relative error is monotone in xx (Figure 8.1). ∎

Relative error of three rules for the doubling time against the exact 2/ (1+r), for rates compounded once a period. The rule of 72 crosses zero near 7.85%, the rule of 70 near 2%; the rule of 69.3 is always below. Data: fig_iv_rule72.py.
Figure 8.1. Relative error of three rules for the doubling time against the exact ln⁡2/ln⁡(1+r)\ln 2/\ln(1+r), for rates compounded once a period. The rule of 72 crosses zero near 7.85%, the rule of 70 near 2%; the rule of 69.3 is always below. Data: fig_iv_rule72.py.

Example 8.4 (Compounding by logarithms)

1.0310=e10ln⁡1.031.03^{10} = e^{10\ln 1.03}, and ln⁡1.03≈0.03−0.00045=0.02955\ln 1.03 \approx 0.03 - 0.00045 = 0.02955, so the exponent is about 0.2955 and the result about e0.3e−0.0045≈1.350×0.9955≈1.344e^{0.3} e^{-0.0045} \approx 1.350 \times 0.9955 \approx 1.344.

8.4 Checking an answer

A fast answer is useful only if it is checked as fast. Three checks cost a second each: the order of magnitude (count the digits, or compare with a round product), the last digit (it is the last digit of the product of the last digits), and the residue modulo 9.

Definition 8.5 (Casting out nines)

Casting out nines checks an integer calculation by replacing each number with the remainder of its digit sum on division by 9, which is the number’s residue modulo 9, and checking that the calculation holds for the residues.

A product passes if the residues of the factors multiply to the residue of the result: 5 8245\,824 has digit sum 19, residue 1. The check fails to see errors that change the result by a multiple of 9, including the commonest slip, the transposition of two digits (Interview question 8.9): a passed check is evidence, a failed check is proof.

8.5 Worked answers

Example 8.6 (A P&L in mixed units)

“You bought 1 250 contracts; each tick is worth 12.50; the market moved three ticks in your favour. What did you make?” Both factors are eighths of powers of ten: 1 250=10 000/81\,250 = 10\,000/8 and 12.5=100/812.5 = 100/8, so 1 250×12.5=106/64=15 6251\,250 \times 12.5 = 10^6/64 = 15\,625, and three ticks make 46 87546\,875. Check: the answer lies between 1 000×10×3=30 0001\,000 \times 10 \times 3 = 30\,000 and 1 300×13×3=50 7001\,300 \times 13 \times 3 = 50\,700, and closer to the top because both factors were rounded down by more than they were rounded up. Saying the bounds takes three seconds and catches a slipped zero.

Example 8.7 (Fees on a fund’s return)

“A fund charges 2% of starting assets and 20% of the gain above that fee. It made 12% before fees. What did the investor make, and what gross return would net 10%?” On 100: the fee takes 2, leaving a gain of 10, of which 20% is 2, so the investor nets 8%. In general the net is 0.8(g−2)0.8(g - 2) for a gross gain of gg per 100, so netting 10 needs g−2=12.5g - 2 = 12.5: a gross return of 14.5%. Check: at g=2g = 2 the investor nets zero and the fund keeps everything, which is what the formula says. Fee structures differ in the order of the two fees and in hurdles; state the one assumed.

Example 8.8 (From a monthly to a yearly return)

“A strategy returns 1.5% a month. What is that compounded over a year?” Take logarithms: ln⁡1.015≈0.015−0.0152/2=0.0148875\ln 1.015 \approx 0.015 - 0.015^2/2 = 0.0148875; twelve months give 0.178650.17865; then e0.17865≈1+0.17865+0.01596+0.00095≈1.1956e^{0.17865} \approx 1 + 0.17865 + 0.01596 + 0.00095 \approx 1.1956, so about 19.6% a year, against 18% for the simple sum. The exact value is 1.01512=1.195621.015^{12} = 1.19562 to five decimals. Check: compounding must add something to 12×1.5%=18%12 \times 1.5\% = 18\%, and the excess, about (122)×0.0152≈1.5%\binom{12}{2} \times 0.015^2 \approx 1.5\%, matches the first cross term.

8.6 Question bank

Interview question 8.1 ★ trader • market maker

47×5347 \times 53.

Solution

Solution of Interview question 8.1.

47×53=502−32=2 500−9=2 49147 \times 53 = 50^2 - 3^2 = 2\,500 - 9 = 2\,491.

What the interviewer is looking for: spotting the difference of squares at once.

Interview question 8.2 ★ trader • market maker

96×10496 \times 104 and 98×9798 \times 97.

Solution

Solution of Interview question 8.2.

96×104=1002−42=9 98496 \times 104 = 100^2 - 4^2 = 9\,984. 98×97=100(100−2−3)+(−2)(−3)=9 500+6=9 50698 \times 97 = 100(100 - 2 - 3) + (-2)(-3) = 9\,500 + 6 = 9\,506.

What the interviewer is looking for: the near-hundred rewrite, including negative offsets.

Interview question 8.3 ★ trader, risk • proprietary firm

65265^2, and without writing anything, 752−65275^2 - 65^2.

Solution

Solution of Interview question 8.3.

652=100×6×7+25=4 22565^2 = 100 \times 6 \times 7 + 25 = 4\,225. 752−652=(75−65)(75+65)=10×140=1 40075^2 - 65^2 = (75 - 65)(75 + 65) = 10 \times 140 = 1\,400.

What the interviewer is looking for: the squares-ending-in-5 rule and factoring a difference of squares rather than computing both.

Interview question 8.4 ★ trader, bank • bank

12.5% of 360, then 36% of 25.

Solution

Solution of Interview question 8.4.

12.5% is 18\tfrac18: 360/8=45360/8 = 45. 36% of 25 is 25% of 36: 9.

What the interviewer is looking for: percentages as fractions, and the symmetry of a percentage.

Interview question 8.5 ★ trader, researcher • any

37\tfrac37 and 513\tfrac5{13} as decimals to three places.

Solution

Solution of Interview question 8.5.

37=3×0.142857≈0.429\tfrac37 = 3 \times 0.142857 \approx 0.429. 513=5×0.0769≈0.385\tfrac5{13} = 5 \times 0.0769 \approx 0.385.

What the interviewer is looking for: a reciprocal table used as multiplication.

Interview question 8.6 ★★ researcher, trader • any

50\sqrt{50} to four decimal places, with a bound on your error.

Solution

Solution of Interview question 8.6.

49+1≈7+114≈7.0714\sqrt{49 + 1} \approx 7 + \tfrac1{14} \approx 7.0714, with error below 1/(8×343)≈0.000361/(8 \times 343) \approx 0.00036; the true value is 7.07117.0711, so the estimate is 0.00030.0003 high, inside the bound. (A second-order term, −1/(8×343)-1/(8 \times 343), corrects it to 7.07117.0711.)

What the interviewer is looking for: linearisation around a known square and a stated error bound.

Interview question 8.7 ★★ trader, bank • bank

By the rule of 72, how long does money take to double at 1%, 6% and 24% a year? Which of the three answers is furthest from the exact value, and in which direction?

Solution

Solution of Interview question 8.7.

The rule gives 72, 12 and 3 years; the exact values are 69.7, 11.9 and 3.22. The 24% answer is furthest in relative terms (about 7% short); the 1% answer is about 3.4% long. The rule overestimates below about 7.85% and underestimates above it (Proposition 8.3).

What the interviewer is looking for: the rule, the exact formula, and knowing the direction of the error.

Interview question 8.8 ★★ trader • market maker

A strategy earns 3.2 basis points on a daily turnover of 250 million. What does it earn a day, and in a year of 252 trading days?

Solution

Solution of Interview question 8.8.

3.2 basis points of 250 million is 3.2×250×100=80 0003.2 \times 250 \times 100 = 80\,000 a day; over 252 days, 80 000×252=20.1680\,000 \times 252 = 20.16 million.

What the interviewer is looking for: basis points of millions as hundreds, and a clean multiplication by 252 (250+2250 + 2).

Interview question 8.9 ★★ trader, developer • proprietary firm

Check 3 847×29=111 5633\,847 \times 29 = 111\,563 by casting out nines. A colleague wrote 111 653111\,653; does it pass? What does this tell you about the check?

Solution

Solution of Interview question 8.9.

Residues: 3 847→22→43\,847 \to 22 \to 4, 29→229 \to 2, product residue 8; 111 563→17→8111\,563 \to 17 \to 8: it passes, and it is right. 111 653111\,653 has the same digits, so the same residue: it passes too, and it is wrong. Casting out nines cannot see a transposition or any error by a multiple of 9; add the last-digit check (7×97 \times 9 ends in 3, which both pass) and a magnitude check, or recompute one partial product.

What the interviewer is looking for: the check and, more important, its blind spot.

Interview question 8.10 ★★ trader, risk • any

A price rises 20% then falls 20%. Where is it relative to its start? What fall, after a 25% rise, brings it back exactly?

Solution

Solution of Interview question 8.10.

1.2×0.8=0.961.2 \times 0.8 = 0.96: 4% below the start. After a 25% rise the price is 54\tfrac54 of the start, so a fall of 15\tfrac15, 20%, brings it back: 1.25×0.8=11.25 \times 0.8 = 1.

What the interviewer is looking for: multiplicative returns and the asymmetry of percentage moves.

Interview question 8.11 ★★★ trader, bank • bank

ln⁡1.07\ln 1.07 to four decimal places without a calculator, and from it the exact doubling time at 7% a year to two decimals.

Solution

Solution of Interview question 8.11.

ln⁡1.07=0.07−0.00245+0.000114−⋯≈0.0677\ln 1.07 = 0.07 - 0.00245 + 0.000114 - \dots \approx 0.0677 (to four decimals; the exact value is 0.067660.06766). The doubling time is 0.6931/0.06766≈10.240.6931/0.06766 \approx 10.24 years, against 10.29 from the rule of 72.

What the interviewer is looking for: three terms of the series and a clean division.

Interview question 8.12 ★★★ trader, researcher • market maker

1.03101.03^{10} to three decimal places.

Solution

Solution of Interview question 8.12.

10ln⁡1.03=10(0.03−0.00045+0.000009)≈0.295610 \ln 1.03 = 10(0.03 - 0.00045 + 0.000009) \approx 0.2956; e0.2956=e0.3e−0.0044≈1.3499×0.9956≈1.344e^{0.2956} = e^{0.3} e^{-0.0044} \approx 1.3499 \times 0.9956 \approx 1.344 (exactly 1.34391.3439).

What the interviewer is looking for: compounding through logarithms, with e0.3e^{0.3} known or derived.

Interview question 8.13 ★★★ trader • market maker

0.0625×4.8×1250.0625 \times 4.8 \times 125, in under ten seconds. Say the rewrite you used.

Solution

Solution of Interview question 8.13.

0.0625=1160.0625 = \tfrac1{16} and 4.8×125=6004.8 \times 125 = 600 (125 is 10008\tfrac{1000}8, and 4.8/8=0.64.8/8 = 0.6), so the product is 600/16=37.5600/16 = 37.5.

What the interviewer is looking for: recognising friendly factors before multiplying.

Interview question 8.14 ★★★ researcher, bank • any

Explain why the rule of 72 uses 72 rather than 69.3, and estimate the rate at which it is exact. Which rule would you use for continuously compounded rates?

Solution

Solution of Interview question 8.14.

For annual compounding the exact doubling time is ln⁡2/ln⁡(1+r)\ln 2/\ln(1 + r) and ln⁡(1+r)<r\ln(1+r) < r, so 69.3/r69.3/r is always too short; a larger numerator compensates, and 72 also has many divisors (2, 3, 4, 6, 8, 9, 12). The rule is exact where 72/(100r)=ln⁡2/ln⁡(1+r)72/(100r) = \ln 2/\ln(1+r), about r=7.85%r = 7.85\%: near the rates at which it is usually applied. For continuous compounding, ln⁡2/r\ln 2/r is exact, so the rule of 69.3.

What the interviewer is looking for: the source of the rule’s error and why its constant is a compromise.

Sources and further reading

  • The rules of the chapter are elementary; the error bound of the linearised square root is the Lagrange remainder of the Taylor series.
  • One Quant Book 1, chapter 7 (carry and P&L arithmetic); One Quant Book 2, chapter 3 (compounding conventions).

Terms defined in this chapter

See all 2333 terms in the glossary