Mathematical Modeling and Computation in Finance
With Exercises and Python and MATLAB Computer Codes
C.W. Oosterlee & L.A. Grzelak
Solutions to exercises from Chapter 2
https://QuantFinanceBook.com
Ex 2.1. a. Applying Itô’s lemma on g(t) = S 2 (t), gives us,
dg(t) = 2S(t)dS(t) + dS(t) · dS(t)
= g(t)(2µ + σ 2 )dt + 2g(t)σdW (t).
The dynamics of the process are given by,
2
g(t) = e(2µ−σ )t+2σW (t)
.
b. We find,
(ln 2)2 W (t)
dg(t) = ln 2 · 2W (t) dW (t) + 2 dt.
2
Due to the appearance of a drift term, the process is not a martingale.
Ex. 2.3. Let X(t), Y (t) be stochastic variables. Then, we have,
(X(tk+1 − X(tk ))(Y (tk+1 ) − Y (tk )) = X(tk+1 )Y (tk+1 ) − X(tk )Y (tk )
− X(tk )(Y (tk+1 ) − Y (tk ))
− Y (tk )(X(tk+1 ) − X(tk )).
Therefore, we have, with m time steps,
m
X
(X(tk+1 ) − X(tk ))(Y (tk+1 ) − Y (tk )) = X(tm )Y (tm ) − X(t1 )Y (t1 )
k=1
m
X
− X(tk )(Y (tk+1 ) − Y (tk ))
k=1
Xm
− Y (tk )(X(tk+1 ) − X(tk )).
k=1
With the time step, ∆t → 0, the discrete sums become Itô integrals, leading to the requested
form.
Ex. 2.5. We have
Z ∞
E[S(t)] = sf (s)ds,
0
where f (s) is the lognormal density function. Hence,
Z ∞
−(log (s/S0 ) − (µ − σ 2 /2)t)2
1
E[S(t)] = √ exp ds.
σ 2πt 0 2σ 2 t
1
With a change of variables, s = S0 ex , it follows that,
Z ∞
−(x − (µ − σ 2 /2)t)2
S0
E[S(t)] = √ ex exp dx
σ 2πt −∞ 2σ 2 t
2
S0 e(µ−1/2σ )t ∞ x −x2
Z
= √ e exp dx
σ 2πt −∞ 2σ 2 t
Z ∞
S0 eµt −x2
= √ exp dx
σ 2πt −∞ 2σ 2 t
S0 eµt ∞
2
−x
Z
= √ exp dx
σ 2π −∞ 2σ 2
= S0 eµt .
This result is the same when using the moment generating function. Furthermore,
Z ∞
S02 −(x − (µ − σ 2 /2)t)2
2x
Var[S(t)] = √ e exp dx − (S0 eµt )2
σ 2πt −∞ 2σ 2 t
2
S02 e2(µ−σ /2)t ∞ 2x −x2
Z
= √ e exp dx − (S0 eµt )2
σ 2πt −∞ 2σ 2 t
2
S 2 e2(µ+σ /2)t ∞ −x2
Z
= 0 √ exp dx − (S0 eµt )2
σ 2πt −∞ 2σ 2 t
2
= S02 e2µt eσ t − 1 .
Once again, it is possible to check this result using the moment generating function.
Ex. 2.7. By definition,
FS (x) = P[S ≤ x] = P[log S ≤ log x] = FX (log x).
Hence,
FS (x) = FX (log x).
d
The probability density function is defined as fS (x) := dx FS (x). Hence, by taking derivatives
at both sides, we find,
1
fS (x) = fX (log x),
x
which completes the proof.
Ex. 2.9. One can approach this exercise in two ways. First of all, one can find the expressions
for X(t), Y (t) and combine them to determine Z(t). The other approach is based on the
dynamics of Z(t) in its differential form by means of Itô’s lemma. We solve the problem by
the first approach and check the result using the second.
a.
σ2
X(t) = eσW (t)− 2 t+0.04t
,
dX(t) = 0.04X(t)dt + σX(t)dW (t).
0.152
Y (t) = e0.15W (t)− 2 t+βt
,
dY (t) = βY (t)dt + 0.15Y (t)dW (t).
Using the expressions for X(t) and Y (t), we get,
0.152 2
−β− σ2 )t
Z(t) = 2e(σ−0.15)W (t)+(0.04+ 2 − λt.
2
b. A martingale process does not contain a drift term. We have,
dZ(t) = (Z + λt)(0.152 + 0.04 − β − 0.15σ)dt − λdt + (Z + λt)(σ − 0.15)dW (t).
With β and σ constant, and λ ∈ R+ , necessary conditions for a vanishing drift term
are λ = 0 and
0.152 + 0.04 − β − 0.15σ = 0 =⇒ β = 0.04 − 0.15σ + 0.152 .
To check this result we employ the Itô’s derivative rules for multivariable functions,
i.e.,
dX(t) X(t)dY (t) dX(t)dY (t) X(t)dY 2 (t)
dZ(t) = 2 − − + − λdt
Y (t) Y 2 (t) Y 2 (t) Y 3 (t)
= (Z(t) + λt) (0.04 − β − 0.15σ + 0.152 )dt + (σ − 0.15)dW (t) − λdt,
which yields the same constraints. Hence, λ = 0 and β = 0.04 − 0.15σ + 0.152 .