MMF 2021 Final Exam 1 December 2016. This is a closed-book exam: no books, no notes, no calculators, no phones, no tablets, no computers (of any kind) allowed. Do NOT turn this page over until you are TOLD to start. Duration of the exam: 3 hours. The exam consists of 8 pages, including this one. Make sure you have all 8 pages. The exam consists of 5 questions. Answer all 5 questions in the exam booklets provided. The mark for each question is listed at the start of the question. Please fill-in ALL the information requested on the front cover of EACH exam booklet that you use. The exam was written with the intention that you would have ample time to complete it. You will be rewarded for concise well-thought-out answers, rather than long rambling ones. We seek quality rather than quantity. Moreover, an answer that contains relevant and correct information as well as irrelevant or incorrect information will be awarded fewer marks than one that contains the same relevant and correct information only. Write legibly. Unreadable answers are worthless. Page 1 of 8 pages.
1. [10 marks: 5 marks for each part] Consider the two expression where log is the natural logarithm to the base e. x + 1 x for x > 0 (1) log(x 2 + x) log(x 2 ) for x > 0 (2) Both of these expressions suffer from catastrophic cancellation when x is large. (a) For each expression, (1) and (2), find a mathematically equivalent expression that does not suffer from catastrophic cancellation. (b) Consider the two expressions you found in part (a) above. In each case, either i. explain why you believe your new expression in part (a) is accurate in a relative error sense when x is large (i.e., when the corresponding expression (1) or (2) is not accurate), or ii. briefly explain why you believe your new expression in part (a) is not accurate in a relative error sense when x is large and give a series that you can use to approximate the expression (1) or (2) that is accurate in a relative error sense when x is large. Briefly explain why you believe your series solution is accurate. Your explanations in parts (a) and (b) do not need to be a proofs just give a convincing explanation of why you believe your expressions are accurate or inaccurate in a relative error sense when x is large and specify what you mean by x is large in this context. Page 2 of 8 pages.
2. [5 marks] Let X Poisson(λ), a Poisson random variable with rate λ. Hence, λ λk P(X = k) = e k! for k = 0, 1, 2,... There are several ways to generate a Poisson random variable, but suppose we choose to use the inverse transform method (sometimes called the inverse CDF method). Write a MatLab-like program segment that uses the inverse transform method to generate a X Poisson(λ). You can use the MatLab function rand to generate U Unif[0, 1], a uniform random variable in the interval [0, 1]. Note: your program does not have to be syntactically correct MatLab. It just has to be close enough to MatLab so that it is clear what you want your program to do. Page 3 of 8 pages.
3. [5 marks] In the course lectures, we discussed the acceptance-rejection method for continuous random varaibles. However, you can extend the acceptance-rejection method to discrete random variables as follows. Suppose X is a discrete random variable with probability mass function (pmf) P(X = k) = p(k) for k = 0, 1, 2,... Assume there is another discrete random variable Y with pmf P(Y = k) = q(k) for k = 0, 1, 2,... In addition, assume you can generate a Y with pmf q and that there is a constant c < such that p(k) c q(k) for k = 0, 1, 2,... The acceptance-rejection method to generate a discrete random variable X with pmf p is as follows. 1. Generate a discrete random variable Y with pmf q. 2. Generate U Unif[0, 1] independent from Y. 3. If U p(y ) c q(y ) then Set X = Y and return X else Go to step 1 and repeat the procedure end if Prove that the random variable X returned by the algorithm above has pmf p. That is, prove P(X = k) = p(k) for k = 0, 1, 2,... Page 4 of 8 pages.
4. [10 marks: 5 marks for each part] Consider a European down-and-in call option for a stock with price S t which satisfies the SDE ds t = r S t dt + σ S t dw t (3) in the risk neutral world, where S 0 = 100 is the initial stock price at time t = 0, r = 0.02 is the risk-free interest rate, σ = 0.2 is the volatility, W t is a standard Brownian motion, T = 0.5 is the time to expiry, K = 100 is the strike price, and B = 80 is the barrier. The option payoff at time T is where and (S T K) + = max(s T K, 0). 1 {St B} (S T K) + { 1 if St B for some t [0, T ] 1 {St B} = 0 otherwise Standard Monte Carlo simulation will not work very well for pricing this option, because most of the sample paths will result in a payoff of 0. To improve the efficiency of the Monte Carlo simulation, consider using importance sampling. In particular, consider changing the SDE that generates the sample path S t from (3) to ds t = µ 1 S t dt + σs t dw t (4) for t [0, 0.25] and for t (0.25, T ], where, as specified above, T = 0.5. ds t = µ 2 S t dt + σs t dw t (5) (a) Discuss how you would choose µ 1 and µ 2 in the SDEs (4) and (5), respectively, so that a significant portion of the the Monte Carlo sample paths generated from (4) and (5) are in the money (i.e., have a positive payoff at time T ). (b) When we talked about importance sampling in class, we used the notation E f [h(x)] = h(x)f(x) dx = h(x) f(x) g(x) dx g(x) [ = E g h(x) f(x) ] g(x) For the importance sampling method described above, what are the functions h(x), f(x) and g(x)? Hint: x is a vector in this case, not a scalar as it is in Question 2 on Assignment 4. Suggestion: if there are some details of your method that you cannot work out, say what is required at that point. Page 5 of 8 pages.
5. [15 marks: 5 marks for each part] In this course this year, we considered numerical methods for PDEs in time and one space dimension. However, PDEs in time and several space dimensions arise frequently in mathematical finance. In previous years, we considered how to generalize our results for numerical methods for PDEs in time and one space dimension to PDEs in time and two space dimensions. We consider an example of this generalization briefly in this question. To this end, consider the Heat Equation in time and two space dimensions: u t (t, x, y) = u xx (t, x, y) + u yy (t, x, y) (6) for t (0, T ], x (0, 1) and y (0, 1), with initial condition u(0, x, y) = u 0 (x, y) (7) for x [0, 1] and y [0, 1] and homogeneous (i.e., zero) boundary conditions for t (0, T ] and y [0, 1] and u(t, 0, y) = u(t, 1, y) = 0 (8) u(t, x, 0) = u(t, x, 1) = 0 (9) for t (0, T ] and x [0, 1]. To ensure that the initial condition matches the boundary conditions, we also assume that for x [0, 1] and y [0, 1]. u 0 (0, y) = u 0 (1, y) = 0 u 0 (x, 0) = u 0 (x, 1) = 0 We can discretize the PDE (6) by letting t = T/K, x = 1/(M + 1) and y = 1/(N + 1), where K, M and N are positive integers. Then we can set u k m,n = u(k t, m x, n y) for k = 0, 1,..., K, m = 0, 1,..., M + 1, n = 0, 1,..., N + 1, and let ũ k m,n be our approximation to u k m,n computed by the Fully Implicit Method ũ k m,n ũ k 1 m,n t = ũk m+1,n 2ũ k m,n + ũ k m 1,n ( x) 2 + ũk m,n+1 2ũ k m,n + ũ k m,n 1 ( y) 2 (10) for k = 1, 2,..., K, m = 1, 2,..., M and n = 1, 2,..., N, where ũ 0 m,n = u 0 (m x, n y) (11) Page 6 of 8 pages.
for m = 0, 1,..., M + 1 and n = 0, 1,..., N + 1, for k = 1, 2,..., K and n = 0, 1,..., N + 1, for k = 1, 2,..., K and m = 0, 1,..., M + 1. ũ k 0,n = ũ k M+1,n = 0 (12) ũ k m,0 = ũ k m,n+1 = 0 (13) (a) Show that the Fully Implicit Method (10) with initial and boundary conditions (11) (13) is consistent with the Heat Equation (6) with initial and boundary conditions (7) (9) of order 1 in t and order 2 in x and y. That is, show that the truncation error associated with (10) is O( t) + O(( x) 2 ) + O(( y) 2 ). To show that the Fully Implicit Method (10) is stable, we first introduce some notation. The tensor product of two matrices A and B is defined to be the block matrix a 1,1 B a 1,2 B a 1,n B a 2,1 B a 2,2 B a 2,n B A B = (14)... a m,1 B a m,2 B... a m,n B where A is an m n matrix with elements a i,j for i = 1, 2,..., m and j = 1, 2,..., n. If B is an m n matrix with elements b i,j for i = 1, 2,..., m and j = 1, 2,..., n, then each a i,j B in A B is a block of elements of size m n (i.e., the same size as B) with element (i, j ) in this block being a i,j b i,j. Note that A B is of dimension m m n n. It is a straightforward computation to verify that, if A is an m n matrix, B is an m n matrix, C is an n p matrix and D is an n p matrix, then (A B)(C D) = (AC) (BD) (15) Since we can consider vectors to be matrices of dimension n 1, the result (15) can be extended to (A B)(u v) = (Au) (Bv) (16) where u is an n-vector and v is an n -vector. You don t have to prove either (15) or (16). Just accept that they are true. Page 7 of 8 pages.
(b) For each k = 0, 1,..., K, let ũ k = [ũ k 1,1, ũ k 2,1,..., ũ k M,1, ũ k 1,2, ũ k 2,2,..., ũ k M,2,..., ũ k 1,N, ũ k 2,N,..., ũ k M,N] T be the MN-vector we get by ordering the points in the first row of the x y grid from left to right, followed by the points in the second row of the x y grid ordered from left to right, and so on. Show that the Fully Implicit Method (10) can be written as ( I N I M t ( x) 2 I N A M t ( y) 2 A N I M ) ũ k = ũ k 1 where I M is the M M identity matrix, I N is the N N identity matrix, A M is the M M tridiagonal matrix with 2 on the main diagonal and 1 on the diagonal above the main diagonal as well as 1 on the diagonal below the main diagonal, and A N is the N N tridiagonal matrix with 2 on the main diagonal and 1 on the diagonal above the main diagonal as well as 1 on the diagonal below the main diagonal. In MatLab notation, e M = ones(m, 1); A M = spdiags([e M, 2 e M, e M ], 1 : 1, M, M); e N = ones(n, 1); A N = spdiags([e N, 2 e N, e N ], 1 : 1, N, N); (c) Use (17) (even if you were not able to prove it) as well as (16) to show that the Fully Implicit Method is stable for all t > 0, x > 0 and y > 0. [Hint: recall that the eigenvalues of A M and A N are all negative real numbers. (17) Have a Happy Holiday Page 8 of 8 pages.