**Contents**

**Cover**

**Half Title page**

**Title page**

**Copyright page**

**Chapter 0: Goals of this Book and Global Overview**

0.1 What is this Book?

0.2 Why has this Book been Written?

0.3 For Whom is this Book Intended?

0.4 Why should I Read this Book?

0.5 The Structure of this Book

0.6 What this Book does not Cover

0.7 Contact, Feedback and More Information

**Part I: The Continuous Theory of Partial Differential Equations**

**Chapter 1: An Introduction to Ordinary Differential Equations**

1.1 Introduction and Objectives

1.2 Two-Point Boundary Value Problem

1.3 Linear Boundary Value Problems

1.4 Initial Value Problems

1.5 Some Special Cases

1.6 Summary and Conclusions

**Chapter 2: An Introduction to Partial Differential Equations**

2.1 Introduction and Objectives

2.2 Partial Differential Equations

2.3 Specialisations

2.4 Parabolic Partial Differential Equations

2.5 Hyperbolic Equations

2.6 Systems of Equations

2.7 Equations Containing Integrals

2.8 Summary and Conclusions

**Chapter 3: Second-Order Parabolic Differential Equations**

3.1 Introduction and Objectives

3.2 Linear Parabolic Equations

3.3 The Continuous Problem

3.4 The Maximum Principle for Parabolic Equations

3.5 A Special Case: One-Factor Generalised Black–Scholes Models

3.6 Fundamental Solution and the Green’s Function

3.7 Integral Representation of the Solution of Parabolic PDEs

3.8 Parabolic Equations in One Space Dimension

3.9 Summary and Conclusions

**Chapter 4: An Introduction to the Heat Equation in One Dimension**

4.1 Introduction and Objectives

4.2 Motivation and Background

4.3 The Heat Equation and Financial Engineering

4.4 The Separation of Variables Technique

4.5 Transformation Techniques for the Heat Equation

4.6 Summary and Conclusions

**Chapter 5: An Introduction to the Method of Characteristics**

5.1 Introduction and Objectives

5.2 First-Order Hyperbolic Equations

5.3 Second-Order Hyperbolic Equations

5.4 Applications to Financial Engineering

5.5 Systems of Equations

5.6 Propagation of Discontinuities

5.7 Summary and Conclusions

**Part II: Finite Difference Methods: the Fundamentals**

**Chapter 6: An Introduction to the Finite Difference Method**

6.1 Introduction and Objectives

6.2 Fundamentals of Numerical Differentiation

6.3 Caveat: Accuracy and Round-off Errors

6.4 Where are Divided Differences used in Instrument Pricing?

6.5 Initial Value Problems

6.6 Nonlinear Initial Value Problems

6.7 Scalar Initial Value Problems

6.8 Summary and Conclusions

**Chapter 7: An Introduction to the Method of Lines**

7.1 Introduction and Objectives

7.2 Classifying Semi-Discretisation Methods

7.3 Semi-Discretisation in Space Using FDM

7.4 Numerical Approximation of First-Order Systems

7.5 Summary and Conclusions

**Chapter 8: General Theory of the Finite Difference Method**

8.1 Introduction and Objectives

8.2 Some Fundamental Concepts

8.3 Stability and the Fourier Transform

8.4 The Discrete Fourier Transform

8.5 Stability for Initial Boundary Value Problems

8.6 Summary and Conclusions

**Chapter 9: Finite Difference Schemes for First-Order Partial Differential Equations**

9.1 Introduction and Objectives

9.2 Scoping the Problem

9.3 Why First-Order Equations are Different: Essential Difficulties

9.4 A Simple Explicit Scheme

9.5 Some Common Schemes for Initial Value Problems

9.6 Some Common Schemes for Initial Boundary Value Problems

9.7 Monotone and Positive-Type Schemes

9.8 Extensions, Generalisations and Other Applications

9.9 Summary and Conclusions

**Chapter 10: FDM for the One-Dimensional Convection—Diffusion Equation**

10.1 Introduction and Objectives

10.2 Approximation of Derivatives on the Boundaries

10.3 Time-Dependent Convection-Diffusion Equations

10.4 Fully Discrete Schemes

10.5 Specifying Initial and Boundary Conditions

10.6 Semi-Discretisation in Space

10.7 Semi-Discretisation in Time

10.8 Conclusions and Summary

**Chapter 11: Exponentially Fitted Finite Difference Schemes**

11.1 Introduction and Objectives

11.2 Motivating Exponential Fitting

11.3 Exponential Fitting and Time-Dependent Convection–Diffusion

11.4 Stability and Convergence Analysis

11.5 Approximating the Derivatives of the Solution

11.6 Special Limiting Cases

11.7 Summary and Conclusions

**Part III: Applying FDM to One-Factor Instrument Pricing**

**Chapter 12: Exact Solutions and Explicit Finite Difference Method for One-Factor Models**

12.1 Introduction and Objectives

12.2 Exact Solutions and Benchmark Cases

12.3 Perturbation Analysis and Risk Engines

12.4 The Trinomial Method: Preview

12.5 Using Exponential Fitting with Explicit Time Marching

12.6 Approximating the Greeks

12.7 Summary and Conclusions

12.8 Appendix: The Formula for Vega

**Chapter 13: An Introduction to the Trinomial Method**

13.1 Introduction and Objectives

13.2 Motivating the Trinomial Method

13.3 Trinomial Method: Comparisons with Other Methods

13.4 The Trinomial Method for Barrier Options

13.5 Summary and Conclusions

**Chapter 14: Exponentially Fitted Difference Schemes for Barrier Options**

14.1 Introduction and Objectives

14.2 What are Barrier Options?

14.3 Initial Boundary Value Problems for Barrier Options

14.4 Using Exponential Fitting for Barrier Options

14.5 Time-Dependent Volatility

14.6 Some Other Kinds of Exotic Options

14.7 Comparisons with Exact Solutions

14.8 Other Schemes and Approximations

14.9 Extensions to the Model

14.10 Summary and Conclusions

**Chapter 15: Advanced Issues in Barrier and Lookback Option Modelling**

15.1 Introduction and Objectives

15.2 Kinds of Boundaries and Boundary Conditions

15.3 Discrete and Continuous Monitoring

15.4 Continuity Corrections for Discrete Barrier Options

15.5 Complex Barrier Options

15.6 Summary and Conclusions

**Chapter 16: The Meshless (Meshfree) Method in Financial Engineering**

16.1 Introduction and Objectives

16.2 Motivating the Meshless Method

16.3 An Introduction to Radial Basis Functions

16.4 Semi-Discretisations and Convection–Diffusion Equations

16.5 Applications of the One-Factor Black–Scholes Equation

16.6 Advantages and Disadvantages of Meshless

16.7 Summary and Conclusions

**Chapter 17: Extending the Black–Scholes Model: Jump Processes**

17.1 Introduction and Objectives

17.2 Jump-Diffusion Processes

17.3 Partial Integro-Differential Equations and Financial Applications

17.4 Numerical Solution of Pide: Preliminaries

17.5 Techniques for the Numerical Solution of PIDEs

17.6 Implicit and Explicit Methods

17.7 Implicit–Explicit Runge–Kutta Methods

17.8 Using Operator Splitting

17.9 Splitting and Predictor–Corrector Methods

17.10 Summary and Conclusions

**Part IV: FDM for Multidimensional Problems**

**Chapter 18: Finite Difference Schemes for Multidimensional Problems**

18.1 Introduction and Objectives

18.2 Elliptic Equations

18.3 Diffusion and Heat Equations

18.4 Advection Equation in Two Dimensions

18.5 Convection–Diffusion Equation

18.6 Summary and Conclusions

**Chapter 19: An Introduction to Alternating Direction Implicit and Splitting Methods**

19.1 Introduction and Objectives

19.2 What is ADI, Really?

19.3 Improvements on the Basic ADI Scheme

19.4 ADI for First-Order Hyperbolic Equations

19.5 ADI Classico and Three-Dimensional Problems

19.6 The Hopscotch Method

19.7 Boundary Conditions

19.8 Summary and Conclusions

**Chapter 20: Advanced Operator Splitting Methods: Fractional Steps**

20.1 Introduction and Objectives

20.2 Initial Examples

20.3 Problems with Mixed Derivatives

20.4 Predictor–Corrector Methods (Approximation Correctors)

20.5 Partial Integro-Differential Equations

20.6 More General Results

20.7 Summary and Conclusions

**Chapter 21: Modern Splitting Methods**

21.1 Introduction and Objectives

21.2 Systems of Equations

21.3 A Different Kind of Splitting: The IMEX Schemes

21.4 Applicability of IMEX Schemes to Asian Option Pricing

21.5 Summary and Conclusions

**Part V: Applying FDM to Multi-Factor Instrument Pricing**

**Chapter 22: Options with Stochastic Volatility: The Heston Model**

22.1 Introduction and Objectives

22.2 An Introduction to Ornstein–Uhlenbeck Processes

22.3 Stochastic Differential Equations and the Heston Model

22.4 Boundary Conditions

22.5 Using Finite Difference Schemes: Prologue

22.6 A Detailed Example

22.7 Summary and Conclusions

**Chapter 23: Finite Difference Methods for Asian Options and other ‘Mixed’ Problems**

23.1 Introduction and Objectives

23.2 An Introduction to Asian Options

23.3 My First PDE Formulation

23.4 Using Operator Splitting Methods

23.5 Cheyette Interest Models

23.6 New Developments

23.7 Summary and Conclusions

**Chapter 24: Multi-Asset Options**

24.1 Introduction and Objectives

24.2 A Taxonomy of Multi-Asset Options

24.3 Common Framework for Multi-Asset Options

24.4 An Overview of Finite Difference Schemes for Multi-Asset Problems

24.5 Numerical Solution of Elliptic Equations

24.6 Solving Multi-Asset Black–Scholes Equations

24.7 Special Guidelines and Caveats

24.8 Summary and Conclusions

**Chapter 25: Finite Difference Methods for Fixed-Income Problems**

25.1 Introduction and Objectives

25.2 An Introduction to Interest Rate Modelling

25.3 Single-Factor Models

25.4 Some Specific Stochastic Models

25.5 An Introduction to Multidimensional Models

25.6 The Thorny Issue of Boundary Conditions

25.7 Introduction to Approximate Methods for Interest Rate Models

25.8 Summary and Conclusions

**Part VI: Free and Moving Boundary Value Problems**

**Chapter 26: Background to Free and Moving Boundary Value Problems**

26.1 Introduction and Objectives

26.2 Notation and Definitions

26.3 Some Preliminary Examples

26.4 Solutions in Financial Engineering: A Preview

26.5 Summary and Conclusions

**Chapter 27: Numerical Methods for Free Boundary Value Problems: Front-Fixing Methods**

27.1 Introduction and Objectives

27.2 An Introduction to Front-Fixing Methods

27.3 A Crash Course on Partial Derivatives

27.4 Functions and Implicit Forms

27.5 Front Fixing for the Heat Equation

27.6 Front Fixing for General Problems

27.7 Multidimensional Problems

27.8 Front-Fixing and American Options

27.9 Other Finite Difference Schemes

27.10 Summary and Conclusions

**Chapter 28: Viscosity Solutions and Penalty Methods for American Option Problems**

28.1 Introduction and Objectives

28.2 Definitions and Main Results for Parabolic Problems

28.3 An Introduction to Semi-Linear Equations and Penalty Method

28.4 Implicit, Explicit and Semi-Implicit Schemes

28.5 Multi-Asset American Options

28.6 Summary and Conclusions

**Chapter 29: Variational Formulation of American Option Problems**

29.1 Introduction and Objectives

29.2 A Short History of Variational Inequalities

29.3 A First Parabolic Variational Inequality

29.4 Functional Analysis Background

29.5 Kinds of Variational Inequalities

29.6 Variational Inequalities using Rothe’s Method

29.7 American Options and Variational Inequalities

29.8 Summary and Conclusions

**Part VII: Design and Implementation in C++**

**Chapter 30: Finding the Appropriate Finite Difference Schemes for your Financial Engineering Problem**

30.1 Introduction and Objectives

30.2 The Financial Model

30.3 The Viewpoints in the Continuous Model

30.4 The Viewpoints in the Discrete Model

30.5 Auxiliary Numerical Methods

30.6 New Developments

30.7 Summary and Conclusions

**Chapter 31: Design and Implementation of First-Order Problems**

31.1 Introduction and Objectives

31.2 Software Requirements

31.3 Modular Decomposition

31.4 Useful C++ Data Structures

31.5 One-Factor Models

31.6 Multi-Factor Models

31.7 Generalisations and Applications To Quantitative Finance

31.8 Summary and Conclusions

31.9 Appendix: Useful Data Structures in C++

**Chapter 32: Moving to Black–Scholes**

32.1 Introduction and Objectives

32.2 The PDE Model

32.3 The FDM Model

32.4 Algorithms and Data Structures

32.5 The C++ Model

32.6 Test Case: The Two-Dimensional Heat Equation

32.7 Finite Difference Solution

32.8 Moving to Software and Method Implementation

32.9 Generalisations

32.10 Summary and Conclusions

**Chapter 33: C++ Class Hierarchies for One-Factor and Two-Factor Payoffs**

33.1 Introduction and Objectives

33.2 Abstract and Concrete Payoff Classes

33.3 Using Payoff Classes

33.4 Lightweight Payoff Classes

33.5 Super-Lightweight Payoff Functions

33.6 Payoff Functions for Multi-Asset Option Problems

33.7 Caveat: Non-Smooth Payoff and Convergence Degradation

33.8 Summary and Conclusions

**Appendix 1: An Introduction to Integral and Partial Integro-Differential Equations**

A1.1 Introduction and Objectives

A1.2 A Short Introduction to Integration Theory

A1.3 Numerical Integration

A1.4 An Introduction to Integral Equations

A1.5 Numerical Approximation of Integral Equations

A1.6 Summary and Conclusions

**Appendix 2: An Introduction to the Finite Element Method**

A2.1 Introduction and Objectives

A2.2 An Initial Value Problem

A2.3 The One-Dimensional Heat Equation

A2.4 Convection Equation in one Dimension

A2.5 One-Factor Black–Scholes and FEM

A2.6 Comparing and Contrasting FEM and FDM

A2.7 Summary and Conclusions

**Bibliography**

**Index**

**Finite Difference Methods inFinancial Engineering**

For other titles in the Wiley Finance Series

please see www.wiley.com/finance

© 2006 Daniel J Duffy

Published by John Wiley & Sons, Ltd

*Registered office*

John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom

For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.

Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.

Designations used by companes to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book.

Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with the respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. It is sold on the understanding that the publisher is not engaged in rendering professional services and neither the publisher nor the author shall be liable for damages arising herefrom. If professional advice or other expert assistance is required, the services of a competent professional should be sought.

*Library of Congress Cataloging-in-Publication Data*

Duffy, Daniel J.

Finite difference methods in financial engineering : a partial differential equation approach / Daniel J. Duffy.

p. cm.

ISBN-13: 978-0-470-85882-0

ISBN-10: 0-470-85882-6

1. Financial engineering—Mathematics. 2. Derivative securities—Prices—Mathematical models. 3. Finite differences. 4. Differential equations, Partial—Numerical solutions. I. Title.

HG176.7.D84 2006

332.01_51562—dc22

2006001397

A catalogue record for this book is available from the British Library.

ISBN 978-0-470-85882-0 (HB)

The goal of this book is to develop robust, accurate and efficient numerical methods to price a number of derivative products in quantitative finance. We focus on one-factor and multi-factor models for a wide range of derivative products such as options, fixed income products, interest rate products and ‘real’ options. Due to the complexity of these products it is very difficult to find exact or closed solutions for the pricing functions. Even if a closed solution can be found it may be very difficult to compute. For this and other reasons we need to resort to approximate methods. Our interest in this book lies in the application of the finite difference method (FDM) to these problems.

This book is a thorough introduction to FDM and how to use it to approximate the various kinds of partial differential equations for contingent claims such as:

- One-factor European and American options
- One-factor and two-factor barrier options with continuous and discrete monitoring
- Multi-asset options
- Asian options, continuous and discrete monitoring
- One-factor and two-factor bond options
- Interest rate models
- The Heston model and stochastic volatility
- Merton jump models and extensions to the Black–Scholes model.

Finite difference theory has a long history and has been applied for more than 200 years to approximate the solutions of partial differential equations in the physical sciences and engineering.

What is the relationship between FDM and financial engineering? To answer this question we note that the behaviour of a stock (or some other underlying) can be described by a stochastic differential equation. Then, a contingent claim that depends on the underlying is modelled by a partial differential equation in combination with some initial and boundary conditions. Solving this problem means that we have found the value for the contingent claim.

Furthermore, we discuss finite difference and variational schemes that model free and moving boundaries. This is the style for exercising American options, and we employ a number of new modelling techniques to locate the position of the free boundary.

Finally, we introduce and elaborate the theory of partial integro-differential equations (PIDEs), their applications to financial engineering and their approximations by FDM. In particular, we show how the basic Black–Scholes partial differential equation is augmented by an integral term in order to model jumps (the Merton model). Finally, we provide worked-out C++ code on the CD that accompanies this book.

There are a number of reasons why this book has been written. First, the author wanted to produce a text that showed how to apply numerical methods (in this case, finite difference schemes) to quantitative finance. Furthermore, it is important to justify the applicability of the schemes rather than just rely on numerical recipes that are sometimes difficult to apply to real problems. The second desire was to construct robust finite difference schemes for use in financial engineering, creating algorithms that describe how to solve the discrete set of equations that result from such schemes and then to map them to C++ code.

This book is for quantitative analysts, financial engineers and others who are involved in defining and implementing models for various kinds of derivatives products. No previous knowledge of partial differential equations (PDEs) or of finite difference theory is assumed. It is, however, assumed that you have some knowledge of financial engineering basics, such as stochastic differential equations, Ito calculus, the Black–Scholes equation and derivative pricing in general. This book will be of value to those financial engineers who use the binomial and trinomial methods to price options, as these two methods are special cases of explicit finite difference schemes. This book will also hopefully be employed by those engineers who use simulation methods (for example, the Monte Carlo method) to price derivatives, and it is hoped that the book will help to bridge the gap between the stochastics and PDE approaches.

Finally, this book could be interesting for mathematicians, physicists and engineers who wish to see how a well-known branch of numerical analysis is applied to financial engineering. The information in the book may even improve your job prospects!

In the author’s opinion, this is one of the first self-contained introductions to the finite difference method and its applications to derivatives pricing. The book introduces the theory of PDE and FDM and their applications to quantitative finance, and can be used as a self-contained guide to learning and discovering the most important finite difference schemes for derivative pricing problems.

Some of the advantages of the approach and the resulting added value of the book are:

- A defined process starting from the financial models through PDEs, FDM and algorithms
- An application of robust, accurate and efficient finite difference schemes for derivatives pricing applications.

This book is more than just a cookbook: it motivates why a method does or does not work and you can learn from this knowledge in a meaningful way. This book is also a good companion to my other book, *Financial Instrument Pricing in C*++ (Duffy, 2004). The algorithms in the present book can be mapped to C++, the de-facto object-oriented language for financial engineering applications

In short, it is hoped that this book will help you to master all the details needed for a good understanding of FDM in your daily work.

The book has been partitioned into seven parts, each of which deals with one specific topic in detail. Furthermore, each part contains material that is required by its successor. In general, we interleave the parts by first discussing the theory (for example, basic finite difference schemes) in a given part and then applying this theory to a problem in financial engineering. This ‘separation of concerns’ approach promotes understandability of the material, and the parts in the book discuss the following topics:

**Part I** presents an introduction to partial differential equations (PDE). This theory may be new for some readers and for this reason these equations are discussed in some detail. The relevance of PDE to instrument pricing is that a contingent claim or derivative can be modelled as an initial boundary value problem for a second-order parabolic partial differential equation. The partial differential equation has one time variable and one or more space variables. The focus in Part I is to develop enough mathematical theory to provide a basis for work on finite differences.

**Part II** is an introduction to the finite difference method for a number of partial differential equations that appear in instrument pricing problems. We learn FDM in the following way: (1) We introduce the model PDEs for the heat, convection and convection–diffusion equations and propose several important finite difference schemes to approximate them. In particular, we discuss a number of schemes that are used in the financial engineering literature and we also introduce some special schemes that work under a range of parameter values. In this part, focus is on the practical application of FDM to parabolic partial differential equations in one space variable.

**Part III** examines the partial differential equations that describe one-factor instrument models and their approximation by the finite difference schemes. In particular, we concentrate on European options, barrier options and options with jumps, and propose several finite difference schemes for such options. An important class of problems discussed in this part is the class of barrier options with continuous or discrete monitoring and robust methods are proposed for each case. Finally, we model the partial integro-differential equations (PIDEs) that describe options with jumps, and we show how to approximate them by finite difference schemes.

**Part IV** discusses how to define and use finite difference schemes for initial boundary value problems in several space variables. First, we discuss ‘direct’ scheme where we discretise the time and space dimensions simultaneously. This approach works well with problems in two space dimensions but for problems in higher dimensions we may need to solve the problem as a series of simpler problems. There are two main contenders: first, alternating direction implicit (ADI) methods are popular in the financial engineering literature; second, we discuss operator splitting methods (or the method of fractional steps) that have their origins in the former Soviet Union. Finally, we discuss some modern developments in this area.

**Part V** applies the results and schemes from Part IV to approximating some multi-factor problems. In particular, we examine the Heston PDE with stochastic volatility, Asian options, rainbow options and two-factor bond models and how to apply ADI and operator splitting methods to them.

**Part VI** deals with instrument pricing problems with the so-called early exercise feature. Mathematically, these problems fall under the umbrella of free and moving boundary value problems. We concentrate on the theory of such problems and the application to one-factor American options. We also discuss ADI method in conjunction with free boundaries.

**Part VII** contains a number of chapters that support the work in the previous parts of the book. Here we address issues that are relevant to the design and implementation of the FDM algorithms in the book. We provide hints, guidelines and C++ sources to help the reader to make the transition to production code.

This book is concerned with the application of the finite difference method to instrument pricing. This viewpoint implies that we concentrate on a number of issues while neglecting others. Thus, this book is not:

- an introduction to numerical analysis
- a guide to the theoretical foundations of the theory of finite differences
- an introduction to instrument pricing
- a full ‘production’ C++ course.

These problems are considered in detail in other books and will be discussed elsewhere.

The author welcomes your feedback, comments and suggestions for improvement. As far as I am aware, all typos and errors have been removed from the text, but some may have slipped past unnoticed. Nevertheless, all errors are my responsibility.

I am a trainer and developer and my main professional interests are in quantitative finance, computational finance and object-oriented programming. In my free time I enjoy judo and studying foreign (natural) languages.

If you have any questions on this book, please do not hesitate to contact me at dduffy@datasim.nl.

Part I of this book is devoted to an overview of ordinary and partial differential equations. We discuss the mathematical theory of these equations and their relevance to quantitative finance. After having read the chapters in Part I you will have gained an appreciation of one-factor and multi-factor partial differential equations.

In this chapter we introduce a class of *second-order ordinary differential equations* as they contain derivatives up to order 2 in one independent variable. Furthermore, the (unknown) function appearing in the differential equation is a function of a single variable. A simple example is the *linear* equation

(1.1)

In general we seek a solution *u* of (1.1) in conjunction with some auxiliary conditions. The coefficients *a, b, c* and *f* are known functions of the variable *x*. Equation (1.1) is called linear because all coefficients are independent of the unknown variable *u*. Furthermore, we have used the following shorthand for the first- and second-order derivatives with respect to *x*:

(1.2)

We examine (1.1) in some detail in this chapter because it is part of the Black–Scholes equation

(1.3)

where the asset price *S* plays the role of the independent variable *x* and *t* plays the role of time. We replace the unknown function *u* by *C* (the option price). Furthermore, in this case, the coefficients in (1.1) have the special form

(1.4)

In the following chapters our intention is to solve problems of the form (1.1) and we then apply our results to the specialised equations in quantitative finance.

Let us examine a general second-order ordinary differential equation given in the form

(1.5)

where the function *f* depends on three variables. The reader may like to check that (1.1) is a special case of (1.5). In general, there will be many solutions of (1.5) but our interest is in defining extra conditions to ensure that it will have a unique solution. Intuitively, we might correctly expect that two conditions are sufficient, considering the fact that you could integrate (1.5) twice and this will deliver two constants of integration. To this end, we determine these extra conditions by examining (1.5) on a *bounded* interval (*a, b*). In general, we discuss linear combinations of the unknown solution *u* and its first derivative at these end-points:

(1.6)

We wish to know the conditions under which problem (1.5), (1.6) has a unique solution. The full treatment is given in Keller (1992), but we discuss the main results in this section. First, we need to place some restrictions on the function *f* that appears on the right-hand side of equation (1.5).

*Definition 1.1.* The function *f*(*x, u, v*) is called uniformly Lipschitz continuous if

(1.7)

where *K* is some constant, and *x, ut*, and *v* are real numbers.

We now state the main result (taken from Keller, 1992).

**Theorem 1.1.** *Consider the function f*(*x; u, v*) *in* (*1.5*) *and suppose that it is uniformly Lipschitz continuous in the region R, defined by*:

(1.8)

*Suppose, furthermore, that f has continuous derivatives in R satisfying, for some constant M*,

(1.9)

*and, that*

(1.10)

*Then the boundary-value problem* (1.5), (1.6) *has a unique solution*.

This is a general result and we can use it in new problems to assure us that they have a unique solution.

The linear boundary conditions in (1.6) are quite general and they subsume a number of special cases. In particular, we shall encounter these cases when we discuss boundary conditions for the Black–Scholes equation. The main categories are:

- Robin boundary conditions
- Dirichlet boundary conditions
- Neumann boundary conditions.

The most general of those is the Robin condition, which is, in fact, (1.6). Special cases of (1.6) at the boundaries *x* = *a* or *x* = *b* are formed by setting some of the coefficients to zero. For example, the boundary conditions at the end-point *x* = *a*:

(1.11)

are called Dirichlet and Neumann boundary conditions at *x* = *a* and at *x* = *b*, respectively.

Thus, in the first case the value of the unknown function *u* is known at *x* = *a* while, in the second case, its derivative is known at *x* = *b* (but not *u* itself). We shall encounter the above three types of boundary condition in this book, not only in a one-dimensional setting but also in multiple dimensions. Furthermore, we shall discuss other kinds of boundary condition that are needed in financial engineering applications.

We now consider a special case of (1.5), namely (1.1). This is called a **linear equation** and is important in many kinds of applications. A special case of Theorem 1.1 occurs when the function *f*(*x; u, v*) is linear in both *u* and *v*. For convenience, we write (1.1) in the canonical form

(1.12)

and the result is:

**Theorem 1.2.** *Let the functions p*(*x*), *q*(*x*) *and r*(*x*) *be continuous in the closed interval* [*a, b*] *with*

(1.13)

Assume that

then the two-point boundary value problem (BVP)

(1.14)

has a unique solution.

*Remark*. The condition |*a*_{0}| + |*b*_{0}| ≠ 0 excludes boundary value problems with Neumann boundary conditions at both ends.

In the previous section we examined a differential equation on a bounded interval. In this case we assumed that the solution was defined in this interval and that certain boundary conditions were defined at the interval’s end-points. We now consider a different problem where we wish to find the solution on a semi-infinite interval, let’s say (*a*, ∞). In this case we define the initial value problem (IVP)

(1.15)

where we assume that the two conditions at *x* = *a* are independent, that is

(1.16)

It is possible to write (1.15) as a first-order system by a change of variables:

(1.17)

This is now a first-order system containing no explicit derivatives at *x* = *a*. System (1.17) is in a form that can be solved numerically by standard schemes (Keller, 1992). In fact, we can apply the same transformation technique to the boundary value problem (1.14) to get

(1.18)

This approach has a number of advantages when we apply finite difference schemes to approximate the solution of problem (1.18). First, we do not need to worry about approximating derivatives at the boundaries and, second, we are able to approximate *v* with the same accuracy as *u* itself. This is important in financial engineering applications because the first derivative represents an option’s delta function.

There are a number of common specialisations of equation (1.5), and each has its own special name, depending on its form:

(1.19)

Each of these equations is a model for more complex equations in multiple dimensions, and, we shall discuss the time-dependent versions of the equations in (1.19). For example, the convection–diffusion equation has been studied extensively in science and engineering and has applications to fluid dynamics, semiconductor modelling and groundwater flow, to name just a few (Morton, 1996). It is also an essential part of the Black–Scholes equation (1.3).

We can transform equation (1.1) into a more convenient form (the so-called *normal form*) by a change of variables under the constraint that the coefficient of the second derivative *a*(*x*) is always positive. For convenience we assume that the right-hand side term *f* is zero. To this end, define

(1.20)

If we multiply equation (1.1) (note *f* = 0) by *p*(*x*)/*a*(*x*) we then get:

(1.21)

This is sometimes known as the *self-adjoint form*. A further change of variables

(1.22)

allows us to write (1.21) to an even simpler form

(1.23)

Equation (1.23) is simpler to solve than equation (1.1).

We have given an introduction to second-order ordinary differential equations and the associated two-point boundary value problems. We have discussed various kinds of boundary conditions and a number of sufficient conditions for uniqueness of the solutions of these problems. Finally, we have introduced a number of topics that will be required in later chapters.

In this chapter we give a gentle introduction to partial differential equations (PDEs). It can be considered to be a panoramic view and is meant to introduce some notation and examples. A PDE is an equation that depends on several independent variables. A well-known example is the Laplace equation:

(2.1)

In this case the dependent variable *u* satisfies (2.1) in some bounded, infinite or semi-infinite space in two dimensions.

In this book we examine PDEs in one or more space dimensions and a single time dimension. An example of a PDE with a derivative in the time direction is the heat equation in two spatial dimensions:

(2.2)

We classify PDEs into three categories of equation, namely *parabolic, hyperbolic* and *elliptic.* Parabolic equations are important for financial engineering applications because the Black–Scholes equation is a specific instance of such a category. Furthermore, generalisations and extensions to the Black–Scholes model may have hyperbolic equations as components. Finally, elliptic equations are useful because they form the time-independent part of the Black–Scholes equations.

We have attempted to categorise partial differential equations as shown in Figure 2.1. At the highest level we have the three major categories already mentioned. At the second level we have classes of equation based on the orders of the derivatives appearing in the PDE, while at level three we have given examples that serve as model problems for more complex equations. The hierarchy is incomplete and somewhat arbitrary (as all taxonomies are). It is not our intention to discuss all PDEs that are in existence but rather to give the reader an overview of some different types. This may be useful for readers who may not have had exposure to such equations in the past.

What makes a PDE parabolic, hyperbolic or elliptic? To answer this question let us examine the *linear* partial differential equation in two independent variables (Carrier and Pearson, 1976; Petrovsky, 1991)

(2.3)

where we have used the (common) shorthand notation

(2.4)

and the coefficients *A, B, C, D, E, F* and *G* are functions of *x* and *y* in general. Equation (2.3) is linear because these functions do not have a dependency on the unknown function *u* = *u*(*x, y*). We assume that equation (2.3) is specified in some region of (*x, v*) space. Note the presence of the cross (mixed) derivatives in (2.3). We shall encounter these terms again in later chapters.

Equation (2.3) subsumes well-known equations in mathematical physics as special cases. For example, the Laplace equation (2.1) is a special case, having the following values:

(2.5)

A detailed discussion of (2.3), and the conditions that determine whether it is elliptic, hyperbolic or parabolic, is given in Carrier and Pearson (1976). We give the main results in this section. The discussion in Carrier and Pearson (1976) examines the quadratic equation:

(2.6)

where ξ (*x*, *y*) is some family of curves in (*x, y*) space (see Figure 2.2). In particular, we wish to find the solutions of the quadratic form by defining the variables:

(2.7)

Then we get the roots

(2.8)

Thus, we distinguish between the following cases:

(2.9)

We note that the variables *x* and *y* appearing in (2.3) are generic and in some cases we may wish to replace them by other more specific variables – for example, replacing *y* by a time variable *t* as in the well-known one-dimensional wave equation

(2.10)

It is easy to check that in this case the coefficients are: *A* = 1, *C* = −1, *B* = *D* = *E* = *F* = *G* = 0 and hence the equation is hyperbolic.

We now discuss a number of special cases of elliptic, parabolic and hyperbolic equations that occur in many areas of application. These equations have been discovered and investigated by the greatest mathematicians of the last three centuries and there is an enormous literature on the theory of these equations and their applications to the world around us.

These time-independent equations occur in many kinds of application:

- Steady-state heat conduction (Kreider
*et al.*, 1966) - Semiconductor device simulation (Fraser, 1986; Bank and Fichtner, 1983)
- Harmonic functions (Du Plessis, 1970; Rudin, 1970)
- Mapping functions between two-dimensional regions (George, 1991).

In general, we must specify boundary conditions for elliptic equations if we wish to have a unique solution. To this end, let us consider a two-dimensional region Ω with smooth boundary Γ as shown in Figure 2.3, and let η be the positive outward normal vector on Γ. A famous example of an elliptic equation is the Poisson equation defined by:

(2.11)

where Δ is the Laplace operator.

Equation (2.11) has a unique solution if we define boundary conditions. There are various options, the most general of which is the Robin condition:

(2.12)

where α, β and *g* are given functions defined on the boundary Γ. A special case is when α = 0, in which case (2.12) reduces to Dirichlet boundary conditions.

A special case of the Poisson equation (2.11) is when *f* = 0. This is then called the Laplace equation (2.1).

In general, we must resort to numerical methods if we wish to find a solution of problem (2.11), (2.12). For general domains, the finite element method (FEM) and other so-called variational techniques have been applied with success (see, for example, Strang *et al.*, 1973; Hughes, 2000). In this book we are mainly interested in square and rectangular regions because many financial engineering applications are defined in such regions. In this case the finite difference method (FDM) is our method of choice (see Richtmyer and Morton, 1967).

In some cases we can find an exact solution to the problem (2.11), (2.12) when the domain Ω is a rectangle. In this case we can then use the *separation of variables* principle, for example. Furthermore, if the domain is defined in a spherical or cylindrical region we can transform (2.11) to a simpler form. For a discussion of these topics, see Kreider *et al.* (1966).

In the previous section we assumed that the boundary Γ of the domain of interest is known. In many applications, however, we not only need to find the solution of a PDE in some region but we define auxiliary constraints on some *unknown* boundary. This boundary may be internal or external to the domain. For time-independent problems we speak of free boundaries while for time-dependent problems we use the term ‘moving’ boundaries. These boundaries occur in numerous applications, some of which are:

- Flow in dams (Baiocchi, 1972; Friedman, 1979)
- Stefan problem: standard model for the melting of ice (Crank, 1984)
- Flow in porous media (Huyakorn and Pinder, 1983)
- Early exercise and American style option (Nielson
*et al.*, 2002).

The following is a good example of a free boundary problem. Imagine immersing a block of ice in luke-warm water at time *t* = 0. Of course, the ice block eventually disappears because of its state change to water. The interesting question is: What is the profile of the block at any time after *t* = 0? This is a typical moving boundary value problem.

Another example that is easy to understand is the following. Consider a rectangular dam *D* = {(*x, y*): 0 < *x* < *a*, 0 < *y* < *H*} and suppose that the walls *x* = 0 and *x* = *a* border reservoirs of water maintained at given levels *g*(*t*) and *f*(*t*), respectively (see Figure 2.4). The so-called piezometric head is given by *u* = *u*(*x, y, t*) = *y* + *p*(*x, y, t*), where *p* is the pressure in the dam. The velocity components are given by:

(2.13)

Furthermore, we distinguish between the dry part and the wet part of the dam as defined by the function φ(*x, t*). The defining equations are (Friedman, 1979; Magenes, 1972):

(2.14)

The function φ(*x, t*) is called the free boundary and it separates the wet part from the dry part of the dam.

Furthermore, on the free boundary *y* = φ(*x, t*) we have the following conditions:

(2.15)

Finally, we have the initial conditions:

(2.16)

We thus see that the problem is the solution of the Laplace equation in the wet region of the dam while, on the free boundary, the equation is a first-order nonlinear hyperbolic equation. Thus, the free boundary is part of the problem and it must be evaluated.

A discussion of analytic and numerical methods for free and moving boundary value problems is given in Crank (1984). Free and moving boundary problems are extremely important in financial engineering, as we shall see in later chapters.

A special case of (2.14) is the so-called stationary dam problem (Baiocchi, 1972). In this case the levels of the reservoirs do not change and we then have the special cases

and *y* = φ_{0}(*x*) is the free boundary.

There may be similarities between the above problem and the free boundary problems that we encounter when modelling options with early excercise features.

This is the most important PDE category in this book because of its relationship to the Black–Scholes equation. The most general linear parabolic PDE in *n* dimensions in this context is given by

(2.17)

where *x* is a point in *n*-dimensional real space and *t* is the time variable, where *t* is increasing from *t* = 0. We assume that the operator *L* is *uniformly elliptical*, that is, there exist positive constants α and β such that

(2.18)

for *x* in some region of *n*-dimensional space and *t* ≥ 0. Another way of expressing (2.18) is by saying that matrix *A*, defined by

(2.19)

is positive-definite.

A special case of (2.17) is the famous multivariate Black–Scholes equation

(2.20)

where τ is the time left to the expiry *T* and *C* is the value of the option on *n* underlying assets. The other parameters and coefficients are:

(2.21)

Equation (2.20) can be derived from the following stochastic differential equation (SDE):

(2.22)

where

(2.23)

and using the generalised Ito’s lemma (see, for example, Bhansali, 1998).

In general, we need to define a unique solution to (2.17) by augmenting the equation with initial conditions and boundary conditions. We shall deal with these in later chapters but for the moment we give one example of a parabolic initial boundary value problem (IBVP) on a bounded domain Ω with boundary Γ. This is defined as the PDE augmented with the following extra boundary and initial conditions

(2.24)

where is the closure of Ω.

We shall discuss parabolic equations in detail in this book by examining them from several viewpoints. First, we discuss the properties of the continuous problem (2.17), (2.24); second, we introduce finite difference schemes for these problems; and finally we examine their relevance to financial engineering.

The second-order terms in (2.17) are called *diffusion terms* while the first-order terms are called *convection* (or *advection*) terms. If the convection terms are zero we then arrive at a diffusion equation, and if the diffusion terms are zero we then arrive at a first-order (hyperbolic) convection equation.

An even more special case of a diffusion equation is when all the diffusion coefficients are equal to 1. We then arrive at the heat equation in non-dimensional form. For example, in three space dimensions this equation has the form

(2.25)

A special class of equations is called *convection–diffusion.* A prototypical example in one space dimension is

(2.26)

Convection–diffusion equations will receive much attention in this book because they model the behaviour of one-factor option pricing problems.

Whereas parabolic equations model fluid and heat flow phenomena, hyperbolic equations model wave phenomena, and there are many application areas where hyperbolic wave equations play an important role:

- Shock waves (Lax, 1973)
- Acoustics (Kinder
*et al.*, 1982) - Neutron transport phenomena (Richtmyer and Morton, 1967)
- Deterministic models in quantitative finance (for example, deterministic interest rates).

We are interested in two sub-categories, namely second-order and first-order hyperbolic equations.

In this case we have a PDE containing a second-order derivative in time. A typical example is the equation (written in self-adjoint form)

(2.27)

In order to define a unique solution to (2.27) we define boundary conditions in space in the usual way. However, since we have a second derivative in time, we shall need to give two initial conditions.

We now take a specific example. Consider an infinite stretched rod of negligible mass. The equations for the displacement of the string given a certain displacement are given by:

(2.28)

A common procedure when viewing (2.28) both analytically and numerically is to define new variables *v* and *w*:

(2.29)

We can write equations (2.28) as a first-order system:

(2.30)

where we define the vectors

(2.31)

and

(2.32)

It can be advantageous from both an analytical and numerical viewpoint to transform higher-order equations to a first-order system.

First-order hyperbolic equations occur in many applications, especially in the theory of gas flow and in shock waves. The prototypical scalar initial value problem is

(2.33)

Furthermore, the smoothness of the solution of (2.33) is determined by its discontinuities (determined by the continuity of the initial condition) and these will be propagated indefinitely. This is different from parabolic PDEs where discontinuities in the initial condition become smeared out as time goes on.

Closely associated with first-order equations is the Method of Characteristics (MOC) (see Courant and Hilbert, 1968). We shall discuss MOC later as a method for solving first-order equations numerically.

In some applications we may wish to solve a PDE for vector-valued functions, that is systems of equations. We shall also come across some examples of such systems in the financial engineering applications in this book. Typical cases are chooser options and compound options.

Let us consider the two-dimensional problem

(2.34)

where *U* is a vector of unknowns and *A, B, C, D* and *E* are matrices. We say that the system (2.34) is parabolic if for each vector

(2.35)

satisfy Re *K*_{j}(*w*) ≤ δ |*w*|^{2}, *j* = 1, …, *n* for some δ > 0 independent of **w** (Thomas, 1998).

This is an important and common class of partial differential equations. In particular, the Friedrichs systems constitute an important sub-category (Friedrichs, 1958). Let us take an example (Duffy, 1977). Let *I* = (0, 1), the open unit interval, and let *T**T**Q**I**T**U**n**U*