The Interview Book · Careers
16Stochastic Calculus
“What is ?” The candidate writes and stops. The interviewer asks for the expectation of , and the missing term appears on its own: integrating the candidate’s answer gives a quantity of zero expectation, while is non-negative and not identically zero. Stochastic calculus questions are asked mostly of bank quants and researchers, and they test a short list of reflexes: Itô’s formula with its second-order term, martingales and optional stopping, the reflection principle, a change of measure, and the link between an expectation and a partial differential equation. The theory is One Quant Book 4’s (chapters 2 to 5); this chapter is its use at the whiteboard.
16.1 Itô’s formula as a calculation rule
For a twice differentiable and a Brownian motion , . For an Itô process the second-order term is . The rule to remember is that : the quadratic variation of Brownian motion is not negligible (One Quant Book 4, chapter 3).
Method 16.1 (Is it a martingale?)
- Apply Itô’s formula to the process.
- Collect the terms: the process is a local martingale exactly when they vanish.
- For a true martingale check integrability (for example, bounded coefficients on , or Novikov’s condition for exponentials).
- If there is a drift, subtract its integral: and are martingales.
Example 16.2 (The exponential martingale and the lognormal median)
has drift : it is a martingale, and . For , , so the mean of grows at and its median at . With and over ten years the mean is times the start and the median : half the paths end below where they began.
16.2 Martingales, hitting times and the reflection principle
Exit problems for Brownian motion reduce to optional stopping on the right martingale, exactly as for the random walk of Chapter 11.
Proposition 16.3 (Exit from an interval)
For from 0, the probability of hitting before is if and otherwise; for , the expected exit time is .
Proof. and are martingales when ; is one otherwise. Optional stopping at the exit time, which has finite expectation, gives the results. ∎
Proposition 16.4 (Reflection principle)
For , .
Proof. Reflect the path after it first reaches : by the strong Markov property the reflected path is again a Brownian motion, and it ends above exactly when the original ends below; the paths that reach split evenly between ending above and below (One Quant Book 4, chapter 2). ∎
fig_iv_reflect.py.The reflection principle gives the law of the running maximum and of the first hitting time; it also explains why a Monte Carlo price of a barrier option monitored on a coarse grid is biased (Figure 16.1), which is the kind of observation an interviewer rewards.
16.3 Changes of measure in one line
Girsanov’s theorem (One Quant Book 4, chapter 5) says that under the measure with density the process is a Brownian motion. In an interview it is used to move a drift: with and a rate , the choice (the market price of risk) makes the discounted price a martingale, which is the risk-neutral measure. Choosing the stock as numeraire instead gives the measure under which the asset-or-nothing digital is priced.
Example 16.5 (Two digitals by two measures)
A cash-or-nothing digital paying 1 if is worth (the risk-neutral probability), and an asset-or-nothing digital paying if is worth (the probability under the stock measure). A call is the difference: asset-or-nothing minus cash-or-nothing, which is the Black–Scholes formula read off in one line (One Quant Book 5, chapter 3).
16.4 From an SDE to a PDE and back
The Feynman–Kac formula links expectations and PDEs: if , then solves with (One Quant Book 4, chapter 4, on the generator). Interviews use it in both directions: to guess a solution of a PDE as an expectation, and to check an expectation by plugging it into the PDE.
Method 16.6 (Checking a proposed expectation)
- Write the generator of the process: .
- Check that the proposed satisfies and the terminal condition.
- Check a limit: at , or for , the answer must reduce to the obvious one.
16.5 Worked answers
Example 16.7 (A mean-reverting spread)
“A spread follows with a day and basis point per square-root day. What are its half-life and its long-run standard deviation?” The mean obeys , so it decays as and halves in days. For the variance, Itô’s formula on gives , whose stationary point is , a standard deviation of basis points. The two numbers are what a pairs trader sizes and times entries with: a spread two standard deviations out, 4.5 basis points, is expected to be halfway back in a week. Check: as the stationary variance blows up, as it must for a random walk.
Example 16.8 (How long a driftless P&L stays under water)
“A strategy’s cumulative P&L is a driftless Brownian motion started at zero. What is the chance it spends at least 90% of the year below zero?” By Lévy’s arcsine law, the fraction of spent positive has distribution function , so the chance of at most 10% of the time positive is . One in five worthless strategies, or skilful strategies with no edge this year, spend nine-tenths of the year under water, and as many spend nine-tenths above it. The density piles up at the ends, not in the middle: long spells on one side are the rule for a random walk, which is why a run of good months says less than it feels.
16.6 Question bank
Interview question 16.1 ★ bank, researcher • bank
Compute and use it to find .
Solution
Solution of Interview question 16.1.
. Integrating and taking expectations, the stochastic integral has mean zero, so . Without the term the answer would be zero, which is impossible for a non-negative variable.
What the interviewer is looking for: the second-order Itô term and the sanity check that exposes its absence.
Interview question 16.2 ★ bank, researcher • bank
Is a martingale? If not, what must be subtracted to make it one?
Solution
Solution of Interview question 16.2.
: the drift is not zero, so it is not a martingale. is (its differential is , and the integrand is square-integrable).
What the interviewer is looking for: reading the drift off Itô’s formula and compensating it.
Interview question 16.3 ★ researcher, trader • systematic fund
What is the probability that a Brownian motion is positive at both and ?
Solution
Solution of Interview question 16.3.
is Gaussian with correlation . For a centred bivariate normal, . A simulation of 400 000 pairs agrees.
What the interviewer is looking for: the correlation of Brownian values and the orthant probability.
Interview question 16.4 ★ bank • bank
What is the distribution of ?
Solution
Solution of Interview question 16.4.
It is a linear functional of a Gaussian process, so Gaussian, with mean 0 and variance
(Equivalently, by integration by parts, whose variance is .)
What the interviewer is looking for: Gaussianity and the covariance integral, or the integration-by-parts representation.
Interview question 16.5 ★★ bank, researcher • market maker
Starting from 0, what is the chance that a Brownian motion hits before , and how long does it take on average to hit either?
Solution
Solution of Interview question 16.5.
By Proposition 16.3, , and .
What the interviewer is looking for: optional stopping on and on .
Interview question 16.6 ★★ researcher, trader • systematic fund
. What is the chance it hits before ?
Solution
Solution of Interview question 16.6.
With , , : . The martingale is .
What the interviewer is looking for: the exponential martingale for a drifted walk.
Interview question 16.7 ★★ bank, risk • bank
What is the probability that a standard Brownian motion exceeds 1 at some time in ? A Monte Carlo with 50 steps gives a smaller number; why, and how do you fix it without more steps?
Solution
Solution of Interview question 16.7.
. A discrete simulation checks the maximum only at the grid points and misses excursions between them, so it underestimates (Figure 16.1). Fix it with a Brownian-bridge correction: between two grid values below the barrier, the path crosses with probability ; draw that event, and the estimate is unbiased on any grid.
What the interviewer is looking for: the reflection principle, the direction of the discretisation bias and the bridge correction.
Interview question 16.8 ★★ trader, risk • asset manager
A stock follows geometric Brownian motion with drift 8% and volatility 40%. Over ten years, find the expected value and the median of its price relative to today. What do you tell an investor who hears only the first number?
Solution
Solution of Interview question 16.8.
Mean ; median . The mean is carried by a minority of very good paths; the typical investor ends where she started. Quote the median and a range, not the mean.
What the interviewer is looking for: the correction and its practical meaning.
Interview question 16.9 ★★ bank • bank
A stock has drift 8% and volatility 20% and the rate is 3%. What change of measure makes the discounted stock a martingale, and what is the drift of under it?
Solution
Solution of Interview question 16.9.
Take and . Under , is a Brownian motion, so has drift , and .
What the interviewer is looking for: the market price of risk as the Girsanov kernel.
Interview question 16.10 ★★★ bank, trader • bank
With , , and zero rates, price the cash-or-nothing digital paying 1 and the asset-or-nothing digital paying if . Deduce the call price.
Solution
Solution of Interview question 16.10.
, . Cash-or-nothing: . Asset-or-nothing: . Call , the Black–Scholes value (and close to ).
What the interviewer is looking for: digitals under two measures and their difference as the call.
Interview question 16.11 ★★★ bank, researcher • bank
Solve with by writing as an expectation, and check it.
Solution
Solution of Interview question 16.11.
By Feynman–Kac with , . Check: , , sum 0; and .
What the interviewer is looking for: writing the solution as an expectation and verifying it in the PDE.
Interview question 16.12 ★★★ researcher, bank • systematic fund
For with , what is the expected time to reach ? What happens as , and is that consistent with Brownian motion reaching with probability one?
Solution
Solution of Interview question 16.12.
and is a martingale; optional stopping (with for ) gives , so . As the expectation tends to infinity: driftless Brownian motion reaches with probability one, but its hitting time has infinite mean (its density decays like ). Certain and fast are different things.
What the interviewer is looking for: Wald for Brownian motion with drift and the heavy tail of the driftless hitting time.
Interview question 16.13 ★★★ researcher, bank • any
Let be the first time hits 1. Then , yet is a martingale started at 0. Why does optional stopping fail? Add a lower barrier at and recover a correct statement.
Solution
Solution of Interview question 16.13.
is finite almost surely but , and is not uniformly integrable (it can go arbitrarily negative before hitting 1), so the optional stopping theorem does not apply. With a lower barrier , the stopped process is bounded, optional stopping holds, and , so the chance of hitting 1 first is ; it tends to one as while the loss in the other case grows, which reconciles the two statements.
What the interviewer is looking for: the conditions of optional stopping and a bounded version that works.
Sources and further reading
- One Quant Book 4, chapters 2–5 (Brownian motion, Itô calculus, SDEs, Girsanov); One Quant Book 5, chapter 3 (Black–Scholes).
- I. Karatzas and S. E. Shreve, Brownian Motion and Stochastic Calculus, Springer, 1988.