Download as pdf or txt
Download as pdf or txt
You are on page 1of 459

Mathematical Modeling

in Economics and Finance


with Probability and Stochastic Processes

Steven R. Dunbar

September 14, 2016


To my wife Charlene, who manages the finances so well.
Preface

History of the Book


This book started with one purpose and ended with a different purpose. In
2002, a former student, one of the best I had taught, approached me with a
book about mathematical finance in his hand. He wanted a reading course
about the subject, because he was thinking about a career in the area. I
flipped through the book briefly, and saw that it was too advanced for a
reading course even with a very good student. I was aware that the topic
combined probability theory and partial differential equations, both interests
of mine. Instead of a reading course, I agreed to conduct a seminar on
mathematical finance, if enough others had an interest. There were others,
including undergraduates, graduate students in finance and economics and
even some faculty from business.
I soon found that there were no books or introductions to the subject
suitable for mathematics students at the upper undergraduate level. I began
to gather my seminar notes and organize them.
After three years of the seminar, it grew into a popular course for senior-
level students from mathematics, finance, actuarial science, computer science
and engineering. The variety of students and their backgrounds refined the
content of the course. The course focus was on combining finance concepts,
especially derivative securities, with probability theory, difference equations
and differential equations to derive consequences, primarily about option
prices.
In late 2008, security markets convulsed and the U. S. economy went
into a deep recession. The causes were many, and are still debated, but

iii
iv PREFACE

one underlying cause was because mathematical methods had been applied
in financial situations where they did not apply [70]. At the same time
for different reasons, mathematical professional organizations urged a new
emphasis on mathematical modeling. The course and the associated notes
evolved in response, with an emphasis on uses and abuses of modeling.
Additionally, a new paradigm in mathematical sciences combining model-
ing, statistics, visualization, and computing with large data sets, sometimes
called “big data”, was maturing and becoming common. “Big data” is now
a source of employment for many mathematics majors. The topic of finance
and economics is a leader in “big data” because of the existing large data
sets and the measurable value in exploiting the data.
The result is the current book combining modeling, probability theory,
difference and differential equations focused on quantitative reasoning, data
analysis, probability, and statistics for economics and finance. The book
uses all of these topics to investigate modern financial instruments that have
enormous economic influence, but are hidden from popular view because
many people wrongly believe these topics are esoteric and difficult.

Purpose of the Book


The purpose is to provide a textbook for a “capstone course” focusing on
mathematical modeling in economic and finance. There are already many
fine books about mathematical modeling in physical and biological sciences.
This text is for an alternative course for students interested in “economic
sciences” instead of the classical sciences. This book combines mathematical
modeling, probability theory, difference and differential equations, numerical
solution and simulation and mathematical analysis in a single course for un-
dergraduates in mathematical sciences. I hope the style is engaging enough
that it can also be enjoyably read as an introduction by any individual in-
terested in these topics.
I understand that this introductory modeling approach makes serious
concessions to completeness and depth, financial accuracy and mathematical
rigor. Phillip Protter is an expert on mathematical finance and in a review
of an elementary text on mathematical finance [56] he makes the following
remarks:
Mathematical finance . . . is a difficult subject, requiring a
broad array of knowledge of subjects that are traditionally con-
sidered hard to learn.
v

The mathematics involved in the Black-Scholes paradigm is


measure-theoretic probability theory, Brownian motion, stochas-
tic processes including Markov processes and martingale theory,
Ito’s stochastic calculus, stochastic differential equations, and
partial differential equations. Those prerequisites give one entry
to the subject, which is why it is best taught to advanced Ph.D.
students. One might expect an American undergraduate to know
calculus-based probability theory and to have had some exposure
to PDEs and perhaps, if one is lucky, an economics course or
two, but not much more. Therefore, any attempt to teach such a
subject to undergraduates is fraught with compromise . . .
Perhaps it is the same with mathematical finance: it simply
is not (yet?) meant to be an undergraduate subject. In a way
that is too bad, because the subject is beautiful and powerful,
and expertise in it is much needed in industry.

Combining economic and financial modeling with probability, stochastic


processes, and differential equations along with quantitative reasoning, and
data analysis with some simulation and computing provides an inviting entry
into deeper aspects of this “beautiful and powerful” subject.
The goals of the book are:

1. Understand the properties of stochastic processes such as sequences


of random variables, coin-flipping games, Brownian motion and the
solutions of stochastic differential equations as a means for modeling
financial instruments for the management of risk.

2. Use financial instruments for the management of risk as motivations


for the detailed study of stochastic processes and solutions of stochastic
differential equations.

3. Introduce standard stochastic processes at the level of the classic refer-


ences by Karlin and Taylor, and Feller. The book proves some mathe-
matical statements at the level of elementary analysis, some more ad-
vanced statements have heuristic motivation without proof, and some
advanced results are stated without proof.

4. Emphasize the mathematical modeling process applied to a modern


area that is not based on physical science yet still leads to classical par-
vi PREFACE

tial differential equations and numerical methods. The field of math-


ematical finance is only 40 years old, uses leading-edge mathematical
and economic ideas, and has some controversial foundational hypothe-
ses. Mathematical finance is also data-rich and even advanced results
are testable in the market. Using ideas illustrated daily on newspaper
financial pages, the book applies the full cycle of mathematical mod-
eling and analysis in a non-trivial, but still accessible, way that has
economic applications.

5. The goal of the book is to reach a point where the students thoroughly
understand the derivation and modeling of financial instruments, ad-
vanced financial models, advanced stochastic processes, partial differen-
tial equations, and numerical methods at a level sufficient for beginning
graduate study in mathematics, finance, economics, actuarial science,
and for entry-level positions in the sophisticated financial services in-
dustry.

The general area of stochastic processes and mathematical finance has


many textbooks and monographs already. This book differs from them in
the following ways:
1. Most books on stochastic processes have a variety of applications, while
this book concentrates on financial instruments for the management of
risk as motivations for the detailed study of mathematical modeling
with stochastic processes. The emphasis is on the modeling process,
not the financial instruments.

2. Most books on mathematical finance assume either prerequisite knowl-


edge about financial instruments or sophisticated mathematical meth-
ods, especially measure-based probability theory and martingale the-
ory. This book serves as a introductory preparation for those texts.

3. This book emphasizes the practice of mathematical modeling, including


post-modeling analysis and criticism, making it suitable for a wider
audience.

Intended Audience and Background


This book is primarily for undergraduate students in mathematics, eco-
nomics, finance, and actuarial science. Students in physical sciences, com-
vii

puter science and engineering will also benefit from the book with its em-
phasis on modeling and the uses and limits of modeling. Graduate students
in economics, finance and business benefit from the non-measure theoretic
based introduction to mathematical finance and mathematical modeling.
This book is for students after a course on calculus-based probability
theory. To understand the explanations and complete the exercises:

1. The reader should be able to calculate joint probabilities of independent


events.

2. The reader should be able to calculate binomial probabilities and nor-


mal probabilities using direct calculation, tables and computer or cal-
culator applications.

3. The reader should be able to recognize common probability distribu-


tions such as negative binomial probabilities and calculate probabilities
from them.

4. The reader should be able to calculate means and variances for common
probability distributions.

5. The reader should be familiar with common statistical concepts of pa-


rameter point evaluations and confidence intervals and hypothesis test-
ing

6. The reader should have a familiarity with compound interest calcula-


tions, both continuous compounding and periodic compounding.

7. The reader should be able to be able to perform interest calculations


to find present values, future values, and simple annuities.

The text also assumes general knowledge of linear algebra, especially


about solutions of linear non-homogeneous equations in linear spaces. A
familiarity with solving difference equations, also called recurrence equations
and recursions, is helpful, but not essential. Where needed, the solution of
the specific difference equations uses elementary methods without reference
to the general theory. Likewise, a familiarity with differential equations is
helpful but not essential since the text derives specific solutions when nec-
essary, again without reference to the general theory. Naturally, a course in
differential equations will deepen understanding and provide another means
viii PREFACE

for discussing mathematical modeling, since that is often the course where
many students first encounter significant mathematical modeling of physical
and biological phenomena. Concepts from linear algebra also enter into the
discussions about Markov processes, but this text does not make the deeper
connections. Ideas from linear algebra pervade the operators and data struc-
tures in the program scripts.

Program Scripts
An important feature of this book is the simulation scripts that accompany
most sections. The simulation scripts illustrate the concepts and theorems
of the section with numerical and graphical evidence. The scripts are part
of the “Rule of 3” teaching philosophy of presenting mathematical ideas
symbolically, numerically and graphically.
The programs are springboards for further experimentation, not finished
apps for casual everyday use. The scripts are minimal in size, in scope of
implementation and with minimal output. The scripts are not complete,
stand-alone, polished applications, rather they are proof-of-concept starting
points. The reader should run the scripts to illustrate the ideas and provide
numerical examples of the results in the section. The scripts provide a seed
for new scripts to increase the size and scope of the simulations. Increasing
the size can often demonstrate convergence or increase confidence in the
results of the section. Increasing the size can also demonstrate that although
convergence is mathematically guaranteed, sometimes the rate of convergence
is slow. The reader is also encouraged to change the output, to provide more
information, to add different graphical representations, and to investigate
rates of convergence.
The scripts are not specifically designed to be efficient, either in program
language implementation or in mathematical algorithm. Efficiency is not
ignored, but it is not the primary consideration in the construction of the
scripts. Similarity of the program algorithm to the mathematical idea takes
precedence over efficiency. One noteworthy aspect of both the similarity
and efficiency is that all the languages use vectorization along with other
notational simplifications such as recycling. Vectorized scripts look more like
the mathematical expressions found in the text, making the code easier to
understand. Vectorized code often runs much faster than the corresponding
code containing loops.
The scripts are not intended to be a tutorial on how to do mathemat-
ix

ical programming in any of the languages. A description of the algorithm


used in the scripts is in each section. The description is usually in full sen-
tences rather than the more formal symbolic representation found in com-
puter science pseudo-code. Given the description and some basic awareness
of programming ideas, the scripts provide multiple examples for study. The
scripts provide a starting point for investigating, testing and comparing lan-
guage features from the documentation or from other sources. The scripts
use good programming style whenever possible, but clarity, simplicity and
similarity to the mathematics are primary considerations.

Connections to MAA CUPM guidelines


The nature of the text as an interdisciplinary capstone text intentionally ad-
dresses each of the cognitive and content recommendations from the Mathe-
matical Association of America’s Committee on the Undergraduate Curricu-
lum for courses and programs in mathematical sciences.

Cognitive Recommendations
1. Students should develop effective thinking and communication skills.
An emphasis in the text is on development, solution and subsequent
critical analysis of mathematical models in economics and finance. Ex-
ercises in most sections ask students to write comparisons and critical
analyses of the ideas, theories, and concepts.

2. Students should learn to link applications and theory.


The entire text is committed to linking methods and theories of proba-
bility and stochastic processes and difference and differential equations
to modern applications in economics and finance. Each chapter has a
specific application of the methods to a model in economics and finance.

3. Students should learn to use technological tools.


Computing examples with modern scripting languages appear through-
out and many exercises encourage further adaptation and experimen-
tation with the scripts.

4. Students should develop mathematical independence and experience


open ended inquiry.
x PREFACE

Many exercises encourage further experimentation, data exploration,


and up-to-date comparisons with new or extended data.

Content Recommendations
1. Mathematical sciences major programs should include concepts and
methods from calculus and linear algebra.
The text makes extensive use of calculus for continuous probability and
through differential equations. The text extends some of the ideas of
calculus to the domain of stochastic calculus. Linear algebra appears
throughout, from the theory of solutions of linear non-homogeneous
equations in linear spaces to operators and data structures in the pro-
gram scripts

2. Students majoring in the mathematical sciences should learn to read,


understand, analyze, and produce proofs, at increasing depth as they
progress through a major.
Mathematical proofs are not emphasized, because rigorous methods
for stochastic processes need measure-theoretic tools from probability.
However, when elementary tools from analysis are familiar to students,
then the text provides proofs or proof sketches. Derivation of the solu-
tion of specific difference equations and differential equations appears
in detail but without reference to general solution methods.

3. Mathematical sciences major programs should include concepts and


methods from data analysis, computing, and mathematical modeling.
Mathematical modeling in economics and finance is the reason for this
book. Collection and analysis of economic and financial data from
public sources is emphasized throughout, and the exercises extend and
renew the data. Providing extensive simulation of concepts through
computing in modern scripting languages is provided throughout. Ex-
ercises encourage the extension and adaptation of the scripts for more
simulation and data analysis.

4. Mathematical sciences major programs should present key ideas and


concepts from a variety of perspectives to demonstrate the breadth of
mathematics.
xi

As a text for a capstone course in mathematics, the text uses the multi-
ple perspectives of mathematical modeling, ideas from calculus, proba-
bility and statistics, difference equations, and differential equations, all
for the purposes of a deeper understanding of economics and finance.
The book emphasizes mathematical modeling as a motivation for new
mathematical ideas, and the application of known mathematical ideas
as a framework for mathematical models. The book emphasizes dif-
ference and differential equations to analyze stochastic processes. The
analogies between fundamental ideas of calculus and ways to analyze
stochastic processes is also emphasized.

5. All students majoring in the mathematical sciences should experience


mathematics from the perspective of another discipline.
The goal of the text focuses on mathematics modeling as a tool for un-
derstanding economic and finance. Collection and analysis of economic
and financial data from public sources using the mathematical tools is
emphasized throughout,

6. Mathematical sciences major programs should present key ideas from


complementary points of view: continuous and discrete; algebraic and
geometric; deterministic and stochastic; exact and approximate.
The text consistently moves from discrete models in finance to contin-
uous models in finance by developing discrete methods in probability
into continuous time stochastic process ideas. The text emphasizes the
differences between exact mathematics and approximate models.

7. Mathematical sciences major programs should require the study of at


least one mathematical area in depth, with a sequence of upper-level
courses.
The text is for a capstone course combining significant mathemati-
cal modeling using probability theory, stochastic processes, difference
equations, differential equations to understand economic and finance
at a level beyond the usual undergraduate approach to economic and
finance using only calculus ideas.

8. Students majoring in the mathematical sciences should work, indepen-


dently or in a small group, on a substantial mathematical project that
xii PREFACE

involves techniques and concepts beyond the typical content of a single


course.
Many of the exercises, especially those that extend the scripts or that
call for more data and data analysis are suitable for projects done either
independently or in small groups.

9. Mathematical sciences major programs should offer their students an


orientation to careers in mathematics.
Financial services, banking, insurance and risk, financial regulation,
and data analysis combined with some knowledge of computing are all
growth areas for careers for students from the mathematical sciences.
This text is an introduction to all of those areas.

Sources
The Mathematical Association of America Committee on the Undergraduate
Program recommendations are from the 2015 CUPM Curriculum Guide to
Majors in the Mathematical Sciences
Contents

Preface iii

1 Background Ideas 1
1.1 Brief History of Mathematical Finance . . . . . . . . . . . . . 1
1.2 Options and Derivatives . . . . . . . . . . . . . . . . . . . . . 11
1.3 Speculation and Hedging . . . . . . . . . . . . . . . . . . . . . 19
1.4 Arbitrage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.5 Mathematical Modeling . . . . . . . . . . . . . . . . . . . . . 32
1.6 Randomness . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
1.7 Stochastic Processes . . . . . . . . . . . . . . . . . . . . . . . 57
1.8 A Model of Collateralized Debt Obligations . . . . . . . . . . 66

2 Binomial Option Pricing Models 77


2.1 Single Period Binomial Models . . . . . . . . . . . . . . . . . . 77
2.2 Multiperiod Binomial Tree Models . . . . . . . . . . . . . . . 88

3 First Step Analysis for Stochastic Processes 101


3.1 A Coin Tossing Experiment . . . . . . . . . . . . . . . . . . . 101
3.2 Ruin Probabilities . . . . . . . . . . . . . . . . . . . . . . . . . 116
3.3 Duration of the Gambler’s Ruin . . . . . . . . . . . . . . . . 133
3.4 A Stochastic Process Model of Cash Management . . . . . . . 148

4 Limit Theorems for Stochastic Processes 171


4.1 Laws of Large Numbers . . . . . . . . . . . . . . . . . . . . . 171
4.2 Moment Generating Functions . . . . . . . . . . . . . . . . . . 179
4.3 The Central Limit Theorem . . . . . . . . . . . . . . . . . . . 186
4.4 The Absolute Excess of Heads over Tails . . . . . . . . . . . . 200

xiii
xiv CONTENTS

5 Brownian Motion 213


5.1 Intuitive Introduction to Diffusions . . . . . . . . . . . . . . . 213
5.2 The Definition of Brownian Motion and the Wiener Process . 220
5.3 Approximation of Brownian Motion by Coin-Flipping Sums . . 235
5.4 Transformations of the Wiener Process . . . . . . . . . . . . . 244
5.5 Hitting Times and Ruin Probabilities . . . . . . . . . . . . . . 254
5.6 Path Properties of Brownian Motion . . . . . . . . . . . . . . 264
5.7 Quadratic Variation of the Wiener Process . . . . . . . . . . . 272

6 Stochastic Calculus 287


6.1 Stochastic Differential Equations and the Euler-Maruyama Method287
6.2 Itô’s Formula . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
6.3 Properties of Geometric Brownian Motion . . . . . . . . . . . 308
6.4 Models of Stock Market Prices . . . . . . . . . . . . . . . . . . 320
6.5 Monte Carlo Simulation of Option Prices . . . . . . . . . . . . 335

7 The Black-Scholes Model 359


7.1 Derivation of the Black-Scholes Equation . . . . . . . . . . . . 359
7.2 Solution of the Black-Scholes Equation . . . . . . . . . . . . . 366
7.3 Put-Call Parity . . . . . . . . . . . . . . . . . . . . . . . . . . 382
7.4 Implied Volatility . . . . . . . . . . . . . . . . . . . . . . . . . 395
7.5 Sensitivity, Hedging and the “Greeks” . . . . . . . . . . . . . . 405
7.6 Limitations of the Black-Scholes Model . . . . . . . . . . . . . 419
List of Figures

1.1 This is not the market for options! . . . . . . . . . . . . . . . 13


1.2 Intrinsic value of a call option. . . . . . . . . . . . . . . . . . . 14
1.3 A schematic diagram of the cash flow in the gold arbitrage
example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.4 The cycle of modeling. . . . . . . . . . . . . . . . . . . . . . . 34
1.5 Schematic diagram of a pendulum. . . . . . . . . . . . . . . . 40
1.6 The process of mathematical modeling according to Edwards
and Penney. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
1.7 The process of mathematical modeling according to Glenn
Ledder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
1.8 Initial conditions for a coin flip, following Keller. . . . . . . . . 51
1.9 Persi Diaconis’ mechanical coin flipper. . . . . . . . . . . . . . 52
1.10 A tree of some stochastic processes, from most general at the
top to more specific at the end leaves. Stochastic processes
studied in this text are red. . . . . . . . . . . . . . . . . . . . 62
1.11 Default probabilities as a function of both the tranche number
0 to 100 and the base mortgage default probability 0.01 to 0.15. 71

2.1 The single period binomial model. . . . . . . . . . . . . . . . . 79


2.2 A binomial tree. . . . . . . . . . . . . . . . . . . . . . . . . . . 89
2.3 Pricing a European call. . . . . . . . . . . . . . . . . . . . . . 91
2.4 Pricing a European put. . . . . . . . . . . . . . . . . . . . . . 92

3.1 Welcome to my casino! . . . . . . . . . . . . . . . . . . . . . . 102


3.2 Where not to lose at the casino! . . . . . . . . . . . . . . . . . 103
3.3 Several typical cycles in a model of the reserve requirement. . 150

4.1 Block diagram of transform methods. . . . . . . . . . . . . . . 180

xv
xvi LIST OF FIGURES

4.2 Approximation of the binomial distribution with the normal


distribution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
4.3 The half-integer correction: In the figure the binomial proba-
bility is 0.7487. The simple normal approximation is 0.6809,
but with the half-integer correction the normal approximation
is 0.7482. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
4.4 Probability of the absolute excess of x heads or tails in 500
tosses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

5.1 Image of a possible random walk in phase line after an odd


number of steps. . . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.2 Graph of the Dow-Jones Industrial Average from February 17,
2015 to February 16, 2016 (blue line) and a random walk with
normal increments with the same initial value and variance
(red line). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
5.3 A standardized density histogram of 1000 daily close-to-close
returns on the S & P 500 Index, from February 29, 2012 to
March 1, 2012, up to February 21, 2016 to February 22, 2016. 225

6.1 Simulation with the Euler-Maruyama method of a process de-


fined by a stochastic differential equation. . . . . . . . . . . . 291
6.2 The p.d.f. and c.d.f. for a lognormal random variable with
m = 1, s = 1.5. . . . . . . . . . . . . . . . . . . . . . . . . . . 310
6.3 The Wilshire 5000 Index from April 1, 2009 to December 31,
2014 plotted in blue along with a Geometric Brownian Motion
having the same mean, variance and starting value in red. . . 326
6.4 The q-q plot for the normalized log-changes from the Wilshire
5000. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

7.1 Value of the call option at maturity. . . . . . . . . . . . . . . . 375


7.2 Value of the call option at various times. . . . . . . . . . . . . 375
7.3 Value surface from the Black-Scholes formula. . . . . . . . . . 376
7.4 Value of the put option at maturity. . . . . . . . . . . . . . . . 387
7.5 Value of the call option at various times. . . . . . . . . . . . . 387
7.6 Value surface from the Black-Scholes formula. . . . . . . . . . 388
LIST OF FIGURES xvii

7.7 Schematic diagram of using Newton’s Method to solve for im-


plied volatility. The current call option value is plotted in
blue. The value of the call option as a function of σ is plotted
in black. The tangent line is plotted in red . . . . . . . . . . . 397
7.8 Value of the call option at various times. . . . . . . . . . . . . 406
7.9 Delta of the call option at various times. . . . . . . . . . . . . 408
7.10 Illustration of the idea of volatility smile with implied volatility
data from call options on the S & P 500 index (SPX). . . . . . 421
7.11 A schematic diagram illustrating the idea of fat tails. . . . . . 422
xviii LIST OF FIGURES
Chapter 1

Background Ideas

1.1 Brief History of Mathematical Finance


Section Starter Question
Name as many financial instruments as you can, and name or describe the
market where you would buy them. Also describe the instrument as high
risk or low risk.

Introduction
One sometime hears that “compound interest is the eighth wonder of the
world”, or the “stock market is just a big casino”. These are colorful say-
ings, maybe based in happy or bitter experience, but each focuses on only one
aspect of one financial instrument. The time value of money and uncertainty
are the central elements influencing the value of financial instruments. Con-
sidering only the time aspect of finance, the tools of calculus and differential
equations are adequate. When considering only the uncertainty, the tools of
probability theory illuminate the possible outcomes. Considering time and
uncertainty together, we begin the study of advanced mathematical finance.
Finance theory is the study of economic agents’ behavior allocating
financial resources and risks across alternative financial instruments over time
in an uncertain environment. Familiar examples of financial instruments are
bank accounts, loans, stocks, government bonds and corporate bonds. Many
less familiar examples abound. Economic agents are units who buy and
sell financial resources in a market. Typical economic agents are individual

1
2 CHAPTER 1. BACKGROUND IDEAS

investors, banks, businesses, mutual funds and hedge funds. Each agent has
many choices of where to buy, sell, invest and consume assets. Each choice
comes with advantages and disadvantages. An agent distributes resources
among the many possible investments with a goal in mind, often maximum
return or minimum risk.
Advanced mathematical finance is the study of the more sophisticated
financial instruments called derivatives. A derivative is a financial agree-
ment between two parties that depends on the future price or performance
of an underlying asset. Derivatives are so called not because they involve a
rate of change, but because their value is derived from the underlying asset.
The underlying asset could be a stock, a bond, a currency, or a commod-
ity. Derivatives have become one of the financial world’s most important
risk-management tools. Finance is about shifting and distributing risk and
derivatives are especially efficient for that purpose [50].
Two common derivatives are futures and options. Futures trading, a
key practice in modern finance, probably originated in seventeenth century
Japan, but the idea goes as far back as ancient Greece. Options were a feature
of the “tulip mania” in seventeenth century Holland. Modern derivatives
differ from their predecessors in that they are usually specifically designed to
objectify and price financial risk.
Derivatives come in many types. The most common examples are fu-
tures, agreements to trade something at a set price at a given date; options,
the right but not the obligation to buy or sell at a given price; forwards,
like futures but traded directly between two parties instead of on exchanges;
and swaps, exchanging flows of income from different investments to man-
age different risk exposure. For example, one party in a deal may want the
potential of rising income from a loan with a floating interest rate, while the
other might prefer the predictable payments ensured by a fixed interest rate.
The name of this elementary swap is a “plain vanilla swap”. More complex
swaps mix the performance of multiple income streams with varieties of risk
[50]. Another more complex swap is a credit-default swap in which a seller
receives a regular fee from the buyer in exchange for agreeing to cover losses
arising from defaults on the underlying loans. These swaps are somewhat
like insurance [50]. These more complex swaps are the source of controversy
since many people believe that they are responsible for the collapse or near-
collapse of several large financial firms in late 2008. As long as two parties are
willing to trade risks and can agree on a price they can craft a corresponding
derivative from any financial instrument. Businesses use derivatives to shift
1.1. BRIEF HISTORY OF MATHEMATICAL FINANCE 3

risks to other firms, chiefly banks. About 95% of the world’s 500 biggest com-
panies use derivatives. Markets called exchanges. are the usual place to buy
and sell derivatives with standardized terms. Derivatives tailored for specific
purposes or risks are bought and sold “over the counter” from big banks.
The “over the counter” market dwarfs the exchange trading. In November
2009, the Bank for International Settlements put the face value of over the
counter derivatives at $604.6 trillion. Using face value is misleading, after
stripping out off-setting claims the residual value is $3.7 trillion, still a large
figure [66].
Mathematical models in modern finance contain beautiful applications
of differential equations and probability theory. Additionally, mathematical
models of modern financial instruments have had a direct and significant
influence on finance practice.

Early History
The origins of much of the mathematics in financial models traces to Louis
Bachelier’s 1900 dissertation on the theory of speculation in the Paris mar-
kets. Completed at the Sorbonne in 1900, this work marks the twin births
of both the continuous time mathematics of stochastic processes and the
continuous time economics of option pricing. While analyzing option pric-
ing, Bachelier provided two different derivations of the partial differential
equation for the probability density for the Wiener process or Brown-
ian motion. In one of the derivations, he works out what is now called
the Chapman-Kolmogorov convolution probability integral. Along the way,
Bachelier derived the method of reflection to solve for the probability func-
tion of a diffusion process with an absorbing barrier. Not a bad performance
for a thesis on which the first reader, Henri Poincaré, gave less than a top
mark! After Bachelier, option pricing theory laid dormant in the economics
literature for over half a century until economists and mathematicians re-
newed study of it in the late 1960s. Jarrow and Protter [31] speculate that
this may have been because the Paris mathematical elite scorned economics
as an application of mathematics.
Bachelier’s work was 5 years before Albert Einstein’s 1905 discovery of
the same equations for his famous mathematical theory of Brownian motion.
The editor of Annalen der Physik received Einstein’s paper on Brownian mo-
tion on May 11, 1905. The paper appeared later that year. Einstein proposed
a model for the motion of small particles with diameters on the order of 0.001
4 CHAPTER 1. BACKGROUND IDEAS

mm suspended in a liquid. He predicted that the particles would undergo


microscopically observable and statistically predictable motion. The English
botanist Robert Brown had already reported such motion in 1827 while ob-
serving pollen grains in water with a microscope. The physical motion is now
called Brownian motion in honor of Brown’s description.
Einstein calculated a diffusion constant to govern the rate of motion of
suspended particles. The paper was Einstein’s justification of the molecu-
lar and atomic nature of matter. Surprisingly, even in 1905 the scientific
community did not completely accept the atomic theory of matter. In 1908,
the experimental physicist Jean-Baptiste Perrin conducted a series of experi-
ments that empirically verified Einstein’s theory. Perrin thereby determined
the physical constant known as Avogadro’s number for which he won the
Nobel prize in 1926. Nevertheless, Einstein’s theory was difficult to rigor-
ously justify mathematically. In a series of papers from 1918 to 1923, the
mathematician Norbert Wiener constructed a mathematical model of Brow-
nian motion. Wiener and others proved many surprising facts about his
mathematical model of Brownian motion, research that continues today. In
recognition of his work, his mathematical construction is often called the
Wiener process. [31]

Growth of Mathematical Finance


Modern mathematical finance theory begins in the 1960s. In 1965 the economist
Paul Samuelson published two papers that argue that stock prices fluctuate
randomly [31]. One explained the Samuelson and Fama efficient markets
hypothesis that in a well-functioning and informed capital market, asset-
price dynamics are described by a model in which the best estimate of an
asset’s future price is the current price (possibly adjusted for a fair expected
rate of return.) Under this hypothesis, attempts to use past price data or
publicly available forecasts about economic fundamentals to predict secu-
rity prices cannot succeed. In the other paper with mathematician Henry
McKean, Samuelson shows that a good model for stock price movements
is Geometric Brownian Motion. Samuelson noted that Bachelier’s model
failed to ensure that stock prices would always be positive, whereas geomet-
ric Brownian motion avoids this error [31].
The most important development was the 1973 Black-Scholes model for
option pricing. The two economists Fischer Black and Myron Scholes (and
simultaneously, and somewhat independently, the economist Robert Merton)
1.1. BRIEF HISTORY OF MATHEMATICAL FINANCE 5

deduced an equation that provided the first strictly quantitative model for
calculating the prices of options. The key variable is the volatility of the
underlying asset. These equations standardized the pricing of derivatives
in exclusively quantitative terms. The formal press release from the Royal
Swedish Academy of Sciences announcing the 1997 Nobel Prize in Economics
states that they gave the honor “for a new method to determine the value of
derivatives. Robert C. Merton and Myron S. Scholes have, in collaboration
with the late Fischer Black developed a pioneering formula for the valuation
of stock options. Their methodology has paved the way for economic valua-
tions in many areas. It has also generated new types of financial instruments
and facilitated more efficient risk management in society.”
The Chicago Board Options Exchange (CBOE) began publicly trading
options in the United States in April 1973, a month before the official pub-
lication of the Black-Scholes model. By 1975, traders on the CBOE were
using the model to both price and hedge their options positions. In fact,
Texas Instruments created a hand-held calculator specially programmed to
produce Black-Scholes option prices and hedge ratios.
The basic insight underlying the Black-Scholes model is that a dynamic
portfolio trading strategy in the stock can replicate the returns from an option
on that stock. This is “hedging an option” and it is the most important idea
underlying the Black-Scholes-Merton approach. Much of the rest of the book
will explain what that insight means and how to apply it to calculate option
values.
The story of the development of the Black-Scholes-Merton option pricing
model is that Black started working on this problem by himself in the late
1960s. His idea was to apply the capital asset pricing model to value the
option in a continuous time setting. Using this idea, the option value satis-
fies a partial differential equation. Black could not find the solution to the
equation. He then teamed up with Myron Scholes who had been thinking
about similar problems. Together, they solved the partial differential equa-
tion using a combination of economic intuition and earlier pricing formulas.
At this time, Myron Scholes was at MIT. So was Robert Merton, who
was applying his mathematical skills to problems in finance. Merton showed
Black and Scholes how to derive their differential equation differently. Merton
was the first to call the solution the Black-Scholes option pricing formula.
Merton’s derivation used the continuous time construction of a perfectly
hedged portfolio involving the stock and the call option together with the
notion that no arbitrage opportunities exist. This is the approach we will
6 CHAPTER 1. BACKGROUND IDEAS

take. In the late 1970s and early 1980s mathematicians Harrison, Kreps
and Pliska showed that a more abstract formulation of the solution as a
mathematical model called a martingale provides greater generality.
By the 1980s, the adoption of finance theory models into practice was
nearly immediate. Additionally, the mathematical models used in financial
practice became as sophisticated as any found in academic financial research
[48].
Several explanations account for the different adoption rates of mathe-
matical models into financial practice during the 1960s, 1970s and 1980s.
Money and capital markets in the United States exhibited historically low
volatility in the 1960s; the stock market rose steadily, interest rates were rel-
atively stable, and exchange rates were fixed. Such simple markets provided
little incentive for investors to adopt new financial technology. In sharp con-
trast, the 1970s experienced several events that led to market change and
increasing volatility. The most important of these was the shift from fixed
to floating currency exchange rates; the world oil price crisis resulting from
the creation of the Middle East cartel; the decline of the United States stock
market in 1973-1974 which was larger in real terms than any comparable
period in the Great Depression; and double-digit inflation and interest rates
in the United States. In this environment, the old rules of thumb and sim-
ple regression models were inadequate for making investment decisions and
managing risk [48].
During the 1970s, newly created derivative-security exchanges traded
listed options on stocks, futures on major currencies and futures on U.S.
Treasury bills and bonds. The success of these markets partly resulted from
increased demand for managing risks in a volatile economic market. This suc-
cess strongly affected the speed of adoption of quantitative financial models.
For example, experienced traders in the over the counter market succeeded by
using heuristic rules for valuing options and judging risk exposure. However
these rules of thumb were inadequate for trading in the fast-paced exchange-
listed options market with its smaller price spreads, larger trading volume
and requirements for rapid trading decisions while monitoring prices in both
the stock and options markets. In contrast, mathematical models like the
Black-Scholes model were ideally suited for application in this new trading
environment [48].
The growth in sophisticated mathematical models and their adoption into
financial practice accelerated during the 1980s in parallel with the extraordi-
nary growth in financial innovation. A wave of de-regulation in the financial
1.1. BRIEF HISTORY OF MATHEMATICAL FINANCE 7

sector was an important element driving innovation.


Conceptual breakthroughs in finance theory in the 1980s were fewer and
less fundamental than in the 1960s and 1970s, but the research resources de-
voted to the development of mathematical models was considerably larger.
Major developments in computing power, including the personal computer
and increases in computer speed and memory enabled new financial mar-
kets and expansions in the size of existing ones. These same technologies
made the numerical solution of complex models possible. Faster computers
also speeded up the solution of existing models to allow virtually real-time
calculations of prices and hedge ratios.

Ethical considerations
According to M. Poovey [54], Enron developed new derivatives specifically to
take advantage of de-regulation. Poovey says that derivatives remain largely
unregulated, for they are too large, too virtual, and too complex for industry
oversight to police. In 1997-1998 the Financial Accounting Standards Board
(an industry standards organization whose mission is to establish and im-
prove standards of financial accounting) did try to rewrite the rules governing
the recording of derivatives, but ultimately they failed: in the 1999-2000 ses-
sion of Congress, lobbyists for the accounting industry persuaded Congress
to pass the Commodities Futures Modernization Act, which exempted or
excluded “over the counter” derivatives from regulation by the Commodity
Futures Trading Commission, the federal agency that monitors the futures
exchanges. Current law requires only banks and other financial institutions
to reveal their derivatives positions. In contrast, Enron, originally an energy
and commodities firm which collapsed in 2001 due to an accounting scandal,
never registered as a financial institution and was never required to disclose
the extent of its derivatives trading.
In 1995, the sector composed of finance, insurance, and real estate over-
took the manufacturing sector in America’s gross domestic product. By
the year 2000 this sector led manufacturing in profits. The Bank for In-
ternational Settlements estimates that in 2001 the total value of derivative
contracts traded approached one hundred trillion dollars, which is approx-
imately the value of the total global manufacturing production for the last
millennium. In fact, one reason that derivatives trades have to be electronic
instead of involving exchanges of capital is that the amounts exceed the total
of the world’s physical currencies.
8 CHAPTER 1. BACKGROUND IDEAS

Prior to the 1970s, mathematical models had a limited influence on fi-


nance practice. But since 1973 these models have become central in markets
around the world. In the future, mathematical models are likely to have an
indispensable role in the functioning of the global financial system including
regulatory and accounting activities.
We need to seriously question the assumptions that make models of
derivatives work: the assumptions that the market follows probability models
and the assumptions underneath the mathematical equations. But what if
markets are too complex for mathematical models? What if unprecedented
events do occur, and when they do – as we know they do – what if they
affect markets in ways that no mathematical model can predict? What if
the regularity that all mathematical models assume ignores social and cul-
tural variables that are not subject to mathematical analysis? Or what if the
mathematical models traders use to price futures actually influence the future
in ways that the models cannot predict and the analysts cannot govern?
Any virtue can become a vice if taken to extreme, and just so with the
application of mathematical models in finance practice. At times, the mathe-
matics of the models becomes too interesting and we lose sight of the models’
ultimate purpose. Futures and derivatives trading depends on the belief that
the stock market behaves in a statistically predictable way; in other words,
that probability distributions accurately describe the market. The mathe-
matics is precise, but the models are not, being only approximations to the
complex, real world. The practitioner should apply the models only tenta-
tively, assessing their limitations carefully in each application. The belief
that the market is statistically predictable drives the mathematical refine-
ment, and this belief inspires derivative trading to escalate in volume every
year.
Financial events since late 2008 show that the concerns of the previ-
ous paragraphs have occurred. In 2009, Congress and the Treasury Depart-
ment considered new regulations on derivatives markets. Complex deriva-
tives called credit default swaps appear to have used faulty assumptions that
did not account for irrational and unprecedented events, as well as social
and cultural variables that encouraged unsustainable borrowing and debt.
Extremely large positions in derivatives which failed to account for unlikely
events caused bankruptcy for financial firms such as Lehman Brothers and
the collapse of insurance giants like AIG. The causes are complex, but critics
fix some of the blame on the complex mathematical models and the people
who created them. This blame results from distrust of that which is not un-
1.1. BRIEF HISTORY OF MATHEMATICAL FINANCE 9

derstood. Understanding the models and their limitations is a prerequisite


for creating a future which allows proper risk management.

Sources
This section is adapted from the articles “Influence of mathematical mod-
els in finance on practice: past, present and future” by Robert C. Merton
in Mathematical Models in Finance edited by S. D. Howison, F. P. Kelly,
and P. Wilmott, Chapman and Hall, 1995, (HF 332, M384 1995); “In Honor
of the Nobel Laureates Robert C. Merton and Myron S. Scholes: A Par-
tial Differential Equation that Changed the World” by Robert Jarrow in the
Journal of Economic Perspectives, Volume 13, Number 4, Fall 1999, pages
229-248; and R. Jarrow and P. Protter, “A short history of stochastic inte-
gration and mathematical finance the early years, 1880-1970”, IMS Lecture
Notes, Volume 45, 2004, pages 75-91. Some additional ideas are drawn from
the article “Can Numbers Ensure Honesty? Unrealistic Expectations and the
U.S. Accounting Scandal”, by Mary Poovey, in the Notice of the American
Mathematical Society, January 2003, pages 27-35.

Key Concepts
1. Finance theory is the study of economic agents’ behavior allocating
financial resources and risks across alternative financial instruments
over time in an uncertain environment. Mathematics provides tools to
model and analyze that behavior in allocation and time, taking into
account uncertainty.

2. Louis Bachelier’s 1900 math dissertation on the theory of speculation


in the Paris markets marks the twin births of both the continuous time
mathematics of stochastic processes and the continuous time economics
of option pricing.

3. The most important theoretical development was the Black-Scholes


model for option pricing published in 1973.

4. The growth in sophisticated mathematical models and their adoption


into financial practice accelerated during the 1980s in parallel with
the extraordinary growth in financial innovation. Major developments
in computing power, including the personal computer and increases
10 CHAPTER 1. BACKGROUND IDEAS

in computer speed and memory enabled new financial markets and


expansions in the size of existing ones.

Vocabulary
1. Finance theory is the study of economic agents’ behavior allocating
financial resources and risks across alternative financial instruments
over time in an uncertain environment.

2. A derivative is a financial agreement between two parties that de-


pends on the future price or performance of an underlying asset. The
underlying asset could be a stock, a bond, a currency, or a commodity.

3. Types of derivatives: Derivatives come in many types. The most


common examples are futures, agreements to trade something at a
set price at a given date; options, the right but not the obligation to
buy or sell at a given price; forwards, like futures but traded directly
between two parties instead of on exchanges; and swaps, exchanging
one lot of obligations for another. Derivatives can be based on pretty
much anything as long as two parties are willing to trade risks and can
agree on a price [66].

Problems to Work for Understanding


1. Write a short summary of the “tulip mania” in seventeenth century
Holland.

2. Write a short summary of the “South Sea Island” bubble in eighteenth


century England.

3. Pick a commodity and find current futures prices for that commodity.

4. Pick a stock and find current options prices on that stock.

Outside Readings and Links:


1. History of the Black Scholes Equation Accessed Thu Jul 23, 2009 6:07
AM

2. Clip from “The Trillion Dollar Bet” Accessed Fri Jul 24, 2009 5:29 AM.
1.2. OPTIONS AND DERIVATIVES 11

1.2 Options and Derivatives


Section Starter Question
Suppose your rich neighbor offered an agreement to you today to sell his clas-
sic Jaguar sports-car to you (and only you) a year from today at a reasonable
price agreed upon today. (You and your neighbor will exchange cash and car
a year from today.) What would be the advantages and disadvantages to you
of such an agreement? Would that agreement be valuable? How would you
determine how valuable that agreement is?

Definitions
A call option is the right to buy an asset at an established price at a certain
time. A put option is the right to sell an asset at an established price at a
certain time. Another slightly simpler financial instrument is a future which
is a contract to buy or sell an asset at an established price at a certain time.
More fully, a call option is an agreement or contract by which at a defi-
nite time in the future, known as the expiry date, the holder of the option
may purchase from the option writer an asset known as the underlying
asset for a definite amount known as the exercise price or strike price.
A put option is an agreement or contract by which at a definite time in
the future, known as the expiry date, the holder of the option may sell to
the option writer an asset known as the underlying asset for a definite
amount known as the exercise price or strike price. The holder of a Eu-
ropean option may only exercise it at the end of its life on the expiry date.
The holder of an American option may exercise it at any time during its
life up to the expiry date. For comparison, in a futures contract the writer
must buy (or sell) the asset to the holder at the agreed price at the prescribed
time. The underlying assets commonly traded on options exchanges include
stocks, foreign currencies, and stock indices. For futures, in addition to these
kinds of assets the common assets are commodities such as minerals and
agricultural products. In this text we will usually refer to options based on
stocks, since stock options are easily described, commonly traded and prices
are easily found.
Jarrow and Protter [31, page 7] tell a story about the origin of the names
European options and American options. While writing his important 1965
article on modeling stock price movements as a geometric Brownian motion,
12 CHAPTER 1. BACKGROUND IDEAS

Paul Samuelson went to Wall Street to discuss options with financial profes-
sionals. Samuelson’s Wall Street contact informed him that there were two
kinds of options, one more complex that could be exercised at any time, the
other more simple that could be exercised only at the maturity date. The
contact said that only the more sophisticated European mind (as opposed
to the American mind) could understand the former more complex option.
In response, when Samuelson wrote his paper, he used these prefixes and
reversed the ordering! Now in a further play on words, financial markets
offer many more kinds of options with geographic labels but no relation to
that place name. For example; two common types are Asian options and
Bermuda options.

The Markets for Options


In the United States, some exchanges trading options are the Chicago Board
Options Exchange (CBOE), the American Stock Exchange (AMEX), and the
New York Stock Exchange (NYSE) among others. Not all options trade on
exchanges. Over-the-counter options markets where financial institutions and
corporations trade directly with each other are increasingly popular. Trading
is particularly active in options on foreign exchange and interest rates. The
main advantage of an over-the-counter option is that a financial institution
can tailor it to meet the needs of a particular client. For example, the strike
price and maturity do not have to correspond to the set standards of the
exchanges. The parties to the option can incorporate other nonstandard
features into the option. A disadvantage of over-the-counter options is that
the terms of the contract need not be open to inspection by others and the
contract may be so different from standard derivatives that it is hard to
evaluate in terms of risk and value.
A European put option allows the holder to sell the asset on a certain
date for a prescribed amount. The put option writer is obligated to buy the
asset from the option holder. If the underlying asset price goes below the
strike price, the holder makes a profit because the holder can buy the asset
at the current low price and sell it at the agreed higher price instead of the
current price. If the underlying asset price goes above the strike price, the
holder exercises the right not to sell. The put option has payoff properties
that are the opposite to those of a call. The holder of a call option wants the
asset price to rise, the higher the asset price, the higher the immediate profit.
The holder of a put option wants the asset price to fall as low as possible.
1.2. OPTIONS AND DERIVATIVES 13

Figure 1.1: This is not the market for options!

The further below the strike price, the more valuable is the put option.
The expiry date specifies the month in which the European option ends.
The precise expiration date of exchange traded options is 10:59 PM Central
Time on the Saturday immediately following the third Friday of the expi-
ration month. The last day on which options trade is the third Friday of
the expiration month. Exchange traded options are typically offered with
lifetimes of 1, 2, 3, and 6 months.
Another item used to describe an option is the strike price, the price
at which the asset can be bought or sold. For exchange traded options on
stocks, the exchange typically chooses strike prices spaced $2.50, $5, or $10
apart. The usual rule followed by exchanges is to use a $2.50 spacing if the
stock price is below $25, $5 spacing when it is between $25 and $200, and
$10 spacing when it is above $200. For example, if Corporation XYZ has
a current stock price of $12.25, options traded on it may have strike prices
of $10, $12.50, $15, $17.50 and $20. A stock trading at $99.88 may have
options traded at the strike prices of $90, $95, $100, $105, $110 and $115.
Options can be in the money, at the money or out of the money.
An in-the-money option would lead to a positive cash flow to the holder if it
were exercised immediately. Similarly, an at-the-money option would lead to
zero cash flow if exercised immediately, and an out-of-the-money would lead
to negative cash flow if it were exercised immediately. If S is the stock price
and K is the strike price, a call option is in the money when S > K, at the
14 CHAPTER 1. BACKGROUND IDEAS

Option Intinsic Value

K Stock Price

Figure 1.2: Intrinsic value of a call option.

money when S = K and out of the money when S < K. Clearly, an option
will be exercised only when it is in the money.

Characteristics of Options
The intrinsic value of an option is the maximum of zero and the value it
would have if exercised immediately. For a call option, the intrinsic value
is therefore max(S − K, 0). Often it might be optimal for the holder of an
American option to wait rather than exercise immediately. The option is then
said to have time value. Note that the intrinsic value does not consider the
transaction costs or fees associated with buying or selling an asset.
The word “may” in the description of options, and the name “option”
itself implies that for the holder of the option or contract, the contract is a
right, and not an obligation. The other party of the contract, known as the
writer does have a potential obligation, since the writer must sell (or buy)
the asset if the holder chooses to buy (or sell) it. Since the writer confers on
the holder a right with no obligation an option has some value. The holder
must pay for the right at the time of opening the contract. Conversely, the
writer of the option must be compensated for the obligation taken on. Our
main goal is to answer the following questions:
How much should one pay for that right? That is, what is the
value of an option? How does that value vary in time? How does
that value depend on the underlying asset?
Note that the value of the option contract depends essentially on the char-
acteristics of the underlying asset. If the asset has relatively large variations
1.2. OPTIONS AND DERIVATIVES 15

Increase in European European American American


Variable Call Put Call Put
Stock Price Increase Decrease Increase Decrease
Strike Price Decrease Increase Decrease Increase
Time to Expiration ? ? Increase Increase
Volatility Increase Increase Increase Increase
Risk-free Rate Increase Decrease Increase Decrease
Dividends Decrease Increase Decrease Increase
Table 1.1: Effect on price of increases in the variables influencing option
prices.

in price, then we might believe that the option contract would be relatively
high-priced since with some probability the option will be in the money. The
option contract value is derived from the asset price, and so we call it a
derivative.
Six factors affect the price of a stock option:

• the current stock price S;

• the strike price K;

• the time to expiration T − t where T is the expiration time and t is the


current time;

• the volatility of the stock price;

• the risk-free interest rate; and

• the dividends expected during the life of the option.

Consider what happens to option prices when one of these factors changes
while all the others remain fixed. Table 1.1 summarizes the results. The
changes regarding the stock price, the strike price, the time to expiration
and the volatility are easy to explain; the other variables are less important
for our considerations.
Upon exercising it at some time in the future, the payoff from a call option
will be the amount by which the stock price exceeds the strike price. Call
options therefore become more valuable as the stock price increases and less
valuable as the strike price increases. For a put option, the payoff on exercise
16 CHAPTER 1. BACKGROUND IDEAS

is the amount by which the strike price exceeds the stock price. Put options
therefore behave in the opposite way to call options. Put options become less
valuable as stock price increases and more valuable as strike price increases.
Consider next the effect of the expiration date. Both put and call Amer-
ican options become more valuable as the time to expiration increases. The
owner of a long-life option has all the exercise options open to the short-
life option — and more. The long-life option must therefore, be worth at
least as much as the short-life option. European put and call options do not
necessarily become more valuable as the time to expiration increases. The
owner of a long-life European option can only exercise at the maturity of the
option.
Roughly speaking, the volatility of a stock price is a measure of how
much future stock price movements may vary relative to the current price.
As volatility increases, the chance that the stock price will either increase or
decrease greatly relative to the present price also increases. For the owner of
a stock, these two outcomes tend to offset each other. However, this is not
so for the owner of a put or call option. The owner of a call benefits from
price increases, but has limited downside risk in the event of price decrease
since the most that he or she can lose is the price of the option. Similarly,
the owner of a put benefits from price decreases but has limited upside risk
in the event of price increases. The values of puts and calls therefore increase
as volatility increases.
The reader will observe that the language about option prices in this
section has been qualitative and imprecise:

• an option is “a contract to buy or sell an asset at an established price”


without specifying how the price is obtained;

• “. . . the option contract would be relatively high-priced . . . ”;

• “Call options therefore become more valuable as the stock price in-
creases . . . ” without specifiying the rate of change; and

• “As volatility increases, the chance that the stock price will either in-
crease or decrease greatly . . . increases”.

The goal in following sections is to develop a mathematical model which


gives quantitative and precise statements about options prices and to judge
the validity and reliability of the model.
1.2. OPTIONS AND DERIVATIVES 17

Sources
The ideas in this section are adapted from Options, Futures and other Deriva-
tive Securities by J. C. Hull, Prentice-Hall, Englewood Cliffs, New Jersey,
1993 and The Mathematics of Financial Derivatives by P. Wilmott, S. How-
ison, J. Dewynne, Cambridge University Press, 195, Section 1.4, “What are
options for?”, Page 13 and R. Jarrow and P. Protter, “A short history of
stochastic integration and mathematical finance the early years, 1880–1970”,
IMS Lecture Notes, Volume 45, 2004, pages 75–91.

Key Concepts
1. A call option is the right to buy an asset at an established price at a
certain time.
2. A put option is the right to sell an asset at an established price at a
certain time.
3. A European option may only be exercised at the end of its life on the
expiry date, an American option may be exercised at any time during
its life up to the expiry date.
4. Six factors affect the price of a stock option:
• the current stock price S;
• the strike price K;
• the time to expiration T − t where T is the expiration time and t
is the current time;
• the volatility of the stock price σ;
• the risk-free interest rate r; and
• the dividends expected during the life of the option.

Vocabulary
1. A call option is the right to buy an asset at an established price at a
certain time.
2. A put option is the right to sell an asset at an established price at a
certain time.
18 CHAPTER 1. BACKGROUND IDEAS

3. A future is a contract to buy (or sell) an asset at an established price


at a certain time.

4. Volatility is a measure of the variability and therefore the risk of a


price, usually the price of a security.

Problems to Work for Understanding


1. (a) Find and write the definition of a “future”, also called a futures
contract. Graph the intrinsic value of a futures contract at its
contract date, or expiration date, as in 1.2.
(b) Explain why holding a call option and writing a put option with
the same strike price K on the same asset is the same as having a
futures contract on the asset with strike price K. Draw a graph of
the value of the option combination and the value of the futures
contract on the same axes.

2. Puts and calls are not the only option contracts available, just the most
fundamental and the simplest. Puts and calls eliminate the risk of up
or down price movements in the underlying asset. Some other option
contracts designed to eliminate other risks are combinations of puts
and calls.

(a) Draw the graph of the value of the option contract composed of
holding a put option with strike price K1 and holding a call option
with strike price K2 where K1 < K2 . (Assume both the put and
the call have the same expiration date.) The holder profits only
if the underlier moves dramatically in either direction. This is
known as a long strangle.
(b) Draw the graph of the value of an option contract composed of
holding a put option with strike price K and holding a call option
with the same strike price K. (Assume both the put and the call
have the same expiration date.) This is called an long straddle,
and also called a bull straddle.
(c) Draw the graph of the value of an option contract composed of
holding one call option with strike price K1 and the simultaneous
1.3. SPECULATION AND HEDGING 19

writing of a call option with strike price K2 with K1 < K2 . (As-


sume both the options have the same expiration date.) This is
known as a bull call spread.
(d) Draw the graph of the value of an option contract created by si-
multaneously holding one call option with strike price K1 , holding
another call option with strike price K2 where K1 < K2 , and writ-
ing two call options at strike price (K1 + K2 )/2. This is known as
a butterfly spread.
(e) Draw the graph of the value of an option contract created by
holding one put option with strike price K and holding two call
options on the same underlying security, strike price, and maturity
date. This is known as a triple option or strap

Outside Readings and Links:


1. What are stock options? An explanation from youtube.com

1.3 Speculation and Hedging


Section Starter Question
Discuss examples of speculation in your experience. (Example: think of
“scalping tickets”.) A hedge is a transaction or investment that is taken out
specifically to reduce or cancel out risk. Discuss examples of hedges in your
experience.

Definitions
Options have two primary uses, speculation and hedging. Speculation
is to assume a financial risk in anticipation of a gain, especially to buy or
sell to profit from market fluctuations. The market fluctuations are random
financial variations with a known (or assumed) probability distribution.

Risk and Uncertainty


Risk, first articulated by the economist F. Knight in 1921, is a variability
that you can put a price on. That is, risk is random financial variation
20 CHAPTER 1. BACKGROUND IDEAS

that has a known (or assumed) probability distribution. In poker, say that
you’ll win a poker hand unless your opponent draws to an inside straight,
a particular kind of card draw from the deck. It is not necessary to know
what this poker play means. However what is important to know is that this
particular kind of draw has a probability of exactly 1/11. A poker player
can calculate the 1/11 with simple rules of probability theory. Your bet
is risk, you gain or lose of your bet with a known probability. It may be
unpleasant to lose the bet, but at least you can account for it in advance
with a probability, [65].
Uncertainty is chance variability due to unknown and unmeasured fac-
tors. You might have some awareness (or not) of the variability out there.
You may have no idea of how many such factors exist, or when any one may
strike, or how big the effects will be. Uncertainty is the “unknown unknowns”
[65].
Risk sparks a free-market economy with the impulse to make a gain.
Uncertainty halts an economy with fear.

Example: Speculation on a stock with calls


An investor who believes that a particular stock, say XYZ, is going to rise
may purchase some shares in the company. If she is correct, she makes
money, if she is wrong she loses money. The investor is speculating. Suppose
the price of the stock goes from $2.50 to $2.70, then the investor makes $0.20
on each $2.50 investment, or a gain of 8%. If the price falls to $2.30, then
the investor loses $0.20 on each $2.50 share, for a loss of 8%. These are both
standard calculations.
Alternatively, suppose the investor thinks that the share price is going
to rise within the next couple of months, and that the investor buys a call
option with exercise price of $2.50 and expiry date in three months.
Now assume that it costs $0.10 to purchase a European call option on
stock XYZ with expiration date in three months and strike price $2.50. That
means in three months time, the investor could, if the investor chooses to,
purchase a share of XYZ at price $2.50 per share no matter what the current
price of XYZ stock is! Note that the price of $0.10 for this option may not
be an proper price for the option, but we use $0.10 simply because it is easy
to calculate with. However, 3-month option prices are often about 5% of the
stock price, so $0.10 is reasonable. In three months time if the XYZ stock
price is $2.70, then the holder of the option may purchase the stock for $2.50.
1.3. SPECULATION AND HEDGING 21

This action is called exercising the option. It yields an immediate profit of


$0.20. That is, the option holder can buy the share for $2.50 and immediately
sell it in the market for $2.70. On the other hand if in three months time,
the XYZ share price is only $2.30, then it would not be sensible to exercise
the option. The holder lets the option expire. Now observe carefully: By
purchasing an option for $0.10, the holder can derive a net profit of $0.10
($0.20 revenue less $0.10 cost) or a loss of $0.10 (no revenue less $0.10 cost.)
The profit or loss is magnified to 100% with the same probability of change.
Investors usually buy options in quantities of hundreds, thousands, even tens
of thousands so the absolute dollar amounts can be large. Compared with
stocks, options offer a great deal of leverage, that is, large relative changes in
value for the same investment. Options expose a portfolio to a large amount
of risk cheaply. Sometimes a large degree of risk is desirable. This is the use
of options and derivatives for speculation.

Example: Speculation on a stock with calls


Consider the profit and loss of a investor who buys 100 call options on XYZ
stock with a strike price of $140. Suppose the current stock price is $138, the
expiration date of the option is two months, and the option price is $5. Since
the options are European, the investor can exercise only on the expiration
date. If the stock price on this date is less than $140, the investor will choose
not to exercise the option since buying a stock at $140 that has a market
value less than $140 is not sensible. In these circumstances the investor loses
the whole of the initial investment of $500. If the stock price is above $140
on the expiration date, the holder will exercise the options. Suppose for
example,the stock price is $155. By exercising the options, the investor is
able to buy 100 shares for $140 per share. By selling the shares immediately,
the investor makes a gain of $15 per share, or $1500 ignoring transaction
costs. Taking the initial cost of the option into account, the net profit to the
investor is $10 per option, or $1000 on an initial investment of $500. Note
that this calculation ignores any time value of money.

Example: Speculation on a stock with puts


Consider an investor who buys 100 European put options on XYZ with a
strike price of $90. Suppose the current stock price is $86, the expiration
date of the option is in 3 months and the option price is $7. Since the
22 CHAPTER 1. BACKGROUND IDEAS

options are European, the holder will exercise only if the stock price is below
$90 at the expiration date. Suppose the stock price is $65 on this date. The
investor can buy 100 shares for $65 per share, and under the terms of the
put option, sell the same stock for $90 to realize a gain of $25 per share,
or $2500. Again, this simple example ignores transaction costs. Taking the
initial cost of the option into account, the investor’s net profit is $18 per
option, or $1800. This is a profit of 257% even though the stock has only
changed price $25 from an initial of $90, or 28%. Of course, if the final price
is above $90, the put option expires worthless, and the investor loses $7 per
option, or $700.

Example: Hedging with calls on foreign exchange rates


Suppose that a U.S. company knows that it is due to pay 1 million pounds to
a British supplier in 90 days. The company has significant foreign exchange
risk. The cost in U.S. dollars of making the payment depends on the exchange
rate in 90 days. The company instead can buy a call option contract to
acquire 1 million pounds at a certain exchange rate, say 1.7 in 90 days. If the
actual exchange rate in 90 days proves to be above 1.7, the company exercises
the option and buys the British pounds it requires for $1,700,000. If the
actual exchange rate proves to be below 1.7, the company buys the pounds
in the market in the usual way. This option strategy allows the company
to insure itself against adverse exchange rate increases but still benefit from
favorable decreases. Of course this insurance comes at the relatively small
cost of buying the option on the foreign exchange rate.

Example: Hedging with a portfolio with puts and calls


Since the value of a call option rises when an asset price rises, what happens
to the value of a portfolio containing both shares of stock of XYZ and a
negative position in call options on XYZ stock? If the stock price is rising,
the call option value will also rise, the negative position in calls will become
greater, and the net portfolio should remain approximately constant if the
positions are in the right ratio. If the stock price is falling then the call
option value price is also falling. The negative position in calls will become
smaller. If held in the proper amounts, the total value of the portfolio should
remain constant! The risk (or more precisely, the variation) in the portfolio
is reduced! The reduction of risk by taking advantage of such correlations
1.3. SPECULATION AND HEDGING 23

is called hedging. Used carefully, options are an indispensable tool of risk


management.
Consider a stock currently selling at $100 and having a standard deviation
in its price fluctuations of $10, for a proportion variation of 10%. We can
use the Black-Scholes formula derived later to show that a call option with a
strike price of $100 and a time to expiration of one year would sell for $11.84.
A 1 percent rise in the stock from $100 to $101 would drive the option price
to $12.73. Consider the total effects in Table 1.2.
Suppose a trader has an original portfolio comprised of 8944 shares of
stock selling at $100 per share. (The unusual number of 8944 shares comes
from the Black-Scholes formula as a hedge ratio.) Assume also that a trader
short sells call options on 10,000 shares at the current price of $11.84. That
is, the short seller borrows the options from another trader and therefore
must later return the options at the option price at the return time. The
obligation to return the borrowed options creates a negative position in the
option value. The transaction is called short selling because the trader sells a
good he or she does not actually own and must later pay it back. In Table 1.2
this debt or short position in the option is indicated by a minus sign. The
entire portfolio of shares and options has a net value of $776,000.
Now consider the effect of a 1 percent change in the price of the stock. If
the stock increases 1 percent,the shares will be worth $903,344. The option
price will increase from $11.84 to $12.73. But since the portfolio also involves
a short position in 10,000 options, this creates a loss of $8,900. This is the
additional value of what the borrowed options are now worth, so the borrower
must additionally this amount back! Taking these two effects into account,
the value of the portfolio will be $776,044. This is nearly the same as the
original value. The slight discrepancy of $44 is rounding error due to the fact
that the number of stock shares calculated from the hedge ratio is rounded
to an integer number of shares for simplicity in the example, and the change
in option value is rounded to the nearest penny, also for simplicity. In actual
practice, financial institutions take great care to avoid round-off differences.
On the other hand of the stock price falls by 1 percent, there will be a
loss in the stock of $8944. The price on this option will fall from $11.84 to
$10.95 and this means that the entire drop in the price of the 10,000 options
will be $8900. Taking both of these effects into account, the portfolio will
then be worth $776,956. The overall value of the portfolio will not change (to
within $44 due to round-off effects) regardless of what happens to the stock
price. If the stock price increases, there is an offsetting loss on the option; if
24 CHAPTER 1. BACKGROUND IDEAS

Original Portfolio S = 100, C = $11.84


8,944 shares of stock $894,400
Short position on 10,000 options -$118,400
Net value $776,000
Stock Price rises 1% S = 101, C = $12.73
8,944 shares of stock $903,344
Short position on 10,000 options -$127,300
Net value $776,044
Stock price falls 1% S = 99, C = $10.95
8,944 shares of stock $885,456
Short position on options -$109,500
Net value $775,956

Table 1.2: Hedging to keep a portfolio constant.

the stock price falls, there is an offsetting gain on the option.


This example is not intended to illustrate a prudent investment strategy.
If an investor desired to maintain a constant amount of money, putting the
sum of money invested in shares into the bank or in Treasury bills instead
would safeguard the sum and even pay a modest amount of interest. If the
investor wished to maximize the investment, then investing in stocks solely
and enduring a probable 10% loss in value would still leave a larger total
investment.
This example is a first example of short selling. It is also an illustration of
how holding an asset and short selling a related asset in carefully calibrated
ratios can hold a total investment constant. The technique of holding and
short-selling to keep a portfolio constant will later be an important idea in
deriving the Black-Scholes formula.

Sources
The section on risk and uncertainty is adapted from N. Silver, The Signal
and the Noise, The Penguin Press, New York, 2012, page 29. The exam-
ples in this section are adapted from Options, Futures and other Derivative
Securities by J. C. Hull, Prentice-Hall, Englewood Cliffs, New Jersey, 1993
and The Mathematics of Financial Derivatives by P. Wilmott, S. Howison,
J. Dewynne, Cambridge University Press, 1995, Section 1.4, “What are op-
tions for?”, Page 13, and Financial Derivatives by Robert Kolb, New York
1.3. SPECULATION AND HEDGING 25

Institute of Finance, New York, 1994, page 110.

Key Concepts
1. Options have two primary uses, speculation and hedging.

2. Options can be a cheap way of exposing a portfolio to a large amount


of risk. Sometimes a large amount of risk is desirable. This is the use
of options and derivatives for speculation.

3. Options allow the investor to insure against adverse security value


movements while still benefiting from favorable movements. This is
use of options for hedging. This insurance comes at the cost of buy-
ing the option.

Vocabulary
1. Risk is random financial variation that has a known (or assumed)
probability distribution. Uncertainty is chance variability that is due
to unknown and unmeasured factors.

2. Speculation is to assume a financial risk in anticipation of a gain,


especially to buy or sell to profit from market fluctuations.

3. Hedging is to protect oneself financially against loss by a counter-


balancing transaction, especially to buy or sell assets as a protection
against loss because of price fluctuation.

Problems to Work for Understanding


1. You would like to speculate on a rise in the price of a certain stock. The
current stock price is $29 and a 3-month call with strike of $30 costs
$2.90. You have $5,800 to invest. Identify two alternate strategies, one
involving investment in the stock, and the other involving investment
in the option. What are the potential gains or losses from each due to
a rise to $31 in three months? What are the potential gains or losses
from each due to a fall to $27 in three months?
26 CHAPTER 1. BACKGROUND IDEAS

2. A company knows it is to receive a certain amount of foreign currency


in 4 months. What kind of option contract is appropriate for hedging?
What is the risk? Be specific.

3. The current price of a stock is $94 and 3-month call options with a
strike price of $95 currently sell for $4.70. An investor who feels that
the price of the stock will increase is trying to decide between buying
100 shares and buying 2,000 call options. Both strategies involve an
investment of $9,400. Write and solve an inequality to find how high the
stock price must rise for the option strategy to be the more profitable.
What advice would you give?

Outside Readings and Links:


• Speculation and Hedging A short youtube video on speculation and
hedging, from “The Trillion Dollar Bet”.

• More Speculation and Hedging A short youtube video on speculation


and hedging.

1.4 Arbitrage
Section Starter Question
It’s the day of the big game. You know that your rich neighbor really wants
to buy tickets, in fact you know he’s willing to pay $50 a ticket. While on
campus, you see a hand lettered sign offering “two general-admission tickets
at $25 each, inquire immediately at the mathematics department”. You have
your phone with you, what should you do? Discuss whether this is a frequent
event, and why or why not? Is this market efficient? Is there any risk in this
market?

Definition of Arbitrage
The notion of arbitrage is crucial in the modern theory of finance. It is a
cornerstone of the Black, Scholes and Merton option pricing theory, devel-
oped in 1973, for which Scholes and Merton received the Nobel Prize in 1997
(Fisher Black died in 1995).
1.4. ARBITRAGE 27

An arbitrage opportunity is a circumstance where the simultaneous


purchase and sale of related securities is guaranteed to produce a riskless
profit. Arbitrage opportunities should be rare, but in a world-wide basis
some do occur.
This section illustrates the concept of arbitrage with simple examples.

An arbitrage opportunity in exchange rates


Consider a stock that is traded in both New York and London. Suppose that
the stock price is $172 in New York and £100 in London at a time when
the exchange rate is $1.7500 per pound. An arbitrageur in New York could
simultaneously buy 100 shares of the stock in New York and sell them in
London to obtain a risk-free profit of

100 shares × 100 £/share × 1.75 $/£ − 100 shares × 172 $/share = $300

in the absence of transaction costs. Transaction costs would probably elim-


inate the profit on a small transaction like this. However, large investment
houses face low transaction costs in both the stock market and the foreign
exchange market. Trading firms would find this arbitrage opportunity very
attractive and would try to take advantage of it in quantities of many thou-
sands of shares.
The shares in New York are underpriced relative to the shares in London
with the exchange rate taken into consideration. However, note that the
demand for the purchase of many shares in New York would soon drive
the price up. The sale of many shares in London would soon drive the price
down. The market would soon reach a point where the arbitrage opportunity
disappears.

An arbitrage opportunity in gold contracts


Suppose that the current market price (called the spot price) of an ounce of
gold is $398 and that an agreement to buy gold in three months time would
set the price at $390 per ounce (called a forward contract). Suppose that
the price for borrowing gold (actually the annualized 3-month interest rate
for borrowing gold, called the convenience price) is 10%. Additionally
assume that the annualized interest rate on 3-month deposits (such as a
certificate of deposit at a bank) is 4%. This set of economic circumstances
creates an arbitrage opportunity. The arbitrageur can borrow one ounce of
28 CHAPTER 1. BACKGROUND IDEAS

$398 + $3.98
$9.95

$398 $390

$2.03 time
3 months

Figure 1.3: A schematic diagram of the cash flow in the gold arbitrage ex-
ample.

gold, immediately sell the borrowed gold at its current price of $398 (this
is called shorting the gold), lend this money out for three months and
simultaneously enter into the forward contract to buy one ounce of gold at
$390 in 3 months. The cost of borrowing the ounce of gold is
$398 × 0.10 × 1/4 = $9.95
and the interest on the 3-month deposit amounts to
$398 × 0.04 × 1/4 = $3.98.
The investor will therefore have 398.00 + 3.98 − 9.95 = 392.03 in the bank ac-
count after 3 months. Purchasing an ounce of gold in 3 months, at the forward
price of $390 and immediately returning the borrowed gold, he will make a
profit of $2.03. This example ignores transaction costs and assumes interests
are paid at the end of the lending period. Transaction costs would probably
consume the profits in this one-ounce example. However, large-volume gold-
trading arbitrageurs with low transaction costs would take advantage of this
opportunity by purchasing many ounces of gold.
Figure 1.3 schematically diagrams this transaction. Time is on the hori-
zontal axis, and cash flow is vertical, with the arrow up if cash comes in to
the investor, and the arrow down if cash flows out from the investor.

Discussion about arbitrage


Arbitrage opportunities as just described cannot last for long. In the first
example, as arbitrageurs buy the stock in New York, the forces of supply
1.4. ARBITRAGE 29

and demand will cause the New York dollar price to rise. Similarly as the
arbitrageurs sell the stock in London, they drive down the London sterling
price. The two stock prices will quickly become equal at the current exchange
rate. Indeed the existence of profit-hungry arbitrageurs (usually pictured as
frenzied traders carrying on several conversations at once!) makes it unlikely
that a major disparity between the sterling price and the dollar price could
ever exist in the first place. In the second example, once arbitrageurs start
to sell gold at the current price of $398, the price will drop. The demand for
the 3-month forward contracts at $390 will cause the price to rise. Although
arbitrage opportunities can arise in financial markets, they cannot last long.
Generalizing, the existence of arbitrageurs means that in practice, only
tiny arbitrage opportunities are observed only for short times in most fi-
nancial markets. As soon as sufficiently many observant investors find the
arbitrage, the prices quickly change as the investors buy and sell to take ad-
vantage of such an opportunity. As a consequence, the arbitrage opportunity
disappears. The principle can stated as follows: in an efficient market there
are no arbitrage opportunities. In this text many arguments depend on the
assumption that arbitrage opportunities do not exist, or equivalently, that
we are operating in an efficient market.
A joke illustrates this principle well: A mathematical economist and a
financial analyst are walking down the street together. Suddenly each spots
a $100 bill lying in the street at the curb! The financial analyst yells “Wow, a
$100 bill, grab it quick!”. The mathematical economist says “Don’t bother, if
it were a real $100 bill, somebody would have picked it up already.” Arbitrage
opportunities are like $100 bills on the ground, they do exist in real life, but
one has to be quick and observant. For purposes of mathematical modeling,
we can treat arbitrage opportunities as non-existent as $100 bills lying in
the street. It might happen, but we don’t base our financial models on the
expectation of finding them.
The principle of arbitrage pricing is that any two investments with
identical payout streams must have the same price. If this were not so,
we could simultaneously sell the more the expensive instrument and buy
the cheaper one; the payment from our sale exceeds the payment for our
purchase. We can make an immediate profit.
Before the 1970s most economists approached the valuation of a security
by considering the probability of the stock going up or down. Economists
now find the price of a security by arbitrage without the consideration of
probabilities. We will use the principle of arbitrage pricing extensively in
30 CHAPTER 1. BACKGROUND IDEAS

this text.

Sources
The ideas in this section are adapted from Options, Futures and other Deriva-
tive Securities by J. C. Hull, Prentice-Hall, Englewood Cliffs, New Jersey,
1993, Stochastic Calculus and Financial Applications, by J. Michael Steele,
Springer, New York, 2001, pages 153–156, the article “What is a . . . Free
Lunch” by F. Delbaen and W. Schachermayer, Notices of the American
Mathematical Society, Vol. 51, Number 5, pages 526–528, and Quantita-
tive Modeling of Derivative Securities, by M. Avellaneda and P. Laurence,
Chapman and Hall, Boca Raton, 2000.

Key Concepts
1. An arbitrage opportunity is a circumstance where the simultaneous
purchase and sale of related securities is guaranteed to produce a risk-
less profit. Arbitrage opportunities should be rare, but in a world-wide
market they can occur.

2. Prices change as the investors move to take advantage of such an op-


portunity. As a consequence, the arbitrage opportunity disappears.
This becomes an economic principle: in an efficient market there are
no arbitrage opportunities.

3. The principle of arbitrage pricing is that any two investments with


identical payout streams must have the same price.

Vocabulary
1. Arbitrage is locking in a riskless profit by simultaneously entering into
transactions in two or more markets, exploiting mismatches in pricing.

Problems to Work for Understanding


1. Consider the hypothetical country of Elbonia, where the government
has declared a “currency band” policy, in which the exchange rate
1.4. ARBITRAGE 31

between the domestic currency, the Elbonian Bongo Buck, denoted by


EBB, and the U.S. Dollar must fluctuate in a prescribed band, namely:

0.95USD ≤ EBB ≤ 1.05USD

for at least one year. Suppose also that the Elbonian government has
issued 1-year notes denominated in the EBB that pay a continuously
compounded interest rate of 30%. Assuming that the corresponding
continuously compounded interest rate for US deposits is 6%, show that
an arbitrage opportunity exists. (Adapted from Quantitative Modeling
of Derivative Securities, by M. Avellaneda and P. Laurence, Chapman
and Hall, Boca Raton, 2000, Exercises 1.7.1, page 18).
2. (a) At a certain time, the exchange rate between the U.S. Dollar and
the Euro was 1.4280, that is, it cost $1.4280 to buy one Euro. At
that time, the 1-year Fed Funds rate, (the bank-to-bank lending
rate), in the United States was 4.7500% (assume it is compounded
continuously). The forward rate (the exchange rate in a forward
contract that allows you to buy Euros in a year) for purchasing
Euros 1 year from today was 1.4312. What was the corresponding
bank-to-bank lending rate in Europe (assume it is compounded
continuously), and what principle allows you to claim that value?
(b) Find the current exchange rate between the U.S. Dollar and the
Euro, the current 1-year Fed Funds rate, and the current forward
rate for exchange of Euros to Dollars. Use those values to compute
the bank-to-bank lending rate in Europe.

3. According to the article “Bullion bulls” on page 81 in the October 8,


2009 issue of The Economist, gold rose from about $510 per ounce in
January 2006 to about $1050 per ounce in October 2009, 46 months
later.

(a) What was the continuously compounded annual rate of increase


of the price of gold over this period?
(b) In October 2009, one could borrow or lend money at 5% interest,
again assume it was compounded continuously. In view of this,
describe a strategy that would have made a profit in October 2010,
involving borrowing or lending money, assuming that the rate of
increase in the price of gold stayed constant over this time.
32 CHAPTER 1. BACKGROUND IDEAS

(c) The article suggests that the rate of increase for gold would stay
constant. In view of this, what do you expect to happen to interest
rates and what principle allows you to conclude that?

4. Consider a market that has a security and a bond so that money can
be borrowed or loaned at an annual interest rate of r compounded
continuously. At the end of a time period T , the security will have
increased in value by a factor U to SU , or decreased in value by a
factor D to value SD. Show that a forward contract with strike price
k that, is, a contract to buy the security which has potential payoffs
SU − k and SD − k should have the strike price set at S exp(rT ) to
avoid an arbitrage opportunity.

Outside Readings and Links:


1. A lecture on currency arbitrage A link to a youtube video.

1.5 Mathematical Modeling


Section Starter Question
Do you believe in the ideal gas law? Does it make sense to “believe in” an
equation? What do we really mean when we say we “believe in” an equation?

Mathematical Modeling
Remember the following proverb: All mathematical models are wrong, but
some mathematical models are useful. [10]
Mathematical modeling involves two equally important activities:

• building a mathematical structure, a model, based on hypotheses about


relations among the quantities that describe the real world situation,
and then deriving new relations;

• evaluating the model, comparing the new relations with the real world
and making predictions from the model.

Good mathematical modeling explains the hypotheses, the development of


the model and its solutions, and then supports the findings by comparing
1.5. MATHEMATICAL MODELING 33

them mathematically with the actual circumstances. A successful model


must allow a user to consider the effects of different hypotheses.
Successful modeling requires a balance between so much complexity that
making predictions from the model may be intractable and so little complex-
ity that the predictions are unrealistic and useless. Complex models often
give more precise, but not necessarily more accurate, answers and so can fool
the modeler into believing that the model is better at prediction that it actu-
ally is. On the other hand, simple models may be useful for understanding,
but are probably too blunt to make useful predictions. Nate Silver quotes
economist Arnold Zellner advising to “Keep it sophisticatedly simple”. [65,
page 225]
At a more detailed level, mathematical modeling involves 4 successive
phases in the cycle of modeling:

1. A real world situation,

2. a mathematical model,

3. a new relation among the quantities,

4. predictions and verifications.

Consider the diagram in Figure 1.4 which illustrates the cycle of modeling.
Connecting phase 1 to 2 in the more detailed cycle builds the mathematical
structure and connecting phase 3 to phase 4 evaluates the model.

Modeling: Connecting Phase 1 to Phase 2


A good description of the model will begin with an organized and complete
description of important factors and observations. The description will often
use data gathered from observations of the problem. It will also include the
statement of scientific laws and relations that apply to the important factors.
From there, the model must summarize and condense the observations into
a small set of hypotheses that capture the essence of the observations. The
small set of hypotheses is a restatement of the problem, changing the prob-
lem from a descriptive, even colloquial, question into a precise formulation
that moves the question from the general to the specific. Here the modeler
demonstrates a clear link between the listed assumptions and the building of
the model.
34 CHAPTER 1. BACKGROUND IDEAS

1 2

Real world Mathematical


situation Identify a limited number of model
quantities and the relations
among them

Mathematical
Comparison and refinement
solution

4 3
New
Prediction relation
Evaluation of the new relation
and among
verification quantities

Figure 1.4: The cycle of modeling.


1.5. MATHEMATICAL MODELING 35

The hypotheses translate into a mathematical structure that becomes the


heart of the mathematical model. Many mathematical models, particularly
those from physics and engineering, become a single equation but mathe-
matical models need not be a single concise equation. Mathematical models
may be a regression relation, either a linear regression, an exponential re-
gression or a polynomial regression. The choice of regression model should
explicitly follow from the hypotheses since the growth rate is an important
consequence of the observations. The mathematical model may be a linear or
nonlinear optimization model, consisting of an objective function and a set
of constraints. Again the choice of linear or nonlinear functions for the ob-
jective and constraints should explicitly follow from the nature of the factors
and the observations. For dynamic situations, the observations often involve
some quantity and its rates of change. The hypotheses express some con-
nection between these quantities and the mathematical model then becomes
a differential equation, either linear or nonlinear depending on the explicit
details of the scientific laws relating the factors considered. For discretely
sampled data instead of continuous time expressions the model may become
a difference equation. If an important feature of the observations and factors
is noise or randomness, then the model may be a probability distribution or
a stochastic process. The classical models from science and engineering usu-
ally take one of these equation-like forms but not all mathematical models
need to follow this format. Models may be a connectivity graph, or a group
of transformations.
If the number of variables is more than a few, or the relations are too
complicated to write in a concise mathematical expression then the model
can be a computer program. Programs written in either high-level languages
such as C, FORTRAN or Basic and very-high-level languages such as R,
Octave, MATLAB, Scientific Python, Perl Data Language or a computer
algebra system are mathematical models. Spreadsheets combining the data
and the calculations are a popular and efficient way to construct a math-
ematical model. The collection of calculations in the spreadsheet express
the laws connecting the factors that the data in the rows and columns of
the spreadsheet represent. Some mathematical models use more elaborate
software specifically designed for modeling. Some software allows the user
to graphically describe the connections among factors to create and alter a
model.
Although this set of examples of mathematical models varies in theoretical
sophistication and the equipment used, the core of each is to connect the data
36 CHAPTER 1. BACKGROUND IDEAS

and the relations into a mechanism that allows the user to vary elements
of the model. Creating a model, whether a single equation, a complicated
mathematical structure, a quick spreadsheet, or a large program is the essence
of the first step connecting the phases labeled 1 and 2 in Figure 1.4.
First models need not be sophisticated or detailed. For beginning anal-
ysis “back of the envelope calculations” and “dimensional analysis” will be
as effective as spending time setting up an elaborate model or solving equa-
tions with advanced mathematics. Unit analysis to check consistency and
outcomes of relations is important to check the harmony of the modeling
assumptions. A good model pays attention to units, the quantities should
be sensible and match. Even more important, a non-dimensionalized model
reveals significant relationships, and major influences. Unit analysis is an
important part of modeling, and goes far beyond simple checking to “make
sure units cancel.” [42, 45]

Mathematical Solution: Connecting Phase 2 to Phase 3


Once the modelers create the model, then they should derive some new re-
lations among the important quantities selected to describe the real world
situation. This is the step connecting the phases labeled 2 and 3 in the dia-
gram. If the model is an equation, for instance the Ideal Gas Law, then one
can solve the equation for one of the variables in terms of the others. In the
Ideal Gas Law, solving for one of the gas parameters is easy. A regression
model may need no additional mathematical solution, although it might be
useful to find auxiliary quantities such as rates of growth or maxima or min-
ima. For an optimization problem the solution is the set of optima or the
rates of change of optima with respect to the constraints. If the model is
a differential equation or a difference equation, then the solution may have
some mathematical substance. For instance, for a ballistics problem, the
model may be a differential equation and the solution by calculus methods
yields the equation of motion. For a problem with randomness, the deriva-
tion may find the mean or the variance. For a connectivity graph, some
interesting quantities are the number of cycles, components or the diameter
of the graph. If the model is a computer program, then this step usually
involves running the program to obtain the output.
It is easy for students to focus most attention on the solution stage of
the process, since the methods are the core of the typical mathematical cur-
riculum. This step usually requires no interpretation, and the model dictates
1.5. MATHEMATICAL MODELING 37

the methods to use. This step is often the easiest in the sense that it is the
clearest on how to proceed, although the mathematical procedures may be
daunting.

Testing and Sensitivity: Connecting Phase 3 to Phase 4

Once this step is done, the model is ready for testing and sensitivity analysis.
This is the step that connects the phases labeled 3 and 4. At the least,
the modelers should try to verify, even with common sense, the results of
the solution. Typically for a mathematical model, the previous step allows
the modelers to produce some important or valuable quantity of the model.
Modelers compare the results of the model with standard or common inputs
with known quantities for the data or statement of the problem. This may
be as easy as substituting into the derived equation, regression expression, or
equation of motion. When running a computer model or program, this may
involve sequences of program runs and related analysis. With any model,
the results will probably not be exactly the same as the known data so
interpretation or error analysis will be necessary. The interpretation requires
judgment on the relative magnitudes of the quantities produced in light of
the confidence in the exactness or applicability of the hypotheses.
Another important activity at this stage in the modeling process is the
sensitivity analysis. The modelers should choose some critical feature of the
model and then vary the parameter value that quantifies that feature. The
results should be carefully compared to the real world and to the predicted
values. If the results do not vary substantially, then perhaps the feature or
parameter is not as critical as believed. This is important new information
for the model. On the other hand, if a predicted or modeled value varies
substantially in comparison to the parameter as it is slightly varied, then the
accuracy of measurement of the critical parameter assumes new importance.
In sensitivity analysis, just as in all modeling, we measure “varying substan-
tially” with significant digits, relative magnitudes, and rates of change. Here
is another area where expressing parameters in dimensionless groups is impor-
tant [45]. In some areas of applied mathematics such as linear optimization
and statistics, a side effect of the solution method is that it automatically
produces sensitivity parameters. In linear optimization, these are sometimes
called the shadow prices and these additional solution values should be used
whenever possible.
38 CHAPTER 1. BACKGROUND IDEAS

Interpretation and Refinement: Connecting Phase 4 to Phase 1

Finally the modelers must take the results from the previous steps and use
them to refine the interpretation and understanding of the real world situ-
ation. In the diagram the interpretation step connects the phases labeled
4 and 1, completing the cycle of modeling. For example, if the situation is
modeling motion, then examining results may show that the predicted mo-
tion is faster than measured, or that the object does not travel as far as the
model predicts. Then it may be that the model does not include the effects
of friction, and so friction should be incorporated into a new model. At this
step, the modeler has to be open and honest in assessing the strengths and
weaknesses of the model. It also requires an improved understanding of the
real world situation to include the correct new elements and hypotheses to
correct the discrepancies in the results. A good model can be useful even
when it fails. When a model fails to match the reality of the situation then
the modeler must understand how it is wrong, and what to do when it is
wrong, and minimizing the cost when it is wrong.
The step between stages 4 and 1 may suggest new processes, or experi-
mental conditions to alter the model. If the problem suggests changes then
the modeler should implement those changes should and test them in another
cycle in the modeling process.

Summary

A good summary of the modeling process is that it is an intense and struc-


tured application of “critical thinking”. Sophistication of mathematical tech-
niques is not always necessary, the mathematics connecting steps 2 and 3 or
potentially steps 3 and 4 may only be arithmetic. The key to good modeling
is the critical thinking that occurs between steps 1 and 2, steps 3 and 4, and
4 and 1. If a model does not fit into this paradigm, it probably does not
meet the criteria for a good model.
Good mathematical modeling, like good critical thinking, does not arise
automatically or naturally. Scientists, engineers, mathematicians and stu-
dents must practice and develop the craft of creating, solving, using, and
interpreting a mathematical model. The structured approach to modeling
helps distinguish the distinct steps, each requiring separate intellectual skills.
It also provides a framework for developing and explaining a mathematical
model.
1.5. MATHEMATICAL MODELING 39

A classification of mathematical models


The goal of mathematical modeling is to represent a real-world situation in
a way that is a close approximation, even ideally exact, with a mathematical
structure that is still solvable. This represents the interplay between the
mathematics occurring between steps 1 and 2 and steps 2 and 3. Then we
can classify models based on this interplay:
• exact models with exact solutions;
• exact models with approximate solutions;
• approximate models with exact solutions;
• approximate models with approximate solutions.
Exact models are uncommon because only rarely do we know physical
representations well enough to claim to represent situations exactly. Exact
models typically occur in discrete situations where we can enumerate all cases
and represent them mathematically.
Example. The average value of the 1-cent, 5-cent, 10-cent and 25-cent coins in
Paula’s purse is 20 cents (the average value is the total money value divided
by the number of coins.) If she had one more 25-cent coin, the average value
would be 21 cents. What coins does Paula have in her purse?
The mathematical model is to let V be the total value of the coins and c
be the number of coins. Write two equations in two unknowns

V /c = 20
(V + 25)/(c + 1) = 21.

The solution is 3 25-cent coins and 1 5-cent coin. Because of the discrete
nature and fixed value of the coins, and the simplicity of the equations, an
exact model has an exact solution.
Approximate models are much more typical.
Example. Modeling the motion of a pendulum is a classic problem in ap-
plied mathematics. Galileo first modeled the pendulum mathematically and
mathematicians and physicists still investigate more sophisticated models.
Most books on applied mathematics and differential equations consider some
form of the pendulum model, for example [42]. An overview of modeling the
pendulum appears in [61].
40 CHAPTER 1. BACKGROUND IDEAS

extension

y
z torsion
x

Figure 1.5: Schematic diagram of a pendulum.


1.5. MATHEMATICAL MODELING 41

As a physically inclusive model of the pendulum, consider the general


elastic pendulum shown in Figure 1.5. The pendulum is a heavy bob B
attached to a pivot point P by an elastic spring. The pendulum has at least
5 degrees of freedom about its rest position. The pendulum can swing in
the x-y-z spatial dimensions. The pendulum can rotate torsionally around
the axis of the spring P B. Finally, the pendulum can lengthen and shorten
along the axis P B. Although we usually think of a pendulum as the short
rigid rod in a clock, some pendula move in all these degrees of freedom, for
example weights dangling from a huge construction crane.
We usually simplify the modeling with assumptions:
1. The pendulum is a rigid rod so that it does not lengthen or shorten,
and it does not rotate torsionally.

2. All the mass is concentrated in the bob B, that is, the pendulum rod
is massless.

3. The motion occurs only in one plane, so the pendulum has only one
degree of freedom, measured by the angle θ.

4. There is no air resistance or friction in the bearing at P .

5. The only forces on the pendulum are at the contact point P and the
force of gravity due to the earth.

6. The pendulum is small relative to the earth so that gravity acts in the
“down” direction only and is constant.
Then with standard physical modeling with Newton’s laws of motion, we
obtain the differential equation for the pendulum angle θ with respect to
vertical,
mlθ00 + mg sin θ = 0, θ(0) = θ0 , θ0 (0) = v0 .
Note the application of the math modeling process moving from phase 1 to
phase 2 with the identification of important variables, the hypotheses that
simplify, and the application of physical laws. It is clear that already the
differential equation describing the pendulum is an approximate model.
Nevertheless, this nonlinear differential equation cannot be solved in terms
of elementary functions. It can be solved in terms of a class of higher tran-
scendental functions known as elliptic integrals, but in practical terms that
is equivalent to not being able to solve the equation analytically. There are
42 CHAPTER 1. BACKGROUND IDEAS

two alternatives, either to solve this equation numerically or to reduce the


equation further to a simpler form.
For small angles sin θ ≈ θ, so if the pendulum does not have large oscil-
lations the model becomes

mlθ00 + mgθ = 0, θ(0) = θ0 , θ0 (0) = v0 .

This differential equation is analytically solvable with standard methods


yielding
θ(t) = A cos(ωt + φ)
for appropriate constants A, ω, and φ derived from the constants of the
model. This is definitely an exact solution to an approximate model. We use
the approximation of sin θ by θ specifically so that the differential equation
is explicitly solvable in elementary functions. The solution to the differen-
tial equation is the process that leads from step 2 to step 3 in the modeling
process. The analysis necessary to measure the accuracy of the exact solu-
tion compared to the physical motion is difficult. The measurement of the
accuracy would be the process of moving from step 2 to step 3 in the cycle
of modeling.
For a clock maker the accuracy of the solution is important. A day has
86,400 seconds, so an error on the order of even 1 part in 10,000 for a physical
pendulum oscillating once per second accumulates unacceptably. This error
concerned physicists such as C. Huygens who created advanced pendula with
a period independent of the amplitude. This illustrates step 3 to step 4 and
the next modeling cycle.
Models of oscillation, including the pendulum, have been a central paradigm
in applied mathematics for centuries. Here we use the pendulum model to
illustrate the modeling process leading to an approximate model with an
exact solution.

An example from physical chemistry


This section illustrates the cycle of mathematical modeling with a simple
example from physical chemistry. This simple example provides a useful
analogy to the role of mathematical modeling in mathematical finance. The
historical order of discovery is slightly modified to illustrate the idealized
modeling cycle. Scientific progress rarely proceeds in simple order.
1.5. MATHEMATICAL MODELING 43

Scientists observed that diverse gases such as air, water vapor, hydrogen,
and carbon dioxide all behave predictably and similarly. After many obser-
vations, scientists derived empirical relations such as Boyle’s law, and the
law of Charles and Gay-Lussac about the gas. These laws express relations
among the volume V , the pressure P , the amount n, and the temperature T
of the gas.
In classical theoretical physics, we can define an ideal gas by making the
following assumptions [24]:
1. A gas consists of particles called molecules which have mass, but es-
sentially have no volume, so the molecules occupy a negligibly small
fraction of the volume occupied by the gas.

2. The molecules can move in any direction with any speed.

3. The number of molecules is large.

4. No appreciable forces act on the molecules except during a collision.

5. The collisions between molecules and the container are elastic, and
of negligible duration so both kinetic energy and momentum are con-
served.

6. All molecules in the gas are identical.


From this limited set of assumptions about theoretical entities called
molecules physicists derive the equation of state for an ideal gas using the
4 quantifiable elements of volume, pressure, amount, and temperature. The
equation of state or ideal gas law is

P V = nRT.

where R is a measured constant, called the universal gas constant. The


ideal gas law is a simple algebraic equation relating the 4 quantifiable ele-
ments describing a gas. The equation of state or ideal gas law predicts very
well the properties of gases under the wide range of pressures, temperatures,
masses and volumes commonly experienced in everyday life. The ideal gas
law predicts with accuracy necessary for safety engineering the pressure and
temperature in car tires and commercial gas cylinders. This level of predic-
tion works even for gases we know do not satisfy the assumptions, such as
air, which chemistry tells us is composed of several kinds of molecules which
44 CHAPTER 1. BACKGROUND IDEAS

have volume and do not experience completely elastic collisions because of


intermolecular forces. We know the mathematical model is wrong, but it is
still useful.
Nevertheless, scientists soon discovered that the assumptions of an ideal
gas predict that the difference in the constant-volume specific heat and the
constant-pressure specific heat of gases should be the same for all gases, a
prediction that scientists observe to be false. The simple ideal gas theory
works well for monatomic gases, such as helium, but does not predict so
well for more complex gases. This scientific observation now requires addi-
tional assumptions, specifically about the shape of the molecules in the gas.
The derivation of the relationship for the observables in a gas is now more
complex, requiring more mathematical techniques.
Moreover, under extreme conditions of low temperatures or high pres-
sures, scientists observe new behaviors of gases. The gases condense into
liquids, pressure on the walls drops and the gases no longer behave according
to the relationship predicted by the ideal gas law. We cannot neglect these
deviations from ideal behavior in accurate scientific or engineering work. We
now have to admit that under these extreme circumstances we can no longer
ignore the size of the molecules, which do occupy some appreciable volume.
We also must admit that we cannot ignore intermolecular forces. The two
effects just described can be incorporated into a modified equation of state
proposed by J.D. van der Waals in 1873. Van der Waals’ equation of state
is:  na 
P + 2 (V − b) = RT.
V
The added constants a and b represent the new elements of intermolecular
attraction and volume effects respectively. If a and b are small because we are
considering a monatomic gas under ordinary conditions, the Van der Waals
equation of state can be well approximated by the ideal gas law. Otherwise
we must use this more complicated relation for engineering our needs with
gases.
Physicists now realize that because of complicated intermolecular forces,
a real gas cannot be rigorously described by any simple equation of state.
We can honestly say that the assumptions of the ideal gas are not correct,
yet are sometimes useful. Likewise, the predictions of the van der Waals
equation of state describe quite accurately the behavior of carbon dioxide
gas in appropriate conditions. Yet for very low temperatures, carbon dioxide
deviates from even these modified predictions because we know that the van
1.5. MATHEMATICAL MODELING 45

der Waals model of the gas is wrong. Even this improved mathematical
model is wrong, but it still is useful.

An example from mathematical finance


For modeling mathematical finance, we make a limited number of idealized
assumptions about securities markets. We start from empirical observations
of economists about supply and demand and the role of prices as a quantifi-
able element relating them. We ideally assume that

1. The market has a very large number of identical, rational traders.

2. All traders always have complete information about all assets they are
trading.

3. Prices vary randomly with some continuous probability distribution.

4. Trading transactions take negligible time.

5. Trading transactions can be in any amounts.

These assumptions are similar to the assumptions about an ideal gas. From
the assumptions we can make some standard economic arguments to derive
some interesting relationships about option prices. These relationships can
help us manage risk, and speculate intelligently in typical markets. How-
ever, caution is necessary. In discussing the economic collapse of 2008-2009,
blamed in part on the overuse or even abuse of mathematical models of risk,
Valencia [69] says “Trying ever harder to capture risk in mathematical for-
mulae can be counterproductive if such a degree of accuracy is intrinsically
unobtainable.” If the dollar amounts get very large (so that rationality no
longer holds!), or only the market has only a few traders, or sharp jumps
in prices occur, or the trades come too rapidly for information to spread
effectively, we must proceed with caution. The observed financial outcomes
may deviate from predicted ideal behavior in accurate scientific or economic
work, or financial engineering.
We must then alter our assumptions, re-derive the quantitative relation-
ships, perhaps with more sophisticated mathematics or introducing more
quantities and begin the cycle of modeling again.
46 CHAPTER 1. BACKGROUND IDEAS

Sources
Some of the ideas about mathematical modeling are adapted from the article
by Valencia [69] and the book When Genius Failed by Roger Lowenstein.
Silver [65] is an excellent popular survey of models and their predictions,
especially large models developed from big data sets. The classification of
mathematical models and solutions is adapted from Sangwin, [61]. The ex-
ample of an exact model with an exact solution is adapted from the 2009
American Mathematics Competition 8. Glenn Ledder reviewed this section
and suggested several of the problems.

Key Concepts
1. “All mathematical models are wrong, but some mathematical models
are useful.” [10]

2. If the modeling assumptions are satisfied, proper mathematical models


should predict well given conditions corresponding to the assumptions.

3. Knowing that all mathematical models are wrong, the real question
becomes how wrong the model must be before it becomes unacceptable.

4. When observed outcomes deviate unacceptably from predicted behav-


ior in honest scientific or engineering work, we must alter our assump-
tions, re-derive the quantitative relationships, perhaps with more so-
phisticated mathematics or introducing more quantities and begin the
cycle of modeling again.

Vocabulary
1. A mathematical model is a mathematical structure (often an equa-
tion) expressing a relationship among a limited number of quantifiable
elements from the “real world” or some isolated portion of it.

Problems to Work for Understanding


1. How many jelly beans fill a cubical box 10 cm on a side?

(a) Find an upper bound for number of jelly beans in the box. Create
and solve a mathematical model for this situation, enumerating
1.5. MATHEMATICAL MODELING 47

explicitly the simplifying assumptions that you make to create and


solve the model.
(b) Find an lower bound for number of jelly beans in the box. Create
and solve a mathematical model for this situation, enumerating
explicitly the simplifying assumptions that you make to create and
solve the model.
(c) Can you use these bounds to find a better estimate for the number
of jelly beans in the box?
(d) Suppose the jelly beans are in a 1-liter jar instead of a cubical box.
(Note that a cubical box 10 cm on a side has a volume of 1 liter.)
What would change about your estimates? What would stay the
same? How does the container being a jar change the problem?

A good way to do this problem is to divide into small groups, and have
each group work the problem separately. Then gather all the groups
and compare answers.

2. How many ping-pong balls fit into the room where you are reading this?
Create and solve a mathematical model for this situation, enumerating
explicitly the simplifying assumptions that you make to create and
solve the model.
Compare this problem to the previous jelly bean problem. How is it
different and how is it similar? How is it easier and how is it more
difficult?

3. How many flat toothpicks would fit on the surface of a sheet of poster
board?
Create and solve a mathematical model for this situation, enumerating
explicitly the simplifying assumptions that you make to create and
solve the model.

4. If your life earnings were doled out to you at a certain rate per hour
for every hour of your life, how much is your time worth?
Create and solve a mathematical model for this situation, enumerating
explicitly the simplifying assumptions that you make to create and
solve the model.
48 CHAPTER 1. BACKGROUND IDEAS

5. A ladder stands with one end on the floor and the other against a wall.
The ladder slides along the floor and down the wall. A cat is sitting
at the middle of the ladder. What curve does the cat trace out as the
ladder slides?
Create and solve a mathematical model for this situation, enumerating
explicitly the simplifying assumptions that you make to create and
solve the model. How is this problem similar to, and different from,
the previous problems about jelly beans in box, ping-pong balls in a
room, toothpicks on a poster board, and life-earnings?

6. In the differential equations text by Edwards and Penney [18], the au-
thors describe the process of mathematical modeling with the diagram
in Figure 1.6 and the following list

Real world
situtation

Formulation Interpretation

Mathematical Mathematical Mathematical


model Analysis results

Figure 1.6: The process of mathematical modeling according to Edwards and


Penney.
1.5. MATHEMATICAL MODELING 49

(a) The formulation of a real world problem in mathematical terms;


that is, the construction of a mathematical model.
(b) The analysis or solution of the resulting mathematical problem.
(c) The interpretation of the mathematical results in the context of
the original real-world situation – for example answering the ques-
tion originally posed.

Compare and contrast this description of mathematical modeling with


the cycle of mathematical modeling of this section, explicitly noting
similarities and differences.

7. Glenn Ledder defines the process of mathematical modeling as

“A mathematical model is a mathematical construction


based on a real setting and created in the hope that its math-
ematical behavior will resemble the real behavior enough to
be useful.”

He uses the diagram in Figure 1.7 as a conceptual model of the modeling


process.

approximation derivation
Real world Conceptual Mathematical
situation model model
validation analysis

Figure 1.7: The process of mathematical modeling according to Glenn Led-


der.

Compare and contrast this description of mathematical modeling with


the cycle of mathematical modeling of this section, explicitly noting
similarities and differences.

Outside Readings and Links:


1. Duke University Modeling Contest Team Accessed August 29, 2009
50 CHAPTER 1. BACKGROUND IDEAS

1.6 Randomness
Section Starter Question
What do we mean when we say something is “random”? What is the dictio-
nary definition of “random”?

Coin Flips and Randomness


The simplest, most common, and in some ways most basic example of a
random process is a coin flip. We flip a coin, and it lands one side up. We
assign the probability 1/2 to the event that the coin will land heads and
probability 1/2 to the event that the coin will land tails. But what does that
assignment of probabilities really express?
To assign the probability 1/2 to the event that the coin will land heads and
probability 1/2 to the event that the coin will land tails is a mathematical
model that summarizes our experience with coins. We have flipped many
coins many times, and we see that about half the time the coin comes up
heads, and about half the time the coin comes up tails. So we abstract this
observation to a mathematical model containing only one parameter, the
probability of a heads.
From this simple model of the outcome of a coin flip we can derive some
mathematical consequences. We will do this extensively in the chapter on
limit theorems for coin-flipping. One of the first consequences we can de-
rive is a theorem called the Weak Law of Large Numbers. This consequence
reassures us that if we make the probability assignment then long term ob-
servations with the model will match our expectations. The mathematical
model shows its worth by making definite predictions of future outcomes. We
will prove other more sophisticated theorems, some with reasonable conse-
quences, others are surprising. Observations show the predictions generally
match experience with real coins, and so this simple mathematical model has
value in explaining and predicting coin flip behavior. In this way, the simple
mathematical model is satisfactory.
In other ways the probability approach is unsatisfactory. A coin flip is
a physical process, subject to the physical laws of motion. The renowned
applied mathematician J. B. Keller investigated coin flips in this way. He
assumed a circular coin with negligible thickness flipped from a given height
y0 = a > 0, and considered its motion both in the vertical direction under
1.6. RANDOMNESS 51

10

Initial Rotational Velocity ω

T
H
0
0 5 10
Initial Upward Velocity u/g

Figure 1.8: Initial conditions for a coin flip, following Keller.

the influence of gravity, and its rotational motion imparted by the flip until
the coin lands on the surface y = 0. The initial conditions imparted to the
coin flip are the initial upward velocity and the initial rotational velocity.
With additional simplifying assumptions Keller shows that the fraction of
flips which land heads approaches 1/2 if the initial vertical and rotational
velocities are high enough. Keller shows more, that for high initial velocities
narrow bands of initial conditions determine the outcome of heads or tails.
From Keller’s analysis we see the randomness comes from the choice of initial
conditions. Because of the narrowness of the bands of initial conditions, slight
variations of initial upward velocity and rotational velocity lead to different
outcomes. The assignment of probabilities 1/2 to heads and tails is actually a
statement of the measure of the initial conditions that determine the outcome
precisely.
The assignment of probabilities 1/2 to heads and tails is actually a state-
ment of our inability to measure the initial conditions and the dynamics
precisely. The heads or tails outcomes alternate in adjacent narrow initial
conditions regions, so we cannot accurately predict individual outcomes. We
instead measure the whole proportion of initial conditions leading to each
outcome.
52 CHAPTER 1. BACKGROUND IDEAS

Figure 1.9: Persi Diaconis’ mechanical coin flipper.

If the coin lands on a hard surface and bounces, the physical prediction
of outcomes is now almost impossible because we know even less about the
dynamics of the bounce, let alone the new initial conditions imparted by the
bounce.
Another mathematician who often collaborated with J. B. Keller, Persi
Diaconis, has exploited this determinism. Diaconis, an accomplished magi-
cian, is reportedly able to flip many heads in a row using his manual skill.
Moreover, he has worked with mechanical engineers to build a precise coin-
flipping machine that can flip many heads in a row by controlling the initial
conditions precisely. Figure 1.9 is a picture of such a machine.
Mathematicians Diaconis, Susan Holmes and Richard Montgomery have
done an even more detailed analysis of the physics of coin flips. The coin-
flipping machines help to show that flipping physical coins is actually slightly
biased. Coins have a slight physical bias favoring the coin’s initial position
51% of the time. The bias results from the rotation of the coin around three
axes of rotation at once. Their more complete dynamical description of coin
flipping needs even more initial information.
If the coin bounces or rolls the physics becomes more complicated. This
is particularly true if the coin rolls on one edge upon landing. The edges of
1.6. RANDOMNESS 53

coins are often milled with a slight taper, so the coin is really more conical
than cylindrical. When landing on edge or spinning, the coin will tip in the
tapered direction.
The assignment of a reasonable probability to a coin toss both summarizes
and hides our inability to measure the initial conditions precisely and to com-
pute the physical dynamics easily. James Gleick summarizes this neatly [23]
“In physics – or wherever natural processes seem unpredictable – apparent
randomness may . . . arise from deeply complex dynamics.” The probability
assignment is usually a good enough model, even if wrong. Except in circum-
stances of extreme experimental care with millions of measurements, using
1/2 for the proportion of heads is sensible.

Randomness and the Markets


A branch of financial analysis, generally called technical analysis, claims
to predict security prices with the assumption that market data, such as
price, volume, and patterns of past behavior predict future (usually short-
term) market trends. Technical analysis also usually assumes that market
psychology influences trading in a way that enables predicting when a stock
will rise or fall.
In contrast is random walk theory. This theory claims that market
prices follow a random path without influence by past price movements. The
randomness makes it impossible to predict which direction the market will
move at any point, especially in the short term. More refined versions of the
random walk theory postulate a probability distribution for the market price
movements. In this way, the random walk theory mimics the mathematical
model of a coin flip, substituting a probability distribution of outcomes for
the ability to predict what will really happen.
If a coin flip, although deterministic and ultimately simple in execution
cannot be practically predicted with well-understood physical principles, then
it should be even harder to believe that some technical forecasters predict
market dynamics. Market dynamics depend on the interactions of thousands
of variables and the actions of millions of people. The economic principles at
work on the variables are incompletely understood compared with physical
principles. Much less understood are the psychological principles that moti-
vate people to buy or sell at a specific price and time. Even allowing that
economic principles which might be mathematically expressed as unambigu-
ously as the Lagrangian dynamics of the coin flip determine market prices,
54 CHAPTER 1. BACKGROUND IDEAS

that still leaves the precise determination of the initial conditions and the
parameters.
It is more practical to admit our inability to predict using basic princi-
ples and to instead use a probability distribution to describe what we see.
In this text, we use the random walk theory with minor modifications and
qualifications. We will see that random walk theory leads to predictions we
can test against evidence, just as a coin-flip sequence can be tested against
the classic limit theorems of probability. In certain cases, with extreme care,
special tools and many measurements of data we may be able to discern bi-
ases, even predictability in markets. This does not invalidate the utility of
the less precise first-order models that we build and investigate. All models
are wrong, but some models are useful.
The cosmologist Stephen Hawking says in his book A Brief History of
Time [25] “A theory is a good theory if it satisfies two requirements: it must
accurately describe a large class of observations on the basis of a model that
contains only a few arbitrary elements, and it must make definite predictions
about the results of future observations.” As we will see the random walk
theory of markets does both. Unfortunately, technical analysis typically does
not describe a large class of observations and usually has many arbitrary
elements.

True Randomness
The outcome of a coin flip is physically determined. The numbers generated
by an “random-number-generator” algorithm are deterministic, and are more
properly known as pseudo-random numbers. The movements of prices in a
market are governed by the hopes and fears of presumably rational human
beings, and so might in principle be predicted. For each of these, we substi-
tute a probability distribution of outcomes as a sufficient summary of what
we have experienced in the past but are unable to predict precisely. Does
true randomness exist anywhere? Yes, in two deeper theories, algorithmic
complexity theory and quantum mechanics.
In algorithmic complexity theory, a number is not random if it is com-
putable, that is, if a computer program will generate it, [23]. Roughly, a
computable number has an algorithm that will generate its decimal digit ex-
pression. For example, for a rational number the division of the denominator
into the numerator determines the repeating digit blocks of the decimal ex-
pression. Therefore rational numbers are not random, as one would expect.
1.6. RANDOMNESS 55

Irrational square roots are not random since a simple algorithm determines
the digits of the nonterminating, nonrepeating decimal expression. Even the
mathematical constant π is not random since a short formula can generate
the digits of π.
In the 1960s mathematicians A. Kolmogorov and G. Chaitin were looking
for a true mathematical definition of randomness. They found one in the
theory of information: they noted that if a mathematician could produce a
sequence of numbers with a computer program significantly shorter than the
sequence, then the mathematician would know the digits were not random.
In the algorithm, the mathematician has a simple theory that accounts for
a large set of facts and allows for prediction of digits still to come, [23].
Remarkably, Kolmogorov and Chaitin showed that many real numbers do not
fit this definition and therefore are random. One way to describe such non-
computable or random numbers is that they are not predictable, containing
nothing but one surprise after another.
This definition helps explain a paradox in probability theory. Suppose we
roll a fair die 20 times. One possible result is 11111111111111111111 and an-
other possible result is 66234441536125563152. Which result is more probable
to occur? Each sequence of numbers is equally likely to occur, with probabil-
ity 1/620 . However, our intuition of algorithmic complexity tells us the short
program “repeat 1 20 times” gives 11111111111111111111, so it seems to
be not random. A description of 66234441536125563152 requires 20 separate
specifications, just as long as the number sequence itself. We then believe the
first monotonous sequence is not random, while the second unpredictable se-
quence is random. Neither sequence is long enough to properly apply the the-
ory of algorithmic complexity, so the intuition remains vague. The paradox
results from an inappropriate application of a definition of randomness. Fur-
thermore, the second sequence has 20!/(3!·3!·3!·3!·4!·4!) = 3,259,095,840,000
permutations but there is only one permutation of the first. Instead of think-
ing of the precise sequence we may confuse it with the more than 3 × 1012
other permutations and believe it is therefore more likely. The confusion of
the precise sequence with the set of permutations contributes to the paradox.
In the quantum world the time until the radioactive disintegration of a
specific N-13 atom to a C-13 isotope is apparently truly random. It seems
we fundamentally cannot determine when it will occur by calculating some
physical process underlying the disintegration. Scientists must use probabil-
ity theory to describe the physical processes associated with true quantum
randomness.
56 CHAPTER 1. BACKGROUND IDEAS

Einstein found this quantum theory hard to accept. His famous remark
is that “God does not play at dice with the universe.” Nevertheless, ex-
periments have confirmed the true randomness of quantum processes. Some
results combining quantum theory and cosmology imply even more profound
and bizarre results. Again in the words of Stephen Hawking, “God not only
plays dice. He also sometimes throws the dice where they cannot be seen.”

Sources
This section is adapted from: “The Probability of Heads”, by J. B. Keller,
American Mathematical Monthly, Volume 83, Number 3, March 1986, pages
191–197, and definitions from investorwords.com. See also the article “A
Reliable Randomizer, Turned on Its Head”, David Adler, Washington Post,
August 2, 2009. The discussion of algorithmic complexity is from James
Gleick’s book The Information. The discussion of the probability paradox is
from Marilyn Vos Savant, Sequences of Die Rolls.

Key Concepts
1. Assigning probability 1/2 to the event that a coin will land heads and
probability 1/2 to the event that a coin will land tails is a mathematical
model that summarizes our experience with many coins.

2. A coin flip is a deterministic physical process, subject to the physical


laws of motion. Extremely narrow bands of initial conditions determine
the outcome of heads or tails. The assignment of probabilities 1/2 to
heads and tails is a summary measure of all initial conditions that
determine the outcome precisely.

3. The random walk theory of asset prices claims that market prices
follow a random path without any influence by past price movements.
This theory says it is impossible to predict which direction the market
will move at any point, especially in the short term. More refined ver-
sions of the random walk theory postulate a probability distribution
for the market price movements. In this way, the random walk theory
mimics the mathematical model of a coin flip, substituting a probabil-
ity distribution of outcomes for the ability to predict what will really
happen.
1.7. STOCHASTIC PROCESSES 57

Vocabulary
1. Technical analysis claims to predict security prices by relying on
the assumption that market data, such as price, volume, and patterns
of past behavior can help predict future (usually short-term) market
trends.

2. The random walk theory of the market claims that market prices
follow a random path up and down according to some probability dis-
tribution without any influence by past price movements. This assump-
tion means that it is not possible to predict which direction the market
will move at any point, although the probability of movement in a given
direction can be calculated.

Problems to Work for Understanding


Outside Readings and Links:
1. A satire on the philosophy of randomness Accessed August 29, 2009.

1.7 Stochastic Processes


Section Starter Question
Name something that is both random and varies over time. Does the ran-
domness depend on the history of the process or only on its current state?

Definition and Notations


A sequence or interval of random outcomes, that is, random outcomes de-
pendent on time is a stochastic process. Stochastic is a synonym for “ran-
dom.” The word is of Greek origin and means “pertaining to chance” (Greek
stokhastikos, skillful in aiming; from stokhasts, diviner; from stokhazesthai,
to guess at, to aim at; and from stochos target, aim, guess). The modifier
stochastic indicates that a subject is random in some aspect. Stochastic is
often used in contrast to “deterministic,” which means that random phenom-
ena are not involved.
More formally, let J be subset of the non-negative real numbers. Usually
J is the nonnegative integers 0, 1, 2, . . . or the nonnegative reals {t : t ≥ 0}.
58 CHAPTER 1. BACKGROUND IDEAS

J is the index set of the process, and we usually refer to t ∈ J as the time
variable. Let Ω be a set, usually called the sample space or probability
space. An element ω of Ω is a sample point or sample path. Let S be a
set of values, often the real numbers, called the state space. A stochastic
process is a function X : (J, Ω) → S, a function of both time and the sample
point to the state space.
Because we are usually interested in the probability of sets of sample
points that lead to a set of outcomes in the state space and not the individ-
ual sample points, the common practice is to suppress the dependence on the
sample point. That is, we usually write X(t) instead of the more complete
X(t, ω). Furthermore, especially if the time set is discrete, say the nonneg-
ative integers, then we usually write the index variable or time variable as
a subscript. Thus Xn would be the usual notation for a stochastic process
indexed by the nonnegative integers and Xt or X(t) is a stochastic process
indexed by the non-negative reals. Because of the randomness, we can think
of a stochastic process as a random sequence if the index set is the nonneg-
ative integers and a random function if the time variable is the nonnegative
reals.

Examples
The most fundamental example of a stochastic process is a coin flip sequence.
The index set is the set of positive integers, counting the number of the flip.
The sample space is the set of all possible infinite coin flip sequences Ω =
{HHT HT T T HT . . . , T HT HT T HHT . . . , . . .}. We take the state space to
be the set 1, 0 so that Xn = 1 if flip n comes up heads, and Xn = 0 if the
flip comes up tails. Then the coin flip stochastic process can be viewed as
the set of all random sequencesP of 1’s and 0’s. An associated random process
is to take X0 = 0 and Sn = nj=0 Xj for n ≥ 0. Now the state space is the
set of nonnegative integers. The stochastic process Sn counts the number of
heads encountered in the flipping sequence up to flip number n.
Alternatively, we can take the same index set, the same probability space
of coin flip sequences and define Yn = 1 if flip n comes up heads, and Yn = −1
if the flip comes up tails. This is just another way to encode the coin flips
now as random sequences of 1’s and −1’s. APmore interesting associated
random process is to take Y0 = 0 and Tn = nj=0 Yj for n ≥ 0. Now the
state space is the set of integers. The stochastic process Tn gives the position
in the integer number line after taking a step to the right for a head, and a
1.7. STOCHASTIC PROCESSES 59

step to the left for a tail. This particular stochastic process is usually called
a simple random walk. We can generalize random walk by allowing the
state space to be the set of points with integer coordinates in two-, three- or
higher-dimensional space, called the integer lattice, and using some random
device to select the direction at each step.

Markov Chains
A Markov chain is sequence of random variables Xj where the index j
runs through 0, 1, 2, . . .. The sample space is not specified explicitly, but it
involves a sequence of random selections detailed by the effect in the state
space. The state space may be either a finite or infinite set of discrete states.
The defining property of a Markov chain is that

P [Xj = l | X0 = k0 , X1 = k1 , . . . , Xj−1 = kj−1 ] = P [Xj = l | Xj−1 = kj−1 ] .

In more detail, the probability of transition from state kj−1 at time j − 1


to state l at time j depends only on kj−1 and l, not on the history X0 =
k0 , X1 = k1 , . . . , Xj−2 = kj−2 of how the process got to kj−1
A simple random walk is an example of a Markov chain. The states are
the integers and the transition probabilities are

P [Xj = l | Xj−1 = k] = 1/2 if l = k − 1 or l = k + 1,


P [Xj = l | Xj−1 = k] = 0 otherwise.

Another example would be the position of a game piece in the board


game Monopoly. The index set is the nonnegative integers listing the plays
of the game, with X0 denoting the starting position at the “Go” corner. The
sample space is the set of infinite sequence of rolls of a pair of dice. The state
space is the set of 40 real-estate properties and other positions around the
board.
Markov chains are an important and useful class of stochastic processes.
Markov chains extended to making optimal decisions under uncertainty are
“Markov decision processes”. Another extension to signal processing and
bioinformatics is the “hidden Markov model”. Mathematicians have exten-
sively studied and classified Markov chains and their extensions but we will
not examine them carefully in this text.
A generalization of a Markov chain is a Markov process. In a Markov
process, we allow the index set to be either a discrete set of times as the
60 CHAPTER 1. BACKGROUND IDEAS

integers or an interval, such as the nonnegative reals. Likewise the state


space may be either a set of discrete values or an interval, even the whole
real line. In mathematical notation a stochastic process X(t) is called Markov
if for every n and t1 < t2 < . . . < tn and real number xn , we have

P [X(tn ) ≤ xn | X(tn−1 ), . . . , X(t1 )] = P [X(tn ) ≤ xn | X(tn−1 )] .

Many of the models in this text will naturally be Markov processes because
of the intuitive modeling appeal of this “memory-less” property.
Many stochastic processes are naturally expressed as taking place in a
discrete state space with a continuous time index. For example, consider
radioactive decay, counting the number of atomic decays that have occurred
up to time t by using a Geiger counter. The discrete state variable is the
number of clicks heard. The mathematical “Poisson process” is an excellent
model of this physical process. More generally, instead of radioactive events
giving a single daughter particle, imagine a birth event with a random number
(distributed according to some probability law) of offspring born at random
times. Then the stochastic process measures the population in time. These
are “birth processes” and make excellent models in population biology and
the physics of cosmic rays. Continue to generalize and imagine that each
individual in the population has a random life-span distributed according
to some law, then dies. This gives a “birth-and-death process”. In another
variation, imagine a disease with a random number of susceptible individuals
getting infected, in turn infecting a random number of other individuals in the
population, then recovering and becoming immune. The stochastic process
counts the number of susceptible, infected and recovered individuals at any
time, an “SIR epidemic process”.
In another variation, consider customers arriving at a service counter
at random intervals with some specified distribution, often taken to be an
exponential probability distribution with parameter λ. The customers get
served one-by-one, each taking a random service time, again often taken to
be exponentially distributed. The state space is the number of customers
waiting for service, the queue length at any time. These are called “queuing
processes”. Mathematically, these processes can be studied with “compound
Poisson processes”.
Continuous Space Processes usually take the state space to be the real
numbers or some interval of the reals. One example is the magnitude of noise
on top of a signal, say a radio message. In practice the magnitude of the noise
1.7. STOCHASTIC PROCESSES 61

can be taken to be a random variable taking values in the real numbers, and
changing in time. Then subtracting off the known signal leaves a continuous-
time, continuous state-space stochastic process. To mitigate the noise’s effect
engineers model the characteristics of the process. To model noise means
to specify the probability distribution of the random magnitude. A simple
model is to take the distribution of values to be normally distributed, leading
to the class of “Gaussian processes” including “white noise”.
Another continuous space and continuous time stochastic process is a
model of the motion of particles suspended in a liquid or a gas. The random
thermal perturbations in a liquid are responsible for a random walk phe-
nomenon known as “Brownian motion” and also as the “Wiener process”,
and the collisions of molecules in a gas are a “random walk” responsible for
diffusion. In this process, we measure the position of the particle over time
so that is a stochastic process from the nonnegative real numbers to either
one-, two- or three-dimensional real space. Random walks have fascinating
mathematical properties. Scientists make the model more realistic by includ-
ing the effects of inertia leading to a more refined form of Brownian motion
called the “Ornstein-Uhlenbeck process”.
Extending this idea to economics, we will model market prices of financial
assets such as stocks as a continuous time, continuous space process. Ran-
dom market forces create small but constantly occurring price changes. This
results in a stochastic process from a continuous time variable representing
time to the reals or nonnegative reals representing prices. By refining the
model so that prices are nonnegative leads to the stochastic process known
as “Geometric Brownian Motion”.

Family of Stochastic Processes

A sequence or interval of random outcomes, that is to say, a string of random


outcomes dependent on time as well as the randomness is a stochastic pro-
cess. With the inclusion of a time variable, the rich range of random outcome
distributions becomes a great variety of stochastic processes. Nevertheless,
the most commonly studied types of random processes have connections. A
tree is in Figure 1.10, along with an indication of the stochastic process types
studied in this text.
62 CHAPTER 1. BACKGROUND IDEAS

Markov Processes

Discrete Time Continuous Time

Finite Infinite Discrete Continuous Infinite Discrete


State Space State Space State Space State Space

Classic
Random Walk Poisson
Markov Chain Gaussian Processes
on Integer Processes
Lattices

Markov Hidden Compound


Wiener Process White
Decision Markov Poisson
(Brownian Motion) Noise
Processes Models Processes

Geometric Birth and Death


Diffusions Queueing Processes
BrownianMotion Processes

Ornstein-Uhlenbeck
Process

Figure 1.10: A tree of some stochastic processes, from most general at the
top to more specific at the end leaves. Stochastic processes studied in this
text are red.
1.7. STOCHASTIC PROCESSES 63

Ways to Interpret Stochastic Processes

Stochastic processes are functions of two variables, the time index and the
sample point. As a consequence, stochastic processes are interpreted in sev-
eral ways. The simplest is to look at the stochastic process at a fixed value
of time. The result is a random variable with a probability distribution, just
as studied in elementary probability.
Another way to look at a stochastic process is to consider the stochastic
process as a function of the sample point ω. Each ω maps to an associated
function X(t). This means that one can look at a stochastic process as a
mapping from the sample space Ω to a set of functions. In this interpre-
tation, stochastic processes are a generalization from the random variables
of elementary probability theory. In elementary probability theory, random
variables are a mapping from a sample space to the real numbers, for stochas-
tic processes the mapping is from a sample space to a space of functions. Now
we ask questions like:

• “What is the probability of the set of functions that exceed a fixed


value on a fixed time interval?”;

• “What is the probability of the set of functions having a certain limit


at infinity?”; and

• “What is the probability of the set of functions that are differentiable


everywhere?”

This is a fruitful way to consider stochastic processes, but it requires sophis-


ticated mathematical tools and careful analysis.
Another way to look at stochastic processes is to ask what happens at
special times. For example, consider the time it takes until the function takes
on one of two certain values, say a and b. Then ask “What is the probability
that the stochastic process assumes the value a before it assumes the value
b?” Note that the time that each function assumes the value a is different,
it is a random time. This provides an interaction between the time variable
and the sample point through the values of the function. This too is a fruitful
way to think about stochastic processes.
In this text, we will consider each of these approaches with the corre-
sponding questions.
64 CHAPTER 1. BACKGROUND IDEAS

Sources
The material in this section is adapted from many texts on probability theory
and stochastic processes, especially the classic texts by S. Karlin and H.
Taylor, S. Ross, and W. Feller.

Key Concepts
1. A sequence or interval of random outcomes, that is, a string of random
outcomes dependent on time as well as the randomness is a stochas-
tic process. With the inclusion of a time variable, the rich range
of random outcome distributions becomes a great variety of stochastic
processes. Nevertheless, the most commonly studied types of random
processes have connections.

2. Stochastic processes are functions of two variables, the time index and
the sample point. As a consequence, stochastic processes are inter-
preted in several ways. The simplest is to look at the stochastic pro-
cess at a fixed value of time. The result is a random variable with a
probability distribution, just as studied in elementary probability.

3. Another way to look at a stochastic process is to consider the stochas-


tic process as a function of the sample point ω. Each ω maps to an
associated function of time X(t). This means that one may look at a
stochastic process as a mapping from the sample space Ω to a set of
functions. In this interpretation, stochastic processes are a generaliza-
tion from the random variables of elementary probability theory.

Vocabulary
1. A sequence or interval of random outcomes, that is, random outcomes
dependent on time is a stochastic process.

2. Let J be a subset of the non-negative real numbers. Let Ω be a set,


usually called the sample space or probability space. An element
ω of Ω is a sample point or sample path. Let S be a set of values,
often the real numbers, called the state space. A stochastic process
is a function X : (J, Ω) → S, that is a function of both time and the
sample point to the state space.
1.7. STOCHASTIC PROCESSES 65

3. The particular stochastic process usually called a simple random


walk Tn gives the position in the integers after taking a step to the
right for a head, and a step to the left for a tail.

4. A generalization of a Markov chain is a Markov Process. In a Markov


process, we allow the index set to be either a discrete set of times as
the integers or an interval, such as the non-negative reals. Likewise the
state space may be either a set of discrete values or an interval, even
the whole real line. In mathematical notation a stochastic process X(t)
is called Markov if for every n and t1 < t2 < . . . < tn and real number
xn , we have

P [X(tn ) ≤ xn | X(tn−1 ), . . . , X(t1 )] = P [X(tn ) ≤ xn | X(tn−1 )] .

Many of the models in this text will naturally be Markov processes


because of the intuitive appeal of this “memory-less” property.

Problems to Work for Understanding

Outside Readings and Links:


1. Origlio, Vincenzo. “Stochastic.” From MathWorld–A Wolfram Web
Resource, created by Eric W. Weisstein. Stochastic

2. Weisstein, Eric W. “Stochastic Process.” From MathWorld–A Wolfram


Web Resource. Stochastic Process

3. Weisstein, Eric W. “Markov Chain.” From MathWorld–A Wolfram


Web Resource. Markov Chain

4. Weisstein, Eric W. “Markov Process.” From MathWorld–A Wolfram


Web Resource. Markov Process

5. Julia Ruscher studying stochastic processes


66 CHAPTER 1. BACKGROUND IDEAS

1.8 A Model of Collateralized Debt Obliga-


tions
Section Starter Question
How can you evaluate cumulative binomial probabilities
n  
X N j
P [SN ≤ n] = p (1 − p)N −j
j=0
j

when the value of N is large, say N = 100 and the value of p is small, say
p = 0.05 ?

A binomial model of mortgages


To illustrate the previous sections altogether we will make a simple bino-
mial probability model of a financial instrument called a CDO, standing for
“Collateralized Debt Obligation”. The market in this derivative financial in-
strument is large, in 2007 amounting to at least $1.3 trillion dollars, of which
56% came from derivatives based on residential mortgages. Heavy reliance
on these financial derivatives based on the real estate market contributed
to the demise of some old-line brokerage firms such as Bear Stearns and
Merrill Lynch in the autumn of 2008. The quick loss in value of these deriva-
tives sparked a lack of economic confidence which led to the sharp economic
downturn in the fall of 2008 and the subsequent recession. We will build a
“stick-figure” model of these instruments, and even this simple model will
demonstrate that the CDOs were far more sensitive to mortgage failure rates
than was commonly understood. While this model does not fully describe
CDOs, it does provide an interesting and accessible example of the modeling
process in mathematical finance.
Consider the following financial situation. A lending company has made
100 mortgage loans to home-buyers. We make two modeling assumptions
about the loans.

1. For simplicity, each loan will have precisely one of 2 outcomes. Either
the home-buyer will pay off the loan resulting in a profit of 1 unit
of money to the lender, or the home-buyer will default on the loan,
resulting in a payoff or profit to the company of 0. For further simplicity
1.8. A MODEL OF COLLATERALIZED DEBT OBLIGATIONS 67

we will say that the unit profit is $1. (The payoff is typically in the
thousands of dollars.)

2. We assume that the probability of default on a loan is p and we will


assume that the probability of default on each loan is independent of
default on all the other loans.

Let S100 be the number of loans that default, resulting in a total profit
of 100 − S100 . The probability of n or fewer of these 100 mortgage loans
defaulting is
n  
X 100 j
P [S100 ≤ n] = p (1 − p)100−j .
j=0
j

We can evaluate this expression in several ways including direct calculation


and approximation methods. For our purposes here, one can use a binomial
probability table, or more easily a computer program which has a cumulative
binomial probability function. The expected number of defaults is 100p, the
resulting expected loss is 100p and the expected profit is 100(1 − p).
But instead of simply making the loans and waiting for them to be paid
off the loan company wishes to bundle these debt obligations differently and
sell them as a financial derivative contract to an investor. Specifically, the
loan company will create a collection of 100 contracts also called tranches.
Contract 1 will pay 1 dollar if 0 of the loans default. Contract 2 will pay 1
dollar if 0 or 1 of the loans defaults, and in general contract n will pay 1 dollar
if n − 1 or fewer of the loans defaults. (This construction is a much simplified
model of mortgage backed securities. In actual practice banks combine many
mortgages with various levels of risk and then package them into derivative
securities with differing levels of risk called tranches. Each tranche pays out
a revenue stream, not a single unit payment. A tranche is usually backed by
thousands of mortgages.)
Suppose to be explicit that 5 of the 100 loans defaults. Then the seller
will have to pay off contracts 6 through 101. The loan company who creates
the contracts will receive 95 dollars from the 95 loans that do not default
and will pay out 95 dollars. If the seller prices the contracts appropriately,
then the lender will have enough money to cover the payout and will have
some profit from selling the contracts
For the contract buyer, the contract will either pay off with a value of 1
or will default. The probability of payoff on contract i will be the sum of
68 CHAPTER 1. BACKGROUND IDEAS

the probabilities that i − 1 or fewer mortgages default:


i−1  
X 100
pj (1 − p)100−j ,
j=0
j

that is, a binomial cumulative distribution function. The probability of de-


fault on contract i will be a binomial complementary distribution function,
which we will denote by
i−1  
X 100 j
pT (i) = 1 − p (1 − p)100−j .
j=0
j

We should calculate a few default probabilities: The probability of default


on contract 1 is the probability of 0 defaults among the 100 loans,
 
100 0
pT (1) = 1 − p (1 − p)100 = 1 − (1 − p)100 .
0

If p = 0.05, then the probability of default is 0.99408. But for the contract 10,
the probability of default is 0.028188. By the 10th contract, this financial
construct has created an instrument that is safer than owning one of the
original mortgages! Because the newly derived security combines the risks of
several individual loans, under the assumptions of the model it is less exposed
to the potential problems of any one borrower.
The expected payout from the collection of contracts will be
100 Xn   100  
X 100 j X 100 j
E [U ] = p (1 − p)100−j
= j p (1 − p)100−j = 100p.
n=0 j=0
j j=0
j

That is, the expected payout from the collection of contracts is exactly the
same as the expected payout from the original collection of mortgages. How-
ever, the lender will also receive the profit of the contracts sold. Moreover,
since the lender is now only selling the possibility of a payout derived from
mortgages and not the mortgages themselves, the lender can even sell the
same contract several times to several different buyers if the profits outweigh
the risk of multiple payouts.
Why rebundle and sell mortgages as tranches? The reason is that for
many of the tranches the risk exposure is less, but the payout is the same
1.8. A MODEL OF COLLATERALIZED DEBT OBLIGATIONS 69

as owning a mortgage loan. Reduction of risk with the same payout is very
desirable for many investors. Those investors may even pay a premium for
low risk investments. In fact, some investors like pension funds are required
by law, regulation or charter to invest in securities that have a low risk. Some
investors may not have direct access to the mortgage market, again by law,
regulation or charter, but in a rising (or bubble) market they desire to get
into that market. These derivative instruments look like a good investment
to them.

Collateralized Debt Obligations


If rebundling mortgages once is good, then doing it again should be better!
So now assume that the loan company has 10,000 loans, and that it divides
these into 100 groups of 100 each, and creates contracts as above. Label the
groups Group 1, Group 2, and so on to Group 100. Now for each group, the
bank makes 100 new contracts. Contract 1.1 will pay off $1 if 0 mortgages
in Group 1 default. Contract 1.2 will pay $1 if 0 or 1 mortgages in Group 1
default. Continue, so for example, Contract 1.10 will pay $1 if 0, 1, 2, . . . , 9
mortgages default in Group 1. Do this for each group, so for example, in the
last group, Contract 100.10 will pay off $1 if 0, 1, 2, . . . , 9 mortgages in Group
100 default. Now for example, the lender gathers up the 100 contracts j.10,
one from each group, into a secondary group and bundles them just as before,
paying off 1 dollar if i − 1 or fewer of these contracts j.10 defaults. These
new derivative contracts are now called collateralized debt obligations
or CDOs. Again, this is a much simplified “stick-figure” model of a real
CDO, see [33]. Sometimes, these second-level constructs are called a “CDO
squared” [22]. Just as before, the probability of payout for the contracts j.10
is
9  
X 100
pT (10)j (1 − pT (10))100−j
j=0
j
and the probability of default is
9  
X 100
pCDO (10) = 1 − pT (10)j (1 − pT (10))100−j .
j=0
j

For example, with p = 0.05 and pT (10) = 0.028188 then pCDO (10) = 0.00054385.
Roughly, the CDO has only 1/100 of the default probability of the original
mortgages, by virtue of re-distributing the risk.
70 CHAPTER 1. BACKGROUND IDEAS

The construction of the contracts j.10 is a convenient example to illus-


trate the relative values of the risk of the original mortgage, the tranche
and the second-order tranche or “CDO-squared”. The number 10 for the
contracts j.10 is not special. In fact, the bank could make a “super-CDO
j.M.N ” where it pays $1 if 0, 1, 2, 3 . . . , M − 1 of the N -tranches in group
j fail, even without a natural relationship between M and N . Even more
is possible, the bank could make a contract that would pay some amount
if some arbitrary finite sequence of contracts composed from some arbitrary
sequence of tranches from some set of groups fails. We could still calculate
the probability of default or non-payment, it’s just a mathematical problem.
The only questions would be what contracts would be risky, what the bank
could sell and how to price everything to be profitable to the bank.
The possibility of creating this “super-CDO j.M.N ” illustrates one prob-
lem with the whole idea of CDOs that led to the collapse and the recession
of 2008. These contracts quickly become confusing and hard to understand.
These contracts are now so far removed from the reality of a homeowner pay-
ing a mortgage to a bank that they become their own gambling game. But
the next section analyzes a more serious problem with these second-order
contracts.

Sensitivity to the parameters


Now we investigate the robustness of the model. We do this by varying the
probability of mortgage default to see how it affects the risk of the tranches
and the CDOs.
Assume that the underlying mortgages actually have a default probabil-
ity of 0.06, a 20% increase in the risk although it is only a 0.01 increase
in the actual rates. This change in the default rate may be due to several
factors. One may be the inherent inability to measure a fairly subjective pa-
rameter such as “mortgage default rate” accurately. Finding the probability
of a home-owner defaulting is not the same as calculating a losing bet in a
dice game. Another may be a faulty evaluation (usually over confident or
optimistic) of the default rates themselves by the agencies who provide the
service of evaluating the risk on these kinds of instruments. Some economic
commentators allege that before the 2008 economic crisis the rating agencies
were under intense competitive pressure to provide “good” ratings in order
to get the business of the firms who create derivative instruments. The agen-
cies may have shaded their ratings to the favorable side in order to keep the
1.8. A MODEL OF COLLATERALIZED DEBT OBLIGATIONS 71

Figure 1.11: Default probabilities as a function of both the tranche number


0 to 100 and the base mortgage default probability 0.01 to 0.15.

business. Finally, the underlying economic climate may be changing and the
earlier estimate, while reasonable for the prior conditions, is no longer valid.
If the economy deteriorates or the jobless rate increases, weak mortgages
called sub-prime mortgages may default at increased rates.
Now with p = 0.06 we calculate that each contract j.10 has a default
probability of 0.078, a 275% increase from the previous probability of 0.028.
Worse, the 10th CDO-squared made of the contracts j.10 will have a default
probability of 0.247, an increase of over 45,400%! The financial derivatives
amplify any error in measuring the default rate to a completely unacceptable
risk. The model shows that the financial instruments are not robust to errors
in the assumptions!
But shouldn’t the companies either buying or selling the derivatives rec-
ognize this? A human tendency is to blame failures, including the failures
of the Wall Street giants, on ignorance, incompetence or wrongful behavior.
In this case, the traders and “rocket scientists” who created the CDOs were
probably neither ignorant nor incompetent. Because they ruined a profitable
endeavor for themselves, we can probably rule out malfeasance too. But dis-
traction resulting from an intense competitive environment allowing no time
72 CHAPTER 1. BACKGROUND IDEAS

for rational reflection along with overconfidence during a bubble can make
us willfully ignorant of the conditions. A failure to properly complete the
modeling cycle leads the users to ignore the real risks.

Criticism of the model

This model is far too simple to base any investment strategy or more serious
economic analysis on it. First, a binary outcome of either pay-off or default
is too simple. Lenders will restructure shaky loans or they will sell them to
other financial institutions so that the lenders will probably get some return,
even if less than originally intended.
The assumption of a uniform probability of default is too simple by far.
Lenders make some loans to safe and reliable home-owners who dutifully
pay off the mortgage in good order. Lenders also make some questionable
loans to people with poor credit ratings, these are called sub-prime loans or
sub-prime mortgages. The probability of default is not the same. In fact,
rating agencies grade mortgages and loans according to risk. There are 20
grades ranging from AAA with a 1-year default probability of less than 0.001
through BBB with a 1-year default probability of slightly less than 0.01 to
CC with a 1-year default probability of more than 0.35. The mortgages may
also change their rating over time as economic conditions change, and that
will affect the derived securities. Also too simple is the assumption of an
equal unit payoff for each loan.
The assumption of independence is clearly incorrect. The similarity of the
mortgages increases the likelihood that most will prosper or suffer together
and potentially default together. Due to external economic conditions, such
as an increase in the unemployment rate or a downturn in the economy,
default on one loan may indicate greater probability of default on other,
even geographically separate loans, especially sub-prime loans. This is the
most serious objection to the model, since it invalidates the use of binomial
probabilities.
However, relaxing any assumptions make the calculations much more dif-
ficult. The non-uniform probabilities and the lack of independence means
that elementary theoretical tools from probability are not enough to analyze
the model. Instead, simulation models will be the next means of analysis.
Nevertheless, the sensitivity of the simple model should make us very
wary of optimistic claims about the more complicated model.
1.8. A MODEL OF COLLATERALIZED DEBT OBLIGATIONS 73

Sources
This section is adapted from a presentation by Jonathan Kaplan of D.E. Shaw
and Co. in summer 2010. Allan Baktoft Jakobsen of Copenhagen suggested
some improvements and clarifications in December 2013. The definitions
are derived from definitions at investorwords.com. The definition of CDO
squared is noted in [22, page 166]. Some facts and figures are derived from the
graphics at Portfolio.com: What’s a CDO [55] and Wall Street Journal.com:
The Making of a Mortgage CDO, [33]

Key Concepts
1. We can make a simple mathematical model of a type of financial deriva-
tive using only the idea of a binomial probability.

2. We must investigate the sensitivity of the model to the parameter values


to completely understand the model.

3. This simple model provides our first illustration of the modeling cycle
in mathematical finance, but even so, it yields valuable insights.

Vocabulary
1. A tranche is a portion or slice of a set of securities. The common
use of tranche is an issue of bonds, often derived from mortgages, with
each tranche distinguished from other tranches by maturity or rate of
return.

2. A collateralized debt obligation or CDO is a derivative security


backed by a pool or slice of other securities. CDOs can be made of any
kind of debt and do not necessarily derive from mortgages. Securities
or bonds derived from mortgages are more specifically called Collater-
alized Mortgage Obligations or CMOs or even more specifically RMBS
for “residential mortgage backed securities”. The terms are often used
interchangeably but CDO is the most common. CDOs contain multi-
ple slices or tranches, each slice made of debt with an associated risk.
Investors who want exposure to the income generated by the debt but
do not want to purchase the debt itself buy the CDOs.
74 CHAPTER 1. BACKGROUND IDEAS

Problems to Work for Understanding


1. Suppose a 20% decrease in the default probability from 0.05 to 0.04
occurs. By what factor do the default rates of the 10-tranches and the
derived 10th CDO change?

2. For the tranches create a table of probabilities of default for contracts


i = 5 to i = 15 for probabilities of default p = 0.03, 0.04, 0.05 0.06 and
0.07 and determine where the contracts become safer investments than
the individual mortgages on which they are based.

3. For a base mortgage default rate of 5%, draw the graph of the default
rate of the contracts as a function of the contract number.

4. The text asserts that the expected payout from the collection of con-
tracts will be
100 Xn   100  
X 100 j X 100 j
E [U ] = p (1−p) 100−j
= j p (1−p)100−j = 100p.
n=0 j=0
j j=0
j

That is, the expected payout from the collection of contracts is exactly
the same the expected payout from the original collection of mortgages.
More generally, show that
N X
X n N
X
aj = j · aj .
n=0 j=0 j=0

5. Write the general expressions for the probabilities of payout and default
for the ith contract from the CDO-squared.

6. The following problem does not have anything to do with money, mort-
gages, tranches, or finance. It is instead a problem that creates and
investigates a mathematical model using binomial probabilities, so it
naturally belongs in this section. This problem is adapted from the clas-
sic 1943 paper by Robert Dorfman on group blood testing for syphilis
among US military draftees.
Suppose that you have a large population that you wish to test for
a certain characteristic in their blood or urine (for example, testing
athletes for steroid use or military personnel for a particular disease).
1.8. A MODEL OF COLLATERALIZED DEBT OBLIGATIONS 75

Each test will be either positive or negative. Since the number of


individuals to be tested is quite large, we can expect that the cost
of testing will also be large. How can we reduce the number of tests
needed and thereby reduce the costs? If the blood could be pooled
by putting a portion of, say, 10 samples together and then testing the
pooled sample, the number of tests might be reduced. If the pooled
sample is negative, then all the individuals in the pool are negative,
and we have checked 10 people with one test. If, however, the pooled
sample is positive, we only know that at least one of the individuals
in the sample will test positive. Each member of the sample must
then be retested individually and a total of 11 tests will be necessary
to do the job. The larger the group size, the more we can eliminate
with one test, but the more likely the group is to test positive. If the
blood could be pooled by putting G samples together and then testing
the pooled sample, the number of tests required might be minimized.
Create a model for the blood testing cost involving the probability of
an individual testing positive (p) and the group size (G) and use the
model to minimize the total number of tests required. Investigate the
sensitivity of the cost to the probability p.
7. The following problem does not have anything to do with money, mort-
gages, tranches, or finance. It is instead a problem that creates and
investigates a mathematical model using binomial probabilities, so it
naturally belongs in this section.
Suppose you are taking a test with 25 multiple-choice questions. Each
question has 5 choices. Each problem is scored so that a correct an-
swer is worth 6 points, an incorrect answer is worth 0 points, and an
unanswered question is worth 1.5 points. You wish to score at least
100 points out of the possible 150 points. The goal is to create a model
of random guessing that optimizes your chances of achieving a score of
at least 100.

(a) How many questions must you answer correctly, leaving all other
questions blank, to score your goal of 100 points? For reference,
let this number of questions be N .
(b) Discuss the form of your mathematical model for the number of
questions required for success. What mathematics did you use for
the solution?
76 CHAPTER 1. BACKGROUND IDEAS

(c) Suppose you can only answer N −1 questions. Create and analyze
a model of guessing on unanswered questions to determine the
optimal number of questions to guess.
(d) Discuss the form of your mathematical model for success with
guessing. What mathematics did you use for the solution?
(e) Now begin some testing and sensitivity analysis. Suppose you can
only answer N −i questions, where 1 ≤ i ≤ N . Adjust and analyze
your model of guessing on unanswered questions to determine the
optimal number of questions to guess.
(f) Test the sensitivity of the model to changes in the probability of
guessing a correct answer.
(g) Critically analyze the model, interpreting it in view of the sensi-
tivity analysis. Change the model appropriately.

Outside Readings and Links:


1. Wall Street Journal.com: The Making of a Mortgage CDO An an-
imated graphic explanation from the Wall Street Journal describing
mortgage backed debt obligations.

2. Portfolio.com: What’s a CDO Another animated graphic explanation


from Portfolio.com describing mortgage backed debt obligations.
Chapter 2

Binomial Option Pricing


Models

2.1 Single Period Binomial Models


Section Starter Question
If you have two unknown values, how many equations will you need to derive
to find the two unknown values? What must you know about the equations?

Single Period Binomial Model

The single period binomial model is the simplest possible financial model,
yet it has the elements of all future models. It is strong enough to be a con-
ceptual model of financial markets. It is simple enough to permit pencil-and-
paper calculation. It can be comprehended as a whole. It is also structured
enough to point to natural generalization. The single period binomial model
is an excellent place to start studying mathematical finance.
Begin by reviewing some defintions:

1. A security is a promise to pay, or an evidence of a debt or property,


typically a stock or a bond. A security is also referred to as an asset.

2. A bond is an interest bearing security that can either make regular


interest payments or a lump sum payment at maturity or both.

77
78 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

3. A stock is a security representing partial ownership of a company,


varying in value with the value of the company. Stocks are also known
as shares or equities.
4. A derivative is a security whose value depends on or is derived from
the future price or performance of another security. Derivatives are also
known as financial derivatives, derivative securities, derivative
products, and contingent claims.
The quantifiable elements of the single period binomial financial model
are:
1. A single interval of time, from t = 0 to t = T .
2. A single stock of initial value S and final value ST . In the time interval
[0, T ] it may either increase by a factor U to value ST = SU with
probability p, or it may decrease in value by factor D to value ST = SD
with probability q = 1 − p.
3. A single bond with a continuously compounded interest rate r over the
interval [0, T ]. If the initial value of the bond is B, then the final value
of the bond will be B exp(rT ).
4. A market for derivatives (such as options) dependent on the value of
the stock at the end of the period. The payoff of the derivative to the
investor would be f (SU ) and f (SD). For example, a futures contract
with strike price K would have value f (ST ) = ST − K. A call option
with strike price K would have value f (ST ) = max(ST − K, 0).
A realistic financial assumption would be D < exp(rT ) < U . Then
investment in the risky security may pay better than investment in a risk
free bond, but it may also pay less! The mathematics only requires that
U 6= D, see below.
We can try to find the value of the derivative by creating a portfolio of
the stock and the bond that will have the same value as the derivative itself
in any circumstance, called a replicating portfolio. Consider a portfolio
consisting of φ units of the stock worth φS and ψ units of the bond worth ψB.
Note the assumption that the stock and bond are divisible, so we can buy
them in any amounts including negative amounts that are short positions. If
we were to buy the this portfolio at time zero, it would cost
φS + ψB.
2.1. SINGLE PERIOD BINOMIAL MODELS 79
Value

SU

SD

T t

Figure 2.1: The single period binomial model.


80 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

One time period of length T on the trading clock later, the portfolio would
be worth
φSD + ψB exp(rT )
after a down move and
φSU + ψB exp(rT )
after an up move. You should find this mathematically meaningful: there
are two unknown quantities φ and ψ to buy for the portfolio, and we have
two expressions to match with the two values of the derivative! That is, the
portfolio will have the same value as the derivative if

φSD + ψB exp(rT ) = f (SD)


φSU + ψB exp(rT ) = f (SU ).

The solution is
f (SU ) − f (SD)
φ=
SU − SD
and
f (SD) (f (SU ) − f (SD)) SD
ψ= − .
B exp(rT ) (SU − SD)B exp(rT )
Note that the solution requires SU 6= SD, but we have already assumed this
natural requirement. Without this requirement there would be no risk in the
stock, and we would not be asking the question in the first place. The value
(or price) of the portfolio, and therefore the derivative should then be

V = φS + ψB
f (SU ) − f (SD) (f (SU ) − f (SD)) SD
 
f (SD)
= ·S+ − ·B
SU − SD B exp(rT ) (SU − SD)B exp(rT )
f (SU ) − f (SD) 1 f (SD)U − f (SU )D
= + .
U −D exp(rT ) (U − D)

We can make one final simplification that will be useful in the next section.
Define
exp(rT ) − D
π=
U −D
so then
U − exp(rT )
1−π =
U −D
2.1. SINGLE PERIOD BINOMIAL MODELS 81

so that we write the value of the derivative as


V = exp(−rT )[πf (SU ) + (1 − π)f (SD)].
(Here π is not used as the mathematical constant giving the ratio of the
circumference of a circle to its diameter. Instead the Greek letter for p
suggests a similarity to the probability p.)
Now consider some other trader offering to sell this derivative with payoff
function f for a price P less than V . Anyone could buy the derivative in
arbitrary quantity, and short the (φ, ψ) stock-bond portfolio in exactly the
same quantity. At the end of the period, the value of the derivative would be
exactly the same as the portfolio. So selling each derivative would repay the
short with a profit of V − P and the trade carries no risk! So P would not
have been a rational price for the trader to quote and the market would have
quickly mobilized to take advantage of the “free” money on offer in arbitrary
quantity. This ignores transaction costs. For an individual, transaction costs
might eliminate the profit. However for large firms trading in large quantities,
transaction costs can be minimal.
Similarly if a seller quoted the derivative at a price P greater than V ,
anyone could short sell the derivative and buy the (φ, ψ) portfolio to lock
in a risk-free profit of P − V per unit trade. Again the market would take
advantage of the opportunity. Hence, V is the only rational price for the
derivative. We have determined the price of the derivative through arbitrage.

How not to price the derivative and a hint of a better way.


Note that we did not determine the price of the derivative in terms of the
expected value of the stock or the derivative. A seemingly logical thing to do
would be to say that the derivative will have value f (SU ) with probability
p and will have value f (SD) with probability 1 − p. Therefore the expected
value of the derivative at time T is
E [f ] = pf (SU ) + (1 − p)f (SD).
The present value of the expectation of the derivative value is
exp(−rT )E [f ] = exp(−rT )[pf (SU ) + (1 − p)f (SD)].
Except in the peculiar case that the expected value just happened to match
the value V of the replicating portfolio, arbitrage drives pricing by expec-
tation out of the market! The problem is that the probability distribution
82 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

(p, 1 − p) only takes into account the movements of the security price. The
expected value is the value of the derivative over many identical iterations
or replications of that distribution, but there will be only one trial of this
particular experiment, so expected value is not a reasonable way to weight
the outcomes. Also, the expected value does not take into account the rest
of the market. In particular, the expected value does not take into account
that an investor has the opportunity to simultaneously invest in alternate
combinations of the risky stock and the risk-free bond. A special combina-
tion of the risky stock and risk-free bond replicates the derivative. As such
the movement probabilities alone do not completely assess the risk associated
with the transaction.
Nevertheless, we still might have with a nagging feeling that pricing by
arbitrage as done above ignores the probability associated with security price
changes. One may legitimately ask if there is a way to value derivatives by
taking some kind of expected value. The answer is yes, a different proba-
bility distribution associated with the binomial model correctly takes into
account the rest of the market. In fact, the quantities π and 1 − π define this
probability distribution. This is called the risk-neutral measure or more
completely the risk-neutral martingale measure. Economically speak-
ing, the market assigns a “fairer” set of probabilities π and 1 − π that give
a value for the option compatible with the no-arbitrage principle. Another
way to say this is that the market changes the odds to make option pricing
fairer. The risk-neutral measure approach is the modern, sophisticated, and
general way to approach derivative pricing.

Summary
Robert Merton summarized this derivative pricing strategy succinctly in [48]:
“The basic insight underlying the Black-Scholes model is that
a dynamic portfolio trading strategy in the stock can be found
which will replicate the returns from an option on that stock.
Hence, to avoid arbitrage opportunities, the option price must
always equal the value of this replicating portfolio.”

Sources
This section is adapted from: “Chapter 2, Discrete Processes” in Financial
Calculus by M. Baxter, A. Rennie, Cambridge University Press, Cambridge,
2.1. SINGLE PERIOD BINOMIAL MODELS 83

1996, [6].

Algorithms, Scripts, Simulations


Algorithm
The aim is to set up and solve for the replicating portfolio and the value of
the corresponding derivative security in a single period binomial model. The
scripts output the portfolio amounts and the derivative security value. First
set values of S, U , D, r, T , and K. Define the derivative security payoff
function. Set the matrix of coefficients in the linear system. Set the right-
hand-side payoff vector. Solve for the portfolio using a linear solver. Finally,
take the dot product of the portfolio with the security and bond values to
get the derivative security value.

Scripts
R R script for singleperiod.
1 S <- 50
2 up <- 0.1
3 down <- 0.03
4 B <- 1
5 r <- 0.06
6 T <- 1
7 K <- 50
8
9 f <- function (x , strike ) {
10 max ( x - strike , 0)
11 }
12
13 m <- rbind ( c ( S * (1 - down ) , B * exp ( r * T ) ) , c ( S * (1 +
up ) , B * exp ( r * T ) ) )
14 payoff <- c ( f ( S * (1 - down ) , K ) , f ( S * (1 + up ) , K ) )
15
16 portfolio <- solve (m , payoff )
17 value <- portfolio % * % c (S , B )
18
19 cat ( " portfolio : phi = " , portfolio [1] , " psi = " , portfolio
[2] , " \ n " )
20 cat ( " value = " , value , " \ n " )
84 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

Octave Octave script for singleperiod.


1 S = 50;
2 up = .10;
3 down = 0.03;
4 B = 1;
5 r = 0.06;
6 T = 1;
7 K = 50;
8
9 function retval = f (x , strike )
10 retval = max ( x - strike , 0) ;
11 endfunction
12
13 m = [ S * (1 - down ) , B * exp ( r * T ) ; S * (1 + up ) , B *
exp ( r * T ) ];
14 payoff = [ f ( S * (1 - down ) , K ) ; f ( S * (1 + up ) , K ) ];
15

16 portfolio = m \ payoff ;
17 value = transpose ( portfolio ) * [ S ; B ];
18
19 disp ( " portfolio : phi = " ) , portfolio (1) , disp ( " psi = " ) ,
portfolio (2)
20 disp ( " derivative value : " ) , value

Perl Perl PDL script for singleperiod.


1 use PDL :: NiceSlice ;
2
3 $S = 50;
4 $up = .10;
5 $down = 0.03;
6 $B = 1;
7 $r = 0.06;
8 $T = 1;
9 $K = 50;
10
11 sub f {
12 my ( $x , $strike ) = @_ ;
13 return max ( pdl [ $x - $strike , 0 ] ) ;
14 }
15

16 $m = pdl [
17 [ $S * ( 1 - $down ) , $B * exp ( $r * $T ) ] ,
2.1. SINGLE PERIOD BINOMIAL MODELS 85

18 [ $S * ( 1 + $up ) , $B * exp ( $r * $T ) ]
19 ];
20 $payoff = transpose (
21 pdl [ f ( $S * ( 1 - $down ) , $K ) , f ( $S * ( 1 + $up
) , $K ) ] ) ;
22
23 $portfolio = inv ( $m ) x $payoff ;
24 $value = ( pdl [ $S , $B ] ) x $portfolio ;
25
26 print " portfolio : phi = " , $portfolio - > range ( [0] ) -> range (
[0] ) ,
27 " psi = " , $portfolio - > range ( [0] ) -> range ( [1] ) , " \ n " ;
28 print " value = " , $value - > range ( [0] ) -> range ( [0] ) , " \ n
";

SciPy Scientific Python script for singleperiod.


1 import scipy
2 from scipy import linalg
3
4 S = 50
5 up = .10
6 down = 0.03
7 B = 1
8 r = 0.06
9 T = 1
10 K = 50
11
12
13 def f (x , strike ) :
14 return max ( x - strike , 0)
15
16
17 m = scipy . array ([[ S * (1 - down ) , B * scipy . exp ( r * T ) ] ,
[ S * (1 + up ) ,
18 B * scipy . exp ( r * T ) ]])
19 payoff = scipy . array ([ f ( S * (1 - down ) , K ) , f ( S * (1 + up
) , K ) ])
20
21 portfolio = scipy . linalg . solve (m , payoff )
22 value = scipy . vdot ( portfolio , scipy . array ([ S , B ]) )
23

24 print ’ portfolio : phi = ’ , portfolio [0] , ’ psi = ’ , portfolio


[1] , ’\ n ’
86 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

25 print ’ derivative value : ’ , value , ’\ n ’

Key Concepts
1. The simplest model for pricing an option is based on a market having
a single period, a single security having two uncertain outcomes, and a
single bond.

2. Replication of the option payouts with the single security and the single
bond leads to pricing the derivative by arbitrage.

Vocabulary
1. A security is a promise to pay, or an evidence of a debt or property,
typically a stock or a bond. A security is also referred to as an asset.

2. A bond is an interest bearing security that can either make regular


interest payments or a lump sum payment at maturity or both.

3. A stock is a security representing partial ownership of a company,


varying in value with the value of the company. Stocks are also known
as shares or equities.

4. A derivative is a security whose value depends on or is derived from


the future price or performance of another security. Derivatives are also
known as financial derivatives, derivative securities, derivative
products, and contingent claims.

5. A portfolio of the stock and the bond that will have the same value as
the derivative itself in any circumstance is a replicating portfolio.

Problems to Work for Understanding


1. Consider a stock whose price today is $50. Suppose that over the next
year, the stock price can either go up by 10%, or down by 3%, so
the stock price at the end of the year is either $55 or $48.50. The
continuously compounded interest rate on a $1 bond is 6%. If there
2.1. SINGLE PERIOD BINOMIAL MODELS 87

also exists a call on the stock with an exercise price of $50, then what
is the price of the call option? Also, what is the replicating portfolio?

2. A stock price is currently $50. It is known that at the end of 6 months,


it will either be $60 or $42. The risk-free rate of interest with continuous
compounding on a $1 bond is 12% per annum. Calculate the value of
a 6-month European call option on the stock with strike price $48 and
find the replicating portfolio.

3. A stock price is currently $40. It is known that at the end of 3 months,


it will either $45 or $34. The risk-free rate of interest with quarterly
compounding on a $1 bond is 8% per annum. Calculate the value of a
3-month European put option on the stock with a strike price of $40,
and find the replicating portfolio.

4. Your friend, the financial analyst, comes to you, the mathematical


economist, with a proposal: “The single period binomial pricing is all
right as far as it goes, but it is certainly is simplistic. Why not modify
it slightly to make it a little more realistic? Specifically, assume the
stock can assume three values at time T , say it goes up by a factor
U with probability pU , it goes down by a factor D with probability
pD , where D < 1 < U and the stock stays somewhere in between,
changing by a factor M with probability pM where D < M < U and
pD + pM + pU = 1.” The market contains only this stock, a bond
with a continuously compounded risk-free rate r and an option on the
stock with payoff function f (ST ). Make a mathematical model based
on your friend’s suggestion and provide a critique of the model based
on the classical applied mathematics criteria of existence of solutions
to the model and uniqueness of solutions to the model.

5. Modify the scripts to accept interactive inputs of important parameters


and to output results nicely formatted and rounded to cents.

Outside Readings and Links:


1. A video lesson on the binomial option model from Hull
88 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

2.2 Multiperiod Binomial Tree Models


Section Starter Question
Suppose that you owned a 3-month option, and that you tracked the value of
the underlying security at the end of each month. Suppose you were forced
to sell the option at the end of two months. How would you find a fair price
for the option at that time? What simple modeling assumptions would you
make?

The Binomial Tree model


The multiperiod binomial model has N time intervals created by N + 1
trading times t0 = 0, t1 , . . . , tN = T . The spacing between time intervals
is ∆ti = ti − ti−1 , and typically the spacing is equal, although it is not
necessary. The time intervals can be any convenient time length appropriate
for the model, e.g. months, days, minutes, even seconds. Later, we will take
them to be relatively short compared to T .
We model a limited market where a trader can buy or short-sell a risky
security (for instance a stock) and lend or borrow money at a riskless rate r.
For simplicity we assume r is constant over [0, T ]. This assumption of con-
stant r is not necessary, taking r to be ri on [ti , ti−1 ] only makes calculations
messier.
Sn denotes the price of the risky security at time tn for n = 0, 1, . . . N .
This price changes according to the rule

Sn+1 = Sn Hn+1 , 0 ≤ n ≤ N − 1

where Hn+1 is a Bernoulli (two-valued) random variable such that


(
U, with probability p
Hn+1 =
D, with probability q = 1 − p.

Again for simplicity we assume U and D are constant over [0, T ]. This
assumption of constant r is not necessary, for example, taking U to be Ui for
i = 0, 1, . . . , N only makes calculations messier. A binomial tree is a way to
visualize the multiperiod binomial model, as in Figure 2.2.
A pair of integers (n, j), with n = 0, . . . N and j = 0, . . . , n identifies
each node in the tree. We use the convention that node (n, j) leads to nodes
2.2. MULTIPERIOD BINOMIAL TREE MODELS 89

Value
SU 4

SU 3

SU 2 SU 3 D

SU SU 2 D

S SU D SU 2 D2

SD SU D2

SD2 SU D3

SD3

SD4

t1 t2 t3 t4
t

Figure 2.2: A binomial tree.


90 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

(n + 1, j) and (n + 1, j + 1) at the next trading time, with the “up” change


corresponding to (n + 1, j + 1) and the “down” change corresponding to
(n + 1, j). The index j counts the number of up changes to that time, so
n − j is
 the number of down changes. Several paths lead to node (n, j), in
n
fact j of them. The price of the risky underlying asset at trading time tn
is then SU j Dn−j . The probability of going from price S to price SU j Dn−j is
 
n j
pn,j = p (1 − p)n−j .
j

To value a derivative with payout f (SN ), the key idea is that of dynamic
programming — extending the replicating portfolio and corresponding port-
folio values back one period at a time from the claim values to the starting
time.
An example will make this clear. Consider a binomial tree on the times
t0 , t1 , t2 . Assume U = 1.05, D = 0.95, and exp(r∆ti ) = 1.02, so the effective
interest rate on each time interval is 2%. We take S0 = 100. We value a
European call option with strike price K = 100. Using the formula derived
in the previous section
1.02 − 0.95
π= = 0.7
1.05 − 0.95
and 1 − π = 0.3. Then concentrating on the single period binomial branch in
the large square box, the value of the option at node (1, 1) is $7.03 (rounded
to cents). Likewise, the value of the option at node (1, 0) is $0. Then we work
back one step and value a derivative with potential payouts $7.03 and $0 on
the single period binomial branch at (0, 0). This uses the same arithmetic to
obtain the value $4.83 (rounded to cents) at time 0. In the figure, the values
of the security at each node are in the circles, the value of the option at each
node is in the small box beside the circle.
As another example, consider a European put on the same security. The
strike price is again 100. All of the other parameters are the same. We work
backward again through the tree to obtain the value at time 0 as $0.944. In
the figure, the values of the security at each node are in the circles, the value
of the option at each node is in the small box beside the circle.
The multiperiod binomial model for pricing derivatives of a risky security
is also called the Cox-Ross-Rubenstein model or CRR model for short,
after those who introduced it in 1979.
2.2. MULTIPERIOD BINOMIAL TREE MODELS 91

Value
110.25

10.25

105

7.03
K = 100
100 99.75

4.83 0.00

95

0.00

90.25

0.00

t1 t2 t

Figure 2.3: Pricing a European call.


92 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

Value
110.25

0.00

105

0.073
K = 100
100 99.75

0.944 0.25

95

3.04

90.25

9.75

t1 t2 t

Figure 2.4: Pricing a European put.


2.2. MULTIPERIOD BINOMIAL TREE MODELS 93

Advantages and Disadvantages of the model


The disadvantages of the binomial model are:

1. Trading times are not really at discrete times, trading goes on contin-
uously.

2. Securities do not change value according to a Bernoulli (two-valued)


distribution on a single time step, or a binomial distribution on multiple
time periods, they change over a range of values with a continuous
distribution.

3. The calculations are tedious.

4. Developing a continuous theory will take detailed limit-taking consid-


erations.

The advantages of the model are:

1. It clearly reveals the construction of the replicating portfolio.

2. It clearly reveals that the probability distribution is not centrally in-


volved, since expectations of outcomes aren’t used to value the deriva-
tives.

3. It is simple to calculate, although it can get tedious.

4. It reveals that we need more probability theory to get a complete un-


derstanding of path dependent probabilities of security prices.

It is possible, with considerable attention to detail, to make a limiting


argument and pass from the binomial tree model of Cox, Ross and Rubenstein
to the Black-Scholes pricing formula. However, this approach is not the most
instructive. Instead, we will back up from derivative pricing models, and
consider simpler models with only risk, that is, gambling, to get a more
complete understanding of stochastic processes before returning to pricing
derivatives.
Some caution is also needed when reading from other sources about the
Cox-Ross-Rubenstein or Binomial Option Pricing Model. Many other sources
derive the Binomial Option Pricing Model by discretizing the Black-Scholes
Option Pricing Model. The discretization is different from building the model
94 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

from scratch because the parameters have special and more restricted inter-
pretations than the simple model. More sophisticated discretization proce-
dures from the numerical analysis of partial differential equations also lead
to additional discrete option pricing models that are hard to justify by build-
ing them from scratch. The discrete models derived from the Black-Scholes
model are used for simple and rapid numerical evaluation of option prices
rather than for motivation.

Sources
This section is adapted from: “Chapter 2, Discrete Processes” in Financial
Calculus by M. Baxter, A. Rennie [6] and Quantitative Modeling of Derivative
Securities by M. Avellaneda and P. Laurence [2].

Algorithms, Scripts, Simulations


Algorithm
The goal is to set up and solve for the value of the European call option in
a two period binomial model. The scripts will output the derivative security
value. First set values of S, U , D, r, T , and K. Define the derivative security
payoff function. (In the given scripts, it is for a European call option.) Define
the risk neutral measure π. Solve for derivative values at (1, 1) and (1, 0) with
the risk neutral measure formula. Solve for the derivative value with the risk
neutral measure formula linear solver. Finally, print the derivative value.

Scripts
R R script for multiperiod
1 S <- 100
2 factorUp <- 1.05
3 factorDown <- 0.95
4 B <- 1
5 effR <- 1.02
6 deltati <- 1
7 K <- 100
8
9 f <- function (x , strike ) {
10 # European call option
11 max ( x - strike , 0)
2.2. MULTIPERIOD BINOMIAL TREE MODELS 95

12 }
13

14 riskNeutralMeas <- function ( fUp , fDown , exprdt ) {


15 # risk neutral measure pi
16 ( exprdt - fDown ) / ( fUp - fDown )
17 }
18
19 piRNM <- riskNeutralMeas ( factorUp , factorDown , effR )
20
21 v11 <- (1 / effR ) * ( piRNM * f ( S * factorUp * factorUp , K )
+ (1 - piRNM ) * f ( S * factorUp *
22 factorDown , K ) )
23 v10 <- (1 / effR ) * ( piRNM * f ( S * factorUp * factorDown , K
) + (1 - piRNM ) * f ( S *
24 factorDown * factorDown , K ) )
25
26 value <- (1 / effR ) * ( piRNM * v11 + (1 - piRNM ) * v10 )
27
28 cat ( " value : " , value , " \ n " )

Octave Octave script for multiperiod


1 S = 100;
2 factorUp = 1.05;
3 factorDown = 0.95;
4 B = 1;
5 effR = 1.02; # effR = exp ( r * delta t_i )
6 deltati = 1;
7 K = 100;
8
9 function retval = f (x , strike ) # European call option
10 retval = max ( x - strike , 0) ;
11 endfunction
12
13 function retval = riskNeutralMeas ( fUp , fDown , exprdt )
14 retval = ( exprdt - fDown ) / ( fUp - fDown ) ; # risk neutral
measure pi
15 endfunction
16
17 piRNM = riskNeutralMeas ( factorUp , factorDown , effR ) ;
18

19 v11 = (1 / effR ) * ( piRNM * f ( S * factorUp * factorUp , K )


20 + (1 - piRNM ) * f ( S * factorUp * factorDown , K ) ) ;
96 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

21 v10 = (1 / effR ) * ( piRNM * f ( S * factorUp * factorDown ,


K)
22 + (1 - piRNM ) * f ( S * factorDown * factorDown , K ) ) ;
23
24 value = (1 / effR ) * ( piRNM * v11 + (1 - piRNM ) * v10 ) ;
25
26 disp ( " derivative value : " ) , value

Perl Perl PDL script for multiperiod


1 use PDL :: NiceSlice ;
2

3 $S = 100;
4 $factorUp = 1.05;
5 $factorDown = 0.95;
6 $B = 1;
7 $effR = 1.02; # effR = exp ( r * delta t_i )
8 $deltati = 1;
9 $K = 100;
10
11 sub f { # European call option
12 my ( $x , $strike ) = @_ ;
13 return max ( pdl [ $x - $strike , 0 ] ) ;
14 }
15
16 sub riskNeutralMeas {
17 my ( $fUp , $fDown , $exprdt ) = @_ ;
18 return ( $exprdt - $fDown ) / ( $fUp - $fDown ) ; #
risk neutral measure pi
19 }
20
21 $piRNM = riskNeutralMeas ( $factorUp , $factorDown , $effR )
;
22
23 $v11 =
24 ( 1 / $effR )
25 * ( $piRNM * f ( $S * $factorUp * $factorUp , $K )
26 + ( 1 - $piRNM ) * f ( $S * $factorUp *
$factorDown , $K ) ) ;
27 $v10 =
28 ( 1 / $effR )
29 * ( $piRNM * f ( $S * $factorUp * $factorDown , $K )
30 + ( 1 - $piRNM ) * f ( $S * $factorDown *
$factorDown , $K ) ) ;
2.2. MULTIPERIOD BINOMIAL TREE MODELS 97

31
32 $value = ( 1 / $effR ) * ( $piRNM * $v11 + ( 1 - $piRNM )
* $v10 ) ;
33
34 print " value : " , $value , " \ n " ;

SciPy Scientific Python script for multiperiod


1
2 import scipy
3
4 S = 100
5 factorUp = 1.05
6 factorDown = 0.95
7 B = 1
8 effR = 1.02 # effR = exp ( r * delta t_i )
9 deltati = 1
10 K = 100
11
12
13 def f (x , strike ) : # European call option
14 return max ( x - strike , 0)
15
16
17 def riskNeutralMeas ( fUp , fDown , exprdt ) :
18 return ( exprdt - fDown ) / ( fUp - fDown ) # risk
neutral measure pi
19

20
21 piRNM = riskNeutralMeas ( factorUp , factorDown , effR )
22
23 v11 = 1 / effR * ( piRNM * f ( S * factorUp * factorUp , K ) +
(1 - piRNM )
24 * f(S * factorUp * factorDown , K ) )
25 v10 = 1 / effR * ( piRNM * f ( S * factorUp * factorDown , K )
+ (1 - piRNM )
26 * f(S * factorDown * factorDown , K ) )
27
28 value = 1 / effR * ( piRNM * v11 + (1 - piRNM ) * v10 )
29

30 print ’ value : ’ , value , ’\ n ’


98 CHAPTER 2. BINOMIAL OPTION PRICING MODELS

Key Concepts
1. A multiperiod binomial derivative model can be valued by dynamic
programming — computing the replicating portfolio and corresponding
portfolio values back one period at a time from the claim values to the
starting time.

Vocabulary
1. The multiperiod binomial model for pricing derivatives of a risky secu-
rity is also called the Cox-Ross-Rubenstein model or CRR model
for short, after those who introduced it in 1979.

Problems to Work for Understanding


1. Consider a two-time-stage example. Each time stage is a year. A stock
starts at 50. In each year, the stock can go up by 10% or down by 3%.
The continuously compounded interest rate on a $1 bond is constant
at 6% each year. Find the price of a call option with exercise price
50, with exercise date at the end of the second year. Also, find the
replicating portfolio at each node.

2. Consider a three-time-stage example. The first time interval is a month,


then the second time interval is two months, finally, the third time
interval is a month again. A stock starts at 50. In the first interval, the
stock can go up by 10% or down by 3%, in the second interval the stock
can go up by 5% or down by 5%, finally in the third time interval, the
stock can go up by 6% or down by 3%. The continuously compounded
interest rate on a $1 bond is 2% in the first period, 3% in the second
period, and 4% in the third period. Find the price of a call option with
exercise price 50, with exercise date at the end of the 4 months. Also,
find the replicating portfolio at each node.

3. A European cash-or-nothing binary option pays a fixed amount of


money if it expires with the underlying stock value above the strike
price. The binary option pays nothing if it expires with the underlying
stock value equal to or less than the strike price. A stock currently has
price $100 and goes up or down by 20% in each time period. What is
the value of such a cash-or-nothing binary option with payoff $100 at
2.2. MULTIPERIOD BINOMIAL TREE MODELS 99

expiration 2 time units in the future and strike price $100? Assume a
simple interest rate of 10% in each time period.

4. A long strangle option pays max(K1 − S, 0, S − K2 ) if it expires when


the underlying stock value is S. The parameters K1 and K2 are the
lower strike price and the upper strike price, and K1 < K2 . A stock
currently has price $100 and goes up or down by 20% in each time
period. What is the value of such a long strangle option with lower
strike 90 and upper strike 110 at expiration 2 time units in the future?
Assume a simple interest rate of 10% in each time period.

5. A long straddle option pays |S − K| if it expires when the underlying


stock value is S. The option is a portfolio composed of a call and a
put on the same security with K as the strike price for both. A stock
currently has price $100 and goes up or down by 10% in each time
period. What is the value of such a long straddle option with strike
price K = 110 at expiration 2 time units in the future? Assume a
simple interest rate of 5% in each time period.

Outside Readings and Links:


1. Peter Hoadley, Options Strategy Analysis Tools. A useful link on basics
of the Black Scholes option pricing model. It contains terminology,
calculator, animated graphs, and Excel addins (a free trial version) for
making a spreadsheet model. Submitted by Yogesh Makkar, September
9,2003.
100 CHAPTER 2. BINOMIAL OPTION PRICING MODELS
Chapter 3

First Step Analysis for


Stochastic Processes

3.1 A Coin Tossing Experiment


Section Starter Question
Suppose you start with a fortune of $10, and you want to gamble to achieve
$20 before you go broke. Your gambling game is to flip a fair coin successively,
and gain $1 if the coin comes up “Heads” and lose $1 if the coin comes up
“Tails”. What do you estimate is the probability of achieving $20 before going
broke? How long do you estimate it takes before one of the two outcomes
occurs? How do you estimate each of these quantities?

Pure Risk Modeling

We need a better understanding of the paths that risky securities take. We


shall make and investigate a greatly simplified model of randomness and risk.
For our model, we assume:

1. Time is discrete, occurring at t0 = 0, t1 , t2 , . . ..

2. No risk-free investments are available, (i.e. no interest-bearing bonds).

3. No options, and no financial derivatives are available.

101
102CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

4. The only investments are risk-only, that is, our net fortune at the nth
time is a random variable:

Tn+1 = Tn + Yn+1

where T0 = 0 is our given initial fortune, and for simplicity,


(
+1 probability 1/2
Yn =
−1 probability 1/2.

Our model is commonly called “gambling” and we will investigate the prob-
abilities of making a fortune by gambling.

Some Humor

Figure 3.1: Welcome to my casino!


3.1. A COIN TOSSING EXPERIMENT 103

Figure 3.2: Where not to lose at the casino!

An Experiment
The reader should perform the following experiment as a “gambler” to gain
intuition about the coin-tossing game. We call victory the outcome of reach-
ing a fortune goal by chance before going broke. We call ruin the outcome
of going broke by chance before reaching a fortune goal.

1. Each “gambler” has a chart for recording the outcomes of each game
(see below) and a sheet of graph paper.

2. Each “gambler” has a fair coin to flip, say a penny.

3. Each “gambler” flips the coin, and records a +1 (gains $1) if the coin
comes up “Heads” and records −1 (loses $1) if the coin comes up
“Tails”. On the chart, the player records the outcome of each flip
with the flip number, the outcome as “H” or “T” and keeps track of
the cumulative fortune of the gambler so far. Keep these records in a
neat chart, since some problems refer to them later.

4. Each “gambler” should record 100 flips, which takes about 10 to 20


minutes.
104CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

Toss n 1 2 3 4 5 6 7 8 9 10
H or T
Pn −1
Yn = +1,
Tn = i=1 Yi
Toss n 11 12 13 14 15 16 17 18 19 20
H or T
Pn −1
Yn = +1,
Tn = i=1 Yi
Toss n 21 22 23 24 25 26 27 28 29 30
H or T
Pn −1
Yn = +1,
Tn = i=1 Yi
Toss n 31 32 33 34 35 36 37 38 39 40
H or T
P −1
Yn = +1,
Tn = ni=1 Yi
Toss n 41 42 43 44 45 46 47 48 49 50
H or T
Pn −1
Yn = +1,
Tn = i=1 Yi
Toss n 51 52 53 54 55 56 57 58 59 60
H or T
Pn −1
Yn = +1,
Tn = i=1 Yi
Toss n 61 62 63 64 65 66 67 68 69 70
H or T
Pn −1
Yn = +1,
Tn = i=1 Yi
Toss n 71 72 73 74 75 76 77 78 79 80
H or T
Pn −1
Yn = +1,
Tn = i=1 Yi
Toss n 81 82 83 84 85 86 87 88 89 90
H or T
P −1
Yn = +1,
Tn = ni=1 Yi
3.1. A COIN TOSSING EXPERIMENT 105

Toss n 91 92 93 94 95 96 97 98 99 100
H or T
Pn −1
Yn = +1,
Tn = i=1 Yi

Some Outcomes
A simulation with 30 “gamblers” obtained the following results:

1. 14 gamblers reached a net loss of −10 before reaching a net gain of


+10, that is, were “ruined”.

2. 9 gamblers reached a net gain of +10 before reaching a net loss of −10,
that is, achieved “victory”.

3. 7 gamblers still had not reached a net loss of +10 or −10 yet.

This roughly matches the predicted outcomes of 1/2 the gamblers being
ruined, not as close for the predicted proportion of 1/2 for victory. The
mean duration until victory or ruin was 41.6. Compare this to your results.

Sources
This section is adapted from ideas in William Feller’s classic text, An Intro-
duction to Probability Theory and Its Applications, Volume I, Third Edition.
The GeoGebra script is adapted from a demonstration and discussion
among “carlosgomes” of Amarante, Portugal; Noel Lambert of Vosges, France;
and Juan Vicente Snchez Gaitero of Cadiz, Spain on geogebra.org

Algorithms, Scripts, Simulations


Algorithm
The probability of Heads is p. In matrix-oriented languages, use k columns
of the matrix for the iterations of an experiment each with n trials. This is
more efficient than using for-loops or the equivalent.
Then each n × 1 column vector contains the outcomes of the experiment.
Use the random number generator to create a random number in (0, 1). To
simulate the flip of a coin use logical functions to score a 1, also counted as
a Head, if the value is less than p; a 0, also counted as a Tail, if the value
106CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

is greater than p. Column sums then give a 1 × k vector of total numbers


of Heads. Statistical measures can then be applied to this vector. For wins
and losses, linearly transform the coin flips to 1 if Heads, a −1 if Tails.
Cumulatively sum the entries to create the running total. Apply statistical
measures to the last row of the totals.
Finally, set values for victory and ruin. Check when each column first
hits victory or ruin.

Experiment Scripts
Geogebra GeoGebra script for coin flipping experiment

R R script for coin flipping experiment.


1 p <- 0.5
2 n <- 100
3 k <- 30
4 coinFlips <- array ( 0+( runif ( n * k ) <= p ) , dim = c (n , k ) )
5 # 0+ coerces Boolean to numeric
6 headsTotal <- colSums ( coinFlips ) # 0.. n binomial rv
sample , size k
7 muHeads <- mean ( headsTotal ) # Expected value is n
/2
8 sig maSqua redHea ds <- var ( headsTotal ) # Theoretical
value is np (1 - p )
9 cat ( sprintf ( " Empirical Mean of Heads : % f \ n " , muHeads ) )
10 cat ( sprintf ( " Empirical Variance of Heads : % f \ n " ,
sigm aSquar edHead s ) )
11
12 winLose <- 2 * coinFlips - 1 # -1 for Tails , 1 for
Heads
13 totals <- apply ( winLose , 2 , cumsum )
14 # -n .. n ( every other integer ) binomial rv sample
15 # the second argument ‘ ‘2 ’ ’ means column - wise
16 muWinLose <- mean ( totals [n ,]) # Expected value is 0
17 s i gm a S qu a r ed W i nL o s e <- var ( totals [n ,]) # Theoretical
value is 4 np (1 - p )
18 cat ( sprintf ( " Empirical Mean of Wins minus Losses : % f \ n " ,
muWinLose ) )
19 cat ( sprintf ( " Empirical Variance of Wins minus Losses : % f
\ n " , s i gm a S qu a r e dW i n Lo s e ) )
20
3.1. A COIN TOSSING EXPERIMENT 107

Octave Octave script for coin flipping experiment


1 p = 0.5;
2 n = 100;
3 k = 30;
4
5 coinFlips = rand (n , k ) <= p ;
6 headsTotal = sum ( coinFlips ) ; # 0.. n binomial rv sample ,
size k
7 muHeads = mean ( headsTotal ) ; # Expected value is n /2
8 sig maSqua redHea ds = var ( headsTotal ) ; # Theoretical value
is np (1 - p )
9 disp ( " Empirical Mean of Heads : " ) , disp ( muHeads )
10 disp ( " Empirical Variance of Heads : " ) , disp (
sigm aSquar edHead s )
11
12 winLose = 2* coinFlips - 1; # -1 for Tails , 1 for Heads
13 totals = cumsum ( winLose ) ; # -n .. n ( every other integer )
binomial rv sample
14 muWinLose = mean ( totals (n ,:) ) ; # Expected value is 0
15 s i gm a S qu a r ed W i nL o s e = var ( totals (n ,:) ) ; # Theoretical
value is 4 np (1 - p )
16 disp ( " Empirical Mean of Wins minus Losses : " ) , disp (
muWinLose )
17 disp ( " Empirical Variance of Wins minus Losses : " ) , \
18 disp ( s ig m a Sq u a re d W in L o se )
19

Perl Perl PDL script for coin flipping experiment


1 $p = 0.5;
2 $n = 100;
3 $k = 30;
4
5 $coinFlips = random ( $k , $n ) <= $p ; # note order of
dims !!
6 $headsTotal =
7 $coinFlips - > transpose - > sumover ; # 0.. n binomial r
. v . sample , size k
8
9 # note transpose , PDL likes x ( row ) direction for
implicitly threaded operations
10
108CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

11 ( $muHeads , $prms , $median , $min , $max , $adev , $rmsHeads


) =
12 $headsTotal - > stats ;
13
14 # easiest way to get the descriptive statistics
15
16 printf " Empirical Mean of Heads : %6.3 f \ n " , $muHeads ;
17

18 # Theoretical value is np
19 $varHeads = $rmsHeads * $rmsHeads ;
20 printf " Emprical Variance of Heads : %6.3 f \ n " , $varHeads ;
21
22 # Theoretical value is np (1 - p )
23

24 $winLose = 2 * $coinFlips - 1; # note use of threading


25 $totals = ( $winLose - > xchg ( 0 , 1 ) -> cumusumover ) ->
transpose ;
26
27 # note xchg transpose , PDL likes x ( row ) direction for
implicity threaded operations
28
29 ( $muWinLose , $prms , $median , $min , $max , $adev ,
$rmsWinLose ) =
30 $totals ( 0 : $k - 1 , $n - 1 ) -> stats ; # Expected
value is 0
31

32 # pdl are indexed from 0 like C and Perl , so that ’s why


$k -1 , $n -1
33
34 printf " Empirical Mean number of Wins over Losses : %6.3 f
\ n " , $muWinLose ;
35

36 # Theoretical value is 0
37 $varWinLose = $rmsWinLose * $rmsWinLose ; #
Theoretical value is 4 np (1 - p )
38 printf " Empirical Variance of Wins over Losses : %6.3 f \ n
" , $varWinLose ;
39

SciPy Scientific Python script for coin flipping experiment


1 import scipy
2
3 p = 0.5
3.1. A COIN TOSSING EXPERIMENT 109

4 n = 100
5 k = 30
6
7 coinFlips = scipy . random . random (( n , k ) ) <= p
8 # Note Booleans True for Heads and False for Tails
9 headsTotal = scipy . sum ( coinFlips , axis = 0)
10 # Note how Booleans act as 0 ( False ) and 1 ( True )
11 muHeads = scipy . mean ( headsTotal )
12 stddevHeads = scipy . std ( headsTotal )
13 sig maSqua redHea ds = stddevHeads * stddevHeads
14 print " Empirical Mean of Heads : " , muHeads
15 print " Empirical Variance of Heads : " , sigma Square dHeads
16
17 winLose = 2* coinFlips - 1
18 totals = scipy . cumsum ( winLose , axis = 0)
19 muWinLose = scipy . mean ( totals [n -1 , range ( k ) ])
20 stddevWinLose = scipy . std ( totals [n -1 , range ( k ) ])
21 s i gm a S qu a r ed W i nL o s e = stddevWinLose * stddevWinLose
22 print " Empirical Mean of Wins minus Losses : " , muWinLose
23 print " Empirical Variance of Wins minus Losses : " ,
s ig m a Sq u a re d W in L o se

Victory or Ruin Scripts


R R script for victory or ruin.
1 victory <- 10 # top boundary for random walk
2 ruin <- -10 # bottom boundary for random walk
3

4 victoryOrRuin <- array (0 , dim = c ( k ) )


5
6 hitVictory <- apply ( ( totals >= victory ) , 2 , which )
7 hitRuin <- apply ( ( totals <= ruin ) , 2 , which )
8
9 for ( j in 1: k ) {
10 if ( length ( hitVictory [[ j ]]) == 0 & & length (
hitRuin [[ j ]]) == 0 ) {
11 # no victory , no ruin
12 # do nothing
13 }
14 else if ( length ( hitVictory [[ j ]]) > 0 & & length (
hitRuin [[ j ]]) == 0 ) {
15 # victory , no ruin
110CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

16 victoryOrRuin [ j ] <- min ( hitVictory [[ j ]])


17 }
18 else if ( length ( hitVictory [[ j ]]) == 0 & & length (
hitRuin [[ j ]]) > 0 ) {
19 # no victory , ruin
20 victoryOrRuin [ j ] <- - min ( hitRuin [[ j ]])
21 }
22 else # ( length ( hitVictory [[ j ]]) > 0 & & length (
hitRuin [[ j ]]) > 0 )
23 # victory and ruin
24 if ( min ( hitVictory [[ j ]]) < min ( hitRuin [[ j ]]) ) { #
victory first
25 victoryOrRuin [ j ] <- min ( hitVictory [[ j ]]) #
code hitting victory
26 }
27 else { # ruin first
28 victoryOrRuin [ j ] <- - min ( hitRuin [[ j ]]) # code
hitting ruin as negative
29 }
30 }
31
32 vic toryBe foreRu in <- sum (0+( victoryOrRuin > 0) ) # count
exits through top
33 rui nBefor eVicto ry <- sum (0+( victoryOrRuin < 0) ) # count
exits through bottom
34 noRuinOrVictory <- sum (0+( victoryOrRuin == 0) )
35
36 cat ( sprintf ( " Victories : % i Ruins : % i No Ruin or Victory :
%i \n",
37 victoryBeforeRuin , ruinBeforeVictory , noRuinOrVictory
))
38

39 a v g T i m e V i c t o r y O r R u i n <- mean ( abs ( victoryOrRuin ) )


40 v a r T i m e V i c t o r y O r R u i n <- var ( abs ( victoryOrRuin ) )
41
42 cat ( sprintf ( " Average Time to Victory or Ruin : % f \ n " ,
43 avgTimeVictoryOrRuin ))
44 cat ( sprintf ( " Variance of Time to Victory or Ruin : % f \ n " ,
45 varTimeVictoryOrRuin ))
46
47 hist ( victoryOrRuin , nclass = 2 * max ( abs ( victoryOrRuin ) ) +1
) # sample exit time distribution
48
3.1. A COIN TOSSING EXPERIMENT 111

Octave Octave script for victory or ruin,


1 victory = 10; # top boundary for random walk
2 ruin = -10; # bottom boundary for random walk
3
4 # Octave find treats a whole matrix as a single column ,
5 # but I need to treat experiment column by column , so
here is a place
6 # where for clarity , better to loop over columns , using
find on each
7 victoryOrRuin = zeros (1 , k ) ;
8 for j = 1: k
9 hitVictory = find ( totals (: , j ) >= victory ) ;
10 hitRuin = find ( totals (: , j ) <= ruin ) ;
11 if ( ! rows ( hitVictory ) && ! rows ( hitRuin ) )
12 # no victory , no ruin
13 # do nothing
14 elseif ( rows ( hitVictory ) && ! rows ( hitRuin ) )
15 # victory , no ruin
16 victoryOrRuin ( j ) = hitVictory (1) ;
17 elseif ( ! rows ( hitVictory ) && rows ( hitRuin ) )
18 # no victory , but hit ruin
19 victoryOrRuin ( j ) = - hitRuin (1) ;
20 else # ( rows ( hitvictory ) && rows ( hitruin ) )
21 # victory and ruin
22 if ( hitVictory (1) < hitRuin (1) )
23 victoryOrRuin ( j ) = hitVictory (1) ; # code hitting
victory
24 else
25 victoryOrRuin ( j ) = - hitRuin (1) ; # code hitting ruin as
negative
26 endif
27 endif
28 endfor
29
30 victoryOrRuin # display vector of k hitting times
31
32 vic toryBe foreRu in = sum ( victoryOrRuin > 0 ) # count
exits through top
33 rui nBefor eVicto ry = sum ( victoryOrRuin < 0 ) # count
exits through bottom
34 noRuinOrVictory = sum ( victoryOrRuin == 0 )
35
36 a v g T i m e V i c t o r y O r R u i n = mean ( abs ( victoryOrRuin ) )
37 v a r T i m e V i c t o r y O r R u i n = var ( abs ( victoryOrRuin ) )
38
112CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

39 max ( totals )
40 hist ( victoryOrRuin , max ( max ( victoryOrRuin ) ) ) # sample
exit time distribution
41

Perl Perl PDL script for victory or ruin


1 use PDL :: NiceSlice ;
2
3 $victory = 10; # top boundary for random walk
4 $ruin = -10; # bottom boundary for random walk
5

6 $victoryOrRuin = zeros ( $k ) ;
7
8 $hitVictory = ( $totals >= $victory ) ;
9 $hitRuin = ( $totals <= $ruin ) ;
10
11 $whenVictory = $hitVictory ( 0 : $k - 1 , : ) -> xchg ( 0 , 1
) -> maximum_ind ;
12 $whenRuin = $hitRuin ( 0 : $k - 1 , : ) -> xchg ( 0 , 1
) -> maximum_ind ;
13 foreach $i ( 0 .. $k - 1 ) {
14 if ( $whenVictory ( $i ) == 0 and $whenRuin ( $i ) == 0 )
{
15
16 # no victory , no ruin , do nothing
17 $victoryOrRuin ( $i ) = 0;
18 }
19 elsif ( $whenVictory ( $i ) > 0 and $whenRuin ( $i ) == 0
) {
20 $victoryOrRuin ( $i ) .= $whenVictory ( $i ) ;
21 } # victory , no ruin
22 elsif ( $whenVictory ( $i ) == 0 and $whenRuin ( $i ) > 0
) {
23 $victoryOrRuin ( $i ) .= - $whenRuin ( $i ) ;
24 } # no victory , ruin
25 else {
26 if ( $whenVictory ( $i ) < $whenRuin ( $i ) ) { #
victory first
27 $victoryOrRuin ( $i ) .= $whenVictory ( $i ) ; #
code hitting victory
28 }
29 else {
30 $victoryOrRuin ( $i )
3.1. A COIN TOSSING EXPERIMENT 113

31 .= - $whenRuin ( $i ) ; # code hitting


ruin as negative
32 }
33 }
34 }
35
36 $ vic to ry Be fo re Ru in =
37 ( $victoryOrRuin > 0 ) -> sumover ; # count exits
through top
38 $ rui nB ef or eV ic to ry =
39 ( $victoryOrRuin < 0 ) -> sumover ; # count exits
through bottom
40
41 ( $muTimeVictoryOrRuin , $prms , $median , $min , $max ,
$adev ,
42 $ r m s T i m e V i c t o r y O r Ru i n
43 ) = $victoryOrRuin - > abs - > stats ;
44
45 print " Mean time to victory or ruin " ,
$muTimeVictoryOrRuin , " \ n " ;
46 print " Standard deviation of time to victory or ruin " ,
$rmsTimeVictoryOrRuin ,
47 "\n";
48
49 $histLimit = $victoryOrRuin - > abs - > max ;
50 print hist ( $victoryOrRuin , - $histLimit , $histLimit , 1 ) ,
"\n";
51

SciPy Scientific Python script for victory or ruin.


1 victory = 10; # top boundary for random
walk
2 ruin = -10; # bottom boundary of
random walk
3

4 victoryOrRuin = scipy . zeros (k , int ) ;


5 hitVictory = scipy . argmax ( ( totals >= victory ) , axis =0)
6 hitRuin = scipy . argmax ( ( totals <= ruin ) , axis =0)
7 for i in range ( k ) :
8 if hitVictory [ i ] == 0 and hitRuin [ i ] == 0:
9 # no victory , no ruin , do nothing
10 victoryOrRuin [ i ] = 0
11 elif hitVictory [ i ] > 0 and hitRuin [ i ] == 0:
114CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

12 victoryOrRuin [ i ] = hitVictory [ i ]
13 elif hitVictory [ i ] == 0 and hitRuin [ i ] > 0:
14 victoryOrRuin [ i ] = - hitRuin [ i ]
15 else :
16 if hitVictory [ i ] < hitRuin [ i ]:
17 victoryOrRuin [ i ] = hitVictory [ i ]
18 else :
19 victoryOrRuin [ i ] = - hitRuin [ i ]
20
21 vic toryBe foreRu in = sum ( victoryOrRuin > 0 ) # count
exits through top
22 rui nBefor eVicto ry = sum ( victoryOrRuin < 0 ) # count
exits through bottom
23 noRuinOrVictory = sum ( victoryOrRuin == 0 )
24
25 print " Victories : " , victoryBeforeRuin , " Ruins : " ,
ruinBeforeVictory ,
26 print " No Ruin or Victory : " , noRuinOrVictory
27
28 a v g T i m e V i c t o r y O r R u i n = scipy . mean ( abs ( victoryOrRuin ) )
29 s t d T i m e V i c t o r y O r R u i n = scipy . std ( abs ( victoryOrRuin ) )
30 varTimeVictoryOrRuin = stdTimeVictoryOrRuin *
stdTimeVictoryOrRuin
31
32 print " Average Time to Victory or Ruin : " ,
avgTimeVictoryOrRuin
33 print " Variance of Time to Victory or Ruin : " ,
varTimeVictoryOrRuin

Key Concepts
1. Performing an experiment to gain intuition about coin-tossing games.

Vocabulary
1. We call victory the outcome of reaching a fortune goal by chance
before going broke.

2. We call ruin the outcome of going broke by chance before reaching a


fortune goal.
3.1. A COIN TOSSING EXPERIMENT 115

Problems to Work for Understanding


1. How many heads were obtained in your sequence of 100 flips? What
is the class average of the number of heads in 100 flips? What is the
variance of the number of heads obtained by the class members?

2. What is the net win-loss total obtained in your sequence of 100 flips?
What is the class average of the net win-loss total in 100 flips? What is
the variance of the net win-loss total obtained by the class members?

3. How many of the class reached a net gain of +10 (call it victory) before
reaching a net loss of −10 (call it ruin)?

4. How many flips did it take before you reached a net gain of +10 (vic-
tory) or a net loss of −10 (ruin)? What is the class average of the
number of flips before reaching victory before ruin at +10 or a net loss
of −10?

5. What is the maximum net value achieved in your sequence of flips?


What is the class distribution of maximum values achieved in the se-
quence of flips?

6. Perform some simulations of the coin-flipping game, varying p. How


does the value of p affect the experimental probability of victory and
ruin?

Outside Readings and Links:


1. Virtual Laboratories in Probability and Statistics Red and Black Game
Search for Red and Black Game, both the explanation and the simula-
tion.

2. University of California, San Diego, Department of Mathematics, A.M.


Garsia A java applet that simulates how long it takes for a gambler to
go broke. You can control how much money you and the casino start
with, the house odds, and the maximum number of games. Results are
a graph and a summary table. Submitted by Matt Odell, September
8, 2003.
116CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

3.2 Ruin Probabilities


Section Starter Question
What is the solution of the recurrence equation xn = axn−1 where a is a
constant? What kind of a function is the solution? What more, if anything,
needs to be known to obtain a complete solution?

Understanding a Stochastic Process


We consider a sequence of Bernoulli random variables, Y1 , Y2 , Y3 , . . . where
Yi = +1 with probability p and Yi = −1 with probability q. We Pnstart with
an initial value T0 > 0. We define the sequence of sums Tn = i=0 Yi . We
are interested in the stochastic process T1 , T2 , T3 , . . .. It turns out this is a
complicated sequence to understand in full, so we single out particular simpler
features to understand first. For example, we can look at the probability that
the process will achieve the value 0 before it achieves the value a. This is
a special case of a larger class of probability problems called first-passage
probabilities.

Theorems about Ruin Probabilities


Consider a gambler who wins or loses a dollar on each turn of a game with
probabilities p and q = 1 − p respectively. Let his initial capital be T0 > 0.
The game continues until the gambler’s capital either is reduced to 0 or has
increased to a. Let qT0 be the probability of the gambler’s ultimate ruin
and pT0 the probability of his winning. We shall show later that (see also
Duration of the Game Until Ruin.)
pT0 + qT0 = 1
so that we need not consider the possibility of an unending game.
Theorem 1. The probability of the gambler’s ruin is
(q/p)a − (q/p)T0
qT0 =
(q/p)a − 1
if p 6= q and
qT0 = 1 − T0 /a
if p = q = 1/2.
3.2. RUIN PROBABILITIES 117

Proof. The proof uses a first step analysis considering how the probabilities
change after one step or trial. After the first trial the gambler’s fortune is
either T0 − 1 or T0 + 1 and therefore we must have

qT0 = pqT0 +1 + qqT0 −1 (3.1)

provided 1 < T0 < a−1. For T0 = 1, the first trial may lead to ruin, and (3.1)
is replaced by
q1 = pq2 + q.
Similarly, for T0 = a − 1 the first trial may result in victory, and therefore

qa−1 = qqa−2 .

To unify our equations, we define as a natural convention that q0 = 1, and


qa = 0. Then the probability of ruin satisfies (3.1) for T0 = 1, 2, . . . , a − 1.
This defines a set of a − 1 difference equations, with boundary conditions at
0 and a. If we solve the system of difference equations, then we will have the
desired probability qT0 for any value of T0 .
Note that we can rewrite the difference equations as

pqT0 + qqT0 = pqT0 +1 + qqT0 −1 .

Then we can rearrange and factor to obtain


qT0 +1 − qT0 q
= .
qT0 − qT0 −1 p

This says the ratio of successive differences of qT0 is constant. This suggests
that qT0 is a power function,
qT0 = λT0
since power functions have this property.
We first take the case when p 6= q. Then based on the guess above (or
also on standard theory for linear difference equations), we try a solution of
the form qT0 = λT0 . That is

λT0 = pλT0 +1 + qλT0 −1 .

This reduces to
pλ2 − λ + q = 0.
118CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

Since p + q = 1, this factors as

(pλ − q)(λ − 1) = 0,

so the solutions are λ = q/p, and λ = 1. (One could also use the quadratic
formula to obtain the same values.) Again by the standard theory of linear
difference equations, the general solution is

qT0 = A · 1 + B · (q/p)T0 (3.2)

for some constants A, and B.


Now we determine the constants by using the boundary conditions:

q0 = A + B = 1
qa = A + B(q/p)a = 0.

Solving, substituting, and simplifying:


(q/p)a − (q/p)T0
qT0 = .
(q/p)a − 1
(Check for yourself that with this expression 0 ≤ qT0 ≤ 1 as it should be a
for a probability.)
We should show that the solution is unique. So suppose rT0 is another
solution of the difference equations. Given an arbitrary solution of (3.1), the
two constants A and B can be determined so that (3.2) agrees with rT0 at
T0 = 0 and T0 = a. (The reader should be able to explain why by reference
to a theorem in Linear Algebra!) From these two values, all other values
can be found by substituting in (3.1) successively T0 = 1, 2, 3, . . . Therefore,
two solutions which agree for T0 = 0 and T0 = 1 are identical, hence every
solution is of the form (3.2).
The solution breaks down if p = q = 1/2, since then we do not get two
linearly independent solutions of the difference equation (we get the solution
1 repeated twice). Instead, we need to borrow a result from differential equa-
tions (from the variation-of-parameters/reduction-of-order set of ideas used
to derive a complete linearly independent set of solutions.) Certainly, 1 is
still a solution of the difference equation (3.1). A second linearly independent
solution is T0 , (check it out!) and the general solution is qT0 = A + BT0 . To
satisfy the boundary conditions, we must put A = 1, and A + Ba = 0, hence
qT0 = 1 − T0 /a.
3.2. RUIN PROBABILITIES 119

We can consider a symmetric interpretation of this gambling game. In-


stead of a single gambler playing at a casino, trying to make a goal a before
being ruined, consider two gamblers Alice and Bill playing against each other.
Let Alice’s initial capital be T0 and let her play against adversary Bill with
initial capital a − T0 so that their combined capital is a. The game continues
until one gambler’s capital either is reduced to zero or has increased to a,
that is, until one of the two players is ruined.

Corollary 1. pT0 + qT0 = 1

Proof. The probability pT0 of Alice’s winning the game equals the probability
of Bill’s ruin. Bill’s ruin (and Alice’s victory) is therefore obtained from our
ruin formulas on replacing p, q, and T0 by q, p, and a − T0 respectively. That
is, from our formula (for p 6= q) the probability of Alice’s ruin is

(q/p)a − (q/p)T0
qT0 =
(q/p)a − 1

and the probability of Bill’s ruin is

(p/q)a − (p/q)a−T0
pT 0 = .
(p/q)a − 1

Then add these together, and after some algebra, the total is 1. (Check it
out!)
For p = 1/2 = q, the proof is simpler, since then pT0 = 1 − (a − T0 )/a,
and qT0 = 1 − T0 /a, and pT0 + qT0 = 1 easily.

Corollary 2. The expected gain is E [G] = (1 − qT0 )a − T0 .

Proof. In the game, the gambler’s ultimate gain (or loss!) is a Bernoulli (two-
valued) random variable, G, where G assumes the value −T0 with probability
qT0 , and assumes the value a − T0 with probability pT0 . Thus the expected
value is

E [G] = (a − T0 )pT0 + (−T0 )qT0


= pT0 a − T0
= (1 − qT0 )a − T0 .
120CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

Now notice that if q = 1/2 = p, so that we are dealing with a fair game,
then E [G] = (1 − (1 − T0 /a)) · a − T0 = 0. That is, a fair game in the short
run (one trial) is a fair game in the long run (expected value). However, if
p < 1/2 < q, so the game is not fair then our expectation formula says

(q/p)a − (q/p)T0
 
E [G] = 1 − a − T0
(q/p)a − 1
(q/p)T0 − 1
= a − T0
(q/p)a − 1
[(q/p)T0 − 1]a
 
= − 1 T0
[(q/p)a − 1]T0

The sequence [(q/p)n − 1]/n is an increasing sequence, so

[(q/p)T0 − 1]a
 
− 1 < 0.
[(q/p)a − 1]T0

This shows that an unfair game in the short run (one trial) is an unfair game
in the long run.

Corollary 3. The probability of ultimate ruin of a gambler with initial capital


T0 playing against an infinitely rich adversary is

qT0 = 1, p≤q

and
qT0 = (q/p)T0 , p > q.

Proof. Let a → ∞ in the formulas. (Check it out!)

Remark. This corollary says that the probability of “breaking the bank at
Monte Carlo” as in the movies is zero, at least for the simple games we are
considering.
3.2. RUIN PROBABILITIES 121

Some Calculations for Illustration


p q T0 aProbability Probability Expected
of Ruin of Victory Gain
0.5 0.5 9 10 0.1000 0.9000 0
0.5 0.5 90 100 0.1000 0.9000 0
0.5 0.5 900 1,000 0.1000 0.9000 0
0.5 0.5 950 1,000 0.0500 0.9500 0
0.5 0.5 8,000 10,000 0.2000 0.8000 0
0.45 0.55 9 10 0.2101 0.7899 -1
0.45 0.55 90 100 0.8656 0.1344 -77
0.45 0.55 99 100 0.1818 0.8182 -17
0.4 0.6 90 100 0.9827 0.0173 -88
0.4 0.6 99 100 0.3333 0.6667 -32

Why do we hear about people who actually win?

We often hear from people who consistently win at the casino. How can this
be in the face of the theorems above?
A simple illustration makes clear how this is possible. Assume for conve-
nience a gambler who repeatedly visits the casino, each time with a certain
amount of capital. His goal is to win 1/9 of his capital. That is, in units of
his initial capital T0 = 9, and a = 10. Assume too that the casino is fair so
that p = 1/2 = q, then the probability of ruin in any one year is:

qT0 = 1 − 9/10 = 1/10.

That is, if the working capital is much greater than the amount required for
victory, then the probability of ruin is reasonably small.
Then the probability of an unbroken string of ten successes in ten years
is:
(1 − 1/10)10 ≈ exp(−1) ≈ 0.37

This much success is reasonable, but simple psychology would suggest the
gambler would boast about his skill instead of crediting it to luck. More-
over, simple psychology suggests the gambler would also blame one failure
on oversight, momentary distraction, or even cheating by the casino!
122CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

Another Interpretation as a Random Walk


Another common interpretation of this probability game is to imagine it as a
random walk. That is, we imagine an individual on a number line, starting
at some position T0 . The person takes a step to the right to T0 + 1 with
probability p and takes a step to the left to T0 − 1 with probability q and
continues this random process. Then instead of the total fortune at any time,
we consider the geometric position on the line at any time. Instead of reaching
financial ruin or attaining a financial goal, we talk instead about reaching or
passing a certain position. For example, Corollary 3 says that if p ≤ q, then
the probability of visiting the origin before going to infinity is 1. The two
interpretations are equivalent and either can be used depending on which
is more useful. The problems below use the random walk interpretation,
because they are more naturally posed in terms of reaching or passing certain
points on the number line.

The interpretation as Markov Processes and Martingales


The fortune in the coin-tossing game is the first and simplest encounter with
two of the most important ideas in modern probability theory.
We can interpret the fortune in our gambler’s coin-tossing game as a
Markov process. That is, at successive times the process is in various
states. In our case, the states are the values of the fortune. The probability
of passing from one state at the current time t to another state at time t + 1
is completely determined by the present state. That is, for our coin-tossing
game

P [Tt+1 = x + 1|Tt = x] = p
P [Tt+1 = x − 1|Tt = x] = q
P [Tt+1 = y|Tt = x] = 0 for all y 6= x + 1, x − 1

The most important property of a Markov process is that the probability of


being in the next state is completely determined by the current state and not
the history of how the process arrived at the current state. In that sense, we
often say that a Markov process is memory-less.
We can also note the fair coin-tossing game with p = 1/2 = q is a mar-
tingale. That is, the expected value of the process at the next step is the
current value. Using expectation for estimation, the best estimate we have
3.2. RUIN PROBABILITIES 123

of the gambler’s fortune at the next step is the current fortune:

E [Tn+1 |Tn = x] = (x + 1)(1/2) + (x − 1)(1/2) = x.

This characterizes a fair game, after the next step, one can neither expect
to be richer or poorer. Note that the coin-tossing games with p 6= q do not
have this property.
In later sections we have more occasions to study the properties of mar-
tingales, and to a lesser degree Markov processes.

Sources
This section is adapted from W. Feller, in Introduction to Probability Theory
and Applications, Volume I, Chapter XIV, page 342, [19]. Some material is
adapted from [67] and [35]. Steele has an excellent discussion at about the
same level as here, but with a slightly more rigorous approach to solving the
difference equations. He also gives more information about the fact that the
duration is almost surely finite, showing that all moments of the duration
are finite. Karlin and Taylor give a treatment of the ruin problem by direct
application of Markov chain analysis, which is not essentially different, but
points to greater generality.

Algorithms, Scripts, Simulations


Algorithm
The goal is to simulate the probability function for ruin with a given starting
value. First set the probability p, number of Bernoulli trials n, and number
of experiments k. Set the ruin and victory values r and v, the boundaries
for the random walk. For each starting value from ruin to victory, fill an
n × k matrix with the Bernoulli random variables. For languages with multi-
dimensional arrays each the data is kept in a three-dimensional array of size
n × k × (v − r + 1). Cumulatively sum the Bernoulli random variables to
create the fortune or random walk. For each starting value, for each random
walk or fortune path, find the step where ruin or victory is encountered.
For each starting value, find the proportion of fortunes encountering ruin.
Finally, find a least squares linear fit of the ruin probabilities as a function
of the starting value.
124CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

Scripts
Geogebra Geogebra script for ruin probabilities

R R script for ruin probabilities


1
2 p <- 0.5
3 n <- 150
4 k <- 60
5
6 victory <- 10
7 # top boundary for random walk
8 ruin <- -10
9 # bottom boundary for random walk
10 interval <- victory - ruin + 1
11
12 winLose <- 2 * ( array ( 0+( runif ( n * k * interval ) <= p ) , dim =
c (n ,k ,
13 interval ) ) ) - 1
14 # 0+ coerces Boolean to numeric
15 totals <- apply ( winLose , 2:3 , cumsum )
16 # the second argument ‘ ‘2:3 ’ ’ means column - wise in each
panel
17 start <- outer ( array (1 , dim = c ( n +1 , k ) ) , ruin : victory , " * "
)
18
19 paths <- array ( 0 , dim = c ( n +1 , k , interval ) )
20 paths [2:( n +1) , 1: k , 1: interval ] <- totals
21 paths <- paths + start
22
23 hitVictory <- apply ( paths , 2:3 , ( function ( x ) match ( victory
,x , nomatch = n +2) ) ) ;
24 hitRuin <- apply ( paths , 2:3 , ( function ( x ) match ( ruin ,
x , nomatch = n +2) ) ) ;
25 # the second argument ‘ ‘2:3 ’ ’ means column - wise in each
panel
26 # If no ruin or victory on a walk , nomatch = n +2 sets the
hitting
27 # time to be two more than the number of steps , one more
than
28 # the column length . Without the nomatch option , get NA
which
29 # works poorly with the comparison hitRuin < hitVictory
next .
30
3.2. RUIN PROBABILITIES 125

31 p r o b R u i n B e f o r e V i c t o r y <-
32 apply ( ( hitRuin < hitVictory ) , 2 ,
33 ( function ( x ) length (( which (x , arr . ind = FALSE ) ) ) ) ) / k
34
35 startValues <- ( ruin : victory ) ;
36 ruinFunction <- lm ( p r o b R u i n B e f o r e V i c t o r y ~ startValues )
37 # lm is the R function for linear models , a more general
view of
38 # least squares linear fitting for response ~ terms
39 cat ( sprintf ( " Ruin function Intercept : % f \ n " ,
coefficients ( ruinFunction ) [1] ) )
40 cat ( sprintf ( " Ruin function Slope : % f \ n " , coefficients (
ruinFunction ) [2] ) )
41

42 plot ( startValues , p r o b R u i n B e f o r e V i c t o r y ) ;
43 abline ( ruinFunction )
44
45

Octave Octave script for ruin probabilities


1 p = 0.5;
2 n = 150;
3 k = 60;
4
5 victory = 10;
6 # top boundary for random walk
7 ruin = -10;
8 # bottom boundary for random walk
9

10 p r o b R u i n B e f o r e V i c t o r y = zeros (1 , victory - ruin +1) ;


11 for start = ruin : victory
12
13 winLose = 2 * ( rand (n , k ) <= p ) - 1;
14 # -1 for Tails , 1 for Heads
15 totals = cumsum ( winLose ) ;
16 # -n .. n ( every other integer ) binomial rv sample
17
18 paths = [ zeros (1 , k ) ; totals ] + start ;
19 victoryOrRuin = zeros (1 , k ) ;
20 for j = 1: k
21 hitVictory = find ( paths (: , j ) >= victory ) ;
22 hitRuin = find ( paths (: , j ) <= ruin ) ;
23 if ( ! rows ( hitVictory ) && ! rows ( hitRuin ) )
126CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

24 # no victory , no ruin
25 # do nothing
26 elseif ( rows ( hitVictory ) && ! rows ( hitRuin ) )
27 # victory , no ruin
28 victoryOrRuin ( j ) = hitVictory (1) ;
29 elseif ( ! rows ( hitVictory ) && rows ( hitRuin ) )
30 # no victory , but hit ruin
31 victoryOrRuin ( j ) = - hitRuin (1) ;
32 else # ( rows ( hitvictory ) && rows ( hitruin ) )
33 # victory and ruin
34 if ( hitVictory (1) < hitRuin (1) )
35 victoryOrRuin ( j ) = hitVictory (1) ;
36 # code hitting victory
37 else
38 victoryOrRuin ( j ) = - hitRuin (1) ;
39 # code hitting ruin as negative
40 endif
41 endif
42 endfor
43

44 p r o b R u i n B e f o r e V i c t o r y ( start + ( - ruin +1) ) = sum (


victoryOrRuin < 0 ) / k ;
45 # probRuinBeforeVictory
46 endfor
47
48 function coeff = least_square (x , y )
49 n = length ( x ) ;
50 A = [ x ones (n ,1) ];
51 coeff = A \ y ;
52 plot (x ,y , ’x ’) ;
53 hold on
54 interv = [ min ( x ) max ( x ) ];
55 plot ( interv , coeff (1) * interv + coeff (2) ) ;
56 end
57
58 rf = least_square ( transpose ( ruin : victory ) , transpose (
probRuinBeforeVictory ));
59 disp ( " Ruin function Intercept : " ) , disp ( rf (2) )
60 disp ( " Ruin function Slope : " ) , disp ( rf (1) )
61 hold off
62
63
3.2. RUIN PROBABILITIES 127

Perl Perl PDL script for ruin probabilities


1 use PDL :: NiceSlice ;
2
3 $p = 0.5;
4 $n = 150;
5 $k = 60;
6 $victory = 10;
7 $ruin = -10;
8 $interval = $victory - $ruin + 1;
9 $winLose = 2 * ( random ( $k , $n , $interval ) <= $p ) -
1;
10 $totals = ( cumusumover $winLose - > xchg ( 0 , 1 ) ) ->
transpose ;
11 $start = zeroes ( $k , $n + 1 , $interval ) -> zlinvals (
$ruin , $victory ) ;
12
13 $paths = zeroes ( $k , $n + 1 , $interval ) ;
14
15 # use PDL : NiceSlice on next line
16 $paths ( 0 : ( $k - 1 ) , 1 : $n , 0 : ( $interval - 1 ) )
.= $totals ;
17
18 # Note the use of the concat operator here .
19 $paths = $paths + $start ;
20 $hitVictory = $paths - > setbadif ( $paths < $victory ) ;
21 $hitRuin = $paths - > setbadif ( $paths > $ruin ) ;
22
23 $victoryIndex =
24 ( $hitVictory ( ,, : ) -> xchg ( 0 , 1 ) -> minimum_ind )
25 -> inplace - > setbadtoval ( $n + 1 ) ;
26 $ruinIndex =
27 ( $hitRuin ( ,, : ) -> xchg ( 0 , 1 ) -> maximum_ind )
28 -> inplace - > setbadtoval ( $n + 1 ) ;
29
30 $ p r o b R u i n B e f o r e V i c t o r y = sumover ( float ( $ruinIndex <
$victoryIndex ) ) / $k ;
31

32 use PDL :: Fit :: Linfit ;


33 $x = zeroes ( $interval ) -> xlinvals ( $ruin , $victory ) ;
34 $fitFuncs = cat ones ( $interval ) , $x ;
35 ( $ruinFunction , $coeffs ) = linfit1d
$probRuinBeforeVictory , $fitFuncs ;
36 print " Ruin function Intercept : " , $coeffs (0) , " \ n " ;
37 print " Ruin function Slope : " , $coeffs (1) , " \ n " ;
38
128CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

39

SciPy Scientific Python script for ruin probabilities


1 import scipy
2
3 p = 0.5
4 n = 150
5 k = 60
6 victory = 10;
7 ruin = -10;
8 interval = victory - ruin + 1;
9
10 winLose = 2*( scipy . random . random (( n ,k , interval ) ) <= p )
- 1
11 totals = scipy . cumsum ( winLose , axis = 0)
12

13 start = scipy . multiply . outer ( scipy . ones (( n +1 , k ) , dtype =


int ) , scipy . arange ( ruin , victory +1 , dtype = int ) )
14 paths = scipy . zeros (( n +1 ,k , interval ) , dtype = int )
15 paths [ 1: n +1 , : ,:] = totals
16 paths = paths + start
17

18 def match (a ,b , nomatch = None ) :


19 return b . index ( a ) if a in b else nomatch
20 # arguments : a is a scalar , b is a python list , value of
nomatch is scalar
21 # returns the position of first match of its first
argument in its second argument
22 # but if a is not there , returns the value nomatch
23 # modeled on the R function " match " , but with less
generality
24
25 hitVictory = scipy . apply_along_axis ( lambda x :( match (
victory , x . tolist () , nomatch = n +2) ) , 0 , paths )
26 hitRuin = scipy . apply_along_axis ( lambda x : match ( ruin , x .
tolist () , nomatch = n +2) , 0 , paths )
27 # If no ruin or victory on a walk , nomatch = n +2 sets the
hitting
28 # time to be two more than the number of steps , one more
than
29 # the column length .
30
3.2. RUIN PROBABILITIES 129

31 p r o b R u i n B e f o r e V i c t o r y = scipy . mean ( ( hitRuin < hitVictory


) , axis =0)
32 # note that you can treat the bool ’s as binary data !
33
34 ruinFunction = scipy . polyfit ( scipy . arange ( ruin , victory
+1 , dtype = int ) , probRuinBeforeVictory , 1)
35 print " Ruin function Intercept : " , ruinFunction [1];
36 print " Ruin function Slope : " , ruinFunction [0];
37 # should return a slope near -1/( victory - ruin ) and an
intercept near 0.5
38
39

Key Concepts
1. The probabilities, interpretation, and consequences of the “gambler’s
ruin”.

Vocabulary
1. Classical Ruin Problem “Consider the familiar gambler who wins
or loses a dollar with probabilities p and q = 1 − p, respectively play-
ing against an infinitely rich adversary who is always willing to play
although the gambler has the privilege of stopping at his pleasure. The
gambler adopts the strategy of playing until he either loses his capital
(“is ruined”) or increases it to a (with a net gain of a − T0 .) We are
interested in the probability of the gambler’s ruin and the probability
distribution of the duration of the game. This is the classical ruin
problem.”. (From W. Feller, in Introduction to Probability Theory and
Applications, Volume I, Chapter XIV, page 342. [19])

Problems to Work for Understanding


1. Consider the ruin probabilities qT0 as a function of T0 . What is the
domain of qT0 ? What is the range of qT0 ? Explain heuristically why
qT0 is decreasing as a function of T0 .
130CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

2. Show that power functions have the property that the ratio of successive
differences is constant.

3. Show the sequence [(q/p)n − 1]/n is an increasing sequence for 0 < p <
1/2 < q < 1.

4. In a random walk starting at the origin find the probability that the
point a > 0 will be reached before the point −b < 0.

5. James Bond wants to ruin the casino at Monte Carlo by consistently


betting 1 Euro on Red at the roulette wheel. The probability of Bond
winning at one turn in this game is 18/38 ≈ 0.474. James Bond, being
Agent 007, is backed by the full financial might of the British Empire,
and so can be considered to have unlimited funds. Approximately how
much money should the casino have to start with so that Bond has
only a “one-in-a-million” chance of ruining the casino?

6. A gambler starts with $2 and wants to win $2 more to get to a total of


$4 before being ruined by losing all his money. He plays a coin-flipping
game, with a coin that changes with his fortune.

(a) If the gambler has $2 he plays with a coin that gives probability
p = 1/2 of winning a dollar and probability q = 1/2 of losing a
dollar.
(b) If the gambler has $3 he plays with a coin that gives probability
p = 1/4 of winning a dollar and probability q = 3/4 of losing a
dollar.
(c) If the gambler has $1 he plays with a coin that gives probability
p = 3/4 of winning a dollar and probability q = 1/4 of losing a
dollar.

Use “first step analysis” to write three equations in three unknowns


(with two additional boundary conditions) that give the probability
that the gambler will be ruined. Solve the equations to find the ruin
probability.

7. A gambler plays a coin flipping game in which the probability of win-


ning on a flip is p = 0.4 and the probability of losing on a flip is
q = 1 − p = 0.6. The gambler wants to reach the victory level of $16
3.2. RUIN PROBABILITIES 131

before being ruined with a fortune of $0. The gambler starts with $8,
bets $2 on each flip when the fortune is $6, $8, $10 and bets $4 when
the fortune is $4 or $12 Compute the probability of ruin in this game.
8. Prove: In a random walk starting at the origin the probability to reach
the point a > 0 before returning to the origin equals p(1 − q1 ).
9. Prove: In a random walk starting at a > 0 the probability to reach the
origin before returning to the starting point equals qqa−1 .
10. In the simple case p = 1/2 = q, conclude from the preceding problem:
In a random walk starting at the origin, the number of visits to the
point a > 0 that take place before the first return to the origin has
a geometric distribution with ratio 1 − qqa−1 . (Why is the condition
q ≥ p necessary?)
11. (a) Draw a sample path of a random walk (with p = 1/2 = q) starting
from the origin where the walk visits the position 5 twice before
returning to the origin.
(b) Using the results from the previous problems, it can be shown
with careful but elementary reasoning that the number of times
N that a random walk (p = 1/2 = q) reaches the value a a total
of n times before returning to the origin is a geometric random
variable with probability
 n  
1 1
P [N = n] = 1− .
2a 2a
Compute the expected number of visits E [N ] to level a.
(c) Compare the expected number of visits of a random walk (with
p = 1/2 = q) to the value 1,000,000 before returning to the origin
and to the level 10 before returning to the origin.
12. This problem is adapted from Stochastic Calculus and Financial Ap-
plications by J. Michael Steele, Springer, New York, 2001, Chapter 1,
Section 1.6, page 9. Information on buy-backs is adapted from investor-
words.com. This problem suggests how results on biased random walks
can be worked into more realistic models.
Consider a naive model for a stock that has a support level of $20/share
because of a corporate buy-back program. (This means the company
132CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

will buy back stock if shares dip below $20 per share. In the case
of stocks, this reduces the number of shares outstanding, giving each
remaining shareholder a larger percentage ownership of the company.
This is usually considered a sign that the company’s management is
optimistic about the future and believes that the current share price is
undervalued. Reasons for buy-backs include putting unused cash to use,
raising earnings per share, increasing internal control of the company,
and obtaining stock for employee stock option plans or pension plans.)
Suppose also that the stock price moves randomly with a downward
bias when the price is above $20, and randomly with an upward bias
when the price is below $20. To make the problem concrete, we let
Sn denote the stock price at time n, and we express our stock support
hypothesis by the assumptions that

P [Sn+1 = 21|Sn = 20] = 9/10


P [Sn+1 = 19|Sn = 20] = 1/10

We then reflect the downward bias at price levels above $20 by requiring
that for k > 20:

P [Sn+1 = k + 1|Sn = k] = 1/3


P [Sn+1 = k − 1|Sn = k] = 2/3.

We then reflect the upward bias at price levels below $20 by requiring
that for k < 20:

P [Sn+1 = k + 1|Sn = k] = 2/3


P [Sn+1 = k − 1|Sn = k] = 1/3

Using the methods of “single-step analysis” calculate the expected time


for the stock to fall from $25 through the support level all the way down
to $18. (Because of the varying parameters there is no way to solve
this problem using formulas. Instead you will have to go back to basic
principles of single-step or first-step analysis to solve the problem.)

13. Modify the ruin probability scripts to perform simulations of the ruin
calculations in the table in the section Some Calculations for Illustra-
tion and compare the results.
3.3. DURATION OF THE GAMBLER’S RUIN 133

14. Perform some simulations of the coin-flipping game, varying p and the
start value. How does the value of p affect the experimental probability
of victory and ruin?

15. Modify the simulations by changing the value of p and comparing the
experimental results for each starting value to the theoretical ruin func-
tion.

Outside Readings and Links:


1. Virtual Labs in Probability Games of Chance. Scroll down and select
the Red and Black Experiment (marked in red in the Applets Section.
Read the description since the scenario is slightly different but equiva-
lent to the description above.)

2. University of California, San Diego, Department of Mathematics, A.M.


Garsia A java applet that simulates how long it takes for a gambler to
go broke. You can control how much money you and the casino start
with, the house odds, and the maximum number of games. Results are
a graph and a summary table. Submitted by Matt Odell, September
8, 2003.

3. Eric Weisstein, World of Mathematics A good description of gambler’s


ruin, martingale and many other coin tossing and dice problems and
various probability problems Submitted by Yogesh Makkar, September
16th 2003.

3.3 Duration of the Gambler’s Ruin


Section Starter Question
Consider a gambler who wins or loses a dollar on each turn of a fair game
with probabilities p = 1/2 and q = 1/2 respectively. Let his initial capital be
$10. The game continues until the gambler’s capital either is reduced to 0 or
has increased to $20. What is the length of the shortest possible game the
gambler could play? What are the chances of this shortest possible game?
What is the length of the second shortest possible game? How would you
find the probability of this second shortest possible game occurring?
134CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

Understanding a Stochastic Process

We start with a sequence of Bernoulli random variables, Y1 , Y2 , Y3 , . . . where


Yi = +1 with probability p and Yi = −1 with probability q. We start
with an initial value T0Pand set Y0 = T0 for convenience. We define the
sequence of sums Tn = ni=0 Yi . We want to understand the stochastic pro-
cess T1 , T2 , T3 , . . .. It turns out this is a complicated sequence to understand
in full, so we single out particular simpler features to understand first. For
example, we can look at how many trials the process will experience until it
achieves the value 0 or a. In symbols, consider N = min{n : Tn = 0, or Tn =
a} It is possible to consider the probability distribution of this newly defined
random variable. Even this turns out to be complicated, so we look at the
expected value of the number of trials, D = E [N ]. This is a special case
of a larger class of probability problems called first-passage distributions for
first-passage times.
The principle of first-step analysis, also known as conditional expecta-
tions, provides equations for important properties of coin-flipping games and
random walks. The important properties include ruin probabilities and the
duration of the game until ruin. Difference equations derived from first-step
analysis or conditional expectations provide the way to deduce the expected
length of the game in the gambler’s ruin, just as for the probability of ruin
or victory. Expectation by conditioning is the process of deriving a dif-
ference equation for the expectation by conditioning the outcome over an
exhaustive, mutually exclusive set of events, each of which leads to a simpler
probability calculation, then weighting by the probability of each outcome of
the conditioning events. First Step Analysis is how J. Michael Steele refers
to the simple expectation by conditioning process that we use to analyze the
ruin probabilities and expected duration. It is a more specific description for
coin-tossing games of the more general technique of expectation by condi-
tioning.

Expected length of the game

Note that in the following we implicitly assume that the expected duration
of the game is finite. This fact is true, see below for a proof.

Theorem 2. The expected duration of the game in the classical ruin problem
3.3. DURATION OF THE GAMBLER’S RUIN 135

is
T0 a 1 − (q/p)T0
DT0 = − for p 6= q
q − p q − p 1 − (q/p)a
and
T0 (a − T0 ) for p = 1/2 = q.
Proof. If the first trial results in success, the game continues as if the initial
position had been T0 + 1. The conditional expectation of the duration con-
ditioned on success at the first trial is therefore DT0 +1 + 1. Likewise if the
first trial results in a loss, the duration conditioned on the loss at the first
trial is DT0 −1 + 1.
This argument shows that the expected duration satisfies the difference
equation, obtained by expectation by conditioning

DT0 = pDT0 +1 + qDT0 −1 + 1

with the boundary conditions

D0 = 0, Da = 0.

The appearance of the term 1 makes the difference equation non-homogeneous.


Taking a cue from linear algebra, or more specifically the theory of linear non-
homogeneous differential equations, we need to find the general solution to
the homogeneous equation

DTh0 = pDTh0 +1 + qDTh0 −1

and a particular solution to the non-homogeneous equation. We already know


the general solution to the homogeneous equation is DTh0 = A + B(q/p)T0 .
The best way to find the particular solution is inspired guessing, based on
good experience. We can re-write the non-homogeneous equation for the
particular solution as

−1 = pDT0 +1 − DT0 + qDT0 −1 .

The right side is a weighted second difference, a difference equation analog


of the second derivative. Functions whose second derivative is a constant are
quadratic functions. Therefore, it make sense to try a function of the form
DTp0 = k + lT0 + mT02 . In the exercises, we show that the particular solution
is actually DT0 = T0 /(q − p) if p 6= q.
136CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

It follows that the general solution of the duration equation is:

DT0 = T0 /(q − p) + A + B(q/p)T0 .

The boundary conditions require that

A+B =0

and

A + B(q/p)a + a/(q − p) = 0.

Solving for A and B, we find

T0 a 1 − (q/p)T0
DT0 = − .
q − p q − p 1 − (q/p)a

The calculations are not valid if p = 1/2 = q. In this case, the particular
solution T0 /(q − p) no longer makes sense for the equation
1 1
DT0 = DT0 +1 + DT0 −1 + 1
2 2
The reasoning about the particular solution remains the same however, and
we can show that the particular solution is −T0 2 . It follows that the general
solution is of the form DT0 = −T0 2 +A+BT0 . The required solution satisfying
the boundary conditions is

DT0 = T0 (a − T0 ).

Corollary 4. Playing until ruin with no upper goal for victory against an
infinitely rich adversary, the expected duration of the game until ruin is

T0 /(q − p) for p 6= q

and
∞ for p = 1/2 = q.

Proof. Pass to the limit a → ∞ in the preceding formulas.


3.3. DURATION OF THE GAMBLER’S RUIN 137

Illustration 1
The duration can be considerably longer than we expect naively. For instance
in a fair game, with two players with $500 each flipping a coin until one is
ruined, the average duration of the game is 250,000 trials. If a gambler has
only $1 and his adversary $1000, with a fair coin toss, the average duration
of the game is 999 trials, although some games will be quite short! Very long
games can occur with sufficient probability to give a long average.

Some Calculations for Illustration


p q T0 a
Probability Expected
of Ruin Duration
0.5 0.5 9 10 0.1000 9
0.5 0.5 90 100 0.1000 900
0.5 0.5 900 1,000 0.1000 90,000
0.5 0.5 950 1,000 0.0500 47,500
0.5 0.5 8,000 10,000 0.2000 16,000,000
0.45 0.55 9 10 0.2101 11
0.45 0.55 90 100 0.8656 766
0.45 0.55 99 100 0.1818 172
0.4 0.6 90 100 0.9827 441
0.4 0.6 99 100 0.3333 162

Proof that the duration is finite


The following discussion of finiteness of the duration of the game is adapted
from [67] by J. Michael Steele.
When we check the arguments for the probability of ruin or the duration
of the game, we find a logical gap. We have assumed that the duration DT0 of
the game is finite. How do we know for sure that the gambler’s net winnings
will eventually reach a or 0? This important fact requires proof.
The proof uses a common argument in probability, an “extreme case argu-
ment”. We identify an “extreme” event with a small but positive probability
of occurring. We are interested in the complementary “good” event which
at least avoids the extreme event. Therefore the complementary event must
happen with probability not quite 1. The avoidance must happen infinitely
many independent times, but the probability of such a run of “good” events
must go to zero.
138CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

For the gambler’s ruin, we are interested in the event of the game con-
tinuing forever. Consider the extreme event that the gambler wins a times
in a row. If the gambler is not already ruined (at 0), then such a streak of a
wins in a row is guaranteed to boost his fortune above a and end the game
in victory for the gambler. Such a run of luck is unlikely, but it has positive
probability, in fact, probability P = pa . We let Ek denote the event that
the gambler wins on each turn in the time interval [ka, (k + 1)a − 1], so the
Ek are independent events. Hence the complementary events EkC = Ω − Ek
are also independent. Then D > na at least implies that all of the Ek with
0 ≤ k ≤ n fail to occur. Thus, we find
" n #
\
P [DT0 > na] ≤ P EkC = (1 − P )n .
k=0

Note that
P [DT0 = ∞ | T0 = z] ≤ P [D > na | T0 = z]
for all n. Hence, P [DT0 = ∞] = 0, justifying our earlier assumption.

Sources
This section is adapted from [67] with additional background information
from [19].

Algorithms, Scripts, Simulations


Algorithm
The goal is to simulate the duration until ruin or victory as a function of
starting value. First set the probability p, number of Bernoulli trials n,
and number of experiments k. Set the ruin and victory values r and v,
also interpreted as the boundaries for the random walk. For each starting
value from ruin to victory, fill an n × k matrix with the Bernoulli random
variables. Languages with multi-dimensional arrays keep the data in a three-
dimensional array of size n × k × (v − r + 1). Cumulatively sum the Bernoulli
random variables to create the fortune or random walk. For each starting
value, for each random walk or fortune path, find the duration until ruin or
victory. For each starting value, find the mean of the duration until ruin
or victory. Finally, find a least squares polynomial fit for the duration as a
function of the starting value.
3.3. DURATION OF THE GAMBLER’S RUIN 139

Geogebra GeoGebra script for duration.

R R script for duration.


1 p <- 0.5
2 n <- 300
3 k <- 200
4

5 victory <- 10
6 # top boundary for random walk
7 ruin <- 0
8 # bottom boundary for random walk
9 interval <- victory - ruin + 1
10

11 winLose <- 2 * ( array ( 0+( runif ( n * k * interval ) <= p ) , dim =


c (n ,k ,
12 interval ) ) ) - 1
13 # 0+ coerces Boolean to numeric
14 totals <- apply ( winLose , 2:3 , cumsum )
15 # the second argument ‘ ‘2:3 ’ ’ means column - wise in each
panel
16 start <- outer ( array (1 , dim = c ( n +1 , k ) ) , ruin : victory , " * "
)
17
18 paths <- array ( 0 , dim = c ( n +1 , k , interval ) )
19 paths [2:( n +1) , 1: k , 1: interval ] <- totals
20 paths <- paths + start
21
22 hitVictory <- apply ( paths , 2:3 , ( function ( x ) match ( victory
,x , nomatch = n +2) ) ) ;
23 hitRuin <- apply ( paths , 2:3 , ( function ( x ) match ( ruin ,
x , nomatch = n +2) ) ) ;
24 # the second argument ‘ ‘2:3 ’ ’ means column - wise in each
panel
25 # If no ruin or victory on a walk , nomatch = n +2 sets the
hitting
26 # time to be two more than the number of steps , one more
than
27 # the column length . Without the nomatch option , get NA
which
28 # works poorly with the comparison hitRuin < hitVictory
next .
29
30 duration <- pmin ( hitVictory , hitRuin ) - 1
31 # Subtract 1 since R arrays are 1 - based , so duration is 1
less than index
140CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

32 is . na ( duration ) = duration > n


33 # Remove durations greater than length of trials
34 meanDuration = colMeans ( duration , na . rm = TRUE )
35
36 startValues <- ( ruin : victory ) ;
37 durationFunction <- lm ( meanDuration ~ poly ( startValues
,2 , raw = TRUE ) )
38 # lm is the R function for linear models , a more general
view of
39 # least squares linear fitting for response ~ terms
40
41 plot ( startValues , meanDuration , col = " blue " ) ;
42 lines ( startValues , predict ( durationFunction , data =
startValues ) , col = " red " )
43
44 cat ( sprintf ( " Duration function is : % f + % f x + % f x ^2 \ n
",
45 coefficients ( durationFunction ) [1] , coefficients (
durationFunction ) [2] ,
46 coefficients ( durationFunction ) [3] ) )
47
48

Octave Octave script for ruin probabilities


1 p = 0.5;
2 n = 300;
3 k = 200;
4
5 victory = 10;
6 # top boundary for random walk
7 ruin = 0;
8 # bottom boundary for random walk
9
10 p r o b R u i n B e f o r e V i c t o r y = zeros (1 , victory - ruin +1) ;
11 for start = ruin : victory
12
13 winLose = 2 * ( rand (n , k ) <= p ) - 1;
14 # -1 for Tails , 1 for Heads
15 totals = cumsum ( winLose ) ;
16 # -n .. n ( every other integer ) binomial rv sample
17

18 paths = [ zeros (1 , k ) ; totals ] + start ;


19 victoryOrRuin = zeros (1 , k ) ;
3.3. DURATION OF THE GAMBLER’S RUIN 141

20 for j = 1: k
21 hitVictory = find ( paths (: , j ) >= victory ) ;
22 hitRuin = find ( paths (: , j ) <= ruin ) ;
23 if ( ! rows ( hitVictory ) && ! rows ( hitRuin ) )
24 # no victory , no ruin
25 # do nothing
26 elseif ( rows ( hitVictory ) && ! rows ( hitRuin ) )
27 # victory , no ruin
28 victoryOrRuin ( j ) = hitVictory (1) -1;
29 ## subtract 1 since vectors are 1 - based
30 elseif ( ! rows ( hitVictory ) && rows ( hitRuin ) )
31 # no victory , but hit ruin
32 victoryOrRuin ( j ) = -( hitRuin (1) -1) ;
33 ## subtract 1 since vectors are 1 - based
34 else # ( rows ( hitvictory ) && rows ( hitruin ) )
35 # victory and ruin
36 if ( hitVictory (1) < hitRuin (1) )
37 victoryOrRuin ( j ) = hitVictory (1) -1;
38 # code hitting victory
39 ## subtract 1 since vectors are 1 - based
40 else
41 victoryOrRuin ( j ) = -( hitRuin (1) -1) ;
42 # code hitting ruin as negative
43 ## subtract 1 since vectors are 1 - based
44 endif
45 endif
46 endfor
47
48 d u r a t i o n U n t i l V i c t o r y O r R u i n ( start + ( - ruin +1) ) = mean (
abs ( victoryOrRuin ) ) ;
49
50 endfor
51
52 durationFunction = polyfit ([ ruin : victory ] ,
durationUntilVictoryOrRuin , \
53 2) ;
54
55 plot ([ ruin : victory ] , durationUntilVictoryOrRuin , ’+ r ’) ;
56 hold on ;
57
58 x = linspace ( ruin , victory , 101) ;
59 fittedDuration = polyval ( durationFunction , x ) ;
60 plot (x , fittedDuration , ’ - ’) ;
61 hold off ;
62
142CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

63 disp ( " Duration function is a_2 + a_1 x + a_0 x ^2 where : " )


64 disp ( " a_2 " ) , disp ( durationFunction (3) ) ,
65 disp ( " a_1 " ) , disp ( durationFunction (2) ) ,
66 disp ( " a_0 " ) , disp ( durationFunction (1) )
67
68

Perl Perl PDL script for ruin probabilities


1 use PDL :: NiceSlice ;
2

3 $p = 0.5;
4 $n = 300;
5 $k = 200;
6 $victory = 10;
7 $ruin = 0;
8 $interval = $victory - $ruin + 1;
9 $winLose = 2 * ( random ( $k , $n , $interval ) <= $p ) -
1;
10 $totals = ( cumusumover $winLose - > xchg ( 0 , 1 ) ) ->
transpose ;
11 $start = zeroes ( $k , $n + 1 , $interval ) -> zlinvals (
$ruin , $victory ) ;
12
13 $paths = zeroes ( $k , $n + 1 , $interval ) ;
14
15 # use PDL : NiceSlice on next line
16 # Note the use of the concat operator here .
17 $paths ( 0 : ( $k - 1 ) , 1 : $n , 0 : ( $interval - 1 ) )
.= $totals ;
18
19 $paths = $paths + $start ;
20 $hitVictory = $paths - > setbadif ( $paths < $victory ) ;
21 $hitRuin = $paths - > setbadif ( $paths > $ruin ) ;
22

23 $victoryIndex =
24 ( $hitVictory ( ,, : ) -> xchg ( 0 , 1 ) -> minimum_ind )
25 -> inplace - > setbadtoval ( $n + 1 ) ;
26 $ruinIndex =
27 ( $hitRuin ( ,, : ) -> xchg ( 0 , 1 ) -> maximum_ind )
28 -> inplace - > setbadtoval ( $n + 1 ) ;
29
30 $durationUntilRuinOrVictory =
3.3. DURATION OF THE GAMBLER’S RUIN 143

31 ( $victoryIndex - > glue ( 2 , $ruinIndex ) -> xchg ( 2 , 1 )


) -> xchg ( 0 , 1 )
32 -> setvaltobad ( $n + 1 ) -> minimum ;
33 ( $mean , $prms , $median , $min , $max , $adev , $rms ) =
34 statsover ( $ d u r a t i o n U n t i l R u i n O r V i c t o r y ) ;
35
36 use PDL :: Fit :: Polynomial ;
37 $x = zeroes ( $interval ) -> xlinvals ( $ruin , $victory ) ;
38 ( $ruinFunction , $coeffs ) = fitpoly1d $x , $mean , 3;
39 print " Duration function is : " , $coeffs (0) , " + " , $coeffs
(1) , " x + " ,
40 $coeffs (2) , " x ^2 " , " \ n " ;
41

SciPy Scientific Python script for ruin probabilities


1 import scipy
2

3 p = 0.5
4 n = 300
5 k = 200
6 victory = 10;
7 ruin = 0;
8 interval = victory - ruin + 1
9
10 winLose = 2*( scipy . random . random (( n ,k , interval ) ) <= p )
- 1
11 totals = scipy . cumsum ( winLose , axis = 0)
12
13 start = scipy . multiply . outer ( scipy . ones (( n +1 , k ) , dtype =
int ) , scipy . arange ( ruin , victory +1 , dtype = int ) )
14 paths = scipy . zeros (( n +1 ,k , interval ) , dtype = int )
15 paths [ 1: n +1 , : ,:] = totals
16 paths = paths + start
17
18 def match (a ,b , nomatch = None ) :
19 return b . index ( a ) if a in b else nomatch
20 # arguments : a is a scalar , b is a python list , value of
nomatch is scalar
21 # returns the position of first match of its first
argument in its second argument
22 # but if a is not there , returns the value nomatch
23 # modeled on the R function " match " , but with less
generality
144CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

24
25 hitVictory = scipy . apply_along_axis ( lambda x :( match (
victory , x . tolist () , nomatch = n +2) ) , 0 , paths )
26 hitRuin = scipy . apply_along_axis ( lambda x : match ( ruin , x .
tolist () , nomatch = n +2) , 0 , paths )
27 # If no ruin or victory on a walk , nomatch = n +2 sets the
hitting
28 # time to be two more than the number of steps , one more
than
29 # the column length .
30 d u r a t i o n U n t i l R u i n O r V i c t o r y = scipy . minimum ( hitVictory ,
hitRuin )
31
32 import numpy . ma
33 durationMasked = scipy . ma . masked_greater (
durationUntilRuinOrVictory , n )
34
35 meanDuration = scipy . mean ( durationUntilRuinOrVictory ,
axis = 0)
36 durationFunction = scipy . polyfit ( scipy . arange ( ruin ,
victory +1 , dtype = int ) , meanDuration , 2)
37 print " Duration function is : " , durationFunction [2] , " + " ,
durationFunction [1] , " x + " , durationFunction [0] , " x ^2 "
38 # should return coefficients to (x - ruin ) *( victory - x ) ,
descending degree order
39

Key Concepts
1. The principle of first-step analysis, also known as conditional expec-
tations, provides equations for important properties of coin-flipping
games and random walks. The important properties include ruin prob-
abilities and the duration of the game until ruin.

2. Difference equations derived from first-step analysis or conditional ex-


pectations provide the way to deduce the expected length of the game
in the gambler’s ruin, just as for the probability of ruin or victory.
3.3. DURATION OF THE GAMBLER’S RUIN 145

Vocabulary
1. Expectation by conditioning is the process of deriving a difference
equation for the expectation by conditioning the outcome over an ex-
haustive, mutually exclusive set of events, each of which leads to a
simpler probability calculation, then weighting by the probability of
each outcome of the conditioning events.

2. First Step Analysis is how J. Michael Steele refers to the simple


expectation by conditioning process that we use to analyze the ruin
probabilities and expected duration. It is a more specific description
for coin-tossing games of the more general technique of expectation by
conditioning.

Problems to Work for Understanding


1. (a) Using a trial function of the form DTp0 = k + lT0 + mT02 , show that
a particular solution of the non-homogeneous equation

DT0 = pDT0 +1 + qDT0 −1 + 1

is T0 /(q − p).
(b) Using a trial function of the form DTp0 = k + lT0 + mT02 , show that
a particular solution of the non-homogeneous equation
1 1
DT0 = DT0 +1 + DT0 −1 + 1
2 2
is −T02 .

2. A gambler starts with $2 and wants to win $2 more to get to a total of


$4 before being ruined by losing all his money. He plays a coin-flipping
game, with a coin that changes with his fortune.

(a) If the gambler has $2 he plays with a coin that gives probability
p = 1/2 of winning a dollar and probability q = 1/2 of losing a
dollar.
(b) If the gambler has $3 he plays with a coin that gives probability
p = 1/4 of winning a dollar and probability q = 3/4 of losing a
dollar.
146CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

(c) If the gambler has $1 he plays with a coin that gives probability
p = 3/4 of winning a dollar and probability q = 1/4 of losing a
dollar.
Use “first step analysis” to write three equations in three unknowns
(with two additional boundary conditions) that give the expected du-
ration of the game that the gambler plays. Solve the equations to find
the expected duration.
3. A gambler plays a coin flipping game in which the probability of win-
ning on a flip is p = 0.4 and the probability of losing on a flip is
q = 1 − p = 0.6. The gambler wants to reach the victory level of $16
before being ruined with a fortune of $0. The gambler starts with $8,
bets $2 on each flip when the fortune is $6, $8, $10 and bets $4 when
the fortune is $4 or $12. Compute the probability of ruin in this game.
4. This problem is adapted from Stochastic Calculus and Financial Ap-
plications by J. Michael Steele, Springer, New York, 2001, Chapter 1,
Section 1.6, page 9. Information on buy-backs is adapted from investor-
words.com. This problem suggests how results on biased random walks
can be worked into more realistic models.
Consider a naive model for a stock that has a support level of $20/share
because of a corporate buy-back program. (This means the company
will buy back stock if shares dip below $20 per share. In the case
of stocks, this reduces the number of shares outstanding, giving each
remaining shareholder a larger percentage ownership of the company.
This is usually considered a sign that the company’s management is
optimistic about the future and believes that the current share price is
undervalued. Reasons for buy-backs include putting unused cash to use,
raising earnings per share, increasing internal control of the company,
and obtaining stock for employee stock option plans or pension plans.)
Suppose also that the stock price moves randomly with a downward
bias when the price is above $20, and randomly with an upward bias
when the price is below $20. To make the problem concrete, we let
Yn denote the stock price at time n, and we express our stock support
hypothesis by the assumptions that
P [Yn+1 = 21|Yn = 20] = 9/10
P [Yn+1 = 19|Yn = 20] = 1/10
3.3. DURATION OF THE GAMBLER’S RUIN 147

We then reflect the downward bias at price levels above $20 by requiring
that for k > 20:

P [Yn+1 = k + 1|Yn = k] = 1/3


P [Yn+1 = k − 1|Yn = k] = 2/3.

We then reflect the upward bias at price levels below $20 by requiring
that for k < 20:

P [Yn+1 = k + 1|Yn = k] = 2/3


P [Yn+1 = k − 1|Yn = k] = 1/3

Using the methods of “single-step analysis” calculate the expected time


for the stock to fall from $25 through the support level all the way
down to $18. (There is no reasonable way to solve this problem using
formulas. Instead you will have to go back to basic principles of single-
step or first-step analysis to solve the problem.)

5. Perform some simulations of the coin-flipping game, varying p and the


start value. How does the value of p affect the experimental duration
of victory and ruin?

6. Modify the simulations by changing the value of p and comparing the


experimental results for each starting value to the theoretical duration
function.

7. Modify the duration scripts to perform simulations of the duration cal-


culations in the table in the section Some Calculations for Illustration
and compare the results.

Outside Readings and Links:


1. Virtual Labs in Probability Games of Chance. Scroll down and select
the Red and Black Experiment (marked in red in the Applets Section.
Read the description since the scenario is slightly different but equiva-
lent to the description above.)

2. University of California, San Diego, Department of Mathematics, A.M.


Garsia A java applet that simulates how long it takes for a gambler to
148CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

go broke. You can control how much money you and the casino start
with, the house odds, and the maximum number of games. Results are
a graph and a summary table. Submitted by Matt Odell, September
8, 2003.

3.4 A Stochastic Process Model of Cash Man-


agement
Section Starter Question
Suppose that you have a stock of 5 units of a product. It costs you r dollars
per unit of product to hold the product for a week. You sell and eliminate
from the stock one unit of product per week. What is the total cost of
holding the product? Now suppose that the amount of product sold is 0 or
1 each week, determined by a coin-tossing game. How would you calculate
the expected cost of holding the product?

Background
The reserve requirement is a bank regulation that sets the minimum re-
serves of cash a bank must hold on hand for customer deposits. This is also
called the Federal Reserve requirement or the reserve ratio. These re-
serves exist so banks can satisfy cash withdrawal demands. The reserves also
help regulate the national money supply. Specifically in 2016 the Federal Re-
serve regulations require that the first $15.2 million are exempt from reserve
requirements. A 3 percent reserve ratio applies to net transaction accounts
(a net total of certain account types defined by the Federal Reserve) over
$15.2 million up to and including $110.2 million. A 10 percent reserve ratio
applies to net transaction accounts in excess of $110.2 million. The Federal
Reserve adjusts these amounts from time to time.
Of course, bank customers are frequently depositing and withdrawing
money so the amount of money for the reserve requirement is constantly
changing. If customers deposit more money, the cash on hand exceeds the
reserve requirement. The bank would like to put the excess cash to work,
perhaps by buying Treasury bills. If customers withdraw cash, the available
cash can fall below the required amount to cover the reserve requirement so
the bank gets more cash, perhaps by selling Treasury bills.
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT149

The bank has a dilemma: buying and selling the Treasury bills has a
transaction cost, so the bank does not want to buy and sell too often. On
the other hand, the bank could put excess cash to use by loaning it out, and
so the bank does not want to have too much cash idle. What is the optimal
level of cash that signals a time to buy, and how much should the bank buy
or sell?

Modeling

We assume for a simple model that a bank’s cash level fluctuates randomly as
a result of many small deposits and withdrawals. We model this by dividing
time into successive, equal length periods, each of short duration. The peri-
ods might be weekly, the reporting period the Federal Reserve Bank requires
for some banks. In each time period, assume the reserve randomly increases
or decreases one unit of cash, perhaps measured in units of $100,000, each
with probability 1/2. That is, in period n, the change in the bank’s reserves
is
(
+1 with probability 1/2
Yn =
−1 with probability 1/2.

The equal probability assumption simplifies calculations for this model. It is


possible to relax the assumption to the case p 6= q, but we will not do this
here.
Let T0 = s be the initial cash on hand. Then Tn = T0 + nj=1 Yj is the
P
total cash on hand at period n.
The bank will intervene if the reserve gets too small or too large. Again
for simple modeling, if the reserve level drops to zero, the bank sells assets
such as Treasury bonds to replenish the reserve back up to s. If the cash level
ever increases to S, the bank buys Treasury bonds to reduce the reserves to
s. What we have modeled here is a version of the Gambler’s Ruin, except
that when this “game” reaches the “ruin” or “victory” boundaries, 0 or S
respectively, the “game” immediately restarts again at s.
Now the cash level fluctuates in a sequence of cycles or games. Each cycle
begins with s units of cash on hand and ends with either a replenishment of
cash, or a reduction of cash. See Figure 3.3 for a simple example with s = 2
and S = 5.
150CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

Tn

6
S
4

s 2

0
0 5 10 15 20
Cycle 1 Cycle 2 Cycle 3 n

Figure 3.3: Several typical cycles in a model of the reserve requirement.

Mean number of visits to a particular state


Now let k be one of the possible reserve states with 0 < k < S and let Wsk
be the expected number of visits to the level k up to the ending time of the
cycle starting from s. A formal mathematical expression for this expression
is "N −1 #
X
Wsk = E 1{Tj =k}
j=1

where 1{Tj =k} is the indicator random variable where


(
1 Tj = k
1{Tj =k} =
0 Tj 6= k.

Note that the inner sum is a random sum, since it depends on the length of
the cycle N , which is cycle dependent.
Then using first-step analysis Wsk satisfies the equations
1 1
Wsk = δsk + Ws−1,k + Ws+1,k
2 2
with boundary conditions W0k = WSk = 0. The term δsk is the Kronecker
delta (
1 if k = s
δsk =
6 s.
0 if k =
The explanation of this equation is very similar to the derivation of the
equation for the expected duration of the coin-tossing game. The terms
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT151

1
2
Ws−1,k + 12 Ws+1,k arise from the standard first-step analysis or expectation-
by-conditioning argument for Wsk . The non-homogeneous term in the prior
expected duration equation (which is +1) arises because the game will always
be at least 1 step longer after the first step. In the current equation, the δsk
non-homogeneous term arises because the number of visits to level k after
the first step will be 1 more if k = s but the number of visits to level k after
the first step will be 0 more if k 6= s.
For the ruin probabilities, the difference equation was homogeneous, and
we only needed to find the general solution. For the expected duration,
the difference equation was non-homogeneous with a non-homogeneous term
which was the constant 1, making the particular solution reasonably easy to
find. Now the non-homogeneous term depends on the independent variable,
so solving for the particular solution will be more involved.
h
First we find the general solution Wsk to the homogeneous linear difference
equation
h 1 h 1 h
Wsk = Ws−1,k + Ws+1,k .
2 2
h
This is easy, we already know that it is Wsk = A + Bs.
p
Then we must find a particular solution Wsk to the non-homogeneous
equation
p 1 p 1 p
Wsk = δsk + Ws−1,k + Ws+1,k .
2 2
For purposes of guessing a plausible particular solution, temporarily re-write
the equation as
p p p
−2δsk = Ws−1,k − 2Wsk + Ws+1,k .

The expression on the right is a centered second difference. For the prior
expected duration equation, we looked for a particular solution with a con-
stant centered second difference. Based on our experience with functions it
made sense to guess a particular solution of the form C + Ds + Es2 and then
substitute to find the coefficients. Here we seek a function whose centered
second difference is 0 except at k where the second difference jumps to 1.
This suggests the particular solution is piecewise linear, say
(
p C + Ds if s ≤ k
Wsk =
E + Fs if s > k.
152CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

In the exercises, we verify that the coefficients of the function are


(
p 0 if s < k
Wsk =
2(k − s) if s ≥ k.
p
We can write this as Wsk = −2 max(s − k, 0)
Then solving for the boundary conditions, the full solution is

Wsk = 2 [s(1 − k/S) − max(s − k, 0)] .

Expected Duration and Expected Total Cash in a Cycle


Consider the first passage time N when the reserves first reach 0 or S, so
that cycle ends and the bank intervenes to change the cash reserves. The
value of N is a random variable, it depends on the sample path. We are
first interested in Ds = E [N ], the expected duration of a cycle. From the
previous section we already know Ds = s(S − s).
Next, we need the mean cost of holding cash on hand during a cycle i,
starting from amount s. Call this mean Ws . Let r be the cost per unit of
cash, per unit of time. We then obtain the cost by weighting Wsk , the mean
number of times the cash is at number of units k starting from s, multiplying
by k, multiplying by the factor r and summing over all the available amounts
of cash:
S−1
X
Ws = rkWsk
k=1
" S−1 s−1
#
sX X
=2 rk(S − k) − rk(s − k)
S k=1 k=1
s rS(S − 1)(S + 1) rs(s − 1)(s + 1)
   
=2 −
S 6 6
s 2
= r S − s2 .

3
These results are interesting and useful in their own right as estimates of
the length of a cycle and the expected cost of cash on hand during a cycle.
Now we use these results to evaluate the long run behavior of the cycles.
Upon resetting the cash at hand to s when the amount of cash reaches 0
or S, the cycles are independent of each of the other cycles because of the
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT153

assumption of independence of each step. Let K be the fixed cost of the


buying or selling of the treasury bonds to start the cycle, let Ni be the
random length of the cycle i, and let Ri be the total cost of holding cash
on hand during cycle i. Then the cost over n cycles is nK + R1 + · · · + Rn .
Divide by n to find the average cost

Expected total cost in cycle i = K + E [Ri ] ,

but we have another expression for the expectation E [Ri ],


s 2
Expected cost = E [Ri ] = r S − s2 .

3
Likewise the total length of n cycles is N1 + · · · + Nn . Divide by n to find
the average length,

N1 + · · · + Nn
Expected length = = s(S − s).
n
These expected values allow us to calculate the average costs

K + E [Ri ]
Long run average cost, dollars per week = .
E [Ni ]

Then E [Ri ] = Ws and E [Ni ] = s(S − s). Therefore

K + (1/3)rs(S 2 − s2 )
Long run average cost, dollars per week = .
s(S − s)

Simplify the analysis by setting x = s/S so that the expression of interest is

K + (1/3)rS 3 x(1 − x2 )
Long run average cost = .
S 2 x(1 − x)

Remark. Aside from being a good thing to non-dimensionalize the model


as much as possible, it also appears that optimizing the original long run
cost average in the original variables S and s is messy and difficult. This
of course would not be known until you had tried it. However, knowing the
optimization is difficult in variables s and S additionally motivates making
the transformation to the non-dimensional ratio x = s/S.
154CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

Now we have a function in two variables that we wish to optimize. Take


the partial derivatives with respect to x and S and set them equal to 0, then
solve, to find the critical points.
The results are that

1
xopt =
3
  13
3K
Sopt = 3 .
4r

That is, the optimal value of the maximum amount of cash to keep varies as
the cube root of the cost ratios, and the reset amount of cash is 1/3 of that
amount.

Criticism of the model

The first test of the model would be to look at the amounts S and s for well-
managed banks and determine if the banks are using optimal values. That
is, one could do a statistical survey of well-managed banks and determine
if the values of S vary as the cube root of the cost ratio, and if the restart
value is 1/3 of that amount. Of course, this assumes that the model is valid
and that banks are following the predictions of the model, either consciously
or not.
This model is too simple and we could modify in a number of ways. One
change might be to change the reserve requirements to vary with the level
of deposits, just as the 2010 Federal Reserve requirements vary. Adding
additional reserve requirement levels to the current model adds a level of
complexity, but does not substantially change the level of mathematics in-
volved.
The most important change would be to allow the changes in deposits
to have a continuous distribution instead of jumping up or down by one
unit in each time interval. Modification to continuous time would make the
model more realistic instead of changing the cash at discrete time intervals.
The assumption of statistical independence from time step to time step is
questionable, and so could also be relaxed. All these changes require deeper
analysis and more sophisticated stochastic processes.
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT155

Sources
This section is adapted from: Section 6.1.3 and 6.2, pages 157-164 in An
Introduction to Stochastic Modeling, [68].

Algorithms, Scripts, Simulations


Set the top boundary state value and the start and reset state value. Set the
probability of a transition of an interior state to the next higher state. Set
the number of steps in the Markov chain. Create the Markov chain transition
probability matrix. For this Markov chain, the transition probability matrix
is tridiagonal, with 0 on the main diagonal, p on the upper diagonal and 1−p
on the lower diagonal. For the boundary states, the transition probability is
1 to the start or reset state.
Initialize the vector holding the number of visits to each state, the number
of cycles from start to reset, and the length of each cycle. For each transi-
tion, choose a random value u chosen from a uniform distribution on (0, 1).
Starting from an initialized cumulative probability of 0, compute the cumu-
lative probability of the current state’s transition probability distribution.
Compare the cumulative probability to u until the cumulative probability
exceeds u. This is the new state. Update the number of visits to each state,
the number of cycles from start to reset, and the length of each cycle and
at the end of a cycle compute the average number of visit and the average
length of the cycle. Print the average number of visits, and compare to the
theoretical number of visits, Or for cash management, compute the actual
cash management cost and the theoretical cash management value.

Markov Chain Algorithm


Geogebra GeoGebra script for a markov chain

R R script for markov chain.


1 n <- 10 # Top boundary , number of states 0.. n is n +1
2 s <- 5 # Start and Reset state number 1 <= s <= n -1
3 p <- 1 / 2
4 steps <- 1000
5
6 diag . num <- outer ( seq (1 , n +1) , seq (1 , n +1) , " -" )
7 # diag . num is a matrix whose ith lower diagonal equals i ,
opposite for upper diagonal
156CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

8 T <- mat . or . vec ( n +1 , n +1)


9 # mat . or . vec creates an nr by nc zero matrix if nc is
greater than 1
10 # Also remember that matrices in R are 1 - based , so need n
+1 states , 0.. n
11 T [ diag . num == -1] <- p
12 T [ diag . num == 1] <- 1 - p
13 T [1 ,2] <- 0; T [1 , s +1] <- 1;
14 T [ n +1 , n ] <- 0; T [ n +1 , s +1] <- 1;
15
16 # vector to hold the count of visits to each state during
a cycle
17 count <- mat . or . vec (1 , n +1)
18 # Initialize the number of cycles
19 numberCycles <- 0
20 # Initialize the length of the cycle
21 cycleLength <- 0
22 # Start in the state s
23 state = s +1
24

25 # Make steps through the markov chain


26 for ( i in 1: steps )
27 {
28 x = 0;
29 u = runif (1 , 0 , 1) ;
30

31
32 newState = state ;
33 for ( j in 1: ncol ( T ) )
34 {
35 x = x + T [ state , j ];
36 if ( x >= u )
37 {
38 newState = j ;
39 break ;
40 }
41 }
42 # # newState <- sample (1: ncol ( T ) , 1 , prob = T [ state ,])
43 state = newState ;
44 count [ state ] <- count [ state ] + 1
45 cycleLength <- cycleLength + 1
46
47 if ( state == n +1 || state == 1) {
48 numberCycles <- numberCycles + 1
49 avgVisits <- count / numberCycles
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT157

50 avgCycleLength <- i / numberCycles


51 }
52 }
53
54 Wsk <- avgVisits
55 theoreticalWsk <- 2 * ( s * (1 -(0: n ) / n ) - pmax ( s - (0: n ) ,0)
);
56

57 cat ( sprintf ( " Average number of visits to each state in a


cycle : \ n " ) )
58 cat ( Wsk )
59 cat ( " \ n \ n " )
60 cat ( sprintf ( " Theoretical number of visits to each state
in a cycle : \ n " ) )
61 cat ( theoreticalWsk )
62 cat ( " \ n " )
63

Octave Octave script for markov chain


1 n = 10; # Top boundary , number of states 0.. n is n +1
2 s = 5; # Start and Reset state number 1 <= s <= n -1
3 p = 1/2;
4 steps = 1000;
5 rate = 1.0;
6 K = 2; # Charge or cost to reset the Markov chain
7
8 T = diag ( p * ones (1 , n ) , 1) + diag ( (1 - p ) * ones (1 , n ) , -1) ;
9 T (1 ,2) = 0; T (1 , s +1) = 1;
10 T ( n +1 , n ) = 0; T ( n +1 , s +1) = 1;
11
12 # vector to hold the count of visits to each state during
a cycle
13 count = zeros (1 , n +1) ;
14 # Initialize the cyclelength
15 numberCycles = 0;
16 # Start in the state s
17 state = s +1;
18
19 # Make steps through the markov chain
20 for i = 1: steps
21 x = 0;
22 u = rand (1 , 1) ;
23
158CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

24 newState = state ;
25 for j = 1: n +1
26 x = x + T ( state , j ) ;
27 if ( x >= u )
28 newState = j ;
29 break ;
30 endif
31 endfor
32 ## newState = sample (1: ncol ( T ) , 1 , prob = T [ state ,])
33 state = newState ;
34 count ( state ) = count ( state ) + 1;
35
36 if ( state == n +1 || state == 1)
37 numberCycles = numberCycles + 1;
38 avgVisits = count / numberCycles ;
39 avgCycleLength = i / numberCycles ;
40 endif
41 endfor
42
43 disp ( " Average number of visits to each state in a cycle : "
)
44 Wsk = avgVisits
45 disp ( " Theoretical number of visits to each state in a
cycle " )
46 theoreticalWsk = 2*( s *(1 -(0: n ) / n ) - max ( s - (0: n ) ,
zeros (1 , n +1) ) )
47

Perl Perl PDL script for markov chain


1 use PDL :: NiceSlice ;
2
3 $n = 10; # Top boundary , number of states 0.. n
is n +1
4 $s = 5; # Start and Reset state number 1 <= s
<= n -1
5 $p = 1 / 2;
6 $steps = 1000;
7
8 $T = zeroes ( $n + 1 , $n + 1 ) ;
9 $T ( $s , 0 ) .= 1; # note order of indices , note
concat operation
10 $T ( $s , $n ) .= 1;
11 for ( $i = 1; $i <= $n - 1; $i ++ ) {
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT159

12 $T ( $i + 1 , $i ) .= $p ;
13 $T ( $i - 1 , $i ) .= 1 - $p ;
14 }
15
16 # vector to hold the count of visits to each state during
a cycle
17 $count = zeroes ( $n + 1 ) ;
18

19 # Initialize the number of cycles


20 $numberCycles = 0;
21
22 # Start in the state s
23 $state = $s ;
24

25 # Make steps through the markov chain


26 for ( $i = 1; $i <= $steps ; $i ++ ) {
27 $x = 0;
28 $u = rand (1) ;
29
30 for ( $j = 0; $j <= $n ; $j ++ ) {
31 $x = $x + $T ( $j , $state ) ;
32
33 if ( $x >= $u ) {
34 $state = $j ;
35 last ;
36 }
37
38 }
39 $count ( $state ) ++;
40 if ( $state == $n || $state == 0 ) {
41 $numberCycles ++;
42 $avgVisits = $count / $numberCycles ;
43 $avgCycleLength = $i / $numberCycles ;
44 }
45 }
46
47 $Wsk = $avgVisits ;
48 $theoreticalWsk = 2 * (
49 $s * ( 1 - sequence ( $n + 1 ) / $n ) - maximum (
50 ( pdl ( [ $s - sequence ( $n + 1 ) , zeroes ( $n ) ] )
) -> xchg ( 0 , 1 )
51 )
52 );
53

54 print " Average number of visits to each state in a cycle


160CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

:\ n " , $Wsk , " \ n " ;


55 print " Theoretical number of visits to each state in a
cycle : \ n " ,
56 $theoreticalWsk , " \ n " ;
57

SciPy Scientific Python script for markov chain


1 import scipy
2
3 n = 10; # Top boundary , number of states 0.. n is n +1
4 s = 5; # Start and Reset state number 1 <= s <= n -1
5 p = 0.5;
6 steps = 1000;
7
8 T = scipy . diag ( p * scipy . ones ( n ) , 1) + scipy . diag ( (1 - p )
* scipy . ones ( n ) , -1) ;
9 T [0 ,1] = 0; T [0 , s ] = 1;
10 T [n ,n -1] = 0; T [n , s ] = 1;
11
12 # vector to hold the count of visits to each state during
a cycle
13 count = scipy . zeros ( n +1 , float ) ;
14 # Initialize the cyclelength
15 numberCycles = 0;
16 # Start in the state s
17 state = s ;
18
19 # Make steps through the markov chain
20 for i in range (1 , steps +1) :
21 x = 0;
22 u = scipy . random . random (1) ;
23 newState = state ;
24 for j in range ( n +1) :
25 x = x + T [ state , j ];
26 if ( x >= u ) :
27 newState = j ;
28 break ;
29 # # newState = scipy . random . choice (1 , 1 , prob = T [ state
,])
30 state = newState ;
31 count [ state ] = count [ state ] + 1;
32
33 if ( state == n or state == 0) :
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT161

34 numberCycles = numberCycles + 1;
35 avgVisits = count / numberCycles ;
36 avgCycleLength = i / numberCycles ;
37
38 Wsk = avgVisits
39 theoreticalWsk = 2*( s *(1 - scipy . arange (0 , n +1 , dtype = float
) / n ) - scipy . maximum (s - scipy . arange (0 , n +1) , scipy .
zeros ( n +1 , int ) ) )
40 print " Average number of visits to each state in a cycle
:\ n " , Wsk
41 print " Theoretical number of visits to each state in a
cycle : \ n " , theoreticalWsk

Cash Management Algorithm


R R script for cash management.
1 n <- 10 # Top boundary , number of states 0.. n is n +1
2 s <- 5 # Start and Reset state number 1 <= s <= n -1
3 p <- 1 / 2
4 steps <- 1000
5 rate <- 1.0
6 K <- 2 # Charge or cost to reset the Markov chain
7
8 diag . num <- outer ( seq (1 , n +1) , seq (1 , n +1) , " -" )
9 # diag . num is a matrix whose ith lower diagonal equals i ,
opposite for upper diagonal
10 T <- mat . or . vec ( n +1 , n +1)
11 # mat . or . vec creates an nr by nc zero matrix if nc is
greater than 1
12 # Also remember that matrices in R are 1 - based , so need n
+1 states , 0.. n
13 T [ diag . num == -1] <- p
14 T [ diag . num == 1] <- 1 - p
15 T [1 ,2] <- 0; T [1 , s +1] <- 1;
16 T [ n +1 , n ] <- 0; T [ n +1 , s +1] <- 1;
17
18 # vector to hold the count of visits to each state during
a cycle
19 count <- mat . or . vec (1 , n +1)
20 # Initialize the number of cycles
21 numberCycles <- 0
22 # Initialize the total cost of the cashmanagement
162CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

23 totalCost <- 0
24 # Start in the state s
25 state = s +1
26
27 # Make steps through the markov chain
28 for ( i in 1: steps )
29 {
30 x = 0;
31 u = runif (1 , 0 , 1) ;
32
33 newState = state ;
34 for ( j in 1: ncol ( T ) )
35 {
36 x = x + T [ state , j ];
37 if ( x >= u )
38 {
39 newState = j ;
40 break ;
41 }
42 }
43 # # newState <- sample (1: ncol ( T ) , 1 , prob = T [ state ,])
44 state = newState ;
45 count [ state ] <- count [ state ] + 1
46
47 if ( state == n +1 || state == 1) {
48 numberCycles <- numberCycles + 1
49 totalCost <- K + totalCost
50 } else {
51 totalCost <- rate * ( state -1) + totalCost
52 }
53 }
54

55 avgCost <- totalCost / steps


56 t heo re ti ca lA vg Co st <- ( K + (1 / 3) * ( rate * s * ( n ^2 - s ^2) ) ) /
( s * (n - s ) )
57
58 cat ( sprintf ( " Average cost : \ n " ) )
59 cat ( avgCost )
60 cat ( " \ n \ n " )
61 cat ( sprintf ( " Theoretical average cost : \ n " ) )
62 cat ( th eo re ti cal Av gC os t )
63 cat ( " \ n " )
64
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT163

Octave Octave script for cash management


1 n = 10; # Top boundary , number of states 0.. n is n +1
2 s = 5; # Start and Reset state number 1 <= s <= n -1
3 p = 1/2;
4 steps = 1000;
5 rate = 1.0;
6 K = 2; # Charge or cost to reset the Markov chain
7
8 T = diag ( p * ones (1 , n ) , 1) + diag ( (1 - p ) * ones (1 , n ) , -1) ;
9 T (1 ,2) = 0; T (1 , s +1) = 1;
10 T ( n +1 , n ) = 0; T ( n +1 , s +1) = 1;
11
12 # vector to hold the count of visits to each state during
a cycle
13 count = zeros (1 , n +1) ;
14 # Initialize the number of cycles
15 numberCycles = 0;
16 # Initialize the total cost of the cashmanagement
17 totalCost = 0;
18 # Start in the state s
19 state = s +1;
20
21 # Make steps through the markov chain
22 for i = 1: steps
23 x = 0;
24 u = rand (1 , 1) ;
25
26 newState = state ;
27 for j = 1: n +1
28 x = x + T ( state , j ) ;
29 if ( x >= u )
30 newState = j ;
31 break ;
32 endif
33 endfor
34 ## newState = sample (1: ncol ( T ) , 1 , prob = T [ state ,])
35 state = newState ;
36 count ( state ) = count ( state ) + 1;
37
38 if ( state == n +1 || state == 1)
39 numberCycles = numberCycles + 1;
40 totalCost = K + totalCost ;
41 else
42 totalCost = rate *( state -1) + totalCost ;
43 endif
164CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

44 endfor
45

46 disp ( " Average cost : " )


47 avgCost = totalCost / steps
48 disp ( " Theoretical average cost : " )
49 t heo re ti ca lA vg Co st = ( K + (1/3) *( rate * s *( n ^2 - s ^2) ) ) /(
s *( n - s ) )
50

Perl Perl PDL script for cash management


1 use PDL :: NiceSlice ;
2
3 $n = 10; # Top boundary , number of states 0.. n
is n +1
4 $s = 5; # Start and Reset state number 1 <= s
<= n -1
5 $p = 1 / 2;
6 $steps = 1000;
7
8 $rate = 1.0;
9 $K = 2; # Charge or cost to reset the Markov
chain
10

11 $T = zeroes ( $n + 1 , $n + 1 ) ;
12 $T ( $s , 0 ) .= 1; # note order of indices , note
concat operation
13 $T ( $s , $n ) .= 1;
14 for ( $i = 1; $i <= $n - 1; $i ++ ) {
15 $T ( $i + 1 , $i ) .= $p ;
16 $T ( $i - 1 , $i ) .= 1 - $p ;
17 }
18
19 # vector to hold the count of visits to each state during
a cycle
20 $count = zeroes ( $n + 1 ) ;
21
22 # Initialize the number of cycles
23 $numberCycles = 0;
24
25 # Initialize the total cost of the cashmanagement
26 $totalCost = 0.0;
27
28 # Start in the state s
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT165

29 $state = $s ;
30

31 # Make steps through the markov chain


32 for ( $i = 1; $i <= $steps ; $i ++ ) {
33 $x = 0;
34 $u = rand (1) ;
35 for ( $j = 0; $j <= $n ; $j ++ ) {
36 $x = $x + $T ( $j , $state ) ;
37 if ( $x >= $u ) {
38 $state = $j ;
39 last ;
40 }
41 }
42 $count ( $state ) ++;
43 if ( $state == $n || $state == 0 ) {
44 $numberCycles ++;
45 $totalCost = $K + $totalCost ;
46 }
47 else {
48 $totalCost = $rate * $state + $totalCost ;
49 }
50
51 $avgCost = $totalCost / $steps ;
52
53 $ t he o r et i c al A v gC o st =
54 ( $K + ( 1. / 3. ) * ( $rate * $s * ( $n **2 -
$s **2 ) ) )
55 / ( $s * ( $n - $s ) ) ;
56 }
57
58 print " Average Cost : " , $avgCost ,
"\n";
59 print " Theoretical Average Cost : " , $theoreticalAvgCost ,
"\n";
60

SciPy Scientific Python script for cash management


1 import scipy
2
3 n = 10; # Top boundary , number of states 0.. n is n +1
4 s = 5; # Start and Reset state number 1 <= s <= n -1
5 p = 0.5;
6 steps = 1000;
166CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

7 rate = 1.0
8 K = 2.0
9
10 T = scipy . diag ( p * scipy . ones ( n ) , 1) + scipy . diag ( (1 - p )
* scipy . ones ( n ) , -1) ;
11 # square brakets okay , assignment not
12 T [0 ,1] = 0; T [0 , s ] = 1;
13 T [n ,n -1] = 0; T [n , s ] = 1;
14
15 # vector to hold the count of visits to each state during
a cycle
16 count = scipy . zeros ( n +1 , float ) ;
17 # Initialize the cyclelength
18 numberCycles = 0;
19 # Initialize the total cost of the cashmanagement
20 totalCost = 0.0
21 # Start in the state s
22 state = s ;
23
24 # Make steps through the markov chain
25 for i in range (1 , steps +1) :
26 x = 0;
27 u = scipy . random . random (1) ;
28 newState = state ;
29 for j in range ( n +1) :
30 x = x + T [ state , j ];
31 if ( x >= u ) :
32 newState = j ;
33 break ;
34 # # newState = scipy . random . choice (1 , 1 , prob = T [ state
,])
35 state = newState ;
36 count [ state ] = count [ state ] + 1;
37
38 if ( state == n or state == 0) :
39 numberCycles = numberCycles + 1;
40 totalCost = K + totalCost
41 else :
42 totalCost = rate * state + totalCost
43
44 avgCost = totalCost / steps
45 t heo re ti ca lA vg Co st = ( K + (1./3.) *( rate * s *( n **2 - s **2) )
) /( s *( n - s ) )
46 print " Average cost :\ n " , avgCost
47 print " Theoretical average cost : \ n " , t heo re ti ca lA vg Co st
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT167

Key Concepts
1. The reserve requirement is a bank regulation that sets the minimum
reserves of cash a bank must hold on hand for customer deposits. An
important question for the bank is: What is the optimal level of cash
for the bank to hold?

2. We model the cash level with a sequence of cycles or games. Each cycle
begins with s units of cash on hand and ends with either a replenish-
ment of cash, or a reduction of cash. In between these levels, the cash
level is a stochastic process, specifically a coin-tossing game or random
walk.

3. By solving a non-homogeneous difference equation we can determine


the expected number of visits to an intermediate level in the random
process.

4. Using the expected number of visits to a level we can model the ex-
pected costs of the reserve requirement as a function of the maximum
amount to hold and the starting level after a buy or sell. Then we can
minimize the expected costs with calculus to find the optimal values of
the maximum amount and the starting level.

Vocabulary
1. The reserve requirement is a bank regulation that sets the minimum
reserves of cash a bank must hold for customer deposits.

2. The mathematical expression δsk is the Kronecker delta


(
1 if k = s
δsk =
0 6 s.
if k =
168CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES

3. If X is a random variable assuming some values including k, the indi-


cator random variable is
(
1 X=k
1{X=k} =
0 X 6= k.
The indicator random variable indicates whether a random variable
assumes a value, or is in a set. The expected value of the indicator
random variable is the probability of the event.

Problems to Work for Understanding


p
1. Find a particular solution Wsk to the non-homogeneous equation
p 1 p 1 p
Wsk = δsk + Ws−1,k + Ws+1,k .
2 2
using the trial function
(
p C + Ds if s ≤ k
Wsk =
E + F s if s > k.

2. Show that
S−1
X
Ws = kWsk
k=1
S−1
" s−1
#
sX X
=2 k(S − k) − k(s − k)
S k=1 k=1
s S(S − 1)(S + 1) s(s − 1)(s + 1)
   
=2 −
S 6 6
s 2
S − s2

=
3
PN PN 2
You will need formulas for k=1 k and k=1 k or alternatively for
PN
k=1 k(M − k). These are easily found or derived.

3. (a) For the long run average cost


K + (1/3)rS 3 x(1 − x2 )
C= .
S 2 x(S − x)
find ∂C/∂x.
3.4. A STOCHASTIC PROCESS MODEL OF CASH MANAGEMENT169

(b) For the long run average cost

K + (1/3)rS 3 x(1 − x2 )
C= .
S 2 x(1 − x)

find ∂C/∂S.
(c) Find the optimum values of x and S.

Outside Readings and Links:


1. Milton Friedman: The Purpose of the Federal Reserve system. The
reaction of the Federal Reserve system at the beginning of the Great
Depression.
170CHAPTER 3. FIRST STEP ANALYSIS FOR STOCHASTIC PROCESSES
Chapter 4

Limit Theorems for Stochastic


Processes

4.1 Laws of Large Numbers

Section Starter Question

Consider a fair (p = 1/2 = q) coin tossing game carried out for 1000 tosses.
Explain in a sentence what the “law of averages” says about the outcomes
of this game.

The Weak Law of Large Numbers

Lemma 3 (Markov’s Inequality). If X is a random variable that takes only


nonnegative values, then for any a > 0:

P [X ≥ a] ≤ E [X] /a

Proof. Here is a proof for the case where X is a continuous random variable

171
172CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

with probability density f :


Z ∞
E [X] = xf (x) dx
Z0 a Z ∞
= xf (x) dx + xf (x) dx
0 a
Z ∞
≥ xf (x) dx
a
Z ∞
≥ af (x) dx
a
Z ∞
=a f (x) dx
a
= aP [X ≥ a] .
(The proof for the case where X is a purely discrete random variable is
similar with summations replacing integrals. The proof for the general case
is exactly as given with dF (x) replacing f (x) dx and interpreting the integrals
as Riemann-Stieltjes integrals.)
Lemma 4 (Chebyshev’s Inequality). If X is a random variable with finite
mean µ and variance σ 2 , then for any value k > 0:
P [|X − µ| ≥ k] ≤ σ 2 /k 2 .

Proof. Since (X−µ)2 is a nonnegative random variable, we can apply Markov’s


inequality (with a = k 2 ) to obtain
P (X − µ)2 ≥ k 2 ≤ E (X − µ)2 /k 2 .
   

But since (X − µ)2 ≥ k 2 if and only if |X − µ| ≥ k, the inequality above is


equivalent to:
P [|X − µ| ≥ k] ≤ σ 2 /k 2
and the proof is complete.
Theorem 5 (Weak Law of Large Numbers). Let X1 , X2 , X3 , . . . , be indepen-
dent, identically distributed random variables each with mean µ and variance
σ 2 . Let Sn = X1 + · · · + Xn . Then Sn /n converges in probability to µ. That
is:
lim Pn [|Sn /n − µ| > ] = 0.
n→∞
4.1. LAWS OF LARGE NUMBERS 173

Proof. Since the mean of a sum of random variables is the sum of the means,
and scalars factor out of expectations:
n
X
E [Sn /n] = (1/n) E [Xi ] = (1/n)(nµ) = µ.
i=1

Since the variance of a sum of independent random variables is the sum of


the variances, and scalars factor out of variances as squares:
n
X
Var [Sn /n] = (1/n2 ) Var [Xi ] = (1/n2 )(nσ 2 ) = σ 2 /n.
i=1

Fix a value  > 0. Then using elementary definitions for probability measure
and Chebyshev’s Inequality:
0 ≤ Pn [|Sn /n − µ| > ] ≤ Pn [|Sn /n − µ| ≥ ] ≤ σ 2 /(n2 ).
Then by the squeeze theorem for limits
lim Pn [|Sn /n − µ| > ] = 0.
n→∞

Jacob Bernoulli originally proved the Weak Law of Large Numbers in 1713
for the special case when the Xi are binomial random variables. Bernoulli
had to create an ingenious proof to establish the result, since Chebyshev’s
inequality was not known at the time. The theorem then became known as
Bernoulli’s Theorem. Simeon Poisson proved a generalization of Bernoulli’s
binomial Weak Law and first called it the Law of Large Numbers. In 1929
the Russian mathematician Aleksandr Khinchin proved the general form of
the Weak Law of Large Numbers presented here. Many other versions of the
Weak Law are known, with hypotheses that do not require such stringent
requirements as being identically distributed, and having finite variance.

The Strong Law of Large Numbers


Theorem 6 (Strong Law of Large Numbers). Let X1 , X2 , X3 , . . . , be indepen-
dent,
 identically distributed random variables each with mean µ and variance
E Xj2 < ∞. Let Sn = X1 + · · · + Xn . Then Sn /n converges with probability


1 to µ,  
Sn
P lim = µ = 1.
n→∞ n
174CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

The proof of this theorem is beautiful and deep, but would take us too far
afield to prove it. The Russian mathematician Andrey Kolmogorov proved
the Strong Law in the generality stated here, culminating a long series of
investigations through the first half of the 20th century.

Discussion of the Weak and Strong Laws of Large Numbers


In probability theory a theorem that tells us how a sequence of probabilities
converges is called a weak law. For coin tossing, the sequence of probabilities
is the sequence of binomial probabilities associated with the first n tosses.
The Weak Law of Large Numbers says that if we take n large enough, then
the binomial probability of the mean over the first n tosses differing “much”
from the theoretical mean should be small. This is what is usually popularly
referred to as the law of averages. However, this is a limit statement and the
Weak law of Large Numbers above does not indicate the rate of convergence,
nor the dependence of the rate of convergence on the difference . Note
furthermore that the Weak Law of Large Numbers in no way justifies the
false notion called the “Gambler’s Fallacy”, namely that a long string of
successive Heads indicates a Tail “is due to occur soon”. The independence
of the random variables completely eliminates that sort of prescience.
A strong law tells how the sequence of random variables as a sample
path behaves in the limit. That is, among the infinitely many sequences
(or paths) of coin tosses we select one “at random” and then evaluate the
sequence of means along that path. The Strong Law of Large Numbers says
that with probability 1 that sequence of means along that path will converge
to the theoretical mean. The formulation of the notion of probability on an
infinite (in fact an uncountably infinite) sample space requires mathematics
beyond the scope of the course, partially accounting for the lack of a proof
for the Strong Law here.
Note carefully the difference between the Weak Law of Large Numbers
and the Strong Law. We do not simply move the limit inside the probability.
These two results express different limits. The Weak Law is a statement
that the group of finite-length experiments whose sample mean is close to
the population mean approaches all of the possible experiments as the length
increases. The Strong Law is an experiment-by-experiment statement, it says
(almost every) sequence has a sample mean that approaches the population
mean. This is reflected in the subtle difference in notation here. In the
Weak Law the probabilities are written with a subscript: Pn [·] indicating
4.1. LAWS OF LARGE NUMBERS 175

this is a binomial probability distribution with parameter n (and p). In the


Strong Law, the probability is written without a subscript, indicating this is
a probability measure on a sample space. Weak laws are usually much easier
to prove than strong laws.

Sources
This section is adapted from Chapter 8, “Limit Theorems”, A First Course
in Probability, by Sheldon Ross, Macmillan, 1976.

Algorithms, Scripts, Simulations


Algorithm
The experiment is flipping a coin n times, and repeat the experiment k times.
Then compute the proportion for which the sample mean deviates from p by
more than .

Scripts
Geogebra GeoGebra

R R script for the Law of Large Numbers


1 p <- 0.5
2 n <- 10000
3 k <- 1000
4 coinFlips <- array ( 0+( runif ( n * k ) <= p ) , dim = c (n , k ) )
5 # 0+ coerces Boolean to numeric
6 headsTotal <- colSums ( coinFlips )
7 # 0.. n binomial rv sample , size k
8

9 epsilon <- 0.01


10 mu <- p
11 prob <- sum ( 0+( abs ( headsTotal / n - mu ) > epsilon ) ) / k
12 cat ( sprintf ( " Empirical probability : % f \ n " , prob ) )

Octave Octave script for the Law of Large Numbers


176CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

1 p = 0.5;
2 n = 10000;
3 k = 1000;
4
5 coinFlips = rand (n , k ) <= p ;
6 headsTotal = sum ( coinFlips ) ;
7 # 0.. n binomial rv sample , size k
8
9 epsilon = 0.01
10 mu = p ;
11 prob = sum ( abs ( headsTotal / n - mu ) > epsilon ) / k ;
12 disp ( " Empirical probability : " ) , disp ( prob )

Perl Perl PDL script for the Law of Large Numbers


1 use PDL :: NiceSlice ;
2
3 $p = 0.5;
4 $n = 10000;
5 $k = 1000;
6
7 $coinFlips = random ( $k , $n ) <= $p ;
8
9 # note order of dims !!
10 $headsTotal = $coinFlips - > transpose - > sumover ;
11
12 # 0.. n binomial r . v . sample , size k
13 # note transpose , PDL likes x ( row ) direction for
14 # implicitly threaded operations
15
16 $epsilon = 0.01;
17 $mu = $p ;
18
19 $prob = ( ( abs ( ( $headsTotal / $n ) - $mu ) > $epsilon
) -> sumover ) / $k ;
20
21 print " Empirical probability : " , $prob , " \ n " ;

SciPy Scientific Python script for the Law of Large Numbers


1 import scipy
4.1. LAWS OF LARGE NUMBERS 177

2
3 p = 0.5
4 n = 10000
5 k = 1000
6
7 coinFlips = scipy . random . random (( n , k ) ) <= p
8 # Note Booleans True for Heads and False for Tails
9 headsTotal = scipy . sum ( coinFlips , axis = 0)
10 # 0.. n binomial r . v . sample , size k
11 # Note how Booleans act as 0 ( False ) and 1 ( True )
12
13 epsilon = 0.01
14 mu = p
15

16 prob = ( scipy . sum ( abs ( headsTotal . astype ( ’ float ’) / n - mu


) > epsilon ) ) . astype ( ’ float ’) / k
17 # Note the casting of integer types to float to get
floats
18
19 print " Empirical probability : " , prob

Key Concepts
1. The precise statement, meaning and proof of the Weak Law of Large
Numbers.
2. The precise statement and meaning of the Strong Law of Large Num-
bers.

Vocabulary
1. The Weak Law of Large Numbers is a precise mathematical state-
ment of what is usually loosely referred to as the “law of averages”.
Precisely, let X1 , . . . , Xn be independent, identically distributed ran-
dom variables each with mean µ and variance σ 2 . Let Sn = X1 +· · ·+Xn
and consider the sample mean or more loosely, the “average” Sn /n.
Then the Weak Law of Large Numbers says that the sample mean Sn /n
converges in probability to the population mean µ. That is:

lim Pn [|Sn /n − µ| > ] = 0.


n→∞
178CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

In words, the proportion of those samples whose sample mean differs


significantly from the population mean diminishes to zero as the sample
size increases.

2. The Strong Law of Large Numbers says that Sn /n converges to µ


with probability 1. That is:
h i
P lim Sn /n = µ = 1.
n→∞

In words, the Strong Law of Large Numbers “almost every” sample


mean approaches the population mean as the sample size increases.

Problems to Work for Understanding


1. Suppose X is a continuous random variable with mean and variance
both equal to 20. What can be said about P [0 ≤ X ≤ 40]?

2. Suppose X is an exponentially distributed random variable with mean


E [X] = 1. For x = 0.5, 1, and 2, compare P [X ≥ x] with the Markov
Inequality bound.

3. Suppose X is a Bernoulli random variable with P [X = 1] = p and


P [X = 0] = 1 − p = q. Compare P [X ≥ 1] with the Markov Inequality
bound.

4. Make a sequence of 100 coin tosses and keep a record as in Experiment.


How “typical” was your coin flip sequence? All 2100 coin flip sequences
are equally likely of course, so yours is neither more nor less typical
than any other in that way. However, some sets or events of coin flip
sequences are more or less “typical” when measured by the probability
of a corresponding event. What is your value of S100 , and the number
of heads and the number of tails in your record? Using your value of
S100 let  = |S100 | and use Chebyshev’s Inequality as in the proof of
the Weak Law of Large Numbers to provide an upper bound on the
probability that for all possible records |S100 | > .

5. Let X1 , X2 , . . . , X10 be independent Poisson random variables with


mean 1. First use the Markov Inequality to get a bound on

P [X1 + · · · + X10 > 15]


4.2. MOMENT GENERATING FUNCTIONS 179

. Next find the exact probability that P [X1 + · · · + X10 > 15] using
that the fact that the sum of independent Poisson random variables
with parameters λ1 , λ2 is again Poisson with parameter λ1 + λ2 .

6. Write a proof of Markov’s Inequality for a random variable taking pos-


itive integer values.

7. Modify the scripts to compute the proportion of sample means which


deviate from p by more than  for increasing values of n. Do the
proportions decrease with increasing values of n? If so, at what rate
do the proportions decrease?

Outside Readings and Links:


1. Virtual Laboratories in Probability and Statistics. Search the page for
“Simulation Exercises and then run the Binomial Coin Experiment and
the Matching Experiment.

2.

4.2 Moment Generating Functions


Section Starter Question
Give some examples of transform methods in mathematics, science or engi-
neering that you have seen or used and explain why transform methods are
useful.

Transform Methods
We need some tools to aid in proving theorems about random variables. In
this section we develop a tool called the moment generating function
which converts problems about probabilities and expectations into prob-
lems from calculus about function values and derivatives. Moment gener-
ating functions are one of the large class of transforms in mathematics that
turn a difficult problem in one domain into a manageable problem in an-
other domain. Other examples are Laplace transforms, Fourier transforms,
Z-transforms, generating functions, and even logarithms.
The general method can be expressed schematically in Figure 4.1.
180CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

Xi , P[Xi ], E[Xi ] φX (t)


transform

difficult

inverse transform
conclusions calculations

Figure 4.1: Block diagram of transform methods.


4.2. MOMENT GENERATING FUNCTIONS 181

Expectation of Independent Random Variables


Lemma 7. If X and Y are independent random variables, then for any
functions g and h:
E [g(X)h(Y )] = E [g(X)] E [h(Y )]
Proof. To make the proof definite suppose that X and Y are jointly contin-
uous, with joint probability density function F (x, y). Then:
ZZ
E [g(X)h(Y )] = g(x)h(y)f (x, y) dx dy
(x,y)
Z Z
= g(x)h(y)fX (x)fY (y) dx dy
x y
Z Z
= g(x)fX (x) dx h(y)fY (y) dy
x y
= E [g(X)] E [h(Y )] .

Remark. In words, the expectation of the product of independent random


variables is the product of the expectations.

The Moment Generating Function


The moment generating function φX (t) is defined by
(P
txi
i e p(xi ) if X is discrete
φX (t) = E e
 tX 
= R tx
x
e f (x) dx if X is continuous

for all values t for which the integral converges.


Example. The degenerate probability distribution has all the probability
concentrated at a single point. That is, the degenerate random variable is a
discrete random variable exhibiting certainty of outcome. If X is a degenerate
random variable, then X = µ with probability 1 and X is any other value with
probability 0. The moment generating function of the degenerate random
variable is particularly simple:
X
exi t = eµt .
xi =µ
182CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

If the moments of order k exist for 0 ≤ k ≤ k0 , then the moment generat-


ing function is continuously differentiable up to order k0 at t = 0. Assuming
that all operations can interchanged, the moments of X can be generated
from φX (t) by repeated differentiation:

d  tX 
φ0X (t) = E e
dt Z
d
= etx fX (x) dx
dt
Z x
d tx
= e fX (x) dx
x dt
Z
= xetx fX (x) dx
x
= E XetX .
 

Then
φ0X (0) = E [X] .
Likewise
d 0
φ00X (t) = φ (t)
dt ZX
d
= xetx fX (x) dx
dt x
d
Z
= x etx fX (x) dx
dt
Zx
= x2 etx fX (x) dx
x
= E X 2 etX .
 

Then
φ00X (0) = E X 2 .
 

Continuing in this way:


(n)
φX (0) = E [X n ]

Remark. In words, the value of the nth derivative of the moment generating
function evaluated at 0 is the value of the nth moment of X.
4.2. MOMENT GENERATING FUNCTIONS 183

Theorem 8. If X and Y are independent random variables with moment


generating functions φX (t) and φY (t) respectively, then φX+Y (t), the moment
generating function of X + Y is given by φX (t)φY (t). In words, the moment
generating function of a sum of independent random variables is the product
of the individual moment generating functions.
Proof. Using the lemma on independence above:
φX+Y (t) = E et(X+Y )
 

= E etX etY
 

= E etX E etY
   

= φX (t)φY (t).

Theorem 9. If the moment generating function is defined in a neighborhood


of t = 0 then the moment generating function uniquely determines the prob-
ability distribution. That is, there is a one-to-one correspondence between
the moment generating function and the distribution function of a random
variable, when the moment-generating function is defined and finite.
Proof. This proof is too sophisticated for the mathematical level we have
now.

The moment generating function of a normal random variable


Theorem 10. If Z ∼ N (µ, σ 2 ), then φZ (t) = exp(µt + σ 2 t2 /2).
Proof.
φZ (t) = E etX
 
Z ∞
1 2 2
=√ etx e−(x−µ) /(2σ ) dx
2πσ 2 −∞
Z ∞
−(x2 − 2µx + µ2 − 2σ 2 tx)
 
1
=√ exp dx
2πσ 2 −∞ 2σ 2
By completing the square:
x2 − 2µx + µ2 − 2σ 2 tx = x2 − 2(µ + σ 2 t)x + µ2
= (x − (µ + σ 2 t))2 − (µ + σ 2 t)2 + µ2
= (x − (µ + σ 2 t))2 − σ 4 t2 − 2µσ 2 t.
184CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

So returning to the calculation of the m.g.f.


Z ∞
− ((x − (µ + σ 2 t))2 − σ 4 t2 − 2µσ 2 t)
 
1
φZ (t) = √ exp dx
2πσ 2 −∞ 2σ 2
 42 Z ∞
σ t + 2µσ 2 t −(x − (µ + σ 2 t))2
 
1
=√ exp exp dx
2πσ 2 2σ 2 −∞ 2σ 2
 42
σ t + 2µσ 2 t

= exp
2σ 2
= exp µt + σ 2 t2 /2


Theorem 11. If Z1 ∼ N (µ1 , σ12 ), and Z2 ∼ N (µ2 , σ22 ) and Z1 and Z2 are
independent, then Z1 + Z2 ∼ N (µ1 + µ2 , σ12 + σ22 ). In words, the sum of
independent normal random variables is again a normal random variable
whose mean is the sum of the means, and whose variance is the sum of the
variances.

Proof. We compute the moment generating function of the sum using our
theorem about sums of independent random variables. Then we recognize the
result as the moment generating function of the appropriate normal random
variable.

φZ1 +Z2 (t) = φZ1 (t)φZ2 (t)


= exp(µ1 t + σ12 t2 /2) exp(µ2 t + σ22 t2 /2)
= exp((µ1 + µ2 )t + (σ12 + σ22 )t2 /2)

An alternative visual proof that the sum of independent normal random


variables is again a normal random variable using only calculus is available
at The Sum of Independent Normal Random Variables is Normal

Sources
This section is adapted from: Introduction to Probability Models, by Sheldon
Ross.
4.2. MOMENT GENERATING FUNCTIONS 185

Key Concepts
1. The moment generating function converts problems about prob-
abilities and expectations into problems from calculus about function
values and derivatives.

2. The value of the nth derivative of the moment generating function


evaluated at 0 is the value of the nth moment of X.

3. The sum of independent normal random variables is again a normal


random variable whose mean is the sum of the means, and whose vari-
ance is the sum of the variances.

Vocabulary
1. RThe nth moment of the random variable X with pdf f (x) is E [X n ] =
x
xn f (x) dx (provided this integral converges absolutely.)

2. The moment generating function φX (t) is defined by


(P
etxi p(xi ) if X is discrete
φX (t) = E e
 tX 
= R i tx
x
e f (x) dx if X is continuous

for all values t for which the integral converges.

Problems to Work for Understanding


1. Calculate the moment generating function of a random variable X
having a uniform distribution on [0, 1]. Use this to obtain E [X] and
Var [X].

2. Calculate the moment generating function of a discrete random vari-


able X having a geometric distribution. Use this to obtain E [X] and
Var [X].

3. Calculate the moment generating function of a Bernoulli random vari-


able having value 1 with probability p and value 0 with probability
1 − p. From this, derive the moment generating function of a binomial
random variable with parameters n and p.
186CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

Outside Readings and Links:


1. Generating Functions in Virtual Laboratories in Probability

2. Moment Generating Functions in MathWorld.com

4.3 The Central Limit Theorem


Section Starter Question
What is the most important probability distribution? Why do you choose
that distribution as most important?

Convergence in Distribution
Lemma 12. Let X1 , X2 , . . . be a sequence of random variables having cu-
mulative distribution functions FXn and moment generating functions φXn .
Let X be a random variable having cumulative distribution function FX
and moment generating function φX . If φXn (t) → φX (t), for all t, then
FXn (t) → FX (t) for all t at which FX (t) is continuous.

We say that the sequence Xi converges in distribution to X and we


write
D
Xi → X.
Notice that P [a < Xi ≤ b] = FXi (b)−FXi (a) → F (b)−F (a) = P [a < X ≤ b],
so convergence in distribution implies convergence of probabilities of events.
Likewise, convergence of probabilities of events implies convergence in distri-
bution.
This lemma is useful because it is routine to determine the pointwise limit
of a sequence of functions using ideas from calculus. It is usually much easier
to check the pointwise convergence of the moment generating functions than
it is to check the convergence in distribution of the corresponding sequence
of random variables.
We won’t prove this lemma, since it would take us too far afield into
the theory of moment generating functions and corresponding distribution
theorems. However, the proof is a routine application of ideas from the
mathematical theory of real analysis.
4.3. THE CENTRAL LIMIT THEOREM 187

Application: Weak Law of Large Numbers.


Here’s a simple representative example of using the convergence of the mo-
ment generating function to prove a useful result. We will prove a version of
the Weak Law of Large numbers that does not require the finite variance of
the sequence of independent, identically distributed random variables.
Theorem 13 (Weak Law of Large Numbers). Let X1 , . . . , Xn be indepen-
dent, identically distributed random variables each with mean µ and such that
E [|X|] is finite. Let Sn = X1 + · · · + Xn . Then Sn /n converges in probability
to µ. That is:
lim Pn [|Sn /n − µ| > ] = 0
n→∞

Proof. If we denote the moment generating function of X by φ(t), then the


moment generating function of
n
Sn X Xi
=
n i=1
n

is (φ(t/n))n . The existence of the first moment assures us that φ(t) is dif-
ferentiable at 0 with a derivative equal to µ. Therefore, by tangent-line
approximation (first-degree Taylor polynomial approximation)
 
t t
φ = 1 + µ + r2 (t/n)
n n

where r2 (t/n) is a error term such that

r2 (t/n)
lim = 0.
n→∞ (t/n)

This is equivalent to (1/t) limn→∞ nr2 (t/n) = 0 or just limn→∞ nr2 (t/n) = 0,
needed for taking the limit in (4.1). Then we need to consider
 n
t t
φ = (1 + µ + r2 (t/n))n . (4.1)
n n

Taking the logarithm of (1 + µ(t/n) + r(t/n))n and using L’Hospital’s Rule,


we see that
φ(t/n)n → exp(µt).
188CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

But this last expression is the moment generating function of the (degenerate)
point mass distribution concentrated at µ. Hence,

lim Pn [|Sn /n − µ| > ] = 0


n→∞

The Central Limit Theorem


Theorem 14 (Central Limit Theorem). Let random variables X1 , . . . Xn

• be independent and identically distributed;

• have common mean E [Xi ] = µ and common variance Var [Xi ] = σ 2 ;


and

• the common moment generating function φXi (t) = E [etxi ] exists and is
finite in a neighborhood of t = 0.
Pn
Consider Sn = i=1 Xi . Let


√ √
Zn = (Sn − nµ)/(σ n) = (1/σ)(Sn /n − µ) n; and

• Z be the standard normally distributed random variable with mean 0


and variance 1.

Then Zn converges in distribution to Z, that is:


Z a √
lim Pn [Zn ≤ a] = (1/ 2π) exp(−u2 /2) du.
n→∞ −∞

Remark. The Central Limit Theorem is true even under the slightly weaker
assumptions that X1 , . . . Xn only are independent and identically distributed
with finite mean µ and finite variance σ 2 without the assumption that mo-
ment generating function exists. However, the proof below using moment
generating functions is simple and direct enough to justify using the addi-
tional hypothesis.
4.3. THE CENTRAL LIMIT THEOREM 189

Proof. Assume at first that µ = 0 and σ 2 = 1. Assume also that the moment
generating function of the Xi , (which are identically distributed, so there is
only√one m.g.f) is φX (t), exists and is everywhere finite. Then the m.g.f of
Xi / n is √  √
φX/√n (t) = E exp(tXi / n) = φX (t/ n).


Recall that the m.g.f of a sum√of independent r.v.s is the product of the
m.g.f.s. Thus the m.g.f of Sn / n is (note that here we used µ = 0 and
σ 2 = 1) √
φSn /√n (t) = [φX (t/ n)]n
The quadratic approximation (second-degree Taylor polynomial expansion)
of φX (t) at 0 is by calculus:

φX (t) = φX (0) + φ0X (0)t + (φ00X (0)/2)t2 + r3 (t) = 1 + t2 /2 + r3 (t)

again since the hypotheses assume E [X] = φ0 (0) = 0 and Var [X] = E [X 2 ] −
(E [X])2 = φ00 (0) − (φ0 (0))2 = φ00 (0) = 1. Here r3 (t) is an error term such
that limt→0 r3 (t)/t2 = 0. Thus,
√ √
φ(t/ n) = 1 + t2 /(2n) + r3 (t/ n)

implying that √
φSn /√n = [1 + t2 /(2n) + r3 (t/ n)]n .
Now by some standard results from calculus,

[1 + t2 /(2n) + r3 (t/ n)]n → exp(t2 /2)

as n → ∞. (If the reader needs convincing, it’s easy to show that



n log(1 + t2 /(2n) + r3 (t/ n)) → t2 /2,

using L’Hospital’s Rule to account for the r3 (t) term.)


To handle the general case, consider the standardized random variables
(Xi − µ)/σ, each of which now has mean 0 and variance 1 and apply the
result.
Abraham de Moivre proved the first version of the central limit theorem
around 1733 in the special case when the Xi are binomial random variables
with p = 1/2 = q. Pierre-Simon Laplace subsequently extended the proof
to the case of arbitrary p 6= q. Laplace also discovered the more general
190CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

form of the Central Limit Theorem presented here. His proof however was
not completely rigorous, and in fact, cannot be made completely rigorous.
A truly rigorous proof of the Central Limit Theorem was first presented by
the Russian mathematician Aleksandr Liapunov in 1901-1902. As a result,
the Central Limit Theorem (or a slightly stronger version of the Central
Limit Theorem) is occasionally referred to as Liapunov’s theorem. A theorem
with weaker hypotheses but with equally strong conclusion is Lindeberg’s
Theorem of 1922. It says that the sequence of random variables need not
be identically distributed, but instead need only have zero means, and the
individual variances are small compared to their sum.

Accuracy of the Approximation by the Central Limit Theorem


The statement of the Central Limit Theorem does not say how good the
approximation is. One rule of thumb is that the approximation given by the
Central Limit Theorem applied to a sequence of Bernoulli random trials or
equivalently to a binomial random variable is acceptable when np(1 − p) >
18 [41, page 34], [58, page 134]. The normal approximation to a binomial
deteriorates as the interval (a, b) over which the probability is computed
moves away from the binomial’s mean value np. Another rule of thumb is
that the normal approximation is acceptable when n ≥ 30 for all “reasonable”
probability distributions.
The Berry-Esséen Theorem gives an explicit bound: For independent,
identically distributed random variables Xi with µ = E [Xi ] = 0, σ 2 = E [Xi2 ],
and ρ = E [|X 3 |], then
Z a


P Sn /(σ n) < a −
  1 −u2 /2 33 ρ 1
√ e du ≤ √ .

−∞ 2π 4 σ3 n

Illustration 1
Figure 4.2 is a graphical illustration of the Central Limit Theorem. More
precisely, this is an illustration of the de Moivre-Laplace version, the approx-
imation of the binomial distribution with the normal distribution.
The figure is actually an non-centered and unscaled illustration since the
binomial random variable Sn is not shifted by the mean, nor normalized to
unit variance. Therefore, the binomial and the corresponding approximating
4.3. THE CENTRAL LIMIT THEOREM 191

0.1

0.05

0
0 5 10 15 20 25 30
x

Figure 4.2: Approximation of the binomial distribution with the normal


distribution.

normal are both centered at E [Sn ] = np. The variance of the approximating

normal is σ 2 = npq and the widths of the bars denoting the binomial
probabilities are all unit width, and the heights of the bars are the actual
binomial probabilities.

Illustration 2
From the Central Limit Theorem we expect the normal distribution applies
whenever an outcome results from numerous small additive effects with no
single or small group of effects dominant. Here is a standard illustration of
that principle.
Consider the following data from the National Longitudinal Survey of
Youth (NLSY). This study started with 12,000 respondents aged 14-21 years
in 1979. By 1994, the respondents were 29-36 years old and had 15,000
children among them. Of the respondents 2,444 had exactly two children.
In these 2,444 families, the distribution of children was boy-boy: 582; girl-
girl 530, boy-girl 666, and girl-boy 666. It appears that the distribution of
girl-girl family sequences is low compared to the other combinations. Our
intuition tells us that all combinations should be equally likely and should
192CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

appear in roughly equal proportions. We will assess this intuition with the
Central Limit Theorem.
Consider a sequence of 2,444 trials with each of the two-child families.
Let Xi = 1 (success) if the two-child family is girl-girl, and Xi = 0 (failure)
if the two-child family is otherwise. We are interested in the probability
distribution of
2444
X
S2444 = Xi .
i=1

In particular, we are interested in the probability Pn [S2444 ≤ 530], that is,


what is the probability of seeing as few as 530 girl-girl families or even fewer
in a sample of 2444 families? We can use the Central Limit Theorem to
estimate this probability.
We are assuming the family “success” variables Xi are independent, and
identically distributed, a reasonable but arguable assumption. Nevertheless,
without this assumption, we cannot justify the use of the Central Limit
Theorem, so we adopt the assumption. Then µ = E [Xi√ ] = (1/4) · 1 +
(3/4) · 0 = 1/4 and Var [Xi ] = (1/4)(3/4) = 3/16 so σ = 3/4 Note that
2444 · (1/4) · (3/4) = 45.75 > 18 so the rule of thumb justifies the use of the
Central Limit Theorem. Hence
S2444 − 2444 · (1/4) 530 − 2444 · (1/4)
 
Pn [S2444 ≤ 530] = Pn √ √ ≤ √ √
( 3/4 · 2444) ( 3/4 · 2444)
≈ P [Z ≤ −3.7838]
≈ 0.0000772

It is highly unlikely that under our assumptions such a proportion would have
occurred. Therefore, we are justified in thinking that under our assumptions,
the actual proportion of girl-girl families is low. We then begin to suspect our
assumptions, one of which was the implicit assumption that the appearance
of girls was equally likely as boys, leading to equal proportions of the four
types of families. In fact, there is ample evidence that the birth of boys is
more likely than the birth of girls.

Illustration 3
We expect the normal distribution to apply whenever the numerical descrip-
tion of a state of a system results from numerous small additive effects, with
4.3. THE CENTRAL LIMIT THEOREM 193

no single or small group of effects dominant. Here is another illustration of


that principle.
We can us the Central Limit Theorem to assess risk. Two large banks
compete for customers to take out loans. The banks have comparable of-
ferings. Assume that each bank has a certain amount of funds available for
loans to customers. Any customers seeking a loan beyond the available funds
will cost the bank, either as a lost opportunity cost, or because the bank it-
self has to borrow to secure the funds to lend to the customer. If too few
customers take out loans then that also costs the bank since now the bank
has unused funds.
We create a simple mathematical model of this situation. We suppose
that the loans are all of equal size and for definiteness each bank has funds
available for a certain number (to be determined) of these loans. Then sup-
pose n customers select a bank independently and at random. Let Xi = 1
if customer i selects bank H with probability 1/2 and PX i = 0 if customers
n
select bank T, also with probability 1/2. Then Sn = i=1 Xi is the number
of loans from bank H to customers. Now there is some positive probability
that more customers will turn up than the bank can accommodate. We can
approximate this probability with the Central Limit Theorem:
√ √ 
P [Sn > s] = Pn (Sn − n/2)/((1/2) n) > (s − n/2)/((1/2) n)

√ 
≈ P Z > (s − n/2)/((1/2) n)

√ 
= P Z > (2s − n)/ n


Now if n is large enough that this probability is less than (say) 0.01, then the
number of loans will be sufficient in 99 of 100 cases. Looking up the value in
a normal probability table,
2s − n
√ > 2.33
n
so if n = 1000, then s = 537 will suffice. If both banks assume the same risk
of sellout at 0.01, then each will have 537 for a total of 1074 loans, of which
74 will be unused. In the same way, if the bank is willing to assume a risk
of 0.20, i.e. having enough loans in 80 of 100 cases, then they would need
funds for 514 loans, and if the bank wants to have sufficient loans in 999 out
of 1000 cases, the bank should have 549 loans available.
Now the possibilities for generalization and extension are apparent. A
first generalization would be allow the loan amounts to be random with some
194CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

distribution. Still we could apply the Central Limit Theorem to approximate


the demand on available funds. Second, the cost of either unused funds or
lost business could be multiplied by the chance of occurring. The total of
the products would be an expected cost, which could then be minimized.

Sources
The proofs in this section are adapted from Chapter 8, “Limit Theorems”,
A First Course in Probability, by Sheldon Ross, Macmillan, 1976. Further
examples and considerations come from Heads or Tails: An Introduction to
Limit Theorems in Probability, by Emmanuel Lesigne, American Mathemat-
ical Society, Chapter 7, pages 29–74. Illustration 1 is adapted from Dicing
with Death: Chance, Health, and Risk by Stephen Senn, Cambridge Univer-
sity Press, Cambridge, 2003. Illustration 2 is adapted from An Introduction
to Probability Theory and Its Applications, Volume I, second edition, William
Feller, J. Wiley and Sons, 1957, Chapter VII.

Algorithms, Scripts, Simulations


Algorithm
The experiment is flipping a coin n times, and repeat the experiment k times.
Then compute thepproportion for which the deviation of the sample sum from
np by more than p(1 − p)n is less than a. Compare this to the theoretical
probability from the standard normal distribution.

Scripts
Geogebra GeoGebra script for the Central Limit Theorem

R R script for the Central Limit Theorem


1 p <- 0.5
2 n <- 10000
3 k <- 1000
4 coinFlips <- array ( 0+( runif ( n * k ) <= p ) , dim = c (n , k ) )
5 # 0+ coerces Boolean to numeric
6 headsTotal <- colSums ( coinFlips )
7 # 0.. n binomial rv sample , size k
8
9 mu <- p
4.3. THE CENTRAL LIMIT THEOREM 195

10 sigma <- sqrt ( p * (1 - p ) )


11 a <- 0.5
12 Zn <- ( headsTotal - n * mu ) / ( sigma * sqrt ( n ) )
13 prob <- sum ( 0+( Zn < a ) ) / k
14 theoretical <- pnorm (a , mean =0 , sd =1)
15 cat ( sprintf ( " Empirical probability : % f \ n " , prob ) )
16 cat ( sprintf ( " Central Limit Theorem estimate : % f \ n " ,
theoretical ) )

Octave Octave script for the Central Limit Theorem


1 p = 0.5;
2 n = 10000;
3 k = 1000;
4
5 coinFlips = rand (n , k ) <= p ;
6 headsTotal = sum ( coinFlips ) ;
7 # 0.. n binomial rv sample , size k
8
9 mu = p ;
10 sigma = sqrt ( p *(1 - p ) ) ;
11 a = 0.5;
12 Zn = ( headsTotal - n * mu ) /( sigma * sqrt ( n ) ) ;
13 prob = sum ( ( Zn < a ) ) / k ;
14 theoretical = stdnormal_cdf ( a ) ;
15 disp ( " Empirical probability : " ) , disp ( prob )
16 disp ( " Central Limit Theorem estimate : " ) , disp (
theoretical )

Perl Perl PDL script for the Central Limit Theorem


1 use PDL :: NiceSlice ;
2

3 sub pnorm {
4 my ( $x , $sigma , $mu ) = @_ ;
5 $sigma = 1 unless defined ( $sigma ) ;
6 $mu = 0 unless defined ( $mu ) ;
7
8 return 0.5 * ( 1 + erf ( ( $x - $mu ) / ( sqrt (2) *
$sigma ) ) ) ;
9 }
196CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

10
11 $p = 0.5;
12 $n = 10000;
13 $k = 1000;
14
15 $coinFlips = random ( $k , $n ) <= $p ;
16
17 # note order of dims !!
18 $headsTotal = $coinFlips - > transpose - > sumover ;
19
20 # 0.. n binomial r . v . sample , size k
21 # note transpose , PDL likes x ( row ) direction for
implicitly threaded operations
22

23 $mu = $p ;
24 $sigma = sqrt ( $p * ( 1 - $p ) ) ;
25 $a = 0.5;
26 $zn = ( $headsTotal - $n * $mu ) / ( $sigma * sqrt ( $n )
);
27

28 $prob = ( ( $zn < $a ) -> sumover ) / $k ;


29 $theoretical = pnorm ( $a ) ;
30
31 print " Empirical probability : " , $prob ,
"\n";
32 print " Moderate Deviations Theorem estimate : " ,
$theoretical , " \ n " ;

SciPy Scientific Python script for the Central Limit Theorem


1
2 import scipy
3
4 p = 0.5
5 n = 10000
6 k = 1000
7
8 coinFlips = scipy . random . random (( n , k ) ) <= p
9 # Note Booleans True for Heads and False for Tails
10 headsTotal = scipy . sum ( coinFlips , axis = 0) # 0.. n
binomial r . v . sample , size k
11 # Note how Booleans act as 0 ( False ) and 1 ( True )
12
13 mu = p
4.3. THE CENTRAL LIMIT THEOREM 197

14 sigma = scipy . sqrt ( p * ( 1 - p ) )


15 a = 0.5
16 Zn = ( headsTotal - n * mu ) /( sigma * scipy . sqrt ( n ) )
17
18 prob = ( scipy . sum ( Zn < a ) ) . astype ( ’ float ’) / k
19 # Note the casting of integer type to float to get float
20 from scipy . stats import norm
21 theoretical = norm . cdf ( a )
22
23 print " Empirical probability : " , prob
24 print " Moderate Deviations Theorem estimate : " ,
theoretical

Key Concepts
1. The statement, meaning and proof of the Central Limit Theorem.

2. We expect the normal distribution to arise whenever the numerical


description of a state of a system results from numerous small random
additive effects, with no single or small group of effects dominant.

Vocabulary
1. The Central Limit Theorem: Suppose that for a sequence of inde-
pendent, identically distributed random variables Xi , each Xi has finite
variance σ 2 . Let
√ √
Zn = (Sn − nµ)/(σ n) = (1/σ)(Sn /n − µ) n

and let Z be the “standard” normally distributed random variable with


mean 0 and variance 1. Then Zn converges in distribution to Z, that
is: Z a
1
lim Pn [Zn ≤ a] = √ exp(−u2 /2) du.
n→∞ −∞ 2π
In words, a shifted and rescaled sample distribution is approximately
standard normal.
198CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

Problems to Work for Understanding


1. Let X1 , X2 , . . . , X10 be independent Poisson random variables with
mean 1. First use the Markov Inequality to get a bound on Pr[X1 +
· · · + X10 > 15]. Next use the Central Limit theorem to get an estimate
of Pr[X1 + · · · + X10 > 15].

2. A first simple assumption is that the daily change of a company’s stock


on the stock market is a random variable with mean 0 and variance σ 2 .
That is, if Sn represents the price of the stock on day n with S0 given,
then
Sn = Sn−1 + Xn , n ≥ 1
where X1 , X2 , . . . are independent, identically distributed continuous
random variables with mean 0 and variance σ 2 . (Note that this is an
additive assumption about the change in a stock price. In the binomial
tree models, we assumed that a stock’s price changes by a multiplicative
factor up or down. We will have more to say about these two distinct
models later.) Suppose that a stock’s price today is 100. If σ 2 = 1,
what can you say about the probability that after 10 days, the stock’s
price will be between 95 and 105 on the tenth day?

3. Suppose you bought a stock at a price b + c, where c > 0 and the


present price is b. (Too bad!) You have decided to sell the stock after
30 more trading days have passed. Assume that the daily change of the
company’s stock on the stock market is a random variable with mean
0 and variance σ 2 . That is, if Sn represents the price of the stock on
day n with S0 given, then

Sn = Sn−1 + Xn , n ≥ 1

where X1 , X2 , . . . are independent, identically distributed continuous


random variables with mean 0 and variance σ 2 . Write an expression
for the probability that you do not recover your purchase price.

4. If you buy a lottery ticket in 50 independent lotteries, and in each


lottery your chance of winning a prize is 1/100, write down and evaluate
the probability of winning and also approximate the probability using
the Central Limit Theorem.

(a) exactly one prize,


4.3. THE CENTRAL LIMIT THEOREM 199

(b) at least one prize,


(c) at least two prizes.

Explain with a reason whether or not you expect the approximation to


be a good approximation.

5. Find a number k such that the probability is about 0.6 that the number
of heads obtained in 1000 tossings of a fair coin will be between 440
and k.

6. Find the moment generating function φX (t) = E [exp(tX)] of the ran-


dom variable X which takes values 1 with probability 1/2 and −1
with probability 1/2. Show directly (that
√ n is, without using Taylor
2
polynomial approximations) that φX (t/ n) → exp(t /2). (Hint: Use
L’Hospital’s Theorem to evaluate the limit, after taking logarithms of
both sides.)

7. A bank has $1,000,000 available to make for car loans. The loans are
in random amounts uniformly distributed from $5,000 to $20,000. How
many loans can the bank make with 99% confidence that it will have
enough money available?

8. An insurance company is concerned about health insurance claims.


Through an extensive audit, the company has determined that over-
statements (claims for more health insurance money than is justified by
the medical procedures performed) vary randomly with an exponential
distribution X with a parameter 1/100 which implies that E [X] = 100
and Var [X] = 1002 . The company can afford some overstatements sim-
ply because it is cheaper to pay than it is to investigate and counter-
claim to recover the overstatement. Given 100 claims in a month, the
company wants to know what amount of reserve will give 95% cer-
tainty that the overstatements do not exceed the reserve. (All units
are in dollars.) What assumptions are you using?

9. Modify the scripts to vary the upper bounds a and lower bound b (with
the other parameters fixed) and observe the difference of the empirical
probability and the theoretical probability.

10. Modify the scripts to vary the probability p (with the other parameters
fixed) and observe the difference of the empirical probability and the
200CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

theoretical probability. Make a conjecture about the difference as a


function of p (i.e. where is the difference increasing, decreasing.)

11. Modify the scripts to vary the number of trials n (with the other param-
eters fixed) and observe the difference of the empirical probability and
the theoretical probability. Test the rate of decrease of the deviation
with increasing n. Does it follow the predictions of the Berry-Esséen
Theorem?

Outside Readings and Links:


1. Virtual Laboratories in Probability and Statistics Search the page for
Normal Approximation to the Binomial Distribution and then run the
Binomial Timeline Experiment.

2. Central Limit Theorem explanation A good visual explanation of the


application of the Central Limit Theorem to sampling means.

3. Central Limit Theorem explanation Another lecture demonstration of


the application of the Central Limit Theorem to sampling means.

4.4 The Absolute Excess of Heads over Tails


Section Starter Question
What does the law of averages have to say about the probability of having a
fixed lead of say 20 Heads or more over Tails or 20 Tails or more over Heads
at the end of a coin flipping game of some fixed duration? What does the
Weak Law of Large Numbers have to say about having a fixed lead? What
does the Weak Law have to say about having a proportional lead, say 1%?
What does the Central Limit Theorem have to say about the lead?

Introduction
Probability theory generally has two classes of theorems about the results of
coin-tossing games and therefore random walks:

1. Those theorems that tell how well-behaved and natural are the out-
comes of typical coin-tossing games and random walks. The Weak Law
4.4. THE ABSOLUTE EXCESS OF HEADS OVER TAILS 201

of Large Numbers, the Strong Law of Large Numbers and the Central
Limit Theorem fall into this category.
2. Those theorems that tell how strange and unnatural are the outcomes
of typical coin-tossing games and random walks. The Arcsine Law and
the Law of the Iterated Logarithm are good examples in this category.
In this section we will ask two related questions about the net fortune in
a coin-tossing game:
1. What is the probability of an excess of a fixed number of heads over
tails or tails over heads at some fixed time in the coin-flipping game?
2. What is the probability that the number of heads exceeds the number
of tails or the number of tails exceeds the number of heads by some
fixed fraction of the number of tosses?
Using the Central Limit Theorem, we will be able to provide precise answers
to each question and then to apply the ideas to interesting questions in
gambling and finance.

The Half-Integer Correction to the Central Limit Theorem


Often when using the Central Limit Theorem to approximate a discrete dis-
tribution, especially the binomial distribution, we adopt the half-integer
correction, also called the continuity correction. The correction arises
because the binomial distribution has a discrete distribution while the stan-
dard normal distribution has a continuous distribution. For any integer s
and real value h with 0 ≤ h < 1 the binomial random variable Sn has
Pn [|Sn | ≤ s] = Pn [|Sn | ≤ s + h], yet the corresponding Central Limit Theo-
rem approximation with √ the standard normal cumulative distribution func-
tion, P [|Z| ≤ (s + h)/ n], increases as h increases from 0 to 1. It is cus-
tomary to take h = 1/2 to interpolate the difference. This choice is also
justified by looking at the approximation of the binomial with the normal,
see Figure 4.3.
Symbolically, the half-integer correction to the Central Limit Theorem is
Z ((b+1/2)−np)/√npq
1
Pn [a ≤ Sn ≤ b] ≈ √
√ exp(−u2 /2) du
((a−1/2)−np)/ npq 2π
(a − 1/2) − np
 

=P √ ≤ Z ≤ (b + 1/2) − np npq
npq
202CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

0.1

0.05

0
0 5 10 15 20 25 30 35
x

Figure 4.3: The half-integer correction: In the figure the binomial probability
is 0.7487. The simple normal approximation is 0.6809, but with the half-
integer correction the normal approximation is 0.7482.

for integers a and b.

The absolute excess of heads over tails

Consider the sequence of independent random variables Yi which take values


1 with probability 1/2 and −1 with probability 1/2. This is a mathematical
model of a fair coin flip game where a 1 results from “heads” on the ith
coin toss and a −1 results from “tails”. Let Hn P and Ln be the number of
heads and tails respectively in n flips. Then Tn = ni=1 Yi = Hn − Ln counts
the difference between the number of heads and tails, an excess of heads if
positive, and a “negative excess”, i.e. a deficit, if negative. Rather than the
clumsy extended phrase “the number of heads exceeds the number of tails or
the number of tails exceeds the number of heads” we can say “the absolute
excess of heads |Tn |.” The value Tn also represents the net “winnings”,
positive or negative, of a gambler in a fair coin flip game.

Corollary 5. Under the assumption that Yi = +1 with probability 1/2 and


4.4. THE ABSOLUTE EXCESS OF HEADS OVER TAILS 203

Yi = −1 with probability 1/2, and Tn = ni=1 Yi , then for an integer s


P

√ 
P [|Tn | > s] ≈ P |Z| ≥ (s + 1/2)/ n


where Z is a standard normal random variable with mean 0 and variance 1.


Proof. Note that µ = E [Yi ] = 0 and σ 2 = Var [Yi ] = 1.

Pn [|Tn | > s] = 1 − Pn [−s ≤ Tn ≤ s]


= 1 − Pn [−s − 1/2 ≤ Tn ≤ s + 1/2]
√ √ √ 
= 1 − Pn (−s − 1/2)/ n ≤ Tn / n ≤ (s + 1/2)/ n

√ √ 
≈ 1 − P (−s − 1/2)/ n ≤ Z ≤ (s + 1/2)/ n

√ 
= P |Z| ≥ (s + 1/2)/ n


The crucial step occurs at the approximation, and uses the Central Limit
Theorem. More precise statements of the Central Limit Theorem such as the
Berry-Esséen inequality can turn the approximation into a inequality.
If we take s to be fixed we now have the answer to our first question:
The probability of an absolute excess of heads over tails greater than a fixed
amount in a fair game of duration n approaches 1 as n increases.
The Central Limit Theorem in the form of the half-integer correction
above provides an alternative proof of the Weak Law of Large Numbers for
the specific case of the binomial random variable Tn . In fact,
   
Tn n + 1/2
Pn >  ≈ P |Z| ≥ √

n n

 
1/2
= P |Z| ≥  n + √ →0
n
as n → ∞.
Rewriting P Tnn >  = P [|Tn | > n] this restatement of the Weak Law
 

actually provides the answer to our second question: The probability that
the absolute excess of heads over tails is greater than a fixed fraction of the
flips in a fair game of duration n approaches 0 as n increases.
Finally, the half-integer correction gives an estimate on the central prob-
ability in a binomial distribution.
204CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

Corollary 6. √ 
Pn [Tn = 0] ≈ P |Z| < (1/2)/ n → 0


as n → ∞.
We can estimate this further:
Z 1/(2√n)
√  1 −u2 /2
P |Z| < (1/2)/ n = √

e du
2π −1/(2√n)
Z 1/(2√n)
1
=√ √
1 − u2 /2 + u4 /8 + . . . du
2π −1/(2 n)
1 1 1 1 1 1
=√ √ − √ 3/2
+ √ 5/2
+ ....
2π n 24 2π n 640 2π n

So we see that P [Tn = 0] goes to zero at the rate of 1/ n.

Illustration 1
What is the probability that the number of heads exceeds the number of tails
by more than 20 or the number of tails exceeds the number of heads by more
than 20 after 500 tosses of a fair coin? By the proposition, this is:
h √ i
P [|Tn | > 20] ≈ P |Z| ≥ 20.5/ 500 = 0.35925.

This is a reasonably large probability, and is larger than many people would
expect.
Figure 4.4 is a graph of the probability of at least s excess heads in 500
tosses of a fair coin:

Illustration 2
What is the probability that there is “about the same number of heads as
tails” in 500 tosses? Here we interpret “about the same” as within 5, that is,
an absolute difference of 1% or less of the number of tosses. Note that since
500 is even the difference in the number of heads and tails cannot be an odd
number, so must be either 0, 2 or 4.
h √ i
P [|T500 | < 5] ≈ P |Z| ≤ 5.5/ 500 = 0.19429
so it would be somewhat unusual (in that it occurs in less than 20% of games)
to have the number of heads and tails so close.
4.4. THE ABSOLUTE EXCESS OF HEADS OVER TAILS 205
Probability

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 10 20 30 40 50 60 70
x

Figure 4.4: Probability of the absolute excess of x heads or tails in 500 tosses.
206CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

Illustration 3
Suppose you closely follow a stock recommendation source whose methods
use technical analysis. You accept every bit of advice from this source about
trading stocks. You choose 10 stocks to buy, sell or hold every day based on
the recommendations. Each day for each stock you will gain or lose money
based on the advice. Note that it is possible to gain money even if the
advice says the stocks will decrease in value, say by short-selling or using put
options. How good can this strategy be? We will make this vague question
precise by asking “How good does the information from the technical analysis
have to be so that the probability of losing money over a year’s time is 1 in
10,000?”
The 10 stocks over 260 business days in a year means that there 2,600
daily gains or losses. Denote each daily gain or loss as Xi , if the advice is
correct you will gain Xi > 0 and if the advice is wrong you will lose Xi < 0.
P2600
We want the total change Xannual = i=1 Xi > 0 and we will measure that
by asking that P [Xannual < 0] be small. In the terms of this section, we are
interested in the complementary probability of an excess of successes over
failures.
We assume that the changes are random variables, identically distributed,
independent and the moments of all the random variables are finite. We
will make specific assumptions about the distribution later, for now these
assumptions are sufficient to apply the Central Limit Theorem. Then the
P2600
total change Xannual = i=1 Xi is approximately normally distributed with
mean µ = 2600 · E [X1 ] and variance σ 2 = 2600 · Var [X1 ]. Note that here
again we are using the uncentered and unscaled version of the Central Limit
Theorem. In symbols
" 2600
# Z b
(u − µ)2
 
X 1
P a≤ Xi ≤ b ≈ √ exp − du .
i=1 2πσ 2 a 2σ 2

We are interested in
"2600 # Z 0
(u − µ)2
 
X 1
P Xi ≤ 0 ≈ √ exp − du .
i=1 2πσ 2 −∞ 2σ 2

By the change of variables v = (u − µ)/σ, we can rewrite the probability as


Z −µ/σ
1  µ
P [Xannual ≤ 0] = √ 2

exp −v /2 dv = Φ −
2π −∞ σ
4.4. THE ABSOLUTE EXCESS OF HEADS OVER TAILS 207

so that the probability depends only on the ratio −µ/σ. We desire that
Φ(−µ/σ) = P [Xannual < 0] < 1/10,000. Then we can solve for −µ/σ ≈ −3.7.
Since µ = 2600·E [X1 ] and σ 2 = 2600·Var [X1 ], wepcalculate that for√the total
annual change to be a loss we must have E [X1 ] / Var [X1 ] ≈ (3.7/ 2600) =
0.073.
Now we consider what the requirement E [X1 ] = 0.07 · Var [X1 ] means
p

for specific distributions. If we assume that the individual changes


pXi are nor-
mally distributed with a positive mean, then we can use E [X1 ] / Var [X1 ] =
0.07 to calculate that P [X1 ] < 0 ≈ 0.47210, or about 47%. Then the proba-
bility of a prediction leading to a positive gain is about 53%. Alternatively,
if we assume that the individual changes Xi are binomial random variables
where the probability of a positive gain is P [X1 = 1] = p, then E [X1 ] = 2p−1
and Var [X1 ] = 4p(1 − p). We can use 2p − 1 = E [X1 ] = 0.07 Var [X1 ] =
0.07 · (4p(1 − p)) to solve for p. The result is p = 0.53483.
In either case, this means that any given piece of advice only has to have
a 53% chance of being correct in order to have a perpetual money-making
machine. Compare this with the strategy of using a coin flip to provide the
advice. Since we don’t observe any perpetual money-making machines, we
conclude that any advice about stock picking must be less than 53% reliable
or about the same as flipping a coin.
Now suppose that instead we have a computer algorithm predicting stock
movements for all publicly traded stocks, of which there are about 2,000.
Suppose further that we wish to restrict the chance that P [Xannual ] < 10−6 ,
that is 1 chance in a million. Then we can repeat the analysis to show that
the computer algorithm would only need to have P [X1 ] < 0 ≈ 0.49737,
practically indistinguishable from a coin flip, in order to make money. This
provides a statistical argument against the utility of technical analysis for
stock price prediction. Not losing money is not sufficient evidence to distin-
guish ability in stock-picking from coin-flipping.

Sources
This section is adapted from the article “Tossing a Fair Coin” by Leonard
Lipkin. The discussion of the continuity correction is adapted from The Con-
tinuity Correction in the section The Central Limit Theorem in the Virtual
Laboratories in Probability and Statistics. The third example in this section
is adapted from a presentation by Jonathan Kaplan of D.E. Shaw and Co.
in summer 2010.
208CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

Algorithms, Scripts, Simulations


Algorithm
The experiment is flipping a coin n times, and repeat the experiment k times.
Then compute the proportion for which the excess of heads over tails is more
than s. Compare this to the theoretical probability from the standard normal
distribution.

Scripts
Geogebra GeoGebra

R R script for Excess Heads.


1 p <- 0.5
2 n <- 500
3 k <- 1000
4 coinFlips <- array ( 0+( runif ( n * k ) <= p ) , dim = c (n , k ) )
5 # 0+ coerces Boolean to numeric
6 winLose = 2 * coinFlips - 1
7 # -1 for Tails , +1 for Heads
8 excessHeads <- colSums ( winLose )
9 # n .. n ( every other integer ) binomial rv sample
10 # the second argument 2 means c o l u m n w i s e
11
12 s <- 20
13 prob <- sum ( 0+( abs ( excessHeads ) > s ) ) / k
14 theoretical <- 2 * (1 - pnorm ( ( s +0.5) / sqrt ( n ) , mean =0 , sd =1)
)
15 cat ( sprintf ( " Empirical probability : % f \ n " , prob ) )
16 cat ( sprintf ( " Excess Heads estimate : % f \ n " , theoretical ) )

Octave Octave script for Excess Heads


1 p = 0.5;
2 n = 500;
3 k = 1000;
4
5 coinFlips = rand (n , k ) <= p ;
6 winLose = 2 * coinFlips - 1;
7 # -1 for Tails , +1 for Heads
8 excessHeads = sum ( winLose ) ;
4.4. THE ABSOLUTE EXCESS OF HEADS OVER TAILS 209

9 # -n .. n ( every other integer ) binomial rv sample , size k


10

11 s = 20;
12 prob = sum ( ( abs ( excessHeads ) > s ) ) / k ;
13 theoretical = 2*(1 - stdnormal_cdf ( ( s +0.5) / sqrt ( n ) ) ) ;
14 disp ( " Empirical probability : " ) , disp ( prob )
15 disp ( " Excess Heads estimate : " ) , disp ( theoretical )

Perl Perl PDL script for Excess Heads


1 use PDL :: NiceSlice ;
2
3 sub pnorm {
4 my ( $x , $sigma , $mu ) = @_ ;
5 $sigma = 1 unless defined ( $sigma ) ;
6 $mu = 0 unless defined ( $mu ) ;
7

8 return 0.5 * ( 1 + erf ( ( $x - $mu ) / ( sqrt (2) *


$sigma ) ) ) ;
9 }
10
11 $p = 0.5;
12 $n = 500;
13 $k = 1000;
14
15 # note order of dims !!
16 $coinFlips = random ( $k , $n ) <= $p ;
17
18 # 0.. n binomial r . v . sample , size k
19 # note transpose , PDL likes x ( row ) direction for
implicitly threaded operations
20 $headsTotal = $coinFlips - > transpose - > sumover ;
21
22 # note use of threading
23 $winLose = 2 * $coinFlips - 1;
24
25 # note xchg transpose , PDL likes x ( row ) direction for
implicity threaded operations
26 $excessHeads = ( $winLose - > xchg ( 0 , 1 ) -> sumover ) ;
27
28 $s = 20;
29 $prob = ( ( abs ( $excessHeads ) > $s ) -> sumover ) /
$k ;
210CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

30 $theoretical = 2 * ( 1 - pnorm ( ( $s + ( 1 / 2 ) ) / sqrt


( $n ) ) ) ;
31
32 print " Empirical probability : " , $prob ,
"\n";
33 print " Excess Heads theoretical estimate : " , $theoretical ,
"\n";

SciPy Scientific Python script for Excess Heads


1 import scipy
2
3 p = 0.5
4 n = 500
5 k = 1000
6
7 coinFlips = scipy . random . random (( n , k ) ) <= p
8 # Note Booleans True for Heads and False for Tails
9 winLose = 2* coinFlips - 1
10 excessHeads = scipy . sum ( winLose , axis = 0)
11
12 s = 20
13 prob = ( scipy . sum ( abs ( excessHeads ) > s ) ) . astype ( ’ float ’
)/k
14 # Note the casting of integer type to float to get float
15 from scipy . stats import norm
16 theoretical = 2*(1 - norm . cdf ( ( s +0.5) / scipy . sqrt ( n ) ) )
17
18 print " Empirical probability : " , prob
19 print " Excess heads theoretical estimate : " , theoretical

Key Concepts
1. The probability that the number of heads exceeds the number of tails or
the number of tails exceeds the number of heads in a sequence of coin-
flips by some fixed amount can be estimated with the Central Limit
Theorem and the probability gets close to 1 as the number of tosses
grows large.
4.4. THE ABSOLUTE EXCESS OF HEADS OVER TAILS 211

2. The probability that the number of heads exceeds the number of tails
or the number of tails exceeds the number of heads in a sequence of
coin-flips by some fixed proportion can be estimated with the Central
Limit Theorem and the probability gets close to 0 as the number of
tosses grows large.

Vocabulary
1. The half-integer correction, also called the continuity correction
arises because the distribution of the binomial distribution is a discrete
distribution, while the standard normal distribution is a continuous
distribution.

Problems to Work for Understanding


1. (a) What is the approximate probability that the number of heads is
within 10 of the number of tails, that is, a difference of 2% or less
of the number of tosses in 500 tosses?
(b) What is the approximate probability that the number of heads is
within 20 of the number of tails, that is, a difference of 4% or less
of the number of tosses in 500 tosses?
(c) What is the approximate probability that the number of heads is
within 25 of the number of tails, that is, a difference of 5% or less
of the number of tosses in 500 tosses?
(d) Derive and then graph a simple power function that gives the
approximate probability that the number of heads is within x of
the number of tails in 500 tosses, for 0 ≤ x ≤ 500.
2. (a) What is the probability that the number of heads is within 10
of the number of tails, that is, a difference of 1% or less of the
number of tosses in 1000 tosses?
(b) What is the probability that the number of heads is within 10
of the number of tails, that is, a difference of 0.5% or less of the
number of tosses in 2000 tosses?
(c) What is the probability that the number of heads is within 10
of the number of tails, that is, a difference of 0.2% or less of the
number of tosses in 5000 tosses?
212CHAPTER 4. LIMIT THEOREMS FOR STOCHASTIC PROCESSES

(d) Derive and then graph a simple power function of n that gives the
approximate probability that the number of heads is within 10 of
the number of tails, that is, a difference of 100 · 10/n% or less of
the number of tosses in n tosses.

3. Derive the rate, as a function of n, that the probability of heads exceeds


tails by a fixed value s approaches 1 as n → ∞.

4. Derive the rate, as a function of n, that the probability of heads exceeds


tails by a fixed fraction  approaches 0 as n → ∞.

5. Calculate the exact value of P [|T500 | < 5] in Illustration 2 and compare


it to the approximation.

Outside Readings and Links:


1. Virtual Laboratories in Probability and Statistics. Search the page for
Random Walk Experiment and run the Last Visit to Zero experiment.

2. Virtual Laboratories in Probability and Statistics. Search the page for


Ballot Experiment and run the Ballot Experiment.
Chapter 5

Brownian Motion

5.1 Intuitive Introduction to Diffusions


Section Starter Question

Suppose you wanted to display the function y = x with a computer plotting
program or a graphing calculator. Describe the process to choose a proper
window to display the graph.

Visualizing Limits of Random Walks


The question is “How should we set up the limiting process so that we can
make a continuous time limit of the discrete time random walk?” First we
consider a discovery approach to this question by asking what do we require
so that we can visualize the limiting process. Next we take a probabilistic
view using the Central Limit Theorem to justify the limiting process to pass
from a discrete probability distribution to a probability density function.
Finally, we consider the limiting process to a differential equation derived
from the difference equation that is the result of first-step analysis.

The Random Walk


Consider a random walk starting at the origin. The nth step takes the walker
to the position Tn = Y1 + · · · + Yn , the sum of n independent, identically
distributed Bernoulli random variables Yi assuming the values +1 and −1
with probabilities p and q = 1 − p respectively. Then recall that the mean of

213
214 CHAPTER 5. BROWNIAN MOTION

−4 −3 −2 −1 0 1 2 3 4

Figure 5.1: Image of a possible random walk in phase line after an odd
number of steps.

a sum of random variables is the sum of the means:

E [Tn ] = (p − q)n

and the variance of a sum of independent random variables is the sum of the
variances:
Var [Tn ] = 4pqn.

Trying to use the mean to derive the limit


Now suppose we want to display a video of the random walk moving left and
right along the x-axis. This would be a video of the “phase line” diagram of
the random walk. Suppose we want the video to display 1 million steps and
be a reasonable length of time, say 1000 seconds, between 16 and 17 minutes.
This fixes the time scale at a rate of one step per millisecond. What should
be the window in the screen to get a good sense of the random walk? For
this question, we use a fixed unit of measurement, say centimeters, for the
width of the screen and the individual steps. Let δ be the length of the steps.
To find the window to display the random walk on the axis, we then need to
know the size of δ · Tn . Now

E [δ · Tn ] = δ · (p − q)n

and
Var [δ · Tn ] = δ 2 · 4pqn.
We want n to be large (about 1 million) and to see the walk on the screen
we want the expected end place to be comparable to the screen size, say 30
cm. That is,
E [δ · Tn ] = δ · (p − q)n < δ · n ≈ 30 cm
5.1. INTUITIVE INTRODUCTION TO DIFFUSIONS 215

so δ must be 3 × 10−5 cm to get the end point on the screen. But then the
movement of the walk measured by the standard deviation
p √
Var [δ · Tn ] ≤ δ · n = 3 × 10−2 cm

will be so small as to be indistinguishable. We will not see any random


variations!

Trying to use the variance to derive the limit


Let us turn the question around: We want to see the variations in many-step
random walks, so the standard deviations must be a reasonable fraction D
of the screen size
p √
Var [δ · Tn ] ≤ δ · n ≈ D · 30 cm .

For n = 106 this is possible if δ = D · 3 × 10−2 cm . We still want to be able


to see the expected ending position which will be

E [δ · Tn ] = δ · (p − q)n = (p − q) · D · 3 × 104 cm .

To be consistent with the requirement that the ending position is on the


screen this will only be possible if (p − q) ≈ 10−3 . That is, p − q must be at
most comparable in magnitude to δ = 3 × 10−2 .

The limiting process


Now generalize these results to visualize longer and longer walks in a fixed
amount of time. Since δ → 0 as n → ∞, then likewise (p − q) → 0, while
p + q = 1, so p → 1/2. The analytic formulation of the problem is as follows.
Let δ be the size of the individual steps, let r be the number of steps per unit
time. We ask what happens to the random walk in the limit where δ → 0,
r → ∞, and p → 1/2 in such a manner that:

(p − q) · δ · r → c

and
4pq · δ 2 · r → D.
Each of these says that we should consider symmetric (p = 1/2 = q) random
walks with step size inversely proportional to the square root of the stepping
rate.
216 CHAPTER 5. BROWNIAN MOTION

The limiting process taking the discrete time random walk to a contin-
uous time process is delicate. It is delicate because we are attempting to
scale in two variables, the step size or space variable and the stepping rate
or time variable, simultaneously. The variables are not independent, two
relationships connect them, one for the expected value and one for the vari-
ance. Therefore we expect that the scaling is only possible when the step size
and stepping rate have a special relationship, namely the step size inversely
proportional to the square root of the stepping rate.

Probabilistic Solution of the Limit Question

In our accelerated random walk, consider the nth step at time t = n/r and
consider the position on the line x = k · δ. Let

vk,n = P [δ · Tn = kδ]

be the probability that the nth step is at position k. We are interested in the
probability of finding the walk at given instant t and in the neighborhood of
a given point x, so we investigate the limit of vk,n as n/r → t, and k · δ → x
with the additional conditions that (p − q) · δ · r → c and 4pq · δ 2 · r → D.
Remember that the random walk can only reach an even-numbered posi-
tion after an even number of steps, and an odd-numbered position after an
odd number of steps. Therefore in all cases n + k is even and (n + k)/2 is
an integer. Likewise n − k is even and (n − k)/2 is an integer. We reach
position k at time step n if the walker takes (n + k)/2 steps to the right and
(n − k)/2 steps to the left. The mix of steps to the right and the left can
be in any order. So the walk δ · Tn reaches position kδ at step n = rt with
binomial probability

 
n
vk,n = p(n+k)/2 q (n−k)/2 .
(n + k)/2
5.1. INTUITIVE INTRODUCTION TO DIFFUSIONS 217

From the Central Limit Theorem


P [δ · Tn = k · δ] = P [(k − 1) · δ < δ · Tn < (k + 1) · δ]
" #
(k − 1)δ − (p − q)δn δTn − (p − q)δn (k + 1)δ − (p − q)δn
=P p < p < p
4pqδ 2 n 4pqδ 2 n 4pqδ 2 n
Z (k+1)δ−(p−q)δn

4pqδ 2 n 1 2
≈ √ e−u /2 du
(k−1)δ−(p−q)δn
√ 2π
4pqδ 2 n
Z (k+1)δ
1 2 2
= p e−(z−(p−q)δn) /(2·4pqδ n) dz
(k−1)δ 2π · 4pqδ 2 n
2δ 2 2
≈p e−(kδ−(p−q)δn) /(2·4pqδ n)
2π · 4pqδ n 2

2δ 2 2
≈p e−(kδ−(p−q)δrt) /(2·4pqδ rt)
2π · 4pqδ 2 rt
2δ 2
=√ e−(x−ct) /(2·Dt) .
2πDt

Similarly
b
−(x − ct)2
 
1
Z
P [a · δ < δ · Tn · δ < bδ] → √ exp dt .
2πDt a 2Dt
The integral on the right may be expressed in terms of the standard normal
cumulative distribution function.
Note that we derived the limiting approximation of the binomial distri-
bution
−(x − ct)2
   

vk,n ∼ √ exp
2πDt 2Dt
by applying the general form of the Central Limit Theorem. However, it
is possible to derive this limit directly through careful analysis. The direct
derivation is the de Moivre-Laplace Limit Theorem and it is the most basic
form of the Central Limit Theorem.

Differential Equation Solution of the Limit Question


Another method is to start from the difference equations governing the ran-
dom walk, and then pass to a differential equation in the limit. Later we can
218 CHAPTER 5. BROWNIAN MOTION

generalize the differential equation and find that the generalized equations
govern new continuous-time stochastic processes. Since differential equations
have a well-developed theory and many tools to manipulate, transform and
solve them, this method turns out to be useful.
Consider the position of the walker in the random walk at the nth and
(n + 1)st trial. Through a first step analysis the probabilities vk,n satisfy the
difference equations:

vk,n+1 = p · vk−1,n + q · vk+1,n .

In the limit as k → ∞ and n → ∞, vk,n will be the sampling of the function


v(t, x) at time intervals r, so that n = rt, and space intervals so that kδ =
x. That is, the function v(t, x) should be an approximate solution of the
difference equation:

v(t + r−1 , x) = pv(t, x − δ) + qv(t, x + δ).

We assume v(t, x) is a smooth function so that we can expand v(t, x) in a


Taylor series at any point. Using the first order approximation in the time
variable on the left, and the second-order approximation on the right in the
space variable, we get (after canceling the leading terms v(t, x) )

∂v(t, x) ∂v(t, x) 1 2 ∂ 2 v(t, x)


= (q − p) · δr + δ r .
∂t ∂x 2 ∂x2
In our passage to limit, the omitted terms of higher order tend to zero, so
we neglect them. The remaining coefficients are already accounted for in our
limits and so the equation becomes:

∂v(t, x) ∂v(t, x) 1 ∂ 2 v(t, x)


= −c + D .
∂t ∂x 2 ∂x2
This is a special diffusion equation, more specifically, a diffusion equation
with convective or drift terms, also known as the Fokker-Planck equation for
diffusion. It is a standard problem to solve the differential equation for v(t, x)
and therefore, we can find the probability of being at a certain position at a
certain time. One can verify that

−[x − ct]2
 
1
v(t, x) = √ exp
2πDt 2Dt
5.1. INTUITIVE INTRODUCTION TO DIFFUSIONS 219

is a solution of the diffusion equation, so we reach the same probability


distribution for v(t, x).
The diffusion equation can be immediately generalized by permitting the
coefficients c and D to depend on x, and t. Furthermore, the equation
possesses obvious analogues in higher dimensions and all these generalization
can be derived from general probabilistic postulates. We will ultimately
describe stochastic processes related to these equations as diffusions.

Sources
This section is adapted from W. Feller, in Introduction to Probability Theory
and Applications, Volume I, Chapter XIV, page 354.

Key Concepts
1. This section introduces the passage from discrete random walks to con-
tinuous time stochastic processes from the probability point of view and
the partial differential equation point of view.

2. To get a sensible passage from discrete random walks to a continuous


time stochastic process the step size must be inversely proportional to
the square root of the stepping rate.

Vocabulary
1. A diffusion process, or a diffusion for short, is a Markov process for
which all sample functions are continuous.

Problems to Work for Understanding


1. Consider a random walk with a step to right having probability p and a
step to the left having probability q. The step length is δ. The walk is
taking r steps per minute. What is the rate of change of the expected
final position and the rate of change of the variance? What must we
require on the quantities p, q, r and δ in order to see the entire random
walk with more and more steps at a fixed size in a fixed amount of
time?
220 CHAPTER 5. BROWNIAN MOTION

2. Verify the limit taking to show that


−[x − ct]2
 
1
vk,n ∼√ exp .
2πDt 2Dt

3. Show that
−[x − ct]2
 
1
v(t, x) = √ exp
2πDt 2Dt
is a solution of
∂v(t, x) ∂v(t, x) 1 ∂ 2 v(t, x)
= −c + D
∂t ∂x 2 ∂x2
by substitution.

Outside Readings and Links:


1. Brownian Motion in Biology. A simulation of a random walk of a sugar
molecule in a cell.

2. Virtual Laboratories in Probability and Statistics. Search the page for


Random Walk Experiment.

5.2 The Definition of Brownian Motion and


the Wiener Process
Section Starter Question
Some mathematical objects are defined by a formula or an expression. Some
other mathematical objects are defined by their properties, not explicitly by
an expression. That is, the objects are defined by how they act, not by what
they are. Can you name a mathematical object defined by its properties?

Definition of Wiener Process


Brownian motion is the physical phenomenon named after the English
botanist Robert Brown who discovered it in 1827. Brownian motion is the
zig-zagging motion exhibited by a small particle, such as a grain of pollen,
immersed in a liquid or a gas. Albert Einstein gave the first explanation of
5.2. THE DEFINITION OF BROWNIAN MOTION AND THE WIENER PROCESS221

this phenomenon in 1905. He explained Brownian motion by assuming the


immersed particle was constantly buffeted by the molecules of the surround-
ing medium. Since then the abstracted process has been used for modeling
the stock market and in quantum mechanics. The Wiener process is the
mathematical definition and abstraction of the physical process as a stochas-
tic process. The American mathematician Norbert Wiener gave the definition
and properties in a series of papers starting in 1918. Generally, the terms
Brownian motion and Wiener process are the same, although Brownian
motion emphasizes the physical aspects and Wiener process emphasizes the
mathematical aspects. Bachelier process means the same thing as Brow-
nian motion and Wiener process. In 1900, Louis Bachelier introduced the
limit of random walk as a model for prices on the Paris stock exchange, and
so is the originator of the mathematical idea now called Brownian motion.
This term is occasionally found in financial literature.
Previously we considered a discrete time random process. That is, at
discrete times n = 1, 2, 3, . . . corresponding to coin flips, we considered a
sequence of random variables Tn . We are now going to consider a continuous
time random process, a function W (t) that is a random variable at each time
t ≥ 0. To say W (t) is a random variable at each time is too general so we
must put more restrictions on our process to have something interesting to
study.
Definition (Wiener Process). The Standard Wiener Process is a stochas-
tic process W (t), for t ≥ 0, with the following properties:

1. Every increment W (t)−W (s) over an interval of length t−s is normally


distributed with mean 0 and variance t − s, that is

W (t) − W (s) ∼ N (0, t − s).

2. For every pair of disjoint time intervals [t1 , t2 ] and [t3 , t4 ], with t1 <
t2 ≤ t3 < t4 , the increments W (t4 ) − W (t3 ) and W (t2 ) − W (t1 ) are
independent random variables with distributions given as in part 1, and
similarly for n disjoint time intervals where n is an arbitrary positive
integer.

3. W (0) = 0.

4. W (t) is continuous for all t.


222 CHAPTER 5. BROWNIAN MOTION

Note that property 2 says that if we know W (s) = x0 , then the inde-
pendence (and W (0) = 0) tells us that further knowledge of the values of
W (τ ) for τ < s give no added knowledge of the probability law governing
W (t) − W (s) with t > s. More formally, this says that if 0 ≤ t0 < t1 < . . . <
tn < t, then

P [W (t) ≥ x | W (t0 ) = x0 , W (t1 ) = x1 , . . . W (tn ) = xn ]


= P [W (t) ≥ x | W (tn ) = xn ] .

This is a statement of the Markov property of the Wiener process.


Recall that the sum of independent random variables that are respectively
normally distributed with mean µ1 and µ2 and variances σ12 and σ22 is a
normally distributed random variable with mean µ1 +µ2 and variance σ12 +σ22 ,
(see Moment Generating Functions.) Therefore for increments W (t3 )−W (t2 )
and W (t2 )−W (t1 ) the sum W (t3 )−W (t2 )+W (t2 )−W (t1 ) = W (t3 )−W (t1 ) is
normally distributed with mean 0 and variance t3 −t1 as we expect. Property
2 of the definition is consistent with properties of normal random variables.
Let
1
p(x, t) = √ exp(−x2 /(2t))
2πt
denote the probability density for a N (0, t) random variable. Then to derive
the joint density of the event

W (t1 ) = x1 , W (t2 ) = x2 , . . . W (tn ) = xn

with t1 < t2 < . . . < tn , it is equivalent to know the joint probability density
of the equivalent event

W (t1 )−W (0) = x1 , W (t2 )−W (t1 ) = x2 −x1 , . . . , W (tn )−W (tn−1 ) = xn −xn−1 .

Then by part 2, we immediately get the expression for the joint probability
density function:

f (x1 , t1 ; x2 , t2 ; . . . ; xn , tn ) = p(x1 , t)p(x2 −x1 , t2 −t1 ) . . . p(xn −xn−1 , tn −tn−1 ).


5.2. THE DEFINITION OF BROWNIAN MOTION AND THE WIENER PROCESS223

20000
Value

19000

18000

17000

16000

15000
Mar 2015

Apr 2015

May 2015

Jun 2015

Jul 2015

Aug 2015

Sep 2015

Oct 2015

Nov 2015

Dec 2015

Jan 2016

Feb 2016

Figure 5.2: Graph of the Dow-Jones Industrial Average from February 17,
2015 to February 16, 2016 (blue line) and a random walk with normal incre-
ments with the same initial value and variance (red line).
224 CHAPTER 5. BROWNIAN MOTION

Comments on Modeling Security Prices with the Wiener Process


A plot of security prices over time and a plot of one-dimensional Brownian
motion versus time has at least a superficial resemblance.
If we were to use Brownian motion to model security prices (ignoring for
the moment that security prices are better modeled with the more sophisti-
cated geometric Brownian motion rather than simple Brownian motion) we
would need to verify that security prices have the 4 defining properties of
Brownian motion.

1. The assumption of normal distribution of stock price changes seems to


be a reasonable first assumption. Figure 5.3 illustrates this reasonable
agreement. The Central Limit Theorem provides a reason to believe
the agreement, assuming the requirements of the Central Limit The-
orem are met, including independence. (Unfortunately, although the
figure shows what appears to be reasonable agreement a more rigorous
statistical analysis shows that the data distribution does not match
normality.)
Another good reason for still using the assumption of normality for
the increments is that the normal distribution is easy to work with.
The normal probability density uses simple functions familiar from
calculus, the normal cumulative probability distribution is tabulated,
the moment-generating function of the normal distribution is easy to
use, and the sum of independent normal distributions is again nor-
mal. A substitution of another distribution is possible but the resulting
stochastic process models are difficult to analyze, beyond the scope of
this model.
However, the assumption of a normal distribution ignores the small
possibility that negative stock prices could result from a large negative
change. This is not reasonable. (The log normal distribution from geo-
metric Brownian motion that avoids this possibility is a better model).
Moreover, the assumption of a constant variance on different intervals
of the same length is not a good assumption since stock volatility itself
seems to be volatile. That is, the variance of a stock price changes and
need not be proportional to the length of the time interval.

2. The assumption of independent increments seems to be a reasonable as-


sumption, at least on a long enough term. From second to second, price
5.2. THE DEFINITION OF BROWNIAN MOTION AND THE WIENER PROCESS225

0.5

0.4

0.3
Frequency

0.2

0.1

0.0
−5 −4 −3 −2 −1 0 1 2 3 4 5
Normalized Daily Changes

Figure 5.3: A standardized density histogram of 1000 daily close-to-close


returns on the S & P 500 Index, from February 29, 2012 to March 1, 2012,
up to February 21, 2016 to February 22, 2016.
226 CHAPTER 5. BROWNIAN MOTION

increments are probably correlated. From day to day, price increments


are probably independent. Of course, the assumption of independent
increments in stock prices is the essence of what economists call the
Efficient Market Hypothesis, or the Random Walk Hypothesis, which
we take as a given in order to apply elementary probability theory.

3. The assumption of W (0) = 0 is simply a normalizing assumption and


needs no discussion.

4. The assumption of continuity is a mathematical abstraction of the col-


lected data, but it makes sense. Securities trade second by second or
minute by minute so prices jump discretely by small amounts. Ex-
amined on a scale of day by day or week by week, then the short-time
changes are tiny and in comparison prices seem to change continuously.

At least as a first assumption, we will try to use Brownian motion as


a model of stock price movements. Remember the mathematical modeling
proverb quoted earlier: All mathematical models are wrong, some mathe-
matical models are useful. The Brownian motion model of stock prices is at
least moderately useful.

Conditional Probabilities
According to the defining property 1 of Brownian motion, we know that if
s < t, then the conditional density of X(t) given X(s) = B is that of a
normal random variable with mean B and variance t − s. That is,

−t(x − B)2
 
1
P [X(t) ∈ (x, x + ∆x) | X(s) = B] ≈ p exp ∆x.
2π(t − s) 2s(t − s)

This gives the probability of Brownian motion being in the neighborhood of


x at time t, t − s time units into the future, given that Brownian motion is
at B at time s, the present.
However the conditional density of X(s) given that X(t) = B, s < t is
also of interest. Notice that this is a much different question, since s is “in
the middle” between 0 where X(0) = 0 and t where X(t) = B. That is, we
seek the probability of being in the neighborhood of x at time s, t − s time
units in the past from the present value X(t) = B.
5.2. THE DEFINITION OF BROWNIAN MOTION AND THE WIENER PROCESS227

Theorem 15. The conditional distribution of X(s), given X(t) = B, s < t,


is normal with mean Bs/t and variance (s/t)(t − s).

P [X(s) ∈ (x, x + ∆x) | X(t) = B]


−(x − Bs/t)2
 
1
≈p exp ∆x.
2π(s/t)(t − s) 2(t − s)

Proof. The conditional density is

fs | t (x | B) = (fs (x)ft−s (B − x))/ft (B)


 2
−x (B − x)2

= K1 exp −
2s 2(t − s)
   
2 1 1 Bx
= K2 exp −x + +
2s 2(t − s) t−s
−t
 
2sBx
= K2 exp · x2 −
2s(t − s) t
2
−t(x − Bs/t)
 
= K3 exp
2s(t − s)

where K1 , K2 , and K3 are


√ constants that do not depend onp x. For example,
K1 is the product of 1/ 2πs from the fs (x) term, and 1/ 2π(t − s) from
the ft−s (B − x) term, times the 1/ft (B) term in the denominator. The K2
term multiplies in an exp(−B 2 /(2(t − s))) term. The K3 term comes from
the adjustment in the exponential to account for completing the square. We
know that the result is a conditional density, so the K3 factor must be the
correct normalizing factor, and we recognize from the form that the result is
a normal distribution with mean Bs/t and variance (s/t)(t − s).

Corollary 7. The conditional density of X(t) for t1 < t < t2 given X(t1 ) =
A and X(t2 ) = B is a normal density with mean

B−A
 
A+ (t − t1 )
t2 − t1

and variance
(t − t1 )(t2 − t)
.
(t2 − t1 )
228 CHAPTER 5. BROWNIAN MOTION

Proof. X(t) subject to the conditions X(t1 ) = A and X(t2 ) = B has the
same density as the random variable A + X(t − t1 ), under the condition
X(t2 − t1 ) = B − A by condition 2 of the definition of Brownian motion.
Then apply the theorem with s = t − t1 and t = t2 − t1 .

Sources
The material in this section is drawn from A First Course in Stochastic
Processes by S. Karlin, and H. Taylor, Academic Press, 1975, pages 343–345
and Introduction to Probability Models by S. Ross, pages 413-416.

Algorithms, Scripts, Simulations


Algorithm
Simulate a sample path of the Wiener process as follows, see [29]. Divide
the interval [0, T ] into a grid 0 = t0 < t1 < . . . < tN −1 < tN = T with
ti+1 − ti = ∆t. Set i = 1 and W (0) = W (t0 ) = 0 and iterate the following
algorithm.

1. Generate a new random number z from the standard normal distribu-


tion.

2. Set i to i + 1.

3. Set W (ti ) = W (ti−1 ) + z ∆t.

4. If i < N , iterate from step 1.

This method of approximation is valid only on the points of the grid. In


between any two points ti and ti−1 , the Wiener process is approximated by
linear interpolation.

Scripts
Geogebra GeoGebra

R R script for Wiener process.


5.2. THE DEFINITION OF BROWNIAN MOTION AND THE WIENER PROCESS229

1 N <- 100
2 # number of end - points of the grid including T
3 T <- 1
4 # length of the interval [0 , T ] in time units
5 Delta <- T / N
6 # time increment
7 W <- numeric ( N +1)
8 # initialization of the vector W approximating
9 # Wiener process
10 t <- seq (0 ,T , length = N +1)
11 W <- c (0 , cumsum ( sqrt ( Delta ) * rnorm ( N ) ) )
12 plot ( t , W , type = " l " , main = " Wiener process " , ylim = c ( -1 ,1)
)

Octave Octave script for Wiener process


1 N = 100;
2 # number of end - points of the grid including T
3 T = 1;
4 # length of the interval [0 , T ] in time units
5 Delta = T / N ;
6 # time increment
7 W = zeros (1 , N +1) ;
8 # initialization of the vector W approximating
9 # Wiener process
10 t = (0: Delta : T ) ;
11 W (2: N +1) = cumsum ( sqrt ( Delta ) * stdnormal_rnd (1 , N ) ) ;
12

13 plot (t , W )
14 axis ([0 ,1 , -1 ,1])
15 title ( " Wiener process " )

Perl Perl PDL script for Winer process


1 use PDL :: NiceSlice ;
2
3 # number of end - points of the grid including T
4 $N = 100;
5

6 # length of the interval [0 , T ] in time units


7 $T = 1;
230 CHAPTER 5. BROWNIAN MOTION

8
9 # time increment
10 $Delta = $T / $N ;
11
12 # initialization of the vector W approximating
13 # Wiener process
14 $W = zeros ( $N + 1 ) ;
15

16 $t = zeros ( $N + 1 ) -> xlinvals ( 0 , 1 ) ;


17 $W ( 1 : $N ) .= cumusumover ( sqrt ( $Delta ) * grandom ( $N )
);
18
19 print " Simulation of the Wiener process : " , $W , " \ n " ;
20

21 # # optional file output to use with external plotting


programming
22 # # such as gnuplot , R , octave , etc .
23 # # Start gnuplot , then from gnuplot prompt
24 ## plot " wienerprocess . dat " with lines
25 # open ( F , " > wienerprocess . dat " ) || die " cannot write : $
! ";
26 # foreach $j ( 0 .. $N ) {
27 # print F $t - > range ( [ $j ] ) , " " , $W - > range ( [ $j ] ) ,
"\ n ";
28 # }
29 # close ( F ) ;

SciPy Scientific Python script for Wiener process


1 import scipy
2
3 N = 100
4 T = 1.
5 Delta = T / N
6
7 # initialization of the vector W approximating
8 # Wiener process
9 W = scipy . zeros ( N +1)
10
11 t = scipy . linspace (0 , T , N +1) ;
12 W [1: N +1] = scipy . cumsum ( scipy . sqrt ( Delta ) * scipy . random .
standard_normal ( N ) )
13
14 print " Simulation of the Wiener process :\ n " , W
5.2. THE DEFINITION OF BROWNIAN MOTION AND THE WIENER PROCESS231

15
16 # # optional file output to use with external plotting
programming
17 # # such as gnuplot , R , octave , etc .
18 # # Start gnuplot , then from gnuplot prompt
19 ## plot " wienerprocess . dat " with lines
20 # f = open ( ’ wienerprocess . dat ’, ’w ’)
21 # for j in range (0 , N +1) :
22 # f . write ( str ( t [ j ]) + ’ ’+ str ( W [ j ]) + ’\ n ’) ;
23
24 # f . close ()

Key Concepts
1. We define Brownian motion in terms of the normal distribution of the
increments, the independence of the increments, the value at 0, and its
continuity.

2. The joint density function for the value of Brownian motion at several
times is a multivariate normal distribution.

Vocabulary
1. Brownian motion is the physical phenomenon named after the En-
glish botanist Robert Brown who discovered it in 1827. Brownian mo-
tion is the zig-zagging motion exhibited by a small particle, such as a
grain of pollen, immersed in a liquid or a gas. Albert Einstein gave the
first explanation of this phenomenon in 1905. He explained Brownian
motion by assuming the immersed particle was constantly buffeted by
the molecules of the surrounding medium. Since then the abstracted
process has been used for modeling the stock market and in quantum
mechanics.

2. The Wiener process is the mathematical definition and abstraction of


the physical process as a stochastic process. The American mathemati-
cian Norbert Wiener gave the definition and properties in a series of
papers starting in 1918. Generally, the terms Brownian motion and
Wiener process are the same, although Brownian motion emphasizes
232 CHAPTER 5. BROWNIAN MOTION

the physical aspects and Wiener process emphasizes the mathematical


aspects.
3. Bachelier process means the same thing as Brownian motion and
Wiener process. In 1900, Louis Bachelier introduced the limit of ran-
dom walk as a model for prices on the Paris stock exchange, and so is
the originator of the mathematical idea now called Brownian motion.
This term is occasionally found in financial literature.

Problems to Work for Understanding


1. Let W (t) be standard Brownian motion.
(a) Find the probability that 0 < W (1) < 1.
(b) Find the probability that 0 < W (1) < 1 and 1 < W (2) − W (1) <
3.
(c) Find the probability that 0 < W (1) < 1 and 1 < W (2)−W (1) < 3
and 0 < W (3) − W (2) < 1/2.
2. Let W (t) be standard Brownian motion.
(a) Find the probability that 0 < W (1) < 1.
(b) Find the probability that 0 < W (1) < 1 and 1 < W (2) < 3.
(c) Find the probability that 0 < W (1) < 1 and 1 < W (2) < 3 and
0 < W (3) < 1/2.
(d) Explain why this problem is different from the previous problem,
and also explain how to numerically evaluate to the probabilities.
3. Explicitly write the joint probability density function for W (t1 ) = x1
and W (t2 ) = x2 .
4. Let W (t) be standard Brownian motion.
(a) Find the probability that W (5) ≤ 3 given that W (1) = 1.
(b) Find the number c such that Pr[W (9) > c | W (1) = 1] = 0.10.
5. Let Z be a normally distributed random variable, with mean 0 and
variance 1, Z ∼ N
√(0, 1). Then consider the continuous time stochastic
process X(t) = tZ. Show that the distribution of X(t) is normal
with mean 0 and variance t. Is X(t) a Brownian motion?
5.2. THE DEFINITION OF BROWNIAN MOTION AND THE WIENER PROCESS233

6. Let W1 (t) be a Brownian motion and W2 (t) be another independent


Brownian motion, and ρ is a constant
p between −1 and 1. Then consider
the process X(t) = ρW1 (t) + 1 − ρ2 W2 (t). Is this X(t) a Brownian
motion?

7. What is the distribution of W (s) + W (t), for 0 ≤ s ≤ t? (Hint:


Note that W (s) and W (t) are not independent. But you can write
W (s) + W (t) as a sum of independent variables. Done properly, this
problem requires almost no calculation.)

8. For two random variables X and Y , statisticians call

Cov(X, Y ) = E[(X − E[X])(Y − E[Y ])]

the covariance of X and Y . If X and Y are independent, then


Cov(X, Y ) = 0. A positive value of Cov(X, Y ) indicates that Y tends
to increases as X does, while a negative value indicates that Y tends
to decrease when X increases. Thus, Cov(X, Y ) is an indication of the
mutual dependence of X and Y . Show that

Cov(W (s), W (t)) = E[W (s)W (t)] = min(t, s)

9. Show that the probability density function


1
p(t; x, y) = √ exp(−(x − y)2 /(2t))
2πt
satisfies the partial differential equation for heat flow (the heat equa-
tion)
∂p 1 ∂ 2p
=
∂t 2 ∂x2
10. Change the scripts to simulate the Wiener process

(a) over intervals different from [0, 1], both longer and shorter,
(b) with more grid points, that is, smaller increments,
(c) with several simulations on the same plot.

Discuss how changes in the parameters of the simulation change the


Wiener process.
234 CHAPTER 5. BROWNIAN MOTION

11. Choose a stock index such as the S & P 500, the Wilshire 5000, etc., and
obtain closing values of that index for a year-long (or longer) interval
of trading days. Find the variance of the closing values and create
a random walk on the same interval with the same initial value and
variance. Plot both sets of data on the same axes, as in Figure 5.2.
Discuss the similarities and differences.

12. Choose an individual stock or a stock index such as the S & P 500, the
Wilshire 5000, etc., and obtain values of that index at regular intervals
such as daily or hourly for a long interval of trading. Find the regular
differences, and normalize by subtracting the mean and dividing by the
standard deviation. Simultaneously plot a histogram of the differences
and the standard normal probability density function. Discuss the
similarities and differences.

Outside Readings and Links:


1. Copyright 1967 by Princeton University Press, Edward Nelson. On line
book Dynamical Theories of Brownian Motion. It has a great historical
review about Brownian motion.

2. National Taiwan Normal University, Department of Physics A simula-


tion of Brownian motion that also allows you to change certain param-
eters.

3. Department of Mathematics,University of Utah, Jim Carlson A Java


applet demonstrates Brownian Paths noticed by Robert Brown.

4. Department of Mathematics,University of Utah, Jim Carlson Some ap-


plets demonstrate Brownian motion, including Brownian paths and
Brownian clouds.

5. School of Statistics,University of Minnesota, Twin Cities,Charlie Geyer


An applet that draws one-dimensional Brownian motion.
5.3. APPROXIMATION OF BROWNIAN MOTION BY COIN-FLIPPING SUMS235

5.3 Approximation of Brownian Motion by


Coin-Flipping Sums
Section Starter Question
Suppose you know the graph y = f (x) of the function f (x). What is the
effect on the graph of the transformation f (ax) where a > 1? What is the
effect on the graph of the transformation (1/b)f (x) where b > 1? What
about the transformation f (ax)/b where a > 1 and b > 1 ?

Approximation of Brownian Motion by Fortunes


As we have now assumed many times, for i ≥ 1 let
(
+1 with probability 1/2
Yi =
−1 with probability 1/2
be a sequence of independent, identically distributed Bernoulli random vari-
ables. Note that Var [Yi ] = 1, which we will need to use in a moment. Let
Y0 = 0 for convenience and let
Xn
Tn = Yi
i=0

be the sequence of sums which represent the successive net fortunes of our
notorious gambler. Sketch the random fortune Tn versus time using linear
interpolation between the points (n − 1, Tn−1 ) and (n, Tn ) to obtain a con-
tinuous, piecewise linear function. The interpolation defines a function Ŵ (t)
defined on [0, ∞) with
√ Ŵ (n) = Tn . This function is piecewise linear with
segments of length 2. The notation Ŵ (t) reminds us of the piecewise linear
nature of the function.
We will compress time, and rescale the space in a special way. Let N be
a large integer, and consider the rescaled function
 
1
ŴN (t) = √ Ŵ (N t).
N

This has the effect of taking a step of size ±1/ N in 1/N time unit. For
example,
 
1 T1 Y1
ŴN (1/N ) = √ Ŵ (N · 1/N ) = √ = √ .
N N N
236 CHAPTER 5. BROWNIAN MOTION

Now consider
Ŵ (N · 1) Ŵ (N ) TN
ŴN (1) = √ = √ =√ .
N N N
According to the Central Limit Theorem, this quantity is approximately
normally distributed, with mean zero, and variance 1. More generally,

Ŵ (N t) √ Ŵ (N t)
ŴN (t) = √ = t √
N Nt
If N t is an integer, ŴN (t) is normally distributed with mean 0 and variance
t. Furthermore, ŴN (0) = 0 and ŴN (t) is a continuous function, and so is
continuous at 0. At times tj = j/N , tk = k/N , t` = `/N , and tm = m/N
with tj < tk ≤ t` < tm (so j < k ≤ ` < m) the function differences √
ŴN (tk ) − ŴN (t√
j ) and ŴN (tm ) − ŴN (t` ) are the differences (Tk − Tj )/ N
and (Tm − T` )/ N , hence independent.
Altogether, this should be a strong suggestion that ŴN (t) is an approxi-
mation to Standard Brownian Motion. We will define the very jagged piece-
wise linear function ŴN (t) as approximate Brownian Motion.
Theorem 16. The limit of the rescaled random walk defining approximate
Brownian Motion is Brownian Motion in the following sense:
1. h i
P ŴN (t) < x → P [W (t) < x] as N → ∞.

2. More generally, the limit of the rescaled random walk defining approx-
imate Brownian Motion is Brownian Motion in the following sense:
h i
P ŴN (t1 ) < x1 , ŴN (t2 ) < x2 , . . . ŴN (tn ) < xn →
P [W (t1 ) < x1 , W (t2 ) < x2 , . . . W (tn ) < xn ] (5.1)

as N → ∞ where t1 < t2 < · · · < tn . That is, the joint distributions of


ŴN (t) converges to the joint normal distribution

f (x1 , t1 ; x2 , t2 ; . . . ; xn , tn ) =
p(x1 , t)p(x2 − x1 , t2 − t1 ) . . . p(xn − xn−1 , tn − tn−1 ) (5.2)

of the Standard Brownian Motion.


5.3. APPROXIMATION OF BROWNIAN MOTION BY COIN-FLIPPING SUMS237

With some additional foundational work, a mathematical theorem estab-


lishes that the rescaled fortune processes actually converge to the mathemat-
ical object called the Standard Brownian Motion as defined in the previous
section. The proof of this mathematical theorem is beyond the scope of a
text of this level, but the theorem above should strongly suggest how this
can happen, and give some intuitive feel for the approximation of Brownian
motion through the rescaled coin-flip process.
Using a scaled random walk is not the only way to approximate Brownian
Motion. Other approximations of the Wiener process use “global” approxi-
mations such as Fourier series (or more generally L2 [0, T ] expansions in an
orthogonal basis) or Bernstein polynomials. The Fourier series representa-
tion is also known at the Karhunen-Loève expansion of the Wiener process,
for elementary details, see [29]. For the representation as a limit of Bern-
stein polynomials, see Introduction to Bernstein Polynomials and Brownian
Motion or [40]. Both of these approximations use ideas from probability the-
ory and analysis which are beyond the scope of this book. When one only
needs to simulate the position of a sample path of Brownian Motion at one
or even several time points, then the scaled random walk approximation is
simple and the accuracy can be estimated with the Central Limit Theorem
or the Berry-Esseen Theorem. If one needs information on a whole sample
path of Brownian Motion, then the “global” methods are more appropriate
approximations. The “global” methods are not only more mathematically
sophisticated, they also are more expensive in terms of processing and rely on
the efficiency of the underlying implementations of the mathematical func-
tions used.

Sources

This section is adapted from Probability by Leo Breiman, Addison-Wesley,


Reading MA, 1968, Section 12.2, page 251. This section also benefits from
ideas in W. Feller, in Introduction to Probability Theory and Volume I, Chap-
ter III and An Introduction to Stochastic Modeling 3rd Edition, H. M. Taylor,
S. Karlin, Academic Press, 1998.
238 CHAPTER 5. BROWNIAN MOTION

Algorithms, Scripts, Simulations


Algorithm

Simulate a sample path of the Wiener process as follows, see [29]. Divide the
interval [0, T ] into a grid of N + 1 nodes 0 = t0 < t1 < · · · < tN −1 < tN = T
with ti+1 − ti = ∆. The nodes may be indexed from either 0 to N or from
1 to N + 1 depending on the language. Create a Bernoulli random walk
T0 , T1 , T2 , . . . TN of N + 1 steps with T0 = 0. Given a value x ∈ [0, T ] the
prior node with tk ≤ x is bx/∆c for 0-based arrays (or bx/∆c + 1 for 1-based
arrays.). The subsequent node with x ≤ tk+1 is dx/∆e for 0-based arrays (or
dx/∆e + 1 for 1-based arrays.). Then define the value of the approximation
function ŴN (x) by linear interpolation between the values of the random
walk at Tk and Tk+1 .
A feature of this N +1-step random walk scaling approximation algorithm
is that it creates the approximation as a function on [0, T ]. This function
can then be plotted with a function plotting routine on any time grid on the
interval [0, T ]. If the time grid used for plotting on [0, T ] has less than N
points, then some of the information in the N -step scaling approximation is
ignored, and the plotted function will be less representative of the approxi-
mation than it could be. If the time grid on [0, T ] is greater than N points,
then the plotted function will just represent the linear interpolation between
the random-walk points at tj = jT /N and no new information is represented.
Depending on the internal plotting routines used by the language, plot-
ting the approximation function ŴN (t) can result in plot artifacts. One
simple artifact may be horizontal segments in the plot. If the plotting algo-
rithms attempt to use adaptive point selection to densely position a greater
portion of a fixed number of plotting points in a region of rapid variation,
then other regions will have fewer plotting points. Those regions with fewer
plotting points will miss some of the information in that region. Depend-
ing on the language, the plotting routine may use smoothing or some other
nonlinear interpolation between plotting points which will result in curved
segments instead of a piecewise linear function. If the intention is to plot an
approximate Brownian Motion, then there are more direct p and efficient ways
to create and plot the N + 1 coordinate pairs (jT /N, T /N Sj ) defining the
vertices of the piecewise linear scaled random walk approximation with an
appropriate amount of information. (This is approach taken in the Geogebra
script, because the language does not support building a separate function
5.3. APPROXIMATION OF BROWNIAN MOTION BY COIN-FLIPPING SUMS239

as in the other languages.) Here the intention is to first to demonstrate the


creation of the approximation function as a piecewise linear function, then
second to use the function to plot a graph.

Scripts
Geogebra GeoGebra

R R script for approximation


1 p <- 0.5
2 N <- 400
3
4 T <- 1
5
6 S <- array (0 , c ( N +1) )
7 rw <- cumsum ( 2 * ( runif ( N ) <= p ) -1 )
8 S [2:( N +1) ] <- rw
9
10 WcaretN <- function ( x ) {
11 Delta <- T / N
12
13 # add 1 since arrays are 1 - based
14 prior = floor ( x / Delta ) + 1
15 subsequent = ceiling ( x / Delta ) + 1
16
17 retval <- sqrt ( Delta ) * ( S [ prior ] + (( x / Delta +1) -
prior ) * ( S [ subsequent ] - S [ prior ]) )
18 }
19
20 plot ( WcaretN , 0 ,1 , n =400)
21
22 # # alternative plotting method
23 # # time point grid
24 # t <- seq (0 ,T , length = N +1)
25 # # approximate Wiener process at time point grid
26 # W <- sapply (t , WcaretN )
27 # plot (t , W , type = " l ")

Octave Octave script for approximation


1 p = 0.5;
2
240 CHAPTER 5. BROWNIAN MOTION

3 global N = 400;
4 global T = 1;
5
6 global S
7 S = zeros ( N +1 , 1) ;
8 S (2: N +1) = cumsum ( 2 * ( rand (N ,1) <= p ) - 1) ;
9
10 function retval = WcaretN ( x )
11 global N ;
12 global T ;
13 global S ;
14 Delta = T / N ;
15
16 # add 1 since arrays are 1 - based
17 prior = floor ( x / Delta ) + 1;
18 subsequent = ceil ( x / Delta ) + 1;
19
20 retval = sqrt ( Delta ) *( S ( prior ) + (( x / Delta +1) - prior )
.*( S ( subsequent ) -S ( prior ) ) ) ;
21

22 endfunction
23
24 fplot ( @WcaretN , [0 , T ])
25
26 ## alternative plotting method
27 ## time point grid ; must be same orientation as S , i . e .
column vector
28 # t = transpose (0: T / N : T ) ;
29 # plot (t , WcaretN ( t ) ) ;

Perl Perl PDL script for approximation


1 use PDL :: NiceSlice ;
2
3 $p = 0.5;
4

5 $N = 400;
6 $T = 1;
7
8 # the random walk
9 $S = zeros ( $N + 1 ) ;
10 $S ( 1 : $N ) .= cumusumover ( 2 * ( random ( $N ) <= $p ) -
1 );
11
5.3. APPROXIMATION OF BROWNIAN MOTION BY COIN-FLIPPING SUMS241

12 # function WcaretN interpolating random walk


13 sub WcaretN {
14 my $x = shift @_ ;
15 $Delta = $T / $N ;
16
17 $prior = floor ( $x / $Delta ) ;
18 $subsequent = ceil ( $x / $Delta ) ;
19

20 $retval =
21 sqrt ( $Delta )
22 * ( $S ( $prior )
23 + ( ( $x / $Delta ) - $prior )
24 * ( $S ( $subsequent ) - $S ( $prior ) ) ) ;
25 }
26
27 # file output to use with external plotting programming
28 # such as gnuplot , R , octave , etc .
29 # Start gnuplot , then from gnuplot prompt
30 # plot " wienerprocess . dat " with lines
31 $M = 300;
32 $tgrid = zeros ( $M + 1 ) -> xlinvals ( 0 , $T ) ;
33 $W = WcaretN ( $tgrid ) ;
34
35 open ( F , " > wienerprocess . dat " ) || die " cannot write : $ !
";
36 foreach $j ( 0 .. $M ) {
37 print F $tgrid - > range ( [ $j ] ) , " " , $W - > range ( [ $j ] )
, "\n";
38 }
39 close ( F ) ;

SciPy Scientific Python script for approximation


1 import scipy
2
3 p = 0.5
4
5 N = 400
6 T = 1.
7
8 # the random walk
9 S = scipy . zeros ( N +1)
10 S [1: N +1] = scipy . cumsum ( 2*( scipy . random . random ( N ) <= p
) - 1 )
242 CHAPTER 5. BROWNIAN MOTION

11
12 def WcaretN ( x ) :
13 Delta = T / N
14 prior = scipy . floor ( x / Delta ) . astype ( int )
15 subsequent = scipy . ceil ( x / Delta ) . astype ( int )
16 return scipy . sqrt ( Delta ) *( S [ prior ] + ( x / Delta - prior
) *( S [ subsequent ] - S [ prior ]) )
17

18 M = 300
19 tgrid = scipy . linspace (0 , T , M +1)
20 W = WcaretN ( tgrid )
21
22 # optional file output to use with external plotting
programming
23 # such as gnuplot , R , octave , etc .
24 # Start gnuplot , then from gnuplot prompt
25 # plot " wienerprocess . dat " with lines
26 f = open ( ’ wienerprocess . dat ’ , ’w ’)
27 for j in range (0 , M +1) :
28 f . write ( str ( tgrid [ j ]) + ’ ’+ str ( W [ j ]) + ’\ n ’) ;
29
30 f . close ()

Key Concepts
1. A properly scaled “random fortune” process (i.e. random walk) approx-
imates Brownian motion.

2. Brownian motion is the limit of “random fortune” discrete time pro-


cesses (i.e. random walks), properly scaled. The study of Brownian
motion is therefore an extension of the study of random fortunes.

Vocabulary
1. We define approximate Brownian √ Motion ŴN (t) to be the rescaled
random walk with steps of size 1/ N taken every 1/N time units where
N is a large integer.
5.3. APPROXIMATION OF BROWNIAN MOTION BY COIN-FLIPPING SUMS243

Problems to Work for Understanding


1. Flip a coin 25 times, recording whether it comes up Heads or Tails
each time. Scoring Yi = +1 for each Heads and Yi P = −1 for each
n
flip, also keep track of the accumulated sum Tn = i=1 Ti for i =
1 . . . 25 representing the net fortune at any time. Plot the resulting Tn
versus n on the interval [0, 25].
√ Finally, using N = 5, plot the rescaled
approximation Ŵ5 (t) = (1/ 5)T (5t) on the interval [0, 5] on the same
graph.

2. (a) What are the slopes of the linear segments of ŴN (t) ?
(b) Is the slope necessarily undefined at the nodes defining ŴN (t) ?
(c) Explain how a plotting routine could create a horizontal segment
in the plot of ŴN (t).

3. Modify one of the scripts in the following ways:

(a) Plot more than one Wiener process sample path on the same set
of axes.
(b) Change p to a value greater than 0.5 and describe the effect on
the sample paths. Change p to a value less than 0.5 and describe
the effect on the sample paths.
(c) Plot the approximation functions for increasing values of N and
describe the effects on the sample paths.
(d) For a fixed, large value of N , plot the approximation at increasing
values of the number of plotting points which are not divisors of
N and describe the effects on the sample paths.
(e) Change the value of T and plot the resulting sample paths, both
without increasing the value of N and increasing the value of N
proportionally to T and describe the resulting sample paths.

4. Iacus [29] uses a different random walk step function approximation to


Brownian Motion:
TbN tc
W̄N (t) = √ .
N
Create scripts that plot this random walk approximation for N = 10,
N = 100 and N = 1000.
244 CHAPTER 5. BROWNIAN MOTION

5. Under the assumption of the theorem that the joint distributions of


ŴN (t) converges to the joint normal distribution is true, show then
that
TbN tc
 
P √ < x → P [W (t) < x] .
N

Outside Readings and Links:


1.

5.4 Transformations of the Wiener Process


Section Starter Question
Suppose you know the graph y = f (x) of the function f (x). What is the
effect on the graph of the transformation f (x + h) − f (h)? What is the
effect on the graph of the transformation f (1/x)? Consider the function
f (x) = sin(x) as an example.

Transformations of the Wiener Process


A set of transformations of the Wiener process produce the Wiener process
again. Since these transformations result in the Wiener process, each tells
us something about the “shape” and “characteristics” of the Wiener pro-
cess. These results are especially helpful when studying the properties of the
Wiener process sample paths. The first of these transformations is a time
homogeneity that says the Wiener process can be re-started anywhere. The
second says that the Wiener process may be rescaled in time and space. The
third is an inversion. Roughly, each of these says the Wiener process is self-
similar in various ways. See the comments after the proof for more detail.

Theorem 17. Let


1. Wshift (t) = W (t + h) − W (h), for fixed h > 0.

2. Wscale (t) = cW (t/c2 ), for fixed c > 0.


Then each of Wshift (t) and Wscale (t) are a version of the Standard Wiener
Process.
5.4. TRANSFORMATIONS OF THE WIENER PROCESS 245

Proof. We have to systematically check each of the defining properties of the


Wiener process in turn for each of the transformed processes.
1.
Wshift (t) = W (t + h) − W (h).
(a) The increment is
Wshift (t + s) − Wshift (s)
= [W (t + s + h) − W (h)] − [W (s + h) − W (h)]
= W (t + s + h) − W (s + h)
which is by definition normally distributed with mean 0 and vari-
ance t.
(b) The increment
Wshift (t4 ) − Wshift (t3 ) = W (t4 + h) − W (t3 + h)
is independent from
Wshift (t2 ) − Wshift (t1 ) = W (t2 + h) − W (t1 + h)
by the property of independence of disjoint increments of W (t).
(c)
Wshift (0) = W (0 + h) − W (h) = 0.
(d) As the composition and difference of continuous functions, Wshift
is continuous.
2.
Wscale (t) = cW (t/c2 )
(a) The increment
Wscale (t) − Wscale (s) = cW ((t)/c2 ) − cW (s/c2 )
= c(W (t/c2 ) − W (s/c2 ))
is normally distributed because it is a multiple of a normally dis-
tributed random variable. Since the increment W (t/c2 )−W (s/c2 )
has mean zero, then
Wscale (t) − Wscale (s) = c(W (t/c2 ) − W (s/c2 ))
246 CHAPTER 5. BROWNIAN MOTION

must have mean zero. The variance is

E (Wscale (t) − W (s))2 = E (cW ((t)/c2 ) − cW (s/c2 ))2


   

= c2 E (W (t/c2 ) − W (s/c2 ))2


 

= c2 (t/c2 − s/c2 ) = t − s.

(b) Note that if t1 < t2 ≤ t3 < t4 , then t1 /c2 < t2 /c2 ≤ t3 /c2 <
t4 /c2 , and the corresponding increments W (t4 /c2 ) − W (t3 /c2 ) and
W (t2 /c2 ) − W (t1 /c2 ) are independent. Then the multiples of each
by c are independent and so Wscale (t4 ) − Wscale (t3 ) and Wscale (t2 ) −
Wscale (t1 ) are independent.
(c) Wscale (0) = cW (0/c2 ) = cW (0) = 0.
(d) As the composition of continuous functions, Wscale is continuous.

Theorem 18. Suppose W (t) is a Standard Wiener Process. Then the trans-
formed processes Winv (t) = tW (1/t) for t > 0, Winv (t) = 0 for t = 0 is a
version of the Standard Wiener Process.

Proof. To show that


Winv (t) = tW (1/t)

is a Wiener process by the four defining properties requires another fact


which is outside the scope of the text. The fact is that any Gaussian process
X(t) with mean 0 and Cov [X(s), X(t), =] min(s, t) must be the Wiener pro-
cess. See the references and outside links for more information. Using this
information, a partial proof follows:

1.
Winv (t) − Winv (s) = tW (1/t) − sW (1/s)

is the difference of normally distributed random variables each with


mean 0, so the difference will be normal with mean 0. It remains to
5.4. TRANSFORMATIONS OF THE WIENER PROCESS 247

check that the normal random variable has the correct variance.

E (Winv (t) − Winv (s))2


 

= E (sW (1/s) − tW (1/t))2


 

= E[(sW (1/s) − sW (1/t)


+ sW (1/t) − tW (1/t) − (s − t)W (0))2 ]
= s2 E (W (1/s) − W (1/t))2
 

+ s(s − t)E [(W (1/s) − W (1/t))(W (1/t) − W (0))]


+ (s − t)2 E (W (1/t) − W (0))2
 

= s2 E (W (1/s) − W (1/t))2 + (s − t)2 E (W (1/t) − W (0))2


   

= s2 (1/s − 1/t) + (s − t)2 (1/t)


= t − s.

Note the use of independence of W (1/s) − W (1/t) from W (1/t) − W (0)


at the third equality.
2. It is hard to show the independence of increments directly. Instead
rely on the fact that a Gaussian process with mean 0 and covariance
function min(s, t) is a Wiener process, and thus prove it indirectly.
Note that

Cov [Winv (s), Winv (t), =] st min(1/s, 1/t) = min(s, t).

3. By definition, Winv (0) = 0.


4. The argument that limt→0 Winv (t) = 0 is equivalent to showing that
limt→∞ W (t)/t = 0. To show this requires use of Kolmogorov’s in-
equality for the Wiener process and clever use of the Borel-Cantelli
lemma and is beyond the scope of this course. Use the translation
property in the third statement of this theorem to prove continuity at
every value of t.

The following comments are adapted from Stochastic Calculus and Finan-
cial Applications by J. Michael Steele. Springer, New York, 2001, page 40.
These laws tie the Wiener process to three important groups of transforma-
tions on [0, ∞), and a basic lesson from the theory of differential equations is
248 CHAPTER 5. BROWNIAN MOTION

that such symmetries can be extremely useful. On a second level, the laws
also capture the somewhat magical fractal nature of the Wiener process. The
scaling law tells us that if we had even one-billionth of a second of a Wiener
process path, we could expand it to a billions years’ worth of an equally valid
Wiener process path! The translation symmetry is not quite so startling, it
merely says that Wiener process can be restarted anywhere. That is, any
part of a Wiener process captures the same behavior as at the origin. The
inversion law is perhaps most impressive, it tells us that the first second of
the life of a Wiener process path is rich enough to capture the behavior of a
Wiener process path from the end of the first second until the end of time.

Algorithms, Scripts, Simulations


Algorithm
Let constants h and c be given. Create an approximation Ŵ (t) of Wiener
process W (t) on a domain [0, T ] large enough to accommodate Ŵ (1 + h) and
Ŵ (1/c2 ). Using the approximation Ŵ (t) create approximations to Wshift (t)
and Wscale (t) with functions Ŵ (t+h)− Ŵ (h) and cŴ (t/c2 ). Plot all functions
on the same set of axes.

Scripts
Geogebra GeoGebra

R R script for transformations.


1 p <- 0.5
2 N <- 400
3
4 T <- 2
5 h <- 0.25
6 c <- 2.0
7

8 S <- array (0 , c ( N +1) )


9 rw <- cumsum ( 2 * ( runif ( N ) <= p ) -1 )
10 S [2:( N +1) ] <- rw
11
12 WcaretN <- function ( x ) {
13 Delta <- T / N
14
15 # add 1 since arrays are 1 - based
5.4. TRANSFORMATIONS OF THE WIENER PROCESS 249

16 prior = floor ( x / Delta ) + 1


17 subsequent = ceiling ( x / Delta ) + 1
18
19 retval <- sqrt ( Delta ) * ( S [ prior ] + (( x / Delta +1) -
prior ) * ( S [ subsequent ] - S [ prior ]) )
20 }
21
22 Wshift <- function ( x ) {
23 retval <- WcaretN ( x + h ) - WcaretN ( h )
24 }
25
26 Wscale <- function ( x ) {
27 retval <- c * WcaretN ( x / c ^2)
28 }
29
30 curve ( WcaretN , 0 ,1 , n =400 , col = " black " )
31 curve ( Wshift , 0 ,1 , n =400 , add = TRUE , col = " blue " )
32 curve ( Wscale , 0 ,1 , n = 400 , add = TRUE , col = " red " )

Octave Octave script for transformations


1 p = 0.5;
2

3 global N = 400;
4 global T = 2;
5
6 global h = 0.25;
7 global c = 2.0;
8

9 global S
10 S = zeros ( N +1 , 1) ;
11 S (2: N +1) = cumsum ( 2 * ( rand (N ,1) <= p ) - 1) ;
12
13 function retval = WcaretN ( x )
14 global N ;
15 global T ;
16 global S ;
17 Delta = T / N ;
18
19 # add 1 since arrays are 1 - based
20 prior = floor ( x / Delta ) + 1;
21 subsequent = ceil ( x / Delta ) + 1;
22
250 CHAPTER 5. BROWNIAN MOTION

23 retval = sqrt ( Delta ) *( S ( prior ) + (( x / Delta +1) - prior )


.*( S ( subsequent ) -S ( prior ) ) ) ;
24
25 endfunction
26
27 function retval = Wshift ( x )
28 global h ;
29 retval = WcaretN ( x + h ) - WcaretN ( h ) ;
30 endfunction
31
32 function retval = Wscale ( x )
33 global c ;
34 retval = c * WcaretN ( x / c ^2) ;
35 endfunction
36
37 fplot ( " [ WcaretN ( x ) , Wshift ( x ) , Wscale ( x ) ] " , [0 ,1])

Perl Perl PDL script for transformations


1 use PDL :: NiceSlice ;
2
3 $p = 0.5;
4
5 $N = 400;
6 $T = 2;
7 $h = 0.25;
8 $c = 2.0;
9
10 # the random walk
11 $S = zeros ( $N + 1 ) ;
12 $S ( 1 : $N ) .= cumusumover ( 2 * ( random ( $N ) <= $p ) -
1 );
13
14 # function WcaretN interpolating random walk
15 sub WcaretN {
16 my $x = shift @_ ;
17 $Delta = $T / $N ;
18
19 $prior = floor ( $x / $Delta ) ;
20 $subsequent = ceil ( $x / $Delta ) ;
21
22 $retval =
23 sqrt ( $Delta )
24 * ( $S ( $prior )
5.4. TRANSFORMATIONS OF THE WIENER PROCESS 251

25 + ( ( $x / $Delta ) - $prior )
26 * ( $S ( $subsequent ) - $S ( $prior ) ) ) ;
27 }
28
29 sub Wshift {
30 my $x = shift @_ ;
31 $retval = WcaretN ( $x + $h ) - WcaretN ( $h ) ;
32 }
33
34 sub Wscale {
35 my $x = shift @_ ;
36 $retval = $c * WcaretN ( $x / ( $c * $c ) ) ;
37 }
38

39 # file output to use with external plotting programming


40 # such as gnuplot
41 # Start gnuplot , then from gnuplot prompt
42 # plot " wienerprocess . dat " using 1:2 with lines title ’
WcaretN ’, " wienerprocess . dat " using 1:3 with lines
title ’ Wshift ’, " wienerprocess . dat " using 1:4 with
lines title ’ Wscale ’
43 $M = 300;
44 $tgrid = zeros ( $M + 1 ) -> xlinvals ( 0 , 1 ) ;
45 $W = WcaretN ( $tgrid ) ;
46 $Wsh = Wshift ( $tgrid ) ;
47 $Wsc = Wscale ( $tgrid ) ;
48
49 open ( F , " > wienerprocess . dat " ) || die " cannot write : $ !
";
50 foreach $j ( 0 .. $M ) {
51 print F $tgrid - > range ( [ $j ] ) , " " , $W - > range ( [ $j ]
), " ",
52 $Wsh - > range ( [ $j ] ) , " " , $Wsc - > range ( [ $j ]
), "\n";
53 }
54 close ( F ) ;

SciPy Scientific Python script for transformations


1
2 import scipy
3

4 p = 0.5
5
252 CHAPTER 5. BROWNIAN MOTION

6 N = 400
7 T = 2.
8 h = 0.25
9 c = 2.0
10
11 # the random walk
12 S = scipy . zeros ( N +1)
13 S [1: N +1] = scipy . cumsum ( 2*( scipy . random . random ( N ) <= p
) - 1 )
14
15 def WcaretN ( x ) :
16 Delta = T / N
17 prior = scipy . floor ( x / Delta ) . astype ( int )
18 subsequent = scipy . ceil ( x / Delta ) . astype ( int )
19 return scipy . sqrt ( Delta ) *( S [ prior ] + ( x / Delta - prior
) *( S [ subsequent ] - S [ prior ]) )
20
21 def Wshift ( x ) :
22 return WcaretN ( x + h ) - WcaretN ( h )
23

24 def Wscale ( x ) :
25 return c * WcaretN ( x / c **2.)
26
27 M = 300
28 tgrid = scipy . linspace (0 , 1 , M +1)
29 W = WcaretN ( tgrid )
30 Wsh = Wshift ( tgrid )
31 Wsc = Wscale ( tgrid )
32
33 # optional file output to use with external plotting
programming
34 # such as gnuplot , R , octave , etc .
35 # Start gnuplot , then from gnuplot prompt
36 # plot " wienerprocess . dat " using 1:2 with lines title ’
WcaretN ’, " wienerprocess . dat " using 1:3 with lines
title ’ Wshift ’, " wienerprocess . dat " using 1:4 with
lines title ’ Wscale ’
37 f = open ( ’ wienerprocess . dat ’ , ’w ’)
38 for j in range (0 , M +1) :
39 f . write ( str ( tgrid [ j ]) + ’ ’+ str ( W [ j ]) + ’ ’+ str ( Wsh [ j ]) +
’ ’+ str ( Wsc [ j ]) + ’\ n ’) ;
40
41 f . close ()
5.4. TRANSFORMATIONS OF THE WIENER PROCESS 253

Sources
This section is adapted from: A First Course in Stochastic Processes by S.
Karlin, and H. Taylor, Academic Press, 1975, pages 351–353 and Financial
Derivatives in Theory and Practice by P. J. Hunt and J. E. Kennedy, John
Wiley and Sons, 2000, pages 23–24.

Key Concepts
1. Three transformations of the Wiener process produce another Wiener
process. The transformations are scaling, inversion and translation.
These results are especially helpful when studying the properties of the
sample paths of Brownian motion.

Vocabulary
1. Scaling, also called re-scaling, is the transformation of f (t) to bf (t/a)
that expands or contracts the time axis (as a > 1 or a < 1) and expands
or contracts the dependent variable scale (as b > 1 or b < 1).

2. Translation, also called shifting is the transformation of f (t) to f (t+


h) or sometimes f (t) to f (t + h) − f (h).

3. Inversion is the transformation of f (t) to f (1/t). It “flips” the inde-


pendent variable axis about 1, so that the interval (0, 1) is “inverted”
to the interval (1, ∞).

Problems to Work for Understanding


1. Explain why there is no script for simulation or approximation of the
inversion transformation of the Wiener process, or if possible provide
such a script.

2. Given the piecewise linear approximation ŴN (t), what are the slopes of
the piecewise linear segments of the scaling transformation cŴN (t/c2 ) ?

3. Modify the scripts to plot an approximation of Wscale (t) on [0, 1] with


the same degree of approximation as ŴN (t) for some N . Plot both on
the same set of axes.
254 CHAPTER 5. BROWNIAN MOTION

4. Show that st min(1/s, 1/t) = min(s, t)

Outside Readings and Links:


1. Russell Gerrard, City University, London, Stochastic Modeling Notes
for the MSc in Actuarial Science, 2003-2004. Contributed by S. Dunbar
October 30, 2005.

5.5 Hitting Times and Ruin Probabilities


Section Starter Question
What is the probability that a simple random walk with p = 1/2 = q starting
at the origin will hit value a > 0 before it hits value −b < 0, where b > 0?
What do you expect in analogy for the standard Wiener process and why?

Hitting Times
Consider the standard Wiener process W (t), which starts at W (0) = 0. Let
a > 0. The hitting time Ta is the first time the Wiener process hits a. In
notation from analysis
Ta = inf{t > 0 : W (t) = a}.
Note the very strong analogy with the duration of the game in the gambler’s
ruin.
Some Wiener process sample paths will hit a > 0 fairly directly. Others
will make an excursion to negative values and take a long time to finally
reach a. Thus Ta will have a probability distribution. We determine that
probability distribution by a heuristic procedure similar to the first step
analysis we made for coin-flipping fortunes.
Specifically, we consider a probability by conditioning, that is, condition-
ing on whether or not Ta ≤ t, for some given value of t.
P [W (t) ≥ a] = P [W (t) ≥ a|Ta ≤ t] P [Ta ≤ t]+P [W (t) ≥ a|Ta > t] P [Ta > t]
Now note that the second conditional probability is 0 because it is an empty
event. Therefore:
P [W (t) ≥ a] = P [W (t) ≥ a|Ta ≤ t] P [Ta ≤ t] .
5.5. HITTING TIMES AND RUIN PROBABILITIES 255

Now, consider Wiener process “started over” again at the time Ta when it hits
a. By the shifting transformation from the previous section, the “started-
over” process has the distribution of Wiener process again, so

P [W (t) ≥ a|Ta ≤ t] = P [W (t) ≥ a|W (Ta ) = a, Ta ≤ t]


= P [W (t) − W (Ta ) ≥ 0|Ta ≤ t]
= 1/2.

This argument is a specific example of the Reflection Principle for the Wiener
process. It says that the Wiener process reflected about a first passage has
the same distribution as the original motion.
Thus
P [W (t) ≥ a] = (1/2)P [Ta ≤ t] .
or

P [Ta ≤ t] = 2P [W (t) ≥ a]
Z ∞
2
=√ exp(−u2 /(2t)) du
2πtZ a

2
=√ exp(−v 2 /2) dv
2π a/√t

(note the change of variables v = u/ t in the second integral) and so we
have derived the c.d.f. of the hitting time random variable. One can easily
differentiate to obtain the p.d.f
a
fTa (t) = √ t−3/2 exp(−a2 /(2t)).

Actually, this argument contains a serious logical gap, since Ta is a ran-
dom time, not a fixed time. That is, the value of Ta is different for each
sample path, it varies with ω. On the other hand, the shifting transformation
defined in the prior section depends on having a fixed time, called h in that
section. To fix this logical gap, we must make sure that “random times” act
like fixed times. Under special conditions, random times can act like fixed
times. Specifically, this proof can be fixed and made completely rigorous by
showing that the standard Wiener process has the strong Markov prop-
erty and that Ta is a Markov time corresponding to the event of first passage
from 0 to a.
256 CHAPTER 5. BROWNIAN MOTION

Note that deriving the p.d.f. of the hitting time is much stronger than the
analogous result for the duration of the game until ruin in the coin-flipping
game. There we were only able to derive an expression for the expected value
of the hitting time, not the probability distribution of the hitting time. Now
we are able to derive the probability distribution of the hitting time fairly
intuitively (although strictly speaking there is a gap). Here is a place where
it is simpler to derive a quantity for Wiener process than it is to derive the
corresponding quantity for random walk.
Let us now consider the probability that the Wiener process hits a > 0,
before hitting −b < 0 where b > 0. To compute this we will make use of
the interpretation of the standard Wiener process as being the limit of the
symmetric random walk. Recall from the exercises following the section on
the gambler’s ruin in the fair (p = 1/2 = q) coin-flipping game that the
probability that the random walk goes up to value a before going down to
value b when the step size is ∆x is
b∆x b
P [ to a before −b ] = =
(a + b)∆x a+b
Thus, the probability of hitting a > 0 before hitting −b < 0 does not depend
on the step size, and also does not depend on the time interval. Therefore,
passing to the limit in the scaling process for random walks, the probabilities
should remain the same. Here is a place where it is easier to derive the result
from the coin-flipping game and pass to the limit than to derive the result
directly from Wiener process principles.

The Distribution of the Maximum


Let t be a given time, let a > 0 be a given value, then
 
P max W (u) ≥ a = P [Ta ≤ t]
0≤u≤t
Z ∞
2
=√ √
exp(−y 2 /2) dy
2π a/ t

Sources
This section is adapted from: Probability Models, by S. Ross, and A First
Course in Stochastic Processes Second Edition by S. Karlin, and H. Taylor,
5.5. HITTING TIMES AND RUIN PROBABILITIES 257

Academic Press, 1975. The technical note about the algorithm combines
discussion about Donkser’s principle from Freedman’s Brownian Motion and
Diffusions, Breiman’s, Probability, Khoshnevisan’s notes, and Peled’s notes

Algorithms, Scripts, Simulations


Algorithm
Set a time interval length T sufficiently long to have a good chance of hitting
the fixed value a before fixed time t < T . Set a large value n for the length of
the random walk used to create the Wiener process, then fill an n × k matrix
with Bernoulli random variables. Cumulatively sum the Bernoulli random
variables to create a scaled random walk approximating the Wiener process.
For each random walk, find when the hitting time is encountered. Also find
the maximum value of the scaled random walk on the interval [0, t]. Since
the approximation is piecewise linear, only the nodes need to be examined.
Compute the fraction of the k walks which have a hitting time less than t
or a maximum greater than a on the interval [0, t]. Compare the fraction to
the theoretical value.
Technical Note: The careful reader will note that the hitting time
Ta = inf{t > 0 : W (t) = a} and the events [Ta ≤ t] and [max0≤u≤t W (u) ≥ a]
are “global” events on the set of all Wiener process paths. However, the
definition of Wiener process only has prescribed probability distributions on
the values at specified times. Implicit in the definition of the Wiener process
is a probability distribution on the “global” set of Wiener processes, but the
proof of the existence of the probability distribution is beyond the scope of
this text. Moreover, there is no easy distribution function to compute the
probability of such events as there is with the normal probability distribution.
The algorithm approximates the probability by counting how many of k
scaled binomial random variables hit a value greater than or equal to a at
a node which corresponds to a time less than or equal to t. Convergence
of the counting probability to the global Wiener process probability requires
justification with Donsker’s Invariance Principle. The principle says that
the piecewise linear processes ŴN (t) converge in distribution to the Wiener
process.
To apply Donsker’s Principle, consider the functional

φ(f ) = h( max f (u))


0≤u≤t
258 CHAPTER 5. BROWNIAN MOTION

where h(·) is a bounded continuous function. The convergence in distribution


from the Invariance Principle implies that
h i
E φ(ŴN (t)) → E [φW ] .

Now taking h(·) to be an approximate indicator function on the interval


[a, ∞) shows that the counting probability converges to the global Wiener
process probability. The details require careful analysis.

Geogebra GeoGebra

R R script for hitting time.


1 T <- 10
2 a <- 1
3 time <- 2
4
5 p <- 0.5
6 n <- 10000
7 k <- 1000
8
9 Delta = T / n
10
11 winLose <- 2 * ( array ( 0+( runif ( n * k ) <= p ) , dim = c (n , k ) ) )
- 1
12 # 0+ coerces Boolean to numeric
13 totals <- apply ( winLose , 2 , cumsum )
14
15 paths <- array ( 0 , dim = c ( n +1 , k ) )
16 paths [2:( n +1) , 1: k ] <- sqrt ( Delta ) * totals
17
18 hitIndex <- apply ( 0+( paths <= a ) , 2 , ( function ( x ) match
(0 , x , nomatch = n +2) ) )
19 # If no hiting on a walk , nomatch = n +2 sets the hitting
20 # time to be two more than the number of steps , one more
than
21 # the column length . Without the nomatch option , get NA
which
22 # works poorly with the comparison
23
24 hittingTime = Delta * ( hitIndex -1)
25 # # subtract 1 since vectors are 1 - based
26
27 probHitlessTa <- sum ( 0+( hittingTime <= time ) ) / k
5.5. HITTING TIMES AND RUIN PROBABILITIES 259

28 probMax = sum ( 0+( apply ( paths [1:(( time / Delta ) +1) ,] , 2 ,


max ) >= a ) ) / k
29 theoreticalProb = 2 * pnorm ( a / sqrt ( time ) , lower = FALSE )
30
31 cat ( sprintf ( " Empirical probability Wiener process paths
hit % f before % f : % f \ n " , a , time , probHitlessTa ) )
32 cat ( sprintf ( " Empirical probability Wiener process paths
greater than % f before % f : % f \ n " , a , time , probMax ) )
33 cat ( sprintf ( " Theoretical probability : % f \ n " ,
theoreticalProb ) )

Octave Octave script for hitting time.


1 T = 10;
2 a = 1;
3 time = 2;
4
5 p = 0.5;
6 n = 10000;
7 k = 1000;
8
9 Delta = T / n ;
10
11 winLose = 2 * ( rand (n , k ) <= p ) - 1;
12 # -1 for Tails , 1 for Heads
13 totals = cumsum ( winLose ) ;
14 # -n .. n ( every other integer ) binomial rv sample
15
16 paths = sqrt ( Delta ) *[ zeros (1 , k ) ; totals ];
17 hittingTime = zeros (1 , k ) ;
18 for j = 1: k
19 hitIndex = find ( paths (: , j ) >= a ) ;
20 if ( ! rows ( hitIndex ) )
21 hittingTime ( j ) = Delta * ( n +2) ;
22 ## If no hitting on a walk , set hitting time to be
two
23 ## more than the number of steps , one more than the
column length .
24 else
25 hittingTime ( j ) = Delta * ( hitIndex (1) -1) ;
26 ## some hitting time
27 ## subtract 1 since vectors are 1 - based
28 endif
29 endfor
260 CHAPTER 5. BROWNIAN MOTION

30
31 probHitlessTa = sum ( ( hittingTime <= time ) ) / k ;
32 probMax = sum ( max ( paths (1:(( time / Delta ) +1) ,:) ) >= a ) / k ;
33 theoreticalProb = 2*(1 - normcdf ( a / sqrt ( time ) ) ) ;
34
35 printf ( " Empirical probability Wiener process paths hit % f
before % f : % f \ n " , a , time , probHitlessTa )
36 printf ( " Empirical probability Wiener process paths
greater than % f before % f : % f \ n " , a , time , probMax )
37 printf ( " Theoretical probability : % f \ n " , theoreticalProb
)

Perl Perl PDL script for hitting time


1 use PDL :: NiceSlice ;
2
3 sub pnorm {
4 my ( $x , $sigma , $mu ) = @_ ;
5 $sigma = 1 unless defined ( $sigma ) ;
6 $mu = 0 unless defined ( $mu ) ;
7
8 return 0.5 * ( 1 + erf ( ( $x - $mu ) / ( sqrt (2) *
$sigma ) ) ) ;
9 }
10
11 $T = 10;
12 $a = 1;
13 $time = 2;
14
15 $p = 0.5;
16 $n = 10000;
17 $k = 1000;
18
19 $Delta = $T / $n ;
20
21 $winLose = 2 * ( random ( $k , $n ) <= $p ) - 1;
22 $totals = ( cumusumover $winLose - > xchg ( 0 , 1 ) ) ->
transpose ;
23
24 $paths = zeroes ( $k , $n + 1 ) ;
25
26 # use PDL : NiceSlice on next line
27 $paths ( 0 : ( $k - 1 ) , 1 : $n ) .= sqrt ( $Delta ) *
$totals ;
5.5. HITTING TIMES AND RUIN PROBABILITIES 261

28
29 $hita = $paths - > setbadif ( $paths <= $a ) ;
30
31 $hitIndex =
32 ( $hita ( ,) -> xchg ( 0 , 1 ) -> minimum_ind ) -> inplace - >
setbadtoval ( $n + 1 ) ;
33
34 $hittingTime = $Delta * $hitIndex ;
35
36 $probHitlessTa = sumover ( $hittingTime < $time ) / $k ;
37 $probMax = sumover (
38 maximum (
39 $paths ( 0 : ( $k - 1 ) , 0 : ( $time / $Delta ) -
1 ) -> xchg ( 0 , 1 )
40 ) >= $a
41 ) / $k ;
42 $theoreticalProb = 2 * ( 1 - pnorm ( $a / sqrt ( $time ) ) ) ;
43
44 print " Empirical probability Wiener process paths hit " ,
$a , " before " , $time ,
45 " is " , $probHitlessTa , " \ n " ;
46 print " Empirical probability Wiener process paths greater
than " , $a ,
47 " before " , $time , " is " , $probMax , " \ n " ;
48 print " Theoretical probability : " , $theoreticalProb , " \ n " ;

SciPy Scientific Python script for hitting time.


1 import scipy
2

3 T = 10.0
4 # note type float
5 a = 1
6 time = 2
7
8 p = 0.5
9 n = 1000
10 k = 50
11
12 Delta = T / n
13
14 winLose = 2*( scipy . random . random (( n , k ) ) <= p ) - 1
15 totals = scipy . cumsum ( winLose , axis = 0)
16
262 CHAPTER 5. BROWNIAN MOTION

17 paths = scipy . zeros (( n +1 , k ) , dtype = float )


18 paths [ 1: n +1 , :] = scipy . sqrt ( Delta ) * totals
19
20 def match (x , arry , nomatch = None ) :
21 if arry [ scipy . where ( ( arry >= x ) ) ]. any () :
22 return scipy . where ( ( arry >= x ) ) [0][0] - 1
23 else :
24 return nomatch
25 # arguments : x is a scalar , arry is a python list , value
of nomatch is scalar
26 # returns the first index of first of its first argument
in its second argument
27 # but if a is not there , returns the value nomatch
28 # modeled on the R function " match " , but with less
generality
29
30 hitIndex = scipy . apply_along_axis ( lambda x :( match (a ,x ,
nomatch = n +2) ) , 0 , paths )
31 # If no ruin or victory on a walk , nomatch = n +2 sets the
hitting
32 # time to be two more than the number of steps , one more
than
33 # the column length .
34
35 hittingTime = Delta * hitIndex
36

37 probHitlessTa = ( scipy . sum ( hittingTime < time ) . astype ( ’


float ’) ) / k
38 probMax = ( scipy . sum ( scipy . amax ( paths [ 0: scipy . floor (
time / Delta ) +1 , : ] , axis =0) >= a ) . astype ( ’ float ’) ) / k
39 from scipy . stats import norm
40 theoreticalProb = 2 * (1 - norm . cdf ( a / scipy . sqrt ( time ) ) )
41
42 print " Empirical probability Wiener process paths hit " ,
a , " before " , time , " is " , probHitlessTa
43 print " Empirical probability Wiener process paths greater
than " , a , " before " , time , " is " , probMax
44 print " Theoretical probability : " , theoreticalProb
5.5. HITTING TIMES AND RUIN PROBABILITIES 263

Key Concepts
1. With the Reflection Principle, we can derive the p.d.f of the hitting
time Ta .

2. With the hitting time, we can derive the c.d.f. of the maximum of the
Wiener Process on the interval 0 ≤ u ≤ t.

Vocabulary
1. The Reflection Principle says the Wiener process reflected about a
first passage has the same distribution as the original motion.

2. The hitting time Ta is the first time the Wiener process assumes the
value a. In notation from analysis

Ta = inf{t > 0 : W (t) = a}.

Problems to Work for Understanding


1. Differentiate the c.d.f. of Ta to obtain the expression for the p.d.f of Ta .

2. Show that E [Ta ] = ∞ for a > 0.

3. Suppose that the fluctuations of a share of stock of a certain company


are well described by a Wiener process. Suppose that the company
is bankrupt if ever the share price drops to zero. If the starting share
price is A(0) = 5, what is the probability that the company is bankrupt
by t = 25? What is the probability that the share price is above 10 at
t = 25?

4. Suppose you own one share of stock whose price changes according to a
Wiener process. Suppose you purchased the stock at a price b+c, c > 0
and the present price is b. You have decided to sell the stock either
when it reaches the price b + c or when an additional time t goes by,
whichever comes first. What is the probability that you do not recover
your purchase price?

5. Modify the scripts by setting p > 0.5 or p < 0.5. What happens to the
hitting time?
264 CHAPTER 5. BROWNIAN MOTION

6. (a) Modify the scripts to plot the probability that the hitting time is
less than or equal to a as a function of a.
(b) Modify the scripts to plot the probability that the hitting time is
less than or equal to a as a function of t. On the same set of axes
plot the theoretical probability as a function of t.

Outside Readings and Links:


1. Russell Gerrard, City University, London, Stochastic Modeling Notes
for the MSc in Actuarial Science, 2003-2004. Contributed by S. Dunbar
October 30, 2005.

5.6 Path Properties of Brownian Motion


Section Starter Question
Provide an example of a continuous function which is not differentiable at
some point. Why does the function fail to have a derivative at that point?
What are the possible reasons that a derivative could fail to exist at some
point?

Non-differentiability of Brownian Motion paths


Probability theory uses the term almost surely to indicate an event which
occurs with probability 1. The complementary events occurring with proba-
bility 0 are sometimes called negligible events. In infinite sample spaces,
it is possible to have meaningful events with probability zero. So to say an
event occurs “almost surely” or is a negligible event is not an empty phrase.

Theorem 19. With probability 1 (i.e. almost surely) Brownian Motion paths
are continuous functions.

To state this as a theorem may seem strange in view of property 4 of the


definition of Brownian motion. Property 4 requires that Brownian motion is
continuous. However, some authors weaken property 4 in the definition to
only require that Brownian motion be continuous at t = 0. Then this theorem
shows that the weaker definition implies the stronger definition used in this
text. This theorem is difficult to prove, and well beyond the scope of this
5.6. PATH PROPERTIES OF BROWNIAN MOTION 265

course. In fact, even the statement above is imprecise. Specifically, there is


an explicit representation of the defining properties of Brownian Motion as a
random variable W (t, ω) which is a continuous function of t with probability
1. We need the continuity for much of what we do later, and so this theorem
is stated here as a fact without proof.

Theorem 20. With probability 1 (i.e. almost surely) a Brownian Motion is


nowhere (except possibly on set of Lebesgue measure 0) differentiable.

This property is even deeper and requires more understanding of analysis


to prove than does the continuity theorem, so we will not prove it here.
Rather, we use this fact as another piece of evidence of the strangeness of
Brownian Motion.
In spite of one’s intuition from calculus, Theorem 20 shows that contin-
uous, nowhere differentiable functions are actually common. Indeed, con-
tinuous, nowhere differentiable functions are useful for stochastic processes.
One can imagine non-differentiability by considering the function f (t) = |t|
which is continuous but not differentiable at t = 0. Because of the corner
at t = 0, the left and right limits of the difference quotient exist but are
not equal. Even more to the point, the function t2/3 is continuous but not
differentiable at t = 0 because of a sharp “cusp” there. The left and right
limits of the difference quotient do not exist (more precisely, each approaches
±∞) at x = 0. One can imagine Brownian Motion as being spiky with tiny
cusps and corners at every point. This becomes somewhat easier to imag-
ine by thinking of the limiting approximation of Brownian Motion by scaled
random walks. The re-scaled coin-flipping fortune graphs look spiky with
many corners. The approximating graphs suggest why the theorem is true,
although this is not sufficient for the proof.

Properties of the Path of Brownian Motion

Theorem 21. With probability 1 (i.e. almost surely) a Brownian Motion


path has no intervals of monotonicity. That is, there is no interval [a, b] with
W (t2 ) − W (t1 ) > 0 (or W (t2 ) − W (t1 ) < 0) for all t2 , t1 ∈ [a, b] with t2 > t1

Theorem 22. With probability 1 (i.e. almost surely) Brownian Motion W (t)
266 CHAPTER 5. BROWNIAN MOTION

has
W (n)
lim sup √ = +∞,
n→∞ n
W (n)
lim inf √ = −∞.
n→∞ n

From Theorem 22 and the continuity we can deduce that for arbitrarily
large t1 , there is a t2 > t1 such that W (t2 ) = 0. That is, Brownian Motion
paths always cross the time-axis at some time greater than any arbitrarily
large value of t. Equivalently, Brownian Motion never eventually stays in the
upper half-plane (or lower half-plane).

Theorem 23. With probability 1 (i.e. almost surely), 0 is an accumulation


point of the zeros of W (t).

From Theorem 22 and the inversion tW (1/t) also being a standard Brow-
nian motion, we heuristically deduce that 0 is an accumulation point of the
zeros of W (t). That is, Standard Brownian Motion crosses the time axis
arbitrarily often near 0.

Theorem 24. With probability 1 (i.e. almost surely) the zero set of Brownian
Motion
{t ∈ [0, ∞) : W (t) = 0}
is an uncountable closed set with no isolated points.

Theorem 25. With probability 1 (i.e. almost surely) the graph of a Brownian
Motion path has Hausdorff dimension 3/2.

Roughly, this means that the graph of a Brownian Motion path is “fuzzier”
or “thicker” than the graph of, for example, a continuously differentiable
function which would have Hausdorff dimension 1. In popular language, this
theorem says that Brownian Motion is a fractal.

Sources
This section is adapted from Notes on Brownian Motion by Yuval Peres,
University of California Berkeley, Department of Statistics.
5.6. PATH PROPERTIES OF BROWNIAN MOTION 267

Algorithms, Scripts, Simulations


Algorithm
For a given value of p and number of steps N on a time interval [0, T ] create
a scaled random walk ŴN (t) on [0, T ]. Then for a given minimum increment
h0 up to a maximum increment h1 create a sequence of equally spaced incre-
ments. Then at a fixed base-point, calculate the difference quotient for each
of the increments. When plotting is available, plot the difference quotients
versus the increments on a semi-logarithmic set of axes.
Because the difference quotients are computed using the scaled random
walk approximation of the Wiener process, the largest possible slope is
p p
T /N /(T /N ) = N/T .

So the plotted difference quotients will “max out” once the increment is less
than the scaled random walk step size.
The Geoegebra simulation finds the closest scaled random walk node less
than the basepoint x0 . Then using the slider to set the value of h, the
Geogebra simulation finds the closest scaled random node greater than x0 +h.
The Geogebra simulation draws the secant line through the two nodes to show
that the difference quotients do not appear to converge as h decreases. The
ultimate secant linepfor the smallest value of h is between two adjacent nodes
and has a slope of N/T .

Geogebra GeoGebra

R R script for.
1 p <- 0.5
2 N <- 1000
3
4 T <- 1
5
6 S <- array (0 , c ( N +1) )
7 rw <- cumsum ( 2 * ( runif ( N ) <= p ) -1 )
8 S [2:( N +1) ] <- rw
9
10 WcaretN <- function ( x ) {
11 Delta <- T / N
12

13 # add 1 since arrays are 1 - based


14 prior = floor ( x / Delta ) + 1
268 CHAPTER 5. BROWNIAN MOTION

15 subsequent = ceiling ( x / Delta ) + 1


16

17 retval <- sqrt ( Delta ) * ( S [ prior ] + (( x / Delta +1) -


prior ) * ( S [ subsequent ] - S [ prior ]) )
18 }
19
20 h0 <- 1e -7
21 h1 <- 1e -2
22 m = 30
23 basepoint = 0.5
24
25 h <- seq ( h0 , h1 , length = m )
26 x0 <- array ( basepoint , c ( m ) )
27

28 diffquotients <- abs ( WcaretN ( x0 + h ) - WcaretN ( x0 ) ) / h


29
30 plot (h , diffquotients , type = " l " , log = " y " , xlab =
expression ( h ) ,
31 ylab = expression ( abs ( W ( x0 + h ) - W ( x0 ) ) / h ) )
32 max ( diffquotients , na . rm = TRUE )

Octave Octave script for


1 p = 0.5;
2
3 global N = 1000;
4 global T = 1;
5
6 global S
7 S = zeros ( N +1 , 1) ;
8 S (2: N +1) = cumsum ( 2 * ( rand (N ,1) <= p ) - 1) ;
9
10 function retval = WcaretN ( x )
11 global N;
12 global T;
13 global S;
14 step = T/N;
15
16 # add 1 since arrays are 1 - based
17 prior = floor ( x / step ) + 1;
18 subsequent = ceil ( x / step ) + 1;
19

20 retval = sqrt ( step ) *( S ( prior ) + (( x / step +1) - prior ) .*(


S ( subsequent ) -S ( prior ) ) ) ;
5.6. PATH PROPERTIES OF BROWNIAN MOTION 269

21
22 endfunction
23
24 h0 = 1e -7;
25 h1 = 1e -2;
26 m = 30;
27 basepoint = 0.5;
28

29 h = transpose ( linspace ( h0 , h1 , m ) ) ;
30 x0 = basepoint * ones (m ,1) ;
31
32 diffquotients = abs ( WcaretN ( x0 + h ) - WcaretN ( x0 ) ) ./
h
33

34 semilogy ( h , diffquotients )
35 xlabel ( " h " )
36 ylabel ( " abs ( W ( x0 + h ) - W ( x0 ) ) / h ) " )

Perl Perl PDL script for


1 $p = 0.5;
2
3 $N = 1000;
4 $T = 1;
5
6 # the random walk
7 $S = zeros ( $N + 1 ) ;
8 $S ( 1 : $N ) .= cumusumover ( 2 * ( random ( $N ) <= $p ) -
1 );
9

10 # function WcaretN interpolating random walk


11 sub WcaretN {
12 my $x = shift @_ ;
13 $Delta = $T / $N ;
14
15 $prior = floor ( $x / $Delta ) ;
16 $subsequent = ceil ( $x / $Delta ) ;
17
18 $retval =
19 sqrt ( $Delta )
20 * ( $S ( $prior )
21 + ( ( $x / $Delta ) - $prior )
22 * ( $S ( $subsequent ) - $S ( $prior ) ) ) ;
23 }
270 CHAPTER 5. BROWNIAN MOTION

24
25 $h0 = 1e -7;
26 $h1 = 1e -2;
27 $m = 30;
28 $basepoint = 0.5;
29
30 $h = zeroes ( $m ) -> xlinvals ( $h0 , $h1 ) ;
31 $x0 = $basepoint * ones ( $m ) ;
32
33 $diffquotients = abs ( WcaretN ( $x0 + $h ) - WcaretN ( $x0 )
) / $h ;
34
35 # file output to use with external plotting programming
36 # such as gnuplot , R , octave , etc .
37 # Start gnuplot , then from gnuplot prompt
38 # set logscale y
39 # plot " pathproperties . dat " with lines
40
41 open ( F , " > pathproperties . dat " ) || die " cannot write : $ !
";
42 foreach $j ( 0 .. $m - 1 ) {
43 print F $h - > range ( [ $j ] ) , " " , $diffquotients - > range
( [ $j ] ) , " \ n " ;
44 }
45 close ( F ) ;

SciPy Scientific Python script for


1
2 import scipy
3
4 p = 0.5
5
6 N = 1000
7 T = 1.
8

9 # the random walk


10 S = scipy . zeros ( N +1)
11 S [1: N +1] = scipy . cumsum ( 2*( scipy . random . random ( N ) <= p
) - 1 )
12
13 def WcaretN ( x ) :
14 Delta = T / N
15 prior = scipy . floor ( x / Delta ) . astype ( int )
5.6. PATH PROPERTIES OF BROWNIAN MOTION 271

16 subsequent = scipy . ceil ( x / Delta ) . astype ( int )


17 return scipy . sqrt ( Delta ) *( S [ prior ] + ( x / Delta - prior
) *( S [ subsequent ] - S [ prior ]) )
18
19 h0 = 1e -7
20 h1 = 1e -2
21 m = 30
22 basepoint = 0.5
23
24 h = scipy . linspace ( h0 , h1 , m )
25 x0 = basepoint * scipy . ones (30)
26
27 diffquotients = scipy . absolute ( WcaretN ( x0 + h ) -
WcaretN ( x0 ) ) / h
28
29 # optional file output to use with external plotting
programming
30 # such as gnuplot , R , octave , etc .
31 # Start gnuplot , then from gnuplot prompt
32 # set logscale y
33 # plot " pathproperties . dat " with lines
34 f = open ( ’ pathproperties . dat ’ , ’w ’)
35 for j in range (0 , m -1) :
36 f . write ( str ( h [ j ]) + ’ ’+ str ( diffquotients [ j ]) + ’\ n ’) ;
37 f . close ()

Key Concepts
1. With probability 1 a Brownian Motion path is continuous but nowhere
differentiable.

2. Although a Brownian Motion path is continuous, it has many counter-


intuitive properties not usually associated with continuous functions.

Vocabulary
1. Probability theory uses the term almost surely to indicate an event
which occurs with probability 1. The complementary events occurring
with probability 0 are sometimes called negligible events. In infinite
sample spaces, it is possible to have meaningful events with probability
272 CHAPTER 5. BROWNIAN MOTION

zero. So to say an event occurs “almost surely” or is an negligible event


is not an empty phrase.

Problems to Work for Understanding


1. In an infinite sequence of fair coin flips, consider the event that there
are only finitely many tails. What is the probability of this event? Is
this event empty? Is this event impossible?

2. Provide a more complete heuristic argument based on Theorem 22 that


almost surely there is a sequence tn with limt→∞ tn = ∞ such that
W (t) = 0

3. Provide a heuristic argument based on Theorem 23 and the shifting


property that the zero set of Brownian Motion

{t ∈ [0, ∞) : W (t) = 0}

has no isolated points.

4. Looking in more advanced references, find another property of Brown-


ian Motion which illustrates strange path properties.

Outside Readings and Links:


1.

5.7 Quadratic Variation of the Wiener Pro-


cess
Section Starter Question
What is an example of a function that “varies a lot”? What is an example of a
function that does not “vary a lot”? How would you measure the “variation”
of a function?
5.7. QUADRATIC VARIATION OF THE WIENER PROCESS 273

Variation
Definition. A function f (x) is said to have bounded variation if, over the
closed interval [a, b], there exists an M such that

|f (t1 ) − f (a)| + |f (t2 ) − f (t1 )| + · · · + |f (b) − f (tn )| ≤ M

for all partitions a = t0 < t1 < t2 < . . . < tn < tn+1 = b of the interval.
The idea is that we measure the total (hence the absolute value) up-and-
down movement of a function. This definition is similar to other partition
based definitions such as the Riemann integral and the arc-length of the
graph of the function. A monotone increasing or decreasing function has
bounded variation. A function with a continuous derivative has bounded
variation. Some functions, for instance the Wiener Process, do not have
bounded variation.
Definition. A function f (t) is said to have quadratic variation if, over the
closed interval [a, b], there exists an M such that

(f (t1 ) − f (a))2 + (f (t2 ) − f (t1 ))2 + · · · + (f (b) − f (tn ))2 ≤ M

for all partitions a = t0 < t1 < t2 < . . . < tn < tn+1 = b of the interval.
Again, the idea is that we measure the total (hence the positive terms
created by squaring) up-and-down movement of a function. However, the
squaring will make small ups-and-downs smaller, so that a function without
bounded variation might have quadratic variation. In fact, this is the case
for the Wiener Process.
Definition. The total quadratic variation of Q of a function f on an
interval [a, b] is
n
X
Q = sup (f (ti+1 ) − f (ti ))2
P
i=0

where the supremum is taken over all partitions P with a = t0 < t1 < . . . <
tn < tn+1 = b, with mesh size going to zero as the number of partition points
n goes to infinity.

Quadratic Variation of the Wiener Process


We can guess that the Wiener Process might have quadratic variation by
considering the quadratic variation of the approximation using a coin-flipping
274 CHAPTER 5. BROWNIAN MOTION

fortune. Consider the piecewise


√ linear √function ŴN (t) on√[0, 1] defined by
the sequence of sums (1/ N )Tn = (1/ N )Y1 + · · · + (1/ N )Yn from the
Bernoulli random variables Yi = +1 with probability p = 1/2 and Yi = −1
with probability q = 1 − p = 1/2. With some analysis, it is possible to show
that we need only consider the quadratic variation at the node points. Then
each term (ŴN ((i + 1)/N ) − ŴN (i/N ))2 = (1/N )Yi+1
2
= 1/N . Therefore, the
quadratic variation using the total number of steps is Q = (1/N ) · N = 1.
Now remembering the Wiener Process is approximated by ŴN (t) suggests
that quadratic variation of the Wiener Process on [0, 1] is 1.
We will not rigorously prove that the total quadratic variation of the
Wiener Process is t with probability 1 because the proof requires deeper
analytic tools. We will instead prove a pair of theorems close to the general
definition of quadratic variation. First is a weak convergence version of the
quadratic variation of the Wiener Process, see [6].
Theorem 26. Let W (t) be the standard Wiener Process. For every fixed
t>0 " n    2 #
(k − 1)t

X kt
lim E W −W . = t.
n→∞
k=1
n n

Proof. Consider
n  2
(k − 1)t
  
X kt
W −W .
k=1
n n

Let   
kt
 (k−1)t
W n
−W n
Znk = p
t/n
Then for each n, the sequence Znk is a sequence of independent, identically
distributed N (0, 1) standard normal random variables. We can write the
quadratic variation on the regularly spaced partition 0 < 1/n < 2/n < . . . <
(n − 1)/n < 1 as
n  2 n
(k − 1)t
  
X kt X t 2
W −W .= Znk
k=1
n n k=1
n
n
!
1X 2
=t Z .
n k=1 nk
5.7. QUADRATIC VARIATION OF THE WIENER PROCESS 275

But notice that the expectation E [Znk


2
] of each term is the same as calculating
the variance of a standard normal N (0, 1) which is 1. Then
" n #
1X 2
E Z
n k=1 nk

converges to 1 by the Weak Law of Large Numbers. Therefore


" n    2 # " n
#
(k − 1)t

X kt 1X 2
lim E W −W = lim E t Znk = t.
n→∞
k=1
n n n→∞ n k=1

Remark. This proof is in itself not sufficient to prove the almost sure theorem
above because it relies on the Weak Law of Large Numbers. Hence the
theorem establishes convergence in distribution only while for the strong
theorem we want convergence almost surely. This is another example showing
that is easier to prove a weak convergence theorem in contrast to an almost
sure convergence theorem.
Theorem 27. Let W (t) be the standard Wiener Process. For every fixed
t>0
2n  2
k−1
  
X k
lim W n
t −W n
t =t
n→∞
n=1
2 2
with probability 1 (that is, almost surely).

Proof. Introduce some briefer notation for the proof, let:


k−1
   
k
∆nk = W n
t −W n
t k = 1, . . . , 2n
2 2
and
Wnk = ∆2nk − t/2n k = 1, . . . , 2n .
P2n 2
P2n
We want to show that k=1 ∆nk → t or equivalently: k=1 Wnk → 0.
n
For each n, the random variables Wnk , k = 1, . . . , 2 are independent and
identically distributed by properties 1 and 2 of the definition of the standard
Wiener Process. Furthermore,

E [Wnk ] = E ∆2nk − t/2n = 0


 
276 CHAPTER 5. BROWNIAN MOTION

by property 1 of the definition of the standard Wiener Process.


A routine (but omitted) computation of the fourth moment of the normal
distribution shows that
E Wnk = 2t2 /4n .
 2

Finally, by property 2 of the definition of the standard Wiener Process


E [Wnk Wnj ] = 0, k 6= j.
Now, expanding the square of the sum, and applying all of these computa-
tions ( )2 
2n 2n
X X
E E Wnk = 2n+1 t2 /4n = 2t2 /2n .
 2
Wnk  =
k=1 k=1

Now apply Chebyshev’s Inequality to see:


" 2n #  n
X 2t2 1
P Wnk >  ≤ 2 .


k=1
 2

Now since (1/2)n is a convergent series, the Borel-Cantelli lemma implies


P
that the event n
X2
W nk > 



k=1
can occur for only finitely many n. That is, for any  > 0, there is an N ,
such that for n > N 2n
X
Wnk < .



k=1
Pn
Therefore we must have that limn→∞ 2k=1 Wnk = 0, and we have established
what we wished to show.
Remark. Starting from
n
2  2
k−1
  
X k
lim W t −W t =t
n→∞
n=1
2n 2n

and without thinking too carefully about what it might mean, we can imagine
an elementary calculus limit to the left side and write the formula:
Z t Z t
2
[ dW (τ )] = t = dτ .
0 0
5.7. QUADRATIC VARIATION OF THE WIENER PROCESS 277

In fact, more advanced mathematics makes this sensible and mathemati-


cally sound. Now from this relation, we could write the integral equality in
differential form:
dW (τ )2 = dτ .
The important thing to remember here is that the formula suggests that
the Wiener Process has differentials that cannot be ignored in second (or
squared, or quadratic) order.
Remark. This theorem can be nicely summarized in the following way: Let
dW (t) = W (t + dt) − W (t). Let dW (t)2 = (W (t + dt) − W (t))2 . Then
(although mathematically not rigorously) it is helpful to remember
dW (t) ∼ N (0, dt)
(dW (t))2 ∼ N ( dt, 0).

Theorem 28. Let W (t) be the standard Wiener Process. For every fixed
t>0
2n
k − 1
   
X k
lim W 2n t − W t = ∞.

n→∞
n=1
2n
In other words, the total variation of a Wiener Process path is infinite, with
probability 1.

Proof.
2n P2n
W kn t − W k−1
  2
− t
   
X k k 1 n=1 2 2 n

W t − W t ≥ k k−1
 .
2n 2n

j=1,...,2n W 2n t − W
max t
n=1 2n

The numerator on the right converges to t, while the denominator goes to


0 because Wiener Process are continuous, therefore uniformly continuous on
bounded intervals. Therefore the fraction on the right goes to infinity.

Sources
The theorem in this section is drawn from A First Course in Stochastic
Processes by S. Karlin, and H. Taylor, Academic Press, 1975. The heuristic
proof using the weak law was taken from Financial Calculus: An introduction
to derivative pricing by M Baxter, and A. Rennie, Cambridge University
Press, 1996, page 59. The mnemonic statement of the quadratic variation in
differential form is derived from Steele’s text.
278 CHAPTER 5. BROWNIAN MOTION

Algorithms, Scripts, Simulations


Algorithm
The simulation of the quadratic variation of the Wiener Process demonstrates
how much the properties of the Wiener Process depend on the full limiting
function, not an approximation. For simulation of quadratic variation of the
Wiener Process using an approximation ŴN (x) of the Wiener Process, the
mesh size of the partition should be approximately the same size as 1/N .
This is easiest to illustrate when the number of partition points is a divisor
or multiple of N and evenly spaced. We already showed above that if the
mesh points coincide with the N steps of the scaled random walk, then the
quadratic variation is 1.
Consider the case when the number of evenly spaced partition points is
a multiple of N , say m = kN . Then on each subintervalp [i/m, (i + 1)/m]2 =
[i/(kN ), (i+1)/(kN )] the quadratic variation is ((±1/ T /N )·(1/(kN ))) =
1/(k 2 N T ) and the total of all kN steps is 1/(kT ) which approaches 0 as k
increases. This is not what is predicted by the theorem about the quadratic
variation of the Wiener Process, but it is consistent with the approximation
function ŴN (t), see the discussion below.
Now consider the case when m is a divisor of N , say km = N . Then
the quadratic variation of ŴN (t) on a partition interval will be the sum of
k scaled random walk steps, squared. An example will show what happens.
With T = 1, let N = 1000 and let the partition have 200 equally spaced
points, so k = 5. Then each partition interval will have a quadratic variation
of:

• (1/ 1000)2 with probability 2 · 51 · (1/32);


√ 5

• (3/ 1000)2 with probability 2 · 3
· (1/32); and
√ 5

• (5/ 1000)2 with probability 2 · 5
· (1/32).

Each partition interval quadratic variation has a mean of (1/1000)·(160/32) =


1/200 and a variance of (1/1000)2 · (1280/32) = 40/(1000)2 . Add 200 par-
tition interval quadratic variations to get the total quadratic variation of
ŴN (t) on [0, 1]. By the Central Limit Theorem the total quadratic varia-
tion will be
√ approximately
√ normally
√ distributed with mean 1 and standard
deviation 200 · ( 40/1000) = 5/25 ≈ 0.089.
5.7. QUADRATIC VARIATION OF THE WIENER PROCESS 279

Note that although ŴN (t) does not have a continuous first derivative,
it fails to have a derivative at only finitely many points, so in that way it
is almost differentiable. In fact,
p ŴN (t) satisfies a uniform Lipschitz condi-
tion (with Lipschitz constant N/T ), which is enough to show that it has
bounded variation. As such the quadratic variation of ŴN (t) is 0.

Scripts
R R script for Quadratic Variation.
1 p <- 0.5
2 N <- 1000
3
4 T <- 1
5
6 S <- array (0 , c ( N +1) )
7 rw <- cumsum ( 2 * ( runif ( N ) <= p ) -1 )
8 S [2:( N +1) ] <- rw
9
10 WcaretN <- function ( x ) {
11 Delta <- T / N
12
13 # add 1 since arrays are 1 - based
14 prior = floor ( x / Delta ) + 1
15 subsequent = ceiling ( x / Delta ) + 1
16
17 retval <- sqrt ( Delta ) * ( S [ prior ] + (( x / Delta +1) -
prior ) * ( S [ subsequent ] - S [ prior ]) )
18 }
19

20 m1 <- N / 5
21 partition1 <- seq (0 ,T ,1 / m1 )
22 m2 <- N
23 partition2 <- seq (0 ,T ,1 / m2 )
24 m3 <- 3 * N
25 partition3 <- seq (0 ,T ,1 / m3 )
26
27 qv1 <- sum ( ( WcaretN ( partition1 [ -1]) - WcaretN (
partition1 [ - length ( partition1 ) ]) ) ^2 )
28 qv2 <- sum ( ( WcaretN ( partition2 [ -1]) - WcaretN (
partition2 [ - length ( partition2 ) ]) ) ^2 )
29 qv3 <- sum ( ( WcaretN ( partition3 [ -1]) - WcaretN (
partition3 [ - length ( partition3 ) ]) ) ^2 )
30
280 CHAPTER 5. BROWNIAN MOTION

31 cat ( sprintf ( " Quadratic variation of approximation of


Wiener process paths with % d scaled random steps with
% d partition intervals is : % f \ n " , N , m1 , qv1 ) )
32 cat ( sprintf ( " Quadratic variation of approximation of
Wiener process paths with % d scaled random steps with
% d partition intervals is : % f \ n " , N , m2 , qv2 ) )
33 cat ( sprintf ( " Quadratic variation of approximation of
Wiener process paths with % d scaled random steps with
% d partition intervals is : % f \ n " , N , m3 , qv3 ) )

Octave Octave script for Quadratic Variation


1 p = 0.5;
2
3 global N = 1000;
4 global T = 1;
5

6 global S
7 S = zeros ( N +1 , 1) ;
8 S (2: N +1) = cumsum ( 2 * ( rand (N ,1) <= p ) - 1) ;
9
10 function retval = WcaretN ( x )
11 global N;
12 global T;
13 global S;
14 step = T/N;
15
16 # add 1 since arrays are 1 - based
17 prior = floor ( x / step ) + 1;
18 subsequent = ceil ( x / step ) + 1;
19
20 retval = sqrt ( step ) *( S ( prior ) + (( x / step +1) - prior ) .*(
S ( subsequent ) -S ( prior ) ) ) ;
21
22 endfunction
23
24 m1 = N /5;
25 partition1 = transpose ( linspace (0 ,T , m1 +1) ) ;
26 m2 = N ;
27 partition2 = transpose ( linspace (0 ,T , m2 +1) ) ;
28 m3 = 3* N ;
29 partition3 = transpose ( linspace (0 ,T , m3 +1) ) ;
30
5.7. QUADRATIC VARIATION OF THE WIENER PROCESS 281

31 qv1 = sumsq ( WcaretN ( partition1 (2: m1 +1) ) - WcaretN (


partition1 (1: m1 ) ) ) ;
32 qv2 = sumsq ( WcaretN ( partition2 (2: m2 +1) ) - WcaretN (
partition2 (1: m2 ) ) ) ;
33 qv3 = sumsq ( WcaretN ( partition3 (2: m3 +1) ) - WcaretN (
partition3 (1: m3 ) ) ) ;
34
35 printf ( " Quadratic variation of approximation of Wiener
process paths with % d scaled random steps with % d
partition intervals is : % f \ n " , N , m1 , qv1 )
36 printf ( " Quadratic variation of approximation of Wiener
process paths with % d scaled random steps with % d
partition intervals is : % f \ n " , N , m2 , qv2 )
37 printf ( " Quadratic variation of approximation of Wiener
process paths with % d scaled random steps with % d
partition intervals is : % f \ n " , N , m3 , qv3 )

Perl Perl PDL script for Quadratic Variation


1 use PDL :: NiceSlice ;
2
3 $p = 0.5;
4
5 $N = 1000;
6 $T = 1;
7
8 # the random walk
9 $S = zeros ( $N + 1 ) ;
10 $S ( 1 : $N ) .= cumusumover ( 2 * ( random ( $N ) <= $p ) -
1 );
11
12 # function WcaretN interpolating random walk
13 sub WcaretN {
14 my $x = shift @_ ;
15 $Delta = $T / $N ;
16

17 $prior = floor ( $x / $Delta ) ;


18 $subsequent = ceil ( $x / $Delta ) ;
19
20 $retval =
21 sqrt ( $Delta )
22 * ( $S ( $prior )
23 + ( ( $x / $Delta ) - $prior )
24 * ( $S ( $subsequent ) - $S ( $prior ) ) ) ;
282 CHAPTER 5. BROWNIAN MOTION

25 }
26

27 $m1 = $N /5;
28 $partition1 = zeroes ( $m1 +1) -> xlinvals ( 0 , $T ) ;
29 $m2 = $N ;
30 $partition2 = zeroes ( $m2 +1) -> xlinvals ( 0 , $T ) ;
31 $m3 = 3* $N ;
32 $partition3 = zeroes ( $m3 +1) -> xlinvals ( 0 , $T ) ;
33
34 $qv1 = sum ( ( WcaretN ( $partition1 (1: $m1 ) ) - WcaretN (
$partition1 (0: $m1 -1) ) ) **2 ) ;
35 $qv2 = sum ( ( WcaretN ( $partition2 (1: $m2 ) ) - WcaretN (
$partition2 (0: $m2 -1) ) ) **2 ) ;
36 $qv3 = sum ( ( WcaretN ( $partition3 (1: $m3 ) ) - WcaretN (
$partition3 (0: $m3 -1) ) ) **2 ) ;
37
38 print " Quadratic variation of approximation of Wiener
process paths with " , $N , " scaled random steps with " ,
$m1 , " partition intervals is : " , $qv1 , " \ n " ;
39 print " Quadratic variation of approximation of Wiener
process paths with " , $N , " scaled random steps with " ,
$m2 , " partition intervals is : " , $qv2 , " \ n " ;
40 print " Quadratic variation of approximation of Wiener
process paths with " , $N , " scaled random steps with " ,
$m3 , " partition intervals is : " , $qv3 , " \ n " ;

SciPy Scientific Python script for Quadratic Variation


1 import scipy
2

3 p = 0.5
4
5 N = 1000
6 T = 1.
7
8 # the random walk
9 S = scipy . zeros ( N +1)
10 S [1: N +1] = scipy . cumsum ( 2*( scipy . random . random ( N ) <= p
) - 1 )
11
12 def WcaretN ( x ) :
13 Delta = T / N
14 prior = scipy . floor ( x / Delta ) . astype ( int )
15 subsequent = scipy . ceil ( x / Delta ) . astype ( int )
5.7. QUADRATIC VARIATION OF THE WIENER PROCESS 283

16 return scipy . sqrt ( Delta ) *( S [ prior ] + ( x / Delta - prior


) *( S [ subsequent ] - S [ prior ]) )
17
18 m1 = N /5
19 partition1 = scipy . linspace ( 0 , T , m1 +1)
20 m2 = N
21 partition2 = scipy . linspace ( 0 , T , m2 +1)
22 m3 = 3* N
23 partition3 = scipy . linspace ( 0 , T , m3 +1)
24
25 qv1 = scipy . sum ( ( WcaretN ( partition1 [1: m1 +1] ) - WcaretN
( partition1 [0: m1 ] ) ) **2)
26 qv2 = scipy . sum ( ( WcaretN ( partition2 [1: m2 +1] ) - WcaretN
( partition2 [0: m2 ] ) ) **2)
27 qv3 = scipy . sum ( ( WcaretN ( partition3 [1: m3 +1] ) - WcaretN
( partition3 [0: m3 ] ) ) **2)
28
29 print " Quadratic variation of approximation of Wiener
process paths with " , N , " scaled random steps with " ,
m1 , " partition intervals is : " , qv1
30 print " Quadratic variation of approximation of Wiener
process paths with " , N , " scaled random steps with " ,
m2 , " partition intervals is : " , qv2
31 print " Quadratic variation of approximation of Wiener
process paths with " , N , " scaled random steps with " ,
m3 , " partition intervals is : " , qv3

Key Concepts
1. The total quadratic variation of the Wiener Process on [0, t] is t.
2. This fact has profound consequences for dealing with the Wiener Pro-
cess analytically and ultimately will lead to Itô’s formula.

Vocabulary
1. A function f (t) is said to have bounded variation if, over the closed
interval [a, b], there exists an M such that
|f (t1 ) − f (a)| + |f (t2 ) − f (t1 )| + · · · + |f (b) − f (tn )| ≤ M
for all partitions a = t0 < t1 < t2 < . . . < tn < tn+1 = b of the interval.
284 CHAPTER 5. BROWNIAN MOTION

2. A function f (t) is said to have quadratic variation if, over the closed
interval [a, b], there exists an M such that

(f (t1 ) − f (a))2 + (f (t2 ) − f (t1 ))2 + · · · + (f (b) − f (tn ))2 ≤ M

for all partitions a = t0 < t1 < t2 < . . . < tn < tn+1 = b of the interval.

3. The mesh size of a partition P with a = t0 < t1 < . . . < tn < tn+1 = b
is maxj=0,...,n {tj+1 − tj | j = 0, . . . , n}.

4. The total quadratic variation of a function f on an interval [a, b] is


n
X
sup (f (tj+1 ) − f (tj ))2
P
j=0

where the supremum is taken over all partitions P with a = t0 < t1 <
. . . < tn < tn+1 = b, with mesh size going to zero as the number of
partition points n goes to infinity.

Problems to Work for Understanding


1. Show that a monotone increasing function has bounded variation.

2. Show that a function with continuous derivative has bounded variation.

3. Show that the function


(
t2 sin(1/t) 0 < t ≤ 1
f (t) =
0 t=0

is of bounded variation, while the function


(
t sin(1/t) 0 < t ≤ 1
f (t) =
0 t=0

is not of bounded variation.

4. Show that a continuous function of bounded variation is also of quadratic


variation.
5.7. QUADRATIC VARIATION OF THE WIENER PROCESS 285

5. Show that the fourth moment E [Z 4 ] = 3 where Z ∼ N (0, 1). Then


show that
E Wnk = 2t2 /4n
 2

6. Modifying one of the scripts, find the quadratic variation of ŴN (t) with
a partition with m partition intervals whose endpoints are randomly
selected values in [0, T ]. One way to approach this is to create a list of
m − 1 points uniformly distributed in [0, T ], append the values 0 and T
to the list, then sort into ascending order to create the partition points.
Find the mesh of this random partition and print its value along with
the quadratic variation. What happens when m is a multiple of N ?
What happens when m is a divisor of N ? What could possibly go
wrong in this calculation?

7. Generalize the example with N = 1000 and m = 200 of the quadratic


variation of ŴN (t) on [0, 1] to the case when the number of partition
intervals m is a divisor of some N , say km = N .

Outside Readings and Links:


1. Wikipedia, Quadratic variation Contributed by S. Dunbar, November
10, 2009.

2. Michael Kozdron, University of Regina, Contributed by S. Dunbar,


November 10, 2009.
286 CHAPTER 5. BROWNIAN MOTION
Chapter 6

Stochastic Calculus

6.1 Stochastic Differential Equations and the


Euler-Maruyama Method
Section Starter Question
Explain how to use a slope-field diagram to solve the ordinary differential
equation
dx
= x.
dt
How would you turn that process into an algorithm to numerically compute
an approximate solution without a diagram?

Stochastic Differential Equations: Symbolically


The straight line segment is the building block of differential calculus. The
basic idea behind differential calculus is that differentiable functions, no mat-
ter how difficult their global behavior, are locally approximated by straight
line segments. In particular, this is the idea behind Euler’s method for ap-
proximating differentiable functions defined by differential equations.
We know that rescaling (“zooming in” on) Brownian motion does not
produce a straight line, it produces another image of Brownian motion. This
self-similarity is ideal for an infinitesimal building block, for instance, we
could build global Brownian motion out of lots of local “chunks” of Brow-
nian motion. This suggests we could build other stochastic processes out
of suitably scaled Brownian motion. In addition, if we include straight line

287
288 CHAPTER 6. STOCHASTIC CALCULUS

segments we can overlay the behavior of differentiable functions onto the


stochastic processes as well. Thus, straight line segments and “chunks” of
Brownian motion are the building blocks of stochastic calculus.
With stochastic differential calculus, we can build new stochastic pro-
cesses. We do this by specifying how to build the new stochastic processes
locally from our base deterministic function, the straight line and our base
stochastic process, standard Brownian motion. We write the local change in
value of the stochastic process over a time interval of (infinitesimal) length
dt as
dX = G(X(t)) dt +H(X(t)) dW (t), X(t0 ) = X0 . (6.1)
Note that we are not allowed to write
dX dW
= G(X(t)) + H(X(t)) , X(t0 ) = X0
dt dt
since standard Brownian motion is nowhere differentiable with probability
1. Actually, the informal stochastic differential equation (6.1) is a compact
way of writing a rigorously defined, equivalent implicit Itô integral equation.
Since we do not have the required rigor, we will approach the stochastic
differential equation intuitively.
The stochastic differential equation says the initial point (t0 , X0 ) is spec-
ified, perhaps with X0 a random variable with a given distribution. A de-
terministic component at each point has a slope determined through G at
that point. In addition, some random perturbation affects the evolution of
the process. The random perturbation is normally distributed with mean 0.
The variance of the random perturbation is (H(X(t)))2 at (t, X(t)). This is
a simple expression of a Stochastic Differential Equation (SDE) which deter-
mines a stochastic process, just as an Ordinary Differential Equation (ODE)
determines a differentiable function. We extend the process with the incre-
mental change information and repeat. This is an expression in words of
the Euler-Maruyama method for numerically simulating the stochastic
differential expression.
Example. A very simple stochastic differential equation is

dX = r dt + dW , X(0) = b

with r a constant. Take a deterministic initial condition to be X(0) = b. The


new process is the stochastic extension of the differential equation expression
of a straight line. The new stochastic process X is drifting or trending at
6.1. STOCHASTIC DIFFERENTIAL EQUATIONS AND THE EULER-MARUYAMA METHOD289

constant rate r with a random variation due to Brownian motion perturba-


tions around that trend. We will later show explicitly that the solution of
this SDE is X(t) = b + rt + W (t) although it is seems intuitively clear that
this should be the process. We will call this Brownian motion with drift.
Example. Another very simple stochastic differential equation is

dX = σ dW , X(0) = b

This stochastic differential equation says that the process is evolving as a


multiple of standard Brownian motion. The solution may be easily guessed as
X(t) = σW (t) which has variance σ 2 t on increments of length t. Sometimes
the new process is called Brownian motion (in contrast to standard Brownian
motion which has variance t on increments of length t).
We combine the previous two examples to consider

dX = r dt +σ dW , X(0) = b

which has solution X(t) = b+rt+σW (t), a multiple of Brownian motion


with drift r started at b. Sometimes this extension of standard Brownian
motion is called Brownian motion. Some authors consider this process di-
rectly instead of the more special case we considered in the previous chapter.
Example. The next simplest and first non-trivial differential equation is

dX = X dW .

Here the differential equation says that process is evolving like Brownian
motion with a variance which is the square of the process value. When the
process is small, the variance is small, when the process is large, the variance
is large. Expressing the stochastic differential equation as dX /X = dW we
may say that the relative change acts like standard Brownian motion. The
resulting stochastic process is called geometric Brownian motion and it
will figure extensively later as a model of security prices.
Example. The next simplest differential equation is

dX = rX dt +σX dW , X(0) = b.

Here the stochastic differential equation says that the growth of the process
at a point is proportional to the process value, with a random perturbation
290 CHAPTER 6. STOCHASTIC CALCULUS

proportional to the process value. Again looking ahead, we could write the
differential equation as dX /X = r dt +σ dW and interpret it to say the
relative rate of increase is proportional to the time observed together with a
random perturbation like a Brownian increment corresponding to the length
of time. We will show later that the analytic expression for the stochastic
process defined by this SDE is b exp((r − 12 σ 2 )t + σW (t)).

Stochastic Differential Equations: Numerically


The sample path that the Euler-Maruyama method produces numerically is
the analog of using the Euler method.
The formula for the Euler-Maruyama (EM) method is based on the defi-
nition of the Itô stochastic integral:
Xj = Xj−1 + G(Xj−1 ) dt +H(Xj−1 )(W (tj−1 + dt) − W (tj−1 )),
tj = tj−1 + dt .
Note that the initial conditions X0 and t0 set the starting point.
In this text, we use coin-flipping sequences of an appropriate length
scaled to create an approximation to W (t) just as in the section Approx-
imation to Brownian Motion. The coin-flipping sequences emphasize the
discrete nature of the simulations with an easily constructed random pro-
cess. This is consistent with the approach of this text which always uses
coin-flipping sequences to create random processes. Note that since the in-
crements W (tj−1 + dt)−W (tj−1 ) are independent and identically distributed,
we will use independent coin-flip sequences to generate the approximation of
the increments. The EM method could use independent normal random
variates directly to obtain the increments W (tj−1 + dt) − W (tj−1 ). Using
independent normal random variates directly would be easier and more effi-
cient. The exercises modify the example scripts to use independent normal
random variates directly.
Then

dW = W (tj−1 + dt) − W (tj−1 ) = W ( dt)


Ŵ (N dt) √ Ŵ (N dt)
≈ ŴN ( dt) = √ = dt √ .
N N dt
The first equality above is the definition of an increment, the second equal-
ity means the random variables W (tj−1 + dt) − W (tj−1 ) and W ( dt) have
6.1. STOCHASTIC DIFFERENTIAL EQUATIONS AND THE EULER-MARUYAMA METHOD291

j tj Xj 2Xj dt dW Xj dW 2Xj dt + Xj +
Xj dW 2Xj dt +
Xj dW
0 0 1 0.2 0 0 0.2 1.2
1 0.1 1.2 0.24 0.2 0.24 0.48 1.68
2 0.2 1.68 0.34 -0.2 -0.34 0.0 1.68
3 0.3 1.68 0.34 0.4 0.67 1.01 2.69
4 0.4 2.69 0.54 -0.2 -0.54 0.0 2.69
5 0.5 2.69 0.54 0 0 0.54 3.23
6 0.6 3.23 0.65 0.4 1.29 1.94 5.16
7 0.7 5.16 1.03 0.4 2.06 3.1 8.26
8 0.8 8.26 1.65 0.4 3.3 4.95 13.21
9 0.9 13.21 2.64 0 0 2.64 15.85
10 1.0 15.85

Figure 6.1: Simulation with the Euler-Maruyama method of a process defined


by a stochastic differential equation.

the same distribution because of the definition of standard Brownian motion


which specifies that increments with equal length are normally distributed
with variance equal to the increment length. The approximate equality oc-
curs because of the approximation of Brownian motion by coin-flipping se-
quences. We generate the approximations using a random number generator,
but we could as well use actual coin-flipping. In Table 6.1 the generation of
the sequences is not recorded, only the summed and scaled (independently
sampled) outcomes.√ For convenience, take dt = 1/10, N = 100, so we need
Ŵ (100 · (1/10))/ 100 = T10 /10. Then to obtain the entries in the column
labeled dW in the table we flip a coin 10 times and record T10 /10. Take
r = 2, b = 1, and σ = 1, so we simulate the solution of

dX = 2X dt +X dW , X(0) = 1.

A computer program can produce such a table with the step size made much
smaller, presumably resulting in better approximation properties. In fact, it
is possible to consider kinds of convergence for the EM method comparable
to the Strong Law of Large Numbers and the Weak Law of Large Numbers.
See the Problems for examples.
292 CHAPTER 6. STOCHASTIC CALCULUS

Discussion

The numerical approximation procedure using coin-flipping makes it clear


that the Euler-Maruyama method generates a random process. The value of
the process depends on the time value and the coin-flip sequence. Each gen-
eration of an approximation will be different because the coin-flip sequence
is different. The Euler-Maruyama method generates a stochastic process
path approximation. To derive distributions and statistics about the process
requires generating multiple paths, see the Problems for examples.
This shows that stochastic differential equations provide a way to define
new stochastic processes. This is analogous to the notion that ordinary
differential equations define new functions to study and use. In fact, one
approach to developing calculus and the analysis of functions is to start
with differential equations, use the Euler method to define approximations of
solutions, and then to develop a theory to handle the passage to continuous
variables. This approach is especially useful for a mathematical modeling
viewpoint since the model often uses differential equations.
This text follows the approach of starting with stochastic differential
equations to describe a situation and numerically defining new stochastic pro-
cesses to model the situation. At certain points, we appeal to more rigorous
mathematical theory to justify the modeling and approximation. One impor-
tant justification asserts that if we write a stochastic differential equation,
then solutions exist and the stochastic differential equation always yields the
same process under equivalent conditions. The Existence-Uniqueness Theo-
rem shows that under reasonable modeling conditions stochastic differential
equations do indeed satisfy this requirement.

Theorem 29 (Existence-Uniqueness). For the stochastic differential equa-


tion
dX = G(t, X(t)) dt +H(t, X(t)) dW (t), X(t0 ) = X0

assume

1. Both G(t, x) and H(t, x) are continuous on (t, x) ∈ [t0 , T ] × R.

2. The coefficient functions G and H satisfy a Lipschitz condition:

|G(t, x) − G(t, y)| + |H(t, x) − H(t, y)| ≤ K|x − y|.


6.1. STOCHASTIC DIFFERENTIAL EQUATIONS AND THE EULER-MARUYAMA METHOD293

3. The coefficient functions G and H satisfy a growth condition in the


second variable

|G(t, x)|2 + |H(t, x)|2 ≤ K(1 + |x|2 )

for all t ∈ [t0 , T ] and x ∈ R.

Then the stochastic differential equation has a strong solution on [t0 , T ] that
is continuous with probability 1 and

sup E X 2 (t) < ∞


 
t∈[t0 ,T ]

and for each given Wiener process W (t), the corresponding strong solutions
are pathwise unique which means that if X and Y are two strong solutions,
then " #
P sup |X(t) − Y (t)| = 0 = 1.
t∈[t0 ,T ]

See [38] for a precise definition of “strong solution” but essentially it


means that for each given Wiener process W (t) we can generate a solution to
the SDE. Note that the coefficient functions here are two-variable functions
of both time t and location x, which is more general than the functions
considered in equation (6.1). The restrictions on the functions G(t, x) and
H(t, x), especially the continuity condition, can be considerably relaxed and
the theorem will still remain true.

Sources
This section is adapted from: “An Algorithmic Introduction to the Numerical
Simulation of Stochastic Differential Equations”, by Desmond J. Higham, in
SIAM Review, Vol. 43, No. 3, pp. 525-546, 2001 and Financial Calculus: An
introduction to derivative pricing by M. Baxter, and A. Rennie, Cambridge
University Press, 1996, pages 52-62. The Existence-Uniqueness Theorem is
adapted from An Introduction to Stochastic Processes with Applications to
Biology, by L. J. S. Allen, Pearson Prentice-Hall, 2003, pages 342-343 and
Numerical Solution of Stochastic Differential Equations, by Peter Kloeden
and Eckhard Platen, Springer Verlag, 1992, pages 127-131.
294 CHAPTER 6. STOCHASTIC CALCULUS

Algorithms, Scripts, Simulations


Algorithm
The scripts apply the EM method to simulate the solution of

dX = rX dt +σX dW , X(0) = b.

The parameters N for the number of steps in the EM method, T for the
ending time, and stochastic differential equation parameters r and s are set.
Find the time step and initialize the arrays holding the time steps and the
solution simulation.
Using M = 30N create a piecewise linear function ŴM (t) using the ap-
proximation scripts in Approximation to Brownian Motion. The parameter
30 is chosen according to the rule of thumb in the DeMoivre-Laplace Central
Limit Theorem, Central Limit Theorem. Then each time increment will have
30 coin flips, sufficient according to the rule of thumb to guarantee a scaled
sum which is appropriately normally distributed.
Then loop over the number of steps using the EM algorithm

Xj = Xj−1 + G(Xj−1 ) dt +H(Xj−1 )(W (tj−1 + dt) − W (tj−1 ))

and plot the resulting simulation.

Scripts
Geogebra GeoGebra

R R script for stochasticsdes.R


1 r <- -1 # growth / decay
rate
2 sigma <- 0.5 # relative
standard deviation
3 b <- 3 # initial
condition
4
5 M <- 100 # number of steps
for EM method to take
6 T <- 1 # maximum time
7 h <- T / M # time step
8 t <- seq ( length = M +1 , from =0 , by = h ) # t is the vector
[0 1 h 2 h 3 h ... Nh ]
6.1. STOCHASTIC DIFFERENTIAL EQUATIONS AND THE EULER-MARUYAMA METHOD295

9 X <- array (0 , c ( M +1) ) # place to store


locations
10
11 N <- 30 * ( M +1) # number of steps
for the Brownian Motion approx
12
13 p <- 0.5
14 S <- array (0 , c ( N +1) )
15 rw <- cumsum ( 2 * ( runif ( N ) <= p ) -1 )
16 S [2:( N +1) ] <- rw
17
18 WcaretN <- function ( z ) {
19 Delta <- T / N
20

21 # add 1 since arrays are 1 - based


22 prior = floor ( z / Delta ) + 1
23 subsequent = ceiling ( z / Delta ) + 1
24
25 retval <- sqrt ( Delta ) * ( S [ prior ] + (( z / Delta +1) -
prior ) * ( S [ subsequent ] - S [ prior ]) )
26 }
27
28 X [1] <- b
29 for ( i in 1: M ) {
30 X [ i +1] <- X [ i ]+ r * X [ i ] * h + sigma * X [ i ] * ( WcaretN ( t [ i ]+ h ) -
WcaretN ( t [ i ]) )
31 }
32
33 plot (t ,X , " l " , xlim = c (0 , T ) , ylim = c ( X [1] - exp ( abs ( r ) * T +1) ,
X [1]+ exp ( abs ( r ) * T +1) ) )
34 title ( main = paste ( " r = " , r , " sigma = " , sigma , " steps = " ,
M))
35

Octave Octave script for stochasticdes.m


1 r = -1; # growth / decay rate
2 sigma = 0.5; # \ sigma
3 b = 3; # initial value
4
5 M =100; # number of steps for EM method to take
6 global T =1; # maximum time
7 h=T/M; # time step
8 t =(0: h : T ) ; # t is the vector [0 1 h 2 h 3 h ... Nh ]
296 CHAPTER 6. STOCHASTIC CALCULUS

9 X = zeros ( size ( t ) ) ; # prepare place to store locations


10

11 global N = 30*( M +1) ; # number of steps for the


Brownian
12 # Motion approximation
13 global S ;
14 p = 1/2;
15 S = zeros ( N +1 , 1) ;
16 S (2: N +1) = cumsum ( 2 * ( rand (N ,1) <= p ) - 1) ;
17
18 function retval = WcaretN ( z )
19 global N ;
20 global T ;
21 global S ;
22 Delta = T / N ;
23
24 # add 1 since arrays are 1 - based
25 prior = floor ( z / Delta ) + 1;
26 subsequent = ceil ( z / Delta ) + 1;
27

28 retval = sqrt ( Delta ) *( S ( prior ) + (( z / Delta +1) - prior )


.*( S ( subsequent ) -S ( prior ) ) ) ;
29
30 endfunction
31
32 X (1) = b ; # initial height at t = 0
33 for i =1: M # start taking steps
34 X ( i +1) = X ( i ) + r * X ( i ) * h + sigma * X ( i ) *( WcaretN ( t ( i ) + h ) -
WcaretN ( t ( i ) ) ) ;
35 end ;
36
37 plot (t , X ) # plot more permanently
38 axis ([0 T X (1) - exp ( abs ( r ) * T +1) X (1) + exp ( abs ( r ) * T +1) ]) ;
# set axis limits
39 grid on ;
40 title ([ " r = " , num2str ( r ) , " , sigma = " , num2str ( sigma ) ,
" , steps = " , num2str ( M ) ] ) ;
41

Perl Perl PDL script for stochasticdes.pl


1 # #!/ usr / bin / pdl
2 use PDL :: NiceSlice ;
3
6.1. STOCHASTIC DIFFERENTIAL EQUATIONS AND THE EULER-MARUYAMA METHOD297

4 $r = -1; # growth / decay rate


5 $sigma = 0.5; # standard deviation
6 $b = 3; # initial value
7
8 $M = 100; # number of steps for EM method to take
9 $T = 1; # maximum time
10 $h = $T / $M ; # time step
11 $t = zeros ( $M + 1 ) -> xlinvals ( 0 , $T ) ; # vector of [0 ,
1h , 2h , 3 h ... Mh ]
12 $X = zeros ( $M + 1 ) ;
13
14 $N = 30*( $M +1) ; # number of steps for the Brownian
Motion
15

16 $p = 0.5;
17 $S = zeros ( $N + 1 ) ; # the random walk
18 $S ( 1 : $N ) .= cumusumover ( 2 * ( random ( $N ) <= $p ) -
1 );
19
20 # function WcaretN interpolating random walk
21 sub WcaretN {
22 my $x = shift @_ ;
23 $Delta = $T / $N ;
24
25 $prior = floor ( $x / $Delta ) ;
26 $subsequent = ceil ( $x / $Delta ) ;
27
28 $retval =
29 sqrt ( $Delta )
30 * ( $S ( $prior )
31 + ( ( $x / $Delta ) - $prior )
32 * ( $S ( $subsequent ) - $S ( $prior ) ) ) ;
33 }
34
35 $X (0) .= $b ; # initial value at t = 0
36 for ( $i =0; $i <= $M -1; $i ++) { # start taking
steps
37 $X ( $i +1) .= $X ( $i ) + $r * $X ( $i ) * $h + $sigma * $X ( $i ) *( WcaretN
( $t ( $i ) + $h ) - WcaretN ( $t ( $i ) ) ) ;
38 }
39
40 # file output to use with external plotting programming
41 # such as gnuplot , R , octave , etc .
42 # Start gnuplot , then from gnuplot prompt
43 # plot " stochasticdes . dat " with lines
298 CHAPTER 6. STOCHASTIC CALCULUS

44
45 open ( F , " > stochasticdes . dat " ) || die " cannot write : $ !
";
46 foreach $j ( 0 .. $M ) {
47 print F $t - > range ( [ $j ] ) , " " , $X - > range ( [ $j ] ) , " \
n";
48 }
49 close ( F ) ;
50

SciPy Scientific Python script for stochasticdes.py


1 import scipy
2
3 r = -1. # growth / decay rate
4 sigma = 0.5 # standard deviation
5 b = 3. # initial value
6
7 M =
100 # number of steps for EM method to take
8 T =
1. # maximum time , note type real
9 h =
T/M # time step
10 t =
scipy . linspace (0 ,T , M +1) # vector of [0 , 1h , 2h , 3 h ...
Nh ]
11 X = scipy . zeros ( M + 1 )
12
13 N = 30*( M +1) # number of steps for the Brownian Motion
14
15 # the random walk
16 p = 0.5
17 S = scipy . zeros ( N +1)
18 S [1: N +1] = scipy . cumsum ( 2*( scipy . random . random ( N ) <= p
) - 1 )
19
20 def WcaretN ( x ) :
21 Delta = T / N # T real coerces Delta
real
22 prior = scipy . floor ( x / Delta ) . astype ( int )
23 subsequent = scipy . ceil ( x / Delta ) . astype ( int )
24 return scipy . sqrt ( Delta ) *( S [ prior ] + ( x / Delta - prior
) *( S [ subsequent ] - S [ prior ]) )
25

26 X [0] = b # iniital value at t = 0


27 for i in range (0 , M ) :
6.1. STOCHASTIC DIFFERENTIAL EQUATIONS AND THE EULER-MARUYAMA METHOD299

28 X [ i +1] = X [ i ]+ r * X [ i ]* h + sigma * X [ i ]*( WcaretN ( t [ i ]+ h ) -


WcaretN ( t [ i ]) )
29
30 # optional file output to use with external plotting
programming
31 # such as gnuplot , R , octave , etc .
32 # Start gnuplot , then from gnuplot prompt
33 # plot " stochasticdes . dat " with lines
34 f = open ( ’ stochasticdes . dat ’ , ’w ’)
35 for j in range (0 , M +1) :
36 f . write ( str ( t [ j ]) + ’ ’+ str ( X [ j ]) + ’\ n ’) ;
37
38 f . close ()

Key Concepts
1. We can numerically simulate the solution to stochastic differential equa-
tions with an analog to Euler’s method, called the Euler-Maruyama
(EM) method.

Vocabulary
1. A stochastic differential equation is a mathematical equation relat-
ing a stochastic process to its local deterministic and random compo-
nents. The goal is to extend the relation to find the stochastic process.
Under mild conditions on the relationship, and with a specifying initial
condition, solutions of stochastic differential equations exist and are
unique.

2. The Euler-Maruyama (EM) method is a numerical method for


simulating the solutions of a stochastic differential equation based on
the definition of the Itô stochastic integral: Given

dX(t) = G(X(t)) dt +H(X(t)) dW (t), X(t0 ) = X0 ,

and a step size dt, we approximate and simulate with

Xj = Xj−1 + G(Xj−1 ) dt +H(Xj−1 )(W (tj−1 + dt) − W (tj−1 ))


300 CHAPTER 6. STOCHASTIC CALCULUS

3. Extensions and variants of standard Brownian motion defined through


stochastic differential equations are Brownian motion with drift,
scaled Brownian motion, and geometric Brownian motion.

Problems to Work for Understanding


1. Graph an approximation of a multiple of Brownian motion with drift
with parameters b = 2, r = 1/2 and σ = 2 on the interval [0, 5] in two
ways.

(a) Flip a coin 25 times, recording whether it comes up Heads or Tails


each time, Scoring Yi = +1 for each Heads and Yi = −1 Pnfor each
flip, also keep track of the accumulated sum Tn = i=1 Ti for
i = 1 . . . 25.√Using N = 5 compute the rescaled approximation
Ŵ5 (t) = (1/ 5)T5t at the values t = 0, 1/5, 2/5, 3/5, . . . 24/5, 5 on
[0, 5]. Finally compute and graph the value of X(t) = b + rt +
σ Ŵ5 (t).
(b) Using the same values of Ŵ5 (t) as approximations for W (dt) com-
pute the values of the solution of the stochastic differential equa-
tion dX = r dt +σ dW , X(0) = b on the interval [0, 5].

2. Repeat the previous problem with parameters b = 2, r = −1/2 and


σ = 2.

3. Repeat the previous problem with parameters b = 2, r = 1/2 and


σ = −2.

4. Modify the scripts to use normally distributed random deivates and


then simulate the solution of the stochastic differential equation

dX(t) = X(t) dt +2X(t) dX

on the interval [0, 1] with initial condition X(0) = 1 and step size
∆t = 1/10.

5. Modify the scripts to use normally distributed random deviates and


then simulate the solution of the stochastic differential equation

dX(t) = tX(t) dt +2X(t) dX


6.1. STOCHASTIC DIFFERENTIAL EQUATIONS AND THE EULER-MARUYAMA METHOD301

on the interval [0, 1] with initial condition X(0) = 1 and step size
∆t = 1/10. Note the difference with the previous problem, now the
multiplier of the dt term is a function of time.
6. Modify the scripts to use general functions G(X) and H(x) and then
apply it to the SDE for the
(a) Ornstein-Uhlenbeck process:
dX = θ(µ − X(t)) dt +σ dW (t), X(t0 ) = X0 .

(b) Cox-Ingersoll-Ross process:


p
dX = θ(µ − X(t)) dt +σ (X(t)) dW (t), X(t0 ) = X0 .

(c) the modified Cox-Ingersoll-Ross process:


p
dX = −θX(t) dt +θ (X(t)) dW (t), X(t0 ) = X0 .

7. Write a program with parameters r, σ, b, T and N (so dt = T /N )


that computes and graphs the approximation of the solution of the
stochastic differential equation
dX(t) = rX(t) dt +σX(t) dX
with X(0) = b on the interval [0, T ]. Apply the program to the stochas-
tic differential equation with r = 2, σ = 1, b = 1, and N = 26 , 27 , 28 on
the interval [0, 1].
8. Generalize the program from the previous problem to include a param-
eter M for the number of sample paths computed. Then using this
program on the interval [0, 1] with M = 1000, and N = 28 compute
1 2
E [|Xn − X(1)|], where X(1) = ber− 2 σ +σŴ28 (1) .
9. Using the program from the previous problem with M = 1000 and N =
1 2
25 , 26 , 27 , 28 , 29 compute E [|XN − X(1)|], where X(1) = ber− 2 σ +σŴ29 (1) .
Then for the 5 values of N , make a log-log plot of E [|XN − X(1)|] on
the vertical axis against ∆t = 1/N on the horizontal axis. Using the
slope of the resulting best-fit line experimentally determine the order
of convergence γ so that
E [|XN − X(1)|] ≤ C(∆t)γ .
302 CHAPTER 6. STOCHASTIC CALCULUS

Outside Readings and Links:


1. Matlab program files for Stochastic Differential Equations offers a num-
ber of MATLAB routines for stochastic differential equations.

6.2 Itô’s Formula


Section Starter Question
State the Taylor expansion of a function f (x) up to order 1. What is the
relation of this expansion to the Mean Value Theorem of calculus? What is
the relation of this expansion to the Fundamental Theorem of calculus?

Motivation, Examples and Counterexamples


We need some operational rules that allow us to manipulate stochastic pro-
cesses with stochastic calculus.
The important thing to know about traditional differential calculus is
that it is:
• the Fundamental Theorem of Calculus;

• the chain rule; and

• Taylor polynomials and Taylor series


that enable us to calculate with functions. A deeper understanding of calcu-
lus recognizes that these three calculus theorems are all aspects of the same
fundamental idea. Likewise we need similar rules and formulas for stochastic
processes. Itô’s formula will perform that function for us. However, Itô’s
formula acts in the capacity of all three of the calculus theorems, and we
have only one such theorem for stochastic calculus.
The next example will show us that we will need some new rules for
stochastic calculus, the old rules from calculus will no longer make sense.
Example. Consider the process which is the square of the Wiener process:

Y (t) = W (t)2 .

We notice that this process is always non-negative, Y (0) = 0, Y has infinitely


many zeroes on t > 0 and E [Y (t)] = E [W (t)2 ] = t. What more can we say
6.2. ITÔ’S FORMULA 303

about this process? For example, what is the stochastic differential of Y (t)
and what would that tell us about Y (t)?
Using naive calculus, we might conjecture using the ordinary chain rule

dY = 2W (t) dW (t).

If that were true then the Fundamental Theorem of Calculus would imply
Z t Z t
Y (t) = dY = 2W (t) dW (t)
0 0
Rt
should also be true. But consider 0 2W (t) dW (t). It ought to correspond
to a limit of a summation (for instance a Riemann-Stieltjes left sum):
Z t n
X
2W (t) dW (t) ≈ 2W ((i − 1)t/n)[W (it/n) − W ((i−)t/n)]
0 i=1

But look at this carefully: W ((i − 1)t/n) = W ((i − 1)t/n) − W (0) is inde-
pendent of [W (it/n) − W ((i−)t/n)] by property 2 of the definition of the
Wiener process. Therefore, if what we conjecture is true, the expected value
of the summation will be zero:
Z t 
E [Y (t)] = E 2W (t) dW (t)
0
" n
#
X
= E lim 2W ((i − 1)t/n)(W (it/n) − W ((i − 1)t/n))
n→∞
i=1
n
X
= lim 2E [[W ((i − 1)t/n) − W (0)][W (it/n) − W ((i − 1)t/n)]]
n→∞
i=1
= 0.

(Note the assumption that the limit and the expectation can be interchanged!)
But the mean of Y (t) = W (t)2 is t which is definitely not zero! The
two stochastic processes don’t agree even in the mean, so something is not
right! If we agree that the integral definition and limit processes should be
preserved, then the rules of calculus will have to change.
We can see how the rules of calculus must change by rearranging the
summation. Use the simple algebraic identity

2b(a − b) = a2 − b2 − (a − b)2

304 CHAPTER 6. STOCHASTIC CALCULUS

to re-write
Z t n
X
2W (t) dW (t) = lim 2W ((i − 1)t/n)[W (it/n) − W ((i − 1)t/n)]
0 n→∞
i=1
n
X
W (it/n)2 − W ((i − 1)t/n)2 − (W (it/n) − W ((i − 1)t/n))2

= lim
n→∞
i=1
n
!
X
= lim W (t)2 − W (0)2 − (W (it/n) − W ((i − 1)t/n))2
n→∞
i=1
n
X
= W (t)2 − lim (W (it/n) − W ((i − 1)t/n))2
n→∞
i=1

We recognize the second term in the last expression as being the quadratic
variation of Wiener process, which we have already evaluated, and so
Z t
2W (t) dW (t) = W (t)2 − t.
0

Itô’s Formula and Itô calculus


Itô’s formula is an expansion expressing a stochastic process in terms of the
deterministic differential and the Wiener process differential, that is, the
stochastic differential equation for the process.

Theorem 30 (Itô’s formula). If Y (t) is scaled Wiener process with drift, sat-
isfying dY = r dt +σ dW and f is a twice continuously differentiable func-
tion, then Z(t) = f (Y (t)) is also a stochastic process satisfying the stochastic
differential equation

dZ = (rf 0 (Y ) + (σ 2 /2)f 00 (Y )) dt +(σf 0 (Y )) dW

In words, Itô’s formula in this form tells us how to expand (in analogy
with the chain rule or Taylor’s formula) the differential of a process which is
defined as an elementary function of scaled Brownian motion with drift.
Itô’s formula is often also called Itô’s lemma by other authors and texts.
Most authors believe that this result is more important than a mere lemma,
and so the text adopts the alternative name of “formula”. “Formula” also
emphasizes the analogy with the chain “rule” and the Taylor “expansion”.
6.2. ITÔ’S FORMULA 305

Example. Consider Z(t) = W (t)2 . Here the stochastic process is standard


Brownian Motion, so r = 0 and σ = 1 so dY = dW . The twice continuously
differentiable function f is the squaring function, f (x) = x2 , f 0 (x) = 2x and
f 00 (x) = 2. Then according to Itô’s formula:

d(W 2 ) = (0 · (2W (t)) + (1/2)(2)) dt +(1 · 2W (t)) dW = dt +2W (t) dW

Notice the additional dt term! Note also that if we repeated the integration
steps above in the example, we would obtain W (t)2 as expected!
Example. Consider geometric Brownian motion

exp(rt + σW (t)).

What SDE does geometric Brownian motion follow? Take Y (t) = rt+σW (t),
so that dY = r dt +σ dW . Then geometric Brownian motion can be written
as Z(t) = exp(Y (t)), so f is the exponential function. Itô’s formula is

dZ = (rf 0 (Y (t)) + (1/2)σ 2 f 00 (Y (t))) dt +σf 0 (Y ) dW

Computing the derivative of the exponential function and evaluating, f 0 (Y (t)) =


exp(Y (t)) = Z(t) and likewise for the second derivative. Hence

dZ = (r + (1/2)σ 2 )Z(t) dt +σZ(t) dW

The case where dY = dW , that is the base process is standard Brownian


Motion so Z = f (W ), occurs commonly enough that we record Itô’s formula
for this special case:

Corollary 8 (Itô’s Formula applied to functions of standard Brownian Mo-


tion). If f is a twice continuously differentiable function, then Z(t) = f (W (t))
is also a stochastic process satisfying the stochastic differential equation

dZ = df (W ) = (1/2)f 00 (W ) dt +f 0 (W ) dW .

Guessing Processes from SDEs with Itô’s Formula


One of the key needs we will have is to go in the opposite direction and con-
vert SDEs to processes, in other words to solve SDEs. We take guidance from
ordinary differential equations, where finding solutions to differential equa-
tions comes from judicious guessing based on a thorough understanding and
306 CHAPTER 6. STOCHASTIC CALCULUS

familiarity with the chain rule. For SDEs the solution depends on inspired
guesses based on a thorough understanding of the formulas of stochastic cal-
culus. Following the guess we require a proof that the proposed solution is
an actual solution, again using the formulas of stochastic calculus.
A few rare examples of SDEs can be solved with explicit familiar func-
tions. This is just like ODEs in that the solutions of many simple differential
equations cannot be solved in terms of elementary functions. The solutions
of the differential equations define new functions which are useful in appli-
cations. Likewise, the solution of an SDE gives us a way of defining new
processes which are useful.
Example. Suppose we are asked to solve the SDE
dZ(t) = σZ(t) dW .
We need an inspired guess, so we try
exp(rt + σW (t))
where r is a constant to be determined while the σ term is given in the SDE.
Itô’s formula for the guess is
dZ = (r + (1/2)σ 2 )Z(t) dt +σZ(t) dW .
We notice that the stochastic term (or Wiener process differential term) is
the same as the SDE. We need to choose the constant r appropriately to
eliminate the deterministic or drift differential term. If we choose r to be
−(1/2)σ 2 then the drift term in the differential equation would match the
SDE we have to solve as well. We therefore guess
Y (t) = exp(σW (t) − (1/2)σ 2 t).
We should double check by applying Itô’s formula.
Soluble SDEs are scarce, and this one is special enough to give a name.
It is the Dolèan’s exponential of Brownian motion.

Sources
This discussion is adapted from Financial Calculus: An introduction to
derivative pricing by M Baxter, and A. Rennie, Cambridge University Press,
1996, pages 52–62 and “An Algorithmic Introduction to the Numerical Sim-
ulation of Stochastic Differential Equations”, by Desmond J. Higham, in
SIAM Review, Vol. 43, No. 3, pages 525–546, 2001.
6.2. ITÔ’S FORMULA 307

Key Concepts
1. Itô’s formula is an expansion expressing a stochastic process in terms of
the deterministic differential and the Wiener process differential, that
is, the stochastic differential equation for the process.

2. Solving stochastic differential equations follows by guessing solutions


based on comparison with the form of Itô’s formula.

Vocabulary
1. Itô’s formula is often also called Itô’s lemma by other authors and
texts. Some authors believe that this result is more important than a
mere lemma, and so I adopt the alternative name of “formula”. “For-
mula” also emphasizes the analogy with the chain “rule” and the Taylor
“expansion”.

Problems to Work for Understanding


1. Find the solution of the stochastic differential equation

dY (t) = Y (t) dt +2Y (t) dW .

2. Find the solution of the stochastic differential equation

dY (t) = tY (t) dt +2Y (t) dW .

Note the difference with the previous problem, now the multiplier of
the dt term is a function of time.

3. Find the solution of the stochastic differential equation

dY (t) = µY (t) dt +σY (t) dW .

4. Find the solution of the stochastic differential equation

dY (t) = µtY (t) dt +σY (t) dW


Note the difference with the previous problem, now the multiplier of
the dt term is a function of time.
308 CHAPTER 6. STOCHASTIC CALCULUS

5. Find the solution of the stochastic differential equation

dY (t) = µ(t)Y (t) dt +σY (t) dW

Note the difference with the previous problem, now the multiplier of the
dt term is a general (technically, a locally bounded integrable) function
of time.

1. “An Algorithmic Introduction to the Numerical Simulation of Stochas-


tic Differential Equations”, by Desmond J. Higham, in SIAM Review,
Vol. 43, No. 3, pp. 525-546, 2001.

2. Financial Calculus: An introduction to derivative pricing by M Baxter,


and A. Rennie, Cambridge University Press, 1996, pages 52–62.

Outside Readings and Links:

6.3 Properties of Geometric Brownian Mo-


tion
Section Starter Question
What is the relative rate of change of a function?
For the function defined by the ordinary differential equation
dx
= rx x(0) = x0
dt
what is the relative rate of growth? What is the function?

Geometric Brownian Motion


Geometric Brownian Motion is the continuous time stochastic process
X(t) = z0 exp(µt + σW (t)) where W (t) is standard Brownian Motion. Most
economists prefer Geometric Brownian Motion as a simple model for market
prices because it is everywhere positive (with probability 1), in contrast to
Brownian Motion, even Brownian Motion with drift. Furthermore, as we
have seen from the stochastic differential equation for Geometric Brownian
Motion, the relative change is a combination of a deterministic proportional
6.3. PROPERTIES OF GEOMETRIC BROWNIAN MOTION 309

growth term similar to inflation or interest rate growth plus a normally dis-
tributed random change

dX
= r dt +σ dW .
X

(See Itô’s Formula and Stochastic Calculus.) On a short time scale this is a
sensible economic model.
A random variable X is said to have the lognormal distribution (with
parameters µ and σ) if log(X) is normally distributed (log(X) ∼ N (µ, σ 2 )).
The p.d.f. for X is

1
fX (x) = √ exp((−1/2)[(ln(x) − µ)/σ]2 ).
2πσx

Theorem 31. At fixed time t, Geometric Brownian Motion z0 exp(µt√+


σW (t)) has a lognormal distribution with parameters (ln(z0 ) + µt) and σ t.

Proof.

FX (x) = P [X ≤ x]
= P [z0 exp(µt + σW (t)) ≤ x]
= P [µt + σW (t) ≤ ln(x/z0 )]
= P [W (t) ≤ (ln(x/z0 ) − µt)/σ]
h √ √ i
= P W (t)/ t ≤ (ln(x/z0 ) − µt)/(σ t)
Z (ln(x/z0 )−µt)/(σ√t)
1
= √ exp(−y 2 /2) dy
−∞ 2π

Now differentiating with respect to x, we obtain that

1 √
fX (x) = √ √ exp((−1/2)[(ln(x) − ln(z0 ) − µt)/(σ t)]2 ).
2πσx t
310 CHAPTER 6. STOCHASTIC CALCULUS

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 1 2 3 4
x

Figure 6.2: The p.d.f. and c.d.f. for a lognormal random variable with m = 1,
s = 1.5.
6.3. PROPERTIES OF GEOMETRIC BROWNIAN MOTION 311

Calculation of the Mean


We can calculate the mean of Geometric Brownian Motion by using the m.g.f.
for the normal distribution.

Theorem 32. E [z0 exp(µt + σW (t))] = z0 exp(µt + (1/2)σ 2 t)

Proof.

E [X(t)] = E [z0 exp(µt + σW (t))]


= z0 exp(µt)E [exp(σW (t))]
= z0 exp(µt)E [exp(σW (t)u)] |u=1
= z0 exp(µt) exp(σ 2 tu2 /2)|u=1
= z0 exp(µt + (1/2)σ 2 t)

since σW (t) ∼ N (0, σ 2 t) and E [exp(Y u)] = exp(σ 2 tu2 /2) when Y ∼ N (0, σ 2 t).
See Moment Generating Functions, Theorem 4.

Calculation of the Variance


We can calculate the variance of Geometric Brownian Motion by using the
m.g.f. for the normal distribution, together with the common formula

Var [X] = E (X − E [X])2 = E X 2 − (E [X])2


   

and the previously obtained formula for E [X].

Theorem 33. Var [z0 exp(µt + σW (t))] = z02 exp(2µt + σ 2 t)[exp(σ 2 t) − 1]

Proof. First compute:

E X(t)2 = E z02 exp(µt + σW (t))2


   

= z02 E [exp(2µt + 2σW (t))]


= z02 exp(2µt)E [exp(2σW (t))]
= z02 exp(2µt)E [exp(2σW (t)u)] |u=1
= z02 exp(2µt) exp(4σ 2 tu2 /2)|u=1
= z02 exp(2µt + 2σ 2 t)
312 CHAPTER 6. STOCHASTIC CALCULUS

Therefore,
Var [z0 exp(µt + σW (t))] = z02 exp(2µt + 2σ 2 t) − z02 exp(2µt + σ 2 t)
= z02 exp(2µt + σ 2 t)[exp(σ 2 t) − 1].

Note that this has the consequence that the variance starts at 0 and then
grows exponentially. The variation of Geometric Brownian Motion starts
small, and then increases, so that the motion generally makes larger and
larger swings as time increases.

Stochastic Differential Equation and Parameter Summary


If a Geometric Brownian Motion is defined by the stochastic differential equa-
tion
dX = rX dt +σX dW X(0) = z0
then the Geometric Brownian Motion is
X(t) = z0 exp((r − (1/2)σ 2 )t + σW (t)).
At each time the Geometric Brownian Motion √ has lognormal distribution
2
with parameters (ln(z0 )+rt−(1/2)σ t) and σ t. The mean of the Geometric
Brownian Motion is E [X(t)] = z0 exp(rt). The variance of the Geometric
Brownian Motion is
Var [X(t)] = z02 exp(2rt)[exp(σ 2 t) − 1]
If the primary object is the Geometric Brownian Motion
X(t) = z0 exp(µt + σW (t)).
then by Itô’s formula the SDE satisfied by this stochastic process is
dX = (µ + (1/2)σ 2 )X(t) dt +σX(t) dW X(0) = z0 .
At each time the Geometric Brownian
√ Motion has lognormal distribution
with parameters (ln(z0 )+µt) and σ t. The mean of the Geometric Brownian
Motion is E [X(t)] = z0 exp(µt + (1/2)σ 2 t). The variance of the Geometric
Brownian Motion is
z02 exp(2µt + σ 2 t)[exp(σ 2 t) − 1].
6.3. PROPERTIES OF GEOMETRIC BROWNIAN MOTION 313

Ruin and Victory Probabilities for Geometric Brownian Motion

Because of the exponential-logarithmic connection between Geometric Brow-


nian Motion and Brownian Motion, many results for Brownian Motion can
be immediately translated into results for Geometric Brownian Motion. Here
is a result on the probability of victory, now interpreted as the condition of
reaching a certain multiple of the initial value. For A < 1 < B define the
“duration to ruin or victory”, or the “hitting time” as

z0 exp(µt + σW (t)) z0 exp(µt + σW (t))


TA,B = min{t ≥ 0 : = A, = B}
z0 z0

Theorem 34. For a Geometric Brownian Motion with parameters µ and σ,


and A < 1 < B,

2 2
1 − A1−(2µ−σ )/σ
 
z0 exp(µTA,B + σW (TA,B ))
P = B = 1−(2µ−σ2 )/σ2
z0 B − A1−(2µ−σ2 )/σ2

Quadratic Variation of Geometric Brownian Motion

The quadratic variation of Geometric Brownian Motion may be deduced from


Itô’s formula:
dX = (µ − σ 2 /2)X dt +σX dW

so that

( dX)2 = (µ − σ 2 /2)2 X 2 dt2 + (µ − σ 2 /2)σX 2 dt dW +σ 2 X 2 ( dW )2 .

Guided by the heuristic principle that terms of order ( dt)2 and dt · dW ≈


( dt)3/2 are small and may be ignored, and that ( dW )2 = dt, we obtain:

( dX)2 = σ 2 X 2 dt .
314 CHAPTER 6. STOCHASTIC CALCULUS

Continuing heuristically, the expected quadratic variation is


Z T  Z T 
E ( dX) = E
2 2 2
σ X dt
0 0
Z T
2
E X
  2 
=σ dt
0
Z T 
2 2 2
=σ z0 exp(2µt + 2σ t) dt
0
σ 2 z02
exp((2µ + 2σ 2 )T ) − 1 .

= 2
2µ + 2σ

Note the assumption that the order of the integration and the expectation
can be interchanged.

Sources
This section is adapted from: A First Course in Stochastic Processes, Second
Edition, by S. Karlin and H. Taylor, Academic Press, 1975, page 357; An
Introduction to Stochastic Modeling 3rd Edition, by H. Taylor, and S. Karlin,
Academic Press, 1998, pages 514–516; and Introduction to Probability Models
9th Edition, S. Ross, Academic Press, 2006.

Algorithms, Scripts, Simulations


Algorithm
Given values for µ, σ and an interval [0, T ], the script creates trials sam-
ple paths of Geometric Brownian Motion, sampled at N equally-spaced values
on [0, T ]. The scripts do this by creating trials Brownian Motion sam-
ple paths sampled at N equally-spaced values on [0, T ] using the definition
of Brownian Motion having normally distributed increments. Adding the
drift term and then exponentiating the sample paths creates trials Ge-
ometric Brownian Motion sample paths sampled at N equally-spaced values
on [0, T ]. Then the scripts use semi-logarithmic least-squares statistical fit-
ting to calculate the relative growth rate of the mean of the sample paths.
The scripts also compute the predicted relative growth rate to compare it
to the calculated relative growth rate. The problems at the end of the sec-
tion explore plotting the sample paths, comparing the sample paths to the
6.3. PROPERTIES OF GEOMETRIC BROWNIAN MOTION 315

predicted mean with standard deviation bounds, and comparing the mean
quadratic variation of the sample paths to the theoretical quadratic variation
of Geometric Brownian Motion.

Scripts

Geogebra GeoGebra applet for Geometric Brownian Motion

R R script for Geomtric Brownian Motion.


1 mu <- 1
2 sigma <- 0.5
3 T <- 1
4 # length of the interval [0 , T ] in time units
5
6 trials <- 200
7 N <- 200
8 # number of end - points of the grid including T
9 Delta <- T / N
10 # time increment
11
12 t <- t ( seq (0 ,T , length = N +1) * t ( matrix (1 , trials , N +1) )
)
13 # Note use of the R matrix recycling rules , by columns ,
so transposes
14 W <- cbind (0 , t ( apply ( sqrt ( Delta ) * matrix ( rnorm ( trials
* N ) , trials , N ) , 1 , cumsum ) ) )
15 # Wiener process , Note the transpose after the apply , (
side effect of
16 # apply is the result matches the length of individual
calls to FUN ,
17 # then the MARGIN dimension / s come next . So it ’ s not so
much
18 # " transposed " as that being a consequence of apply in 2 D
.) Note
19 # use of recycling with cbind to start at 0
20
21 GBM <- exp ( mu * t + sigma * W )
22
23 meanGBM <- colMeans ( GBM )
24
25 meanGBM _ rate <- lm ( log ( meanGBM ) ~ seq (0 ,T , length = N +1) )
26 predicted _ mean _ rate = mu + (1 / 2) * sigma ^2
27
316 CHAPTER 6. STOCHASTIC CALCULUS

28 cat ( sprintf ( " Observed meanGBM relative rate : % f \ n " ,


coefficients ( meanGBM _ rate ) [2] ) )
29 cat ( sprintf ( " Predicted mean relative rate : % f \ n " ,
predicted _ mean _ rate ) )
30

Octave Octave script for Geometric Brownian Motion


1 mu = 1;
2 sigma = 0.5;
3 T = 1;
4 # length of the interval [0 , T ] in time units
5
6 trials = 200;
7 N = 100;
8 # number of end - points of the grid including T
9 Delta = T / N ;
10 # time increment
11
12 W = zeros ( trials , N +1) ;
13 # initialization of the vector W approximating
14 # Wiener process
15 t = ones ( trials , N +1) .* linspace (0 , T , N +1) ;
16 # Note the use of broadcasting ( Octave name for R
recylcing )
17 W (: , 2: N +1) = cumsum ( sqrt ( Delta ) * stdnormal_rnd ( trials
, N ) , 2) ;
18
19 GBM = exp ( mu * t + sigma * W ) ;
20

21 meanGBM = mean ( GBM ) ;


22
23 A = [ transpose ((0: Delta : T ) ) ones ( N +1 , 1) ];
24 meanGBM_rate = A \ transpose ( log ( meanGBM ) )
25 p r ed i c te d _ me a n _r a t e = mu + (1/2) * sigma ^2
26

Perl Perl PDL script for Geometric Brownian Motion


1 $mu = 1;
2 $sigma = 0.5;
6.3. PROPERTIES OF GEOMETRIC BROWNIAN MOTION 317

3 $T = 1.;
4 # length of the interval [0 , T ] in time units
5
6 $trials = 200;
7 $N = 100;
8 # number of end - points of the grid including T
9 $Delta = $T / $N ;
10 # time increment
11
12 $W = zeros ( $N + 1 , $trials ) ;
13 # initialization of the vector W approximating
14 # Wiener process
15 $t = ones ( $N +1 , $trials ) * zeros ( $N + 1 ) -> xlinvals (
0 , $T ) ;
16 # Note the use of PDL dim 1 threading rule ( PDL name for
R recycling )
17 $W ( 1 : $N , : ) .= cumusumover ( sqrt ( $Delta ) * grandom (
$N , $trials ) ) ;
18
19 $GBM = exp ( $mu * $t + $sigma * $W ) ;
20
21 $meanGBM = sumover ( $GBM - > xchg (0 ,1) ) / $trials ;
22
23 use PDL :: Fit :: Linfit ;
24
25 $fitFuncs = cat ones ( $N + 1) , zeros ( $N + 1 ) -> xlinvals (
0 , $T ) ;
26 ( $linfitfunc , $coeffs ) = linfit1d log ( $meanGBM ) ,
$fitFuncs ;
27 print " Observed Mean GBM Rate : " , $coeffs (1) , " \ n " ;
28 print " Predicted Mean GBM Rate : " , $mu + (1./2.) * $sigma
**2 , " \ n " ;
29

SciPy Scientific Python script for Geometric Brownian Motion


1 import scipy
2
3 mu = 1.;
4 sigma = 0.5;
5 T = 1.
6 # length of the interval [0 , T ] in time units
7
8 trials = 200
318 CHAPTER 6. STOCHASTIC CALCULUS

9 N = 100
10 # number of end - points of the grid including T
11 Delta = T / N ;
12 # time increment
13
14 W = scipy . zeros (( trials , N +1) , dtype = float )
15 # initialization of the vector W approximating
16 # Wiener process
17 t = scipy . ones ( ( trials , N +1) , dtype = float ) * scipy .
linspace (0 , T , N +1)
18 # Note the use of recycling
19 W [: , 1: N +1] = scipy . cumsum ( scipy . sqrt ( Delta ) * scipy . random
. standard_normal ( ( trials , N ) ) , axis = 1 ,)
20

21 GBM = scipy . exp ( mu * t + sigma * W )


22 meanGBM = scipy . mean ( GBM , axis =0)
23 p r e d i c t e d _ m e a n _ G B M _ r a t e = mu + (1./2.) * sigma **2
24
25 meanGBM_rate = scipy . polyfit ( scipy . linspace (0 , T , N +1) ,
scipy . log ( meanGBM ) , 1)
26
27 print " Observed Mean GBM Relative Rate : " , meanGBM_rate
[0];
28 print " Predicted Mean GBM Relative Rate : " ,
predicted_mean_GBM_rate ;

Key Concepts
1. Geometric Brownian Motion is the continuous time stochastic process
z0 exp(µt + σW (t)) where W (t) is standard Brownian Motion.

2. The mean of Geometric Brownian Motion is

z0 exp(µt + (1/2)σ 2 t).

3. The variance of Geometric Brownian Motion is

z02 exp(2µt + σ 2 t)(exp(σ 2 t) − 1).


6.3. PROPERTIES OF GEOMETRIC BROWNIAN MOTION 319

Vocabulary
1. Geometric Brownian Motion is the continuous time stochastic pro-
cess z0 exp(µt + σW (t)) where W (t) is standard Brownian Motion.
2. A random variable X is said to have the lognormal distribution (with
parameters µ and σ) if log(X) is normally distributed (log(X) ∼ N (µ, σ 2 )).
The p.d.f. for X is
1
fX (x) = √ exp((−1/2)[(ln(x) − µ)/σ]2 ).
2πσx

Problems to Work for Understanding


1. Differentiate

(ln(x/z0 )−µt)/(σ t)
1
Z
√ exp(−y 2 /2) dy
−∞ 2π
to obtain the p.d.f. of Geometric Brownian Motion.
2. What is the probability that Geometric Brownian Motion with param-
eters µ = −σ 2 /2 and σ (so that the mean is constant) ever rises to
more than twice its original value? In economic terms, if you buy a
stock or index fund whose fluctuations are described by this Geometric
Brownian Motion, what are your chances to double your money?
3. What is the probability that Geometric Brownian Motion with param-
eters µ = 0 and σ ever rises to more than twice its original value? In
economic terms, if you buy a stock or index fund whose fluctuations are
described by this Geometric Brownian Motion, what are your chances
to double your money?
4. Derive the probability of ruin (the probability of Geometric Brownian
Motion hitting A < 1 before hitting B > 1).
5. Modify the scripts to plot several sample paths of Geometric Brownian
Motion all on the same set of axes.
6. Modify the scripts to plot several sample paths of Geometric Brownian
Motion and the mean function of Geometric Brownian Motion and the
mean function plus and minus one standard deviation function, all on
the same set of axes.
320 CHAPTER 6. STOCHASTIC CALCULUS

7. Modify the scripts to measure the quadratic variation of each of many


sample paths of Geometric Brownian Motion, find the mean quadratic
variation and compare to the theoretical quadratic variation of Geo-
metric Brownian Motion.

Outside Readings and Links:


1. Graphical Representations of Brownian Motion and Geometric Brow-
nian Motion

2. Wikipedia Geometric Brownian Motion

6.4 Models of Stock Market Prices


Section Starter Question
What would be some desirable characteristics for a stochastic process model
of a security price?

Returns, Log-Returns, Compound Returns


Let st be a sequence of prices on a stock or a portfolio of stocks, measured at
regular intervals, say day to day. A natural question is how best to measure
the variation of the prices on the time scale of the regular measurement. A
first natural definition of variation is the proportional return rt at time t

rt = (st − st−1 )/st−1 .

The proportional return is usually just called the return, and often it is ex-
pressed as a percentage. A benefit of using returns versus prices is normaliza-
tion: measuring all variables in a comparable metric, essentially percentage
variation. Using proportional returns allows consistent comparison among
two or more securities even though their price sequences may differ by orders
of magnitude. Having comparable variations is a requirement for many mul-
tidimensional statistical analyses. For example, interpreting a covariance is
meaningful when the variables are measured in percentages.
Define the log-return

ρt = log(st /st−1 )
6.4. MODELS OF STOCK MARKET PRICES 321

as another measure of variation on the time scale of the sequence of prices.


For small returns, the difference between returns and log-returns is small.
Notice that
  
st st
1 + rt = = exp log = exp(ρt ).
st−1 st−1
Therefore
ρt = log(1 + rt ) ≈ rt , for rt  1.
More generally, a statistic calculated from a sequence of prices is the
compounding return at time t over n periods, defined as
st
= (1 + rt )(1 + rt−1 ) · · · (1 + rt−n+1 ).
st−n
Taking logarithms, a simplification arises,
 
st
log = log(st ) − log(st−n )
st−n
the logarithm of the compounding return over n periods is just the difference
between the logarithm of the price at the final and initial periods. Further-
more,
 
st
log = log ((1 + rt )(1 + rt−1 ) · · · (1 + rt−n+1 ))
st−n
= ρ1 + ρ2 + · · · + ρn .

So, the advantage of using log-returns is that they are additive. Recall that
the sum of independent normally-distributed random variables is normal.
Therefore, if we assume that log-returns are normally distributed, then the
logarithm of the compounding return is normally distributed. However the
product of normally-distributed variables has no easy distribution, in partic-
ular, it is not normal. So even if we make the simplifying assumption that
the returns are normally distributed, there is no corresponding result for the
compounded return.

Modeling from Stochastic Differential Equations


Using Brownian Motion for modeling stock prices varying over continuous
time has two obvious problems:
322 CHAPTER 6. STOCHASTIC CALCULUS

1. Even if started from a positive value X0 > 0, at each time there is


a positive probability that the process attains negative values, this is
unrealistic for stock prices.

2. Stocks selling at small prices tend to have small increments in price


over a given time interval, while stocks selling at high prices tend to
have much larger increments in price on the same interval. Brownian
Motion has a variance which depends on a time interval but not on the
process value, so this too is unrealistic for stock prices.

Nobel prize-winning economist Paul Samuelson proposed a solution to both


problems in 1965 by modeling stock prices as a Geometric Brownian Motion.
Let S(t) be the continuous-time stock process. The following assumptions
about price increments are the foundation for a model of stock prices.

1. Stock price increments have a deterministic component. In a short


time, changes in price are proportional to the stock price itself with
constant proportionality rate r.

2. The stock price increments have a random component. In a short time,


changes in price are jointly proportional to the stock price, a standard
normal random variable, and the time increment with constant propor-
tionality rate σ.

The first assumption is based on the observation that stock prices have a
general overall growth (or decay if r < 0) rate due to economic conditions.
For mathematical simplicity, we take r to be constant, because we know that
in the absence of randomness, this leads to the exponential function, a simple
mathematical function. The second observation is based on the observation
that stock prices vary both up and down on short times. The change is
apparently random due to a variety of influences, and that the distribution
of changes appears to be normally distributed. The normal distribution has
many mathematically desirable features, so for simplicity the randomness is
taken to be normal. The proportionality constants are taken to be constant
for mathematical simplicity.
These assumptions can be mathematically modeled with a stochastic dif-
ferential equation

dS(t) = rS dt +σS dW (t), S(0) = S0 .


6.4. MODELS OF STOCK MARKET PRICES 323

We already have the solution of this stochastic differential equation as Geo-


metric Brownian Motion:

S(t) = S0 exp((r − (1/2)σ 2 )t + σW (t)).

At each time the Geometric Brownian Motion has √ a lognormal distribution


2
with parameters (ln(S0 ) + rt − (1/2)σ t) and σ t. The mean stock price
at any time is E [X(t)] = S0 exp(rt). The variance of the stock price at any
time is
Var [X(t)] = S02 exp(2rt)[exp(σ 2 t) − 1].

Note that with this model, the log-return over a period from t − n to t
is (r − σ 2 /2)n + σ[W (t) − W (t − n)]. The log-return is normally distributed
with mean and variance characterized by the parameters associated with the
security. This is consistent with the assumptions about the distribution of
log-returns of regular sequences of security processes.
The constant r is often called the drift and σ is called the volatility.
Drifts and volatility are usually reported on an annual basis. Therefore, some
care and attention is necessary when converting this annual rate to a daily
rate. An “annual basis” in finance often means 252 days per year because
there are that many trading days, not counting weekends and holidays in
the 365-day calendar. In order to be consistent in this text with most other
applied mathematics we will use 365 days for annual rates. If necessary, the
conversion of annual rates to financial-year annual rates is a straightforward
matter of dividing annual rates by 365 and then multiplying by 252.

Testing the Assumptions on Data

The Wilshire 5000 Total Market Index, or more simply the Wilshire
5000, is an index of the market value of all stocks actively traded in the
United States. The index is intended to measure the performance of publicly
traded companies headquartered in the United States. Stocks of extremely
small companies are excluded.
In spite of the name, the Wilshire 5000 does not have exactly 5000 stocks.
Developed in the summer of 1974, the index had just shy of the 5,000 issues
at that time. The membership count has ranged from 3,069 to 7,562. The
member count was 3,818 as of September 30, 2014.
324 CHAPTER 6. STOCHASTIC CALCULUS

The index is computed as


M
X
W =α Ni Pi
i=1

where Pi is the price of one share of issue i included in the index, Ni is the
number of shares of issue i, M is the number of member companies included
in the index, and α is a fixed scaling factor. The base value for the index
was 1404.60 points on base date December 31, 1980, when it had a total
market capitalization of $1,404.596 billion. On that date, each one-index-
point change in the index was equal to $1 billion. However, index divisor
adjustments due to index composition changes have changed the relationship
over time, so that by 2005 each index point reflected a change of about $1.2
billion in the total market capitalization of the index.
The index was renamed the “Dow Jones Wilshire 5000” in April 2004,
after Dow Jones & Company assumed responsibility for its calculation and
maintenance. On March 31, 2009 the partnership with Dow Jones ended and
the index returned to Wilshire Associates.
The Wilshire 5000 is the weighted sum of many stock values, each of
which we may reasonably assume is a random variable presumably with a
finite variance. If the random variables are independent, then the Central
Limit Theorem would suggest that the index should be normally distributed.
Therefore, a reasonable hypothesis is that the Wilshire 5000 is a normal ran-
dom variable, although we do not know the mean or variance in advance.
(The assumption of independence is probably too strong, since general eco-
nomic conditions affect most stocks similarly.)
Data for the Wilshire 5000 is easy to obtain. For example, the Yahoo
Finance page for W5000 provides a download with the Date, Open, Close,
High, Low, Volume and Adjusted Close values of the index in reverse order
from today to April 1, 2009, the day Wilshire Associates resumed calculation
of the index. (The Adjusted Close is an adjusted price for dividends and
splits that does not affect this analysis.) The data comes in the form of a
comma-separated-value text file. This file format is well-suited as input for
many programs, especially spreadsheets and data analysis programs such as
R. This analysis uses R.
The data from December 31, 2014 back to April 1, 2009 provides 1449
records with seven fields each. This analysis uses the logarithm of each of
the Close prices. Reversing them and then taking the differences gives 1448
6.4. MODELS OF STOCK MARKET PRICES 325

daily log-returns. The mean of the 1448 daily log-returns is 0.0006675644


and the variance of 1448 daily log-returns is 0.0001178775. Assume that the
log-returns are normally distributed so that the mean change over a year of
252 trading days is 0.1682262 and the variance over a year of 252 trading
days is: 0.02970512. Then the annual standard deviation is 0.1722922. The
initial value on April 1, 2009 is 8242.38.
Use the values r = 0.1682262 and σ = 0.1722922 with initial value S0 =
8242.38 in the stochastic differential equation

dS(t) = rS dt +σS dW (t), S(0) = S0 .

The resulting Geometric Brownian Motion is a model for the Wilshire 5000
index. Figure 6.3 is a plot of the actual data for the Wilshire 5000 over the
period April 1, 2009 to December 31, 2014 along with a simulation using a
Geometric Brownian Motion with these parameters.

Testing the Normality Hypothesis


Comparison of the graphs of the actual Wilshire 5000 data with the Ge-
ometric Brownian Motion suggests that Geometric Brownian Motion gives
plausible results. However, deeper investigation to find if the fundamental
modeling hypotheses are actually satisfied is important.
Consider again the 1448 daily log-returns. The log-returns are normalized
by subtracting the mean and dividing by the standard deviation of the 1448
changes. The maximum of the 1448 normalized changes is 4.58 and the
minimum is −6.81. Already we have a hint that the distribution of the data
is not normally distributed, since the likelihood of seeing normally distributed
data varying 4 to 6 standard deviations from the mean is negligible.
In R, the hist command on the normalized data gives an empirical den-
sity histogram. For simplicity, here the histogram is taken over the 14 one-
standard-deviation intervals from −7 to 7. For this data, the density his-
togram of the normalized data has the values in Table 6.1.
This means, for example, that 0.00069 of the 1448 log-returns, that is 1,
occurred in the interval (−7, −6] and a fraction 0.4088397790, or 592 points,
fall in the interval (0, 1]. The normal distribution gives the expected density
on the same intervals. The ratio between the empirical density and normal
density gives an indication of the deviation from normality. For data within
4 standard deviations, the ratios are about what we would expect. This is
326 CHAPTER 6. STOCHASTIC CALCULUS

Value

20000

15000

10000

2010 2011 2012 2013 2014 2015

Figure 6.3: The Wilshire 5000 Index from April 1, 2009 to December 31,
2014 plotted in blue along with a Geometric Brownian Motion having the
same mean, variance and starting value in red.

(−7, −6] (−6, −5] (−5, −4] (−4, −3] (−3, −2] (−2, −1] (−1, 0]
0.00069 0.00000 0.00276 0.00622 0.02693 0.08771 0.35428

(0, 1] (1, 2] (2, 3] (3, 4] (4, 5] (5, 6] (6, 7]


0.40884 0.08771 0.01796 0.00483 0.00207 0.00000 0.00000
Table 6.1: Density histogram of the normalized Wilshire 5000 data.
6.4. MODELS OF STOCK MARKET PRICES 327

reassuring that for reasonably small changes, the log-returns are approxi-
mately normal. However, the ratio on the interval (−7, 6] is approximately
70,000, and the ratio on the interval (4, 5] is approximately 66. Each of these
is much greater than we expect, that is, the extreme tails of the empirical
density have much greater probability than expected.

Quantile-Quantile Plots
A quantile-quantile (q-q) plot is a graphical technique for determining
if two data sets come from populations with a common distribution. A q-q
plot is a plot of the quantiles of the first data set against the quantiles of the
second data set. By a quantile, we mean the fraction (or percent) of points
below the given value. That is, the 0.3 (or 30%) quantile is the data point
at which 30% percent of the data fall below and 70% fall above that value.
As another example, the median is the 0.5 quantile.
A q-q plot is formed by plotting estimated quantiles from data set 2 on
the vertical axis against estimated quantiles from data set 1 on the horizontal
axis. Both axes are in units of their respective data sets. For a given point
on the q-q plot, we know the quantile level is the same for both points, but
not what the quantile level actually is.
If the data sets have the same size, the q-q plot is essentially a plot
of sorted data set 1 against sorted data set 2. If the data sets are not of
equal size, the quantiles are usually picked to correspond to the sorted values
from the smaller data set and then the quantiles for the larger data set are
interpolated from the data.
The quantiles from the normal distribution are the values from the in-
verse cumulative distribution function. These quantiles are tabulated, or
they may be obtained from statistical software. For example, in R the
function qnorm gives the quantiles, e.g. qnorm(0.25) = -0.6744898, and
qnorm(0.90) = 1.281552. Estimating the quantiles for the normalized Wilshire
5000 data is more laborious but is not difficult in principle. Sorting the
data and then finding the value for which 100k% of the data is less and
100(1 − k)% of the data is greater gives the k percentile for 0 ≤ k ≤ 1.
For example, the 0.25-quantile for the scaled and normalized daily changes is
−0.4342129 and the 0.90-quantile for the scaled and normalized daily changes
is 1.072526. Then for the q-q plot, plot the values (−0.6744898, −0.4342129)
and (1.281552, 1.072526). Using many quantiles gives the full q-q plot.
In R, to create a q-q plot of the log-changes for the Wilshire 5000 data
328 CHAPTER 6. STOCHASTIC CALCULUS

Figure 6.4: The q-q plot for the normalized log-changes from the Wilshire
5000.
6.4. MODELS OF STOCK MARKET PRICES 329

with a reference line against the normal distribution use the two commands
qqnorm() and qqline() on the data set. In the q-q plot in Figure 6.4, the
“twist” of the plot above and below the reference line indicates that the tails
of the normalized Wilshire 5000 data are more dispersed than the standard
normal data. The low quantiles of the normalized Wilshire 5000 quantiles
occur at more negative values than the standard normal distribution. The
high quantiles occur at values greater than the standard normal distribution.
However, for quantiles near the median, the data does seem to follow the
normal distribution. The plot is a graphical representation of the fact that
extreme events are more likely to occur than would be predicted by a normal
distribution.

Summary
Using log-returns for stock price has the simplifying advantage of additivity.
If we assume that log-returns are normally distributed, then the logarithm
of the compounding return is normally distributed.
Two problems with using Brownian Motion for modeling stock prices
varying over continuous time lead to modeling stock prices with the stochastic
differential equation for Geometric Brownian Motion. The log-return over a
period from t − n to t is (r − σ 2 /2)n + σ[W (t) − W (t − n)]. The log-return is
normally distributed with mean and variance characterized by the parameters
associated with the security.
The modeling assumptions can be tested against data for the Wilshire
5000 Index. The Geometric Brownian Motion models using the parameters
for the Wilshire 5000 Index resemble the actual data. However, deeper sta-
tistical investigation of the log-returns shows that while log-returns within 4
standard deviations from the mean are normally distributed, extreme events
are more likely to occur than would be predicted by a normal distribution.

Sources
This section is adapted from: “Measuring historical volatility”, Cathy O’Neil,
July 24, 2011, http://mathbabe.org/2011/08/30/why-log-returns/ “Why
Log Returns”, Quantitivity, February 11, 2011, https://quantivity.wordpress.com/2011/02/21/wh
“Geometric Brownian Motion and the Efficient Market Hypothesis”, Ronald
W. Shonkwiler, in Finance with Monte Carlo, 2012. Information about the
Wilshire 5000 comes from [72]. The explanations of q-q plots is adapted from
330 CHAPTER 6. STOCHASTIC CALCULUS

the NIST Engineering Statistics Handbook, [49].

Algorithms, Scripts, Simulations


Algorithm
This script simulates the Wilshire 5000 Index over the period April 1, 2009
to December 31, 2014 using Geometric Brownian Motion with drift and stan-
dard deviation parameters calculated from the data over that same period.
The resulting simulation is plotted over that 5.75 year time period. Set the
drift r, variance σ, time interval T , and starting value S0 . Set the number
of time divisions n and compute the time increment ∆. Compute a Wiener
process simulation, then apply the exponential to create a Geometric Brow-
nian Motion with the parameters. Plot the simulation on the time interval,
or output the data to a file for later plotting or use.

Scripts
R R script for Stock Market Model.
1 mu <- 0.1682262
2 sigma <- 0.1722922
3 T <- 5.75
4 # length of the interval [0 , T ] in time units of years
5 S0 <- 8242.38
6
7 N <- 1448
8 # number of end - points of the grid including T
9 Delta <- T / N
10 # time increment ,
11
12 t <- seq (0 , T , length = N + 1)
13 W <- c (0 , cumsum ( sqrt ( Delta ) * rnorm ( N ) ) ) # Wiener
process ,
14 GBM <- S0 * exp ( mu * t + sigma * W )
15
16 plot (t , GBM , type = " l " , xaxt = " n " , ylab = " Simulated
Wilshire 5000 Index " )
17 axis (1 , at = c (0.75 , 1.75 , 2.75 , 3.75 , 4.75 , 5.75) , label
= c ( " 2010 " , " 2011 " , " 2012 " ,
18 " 2013 " , " 2014 " , " 2015 " ) )
6.4. MODELS OF STOCK MARKET PRICES 331

Octave Octave script for Stock Market Model.


1 mu = 0.168226;
2 sigma = 0.1722922;
3 T = 5.75;
4 # length of the interval [0 , T ] in time units of years
5 S0 = 8242.38;
6
7 N = 1448;
8 # number of end - points of the grid including T
9 Delta = T / N ;
10 # time increment
11
12 W = zeros (1 , N + 1) ;
13 # initialization of the vector W approximating
14 # Wiener process
15 t = linspace (0 , T , N + 1) ;
16 W (2: N + 1) = cumsum ( sqrt ( Delta ) * stdnormal_rnd (1 , N ) ) ;
17 GBM = S0 * exp ( mu * t + sigma * W ) ;
18
19 plot (t , GBM )
20 set ( gca , ’ xtick ’ , [0.75 , 1.75 , 2.75 , 3.75 , 4.75 , 5.75])
21 set ( gca , ’ xticklabel ’ , { ’ 2010 ’ , ’ 2011 ’ , ’ 2012 ’ , ’ 2013 ’ ,
’ 2014 ’ , ’ 2015 ’ })

Perl Perl PDL script for Stock Market Model.


1 use PDL :: NiceSlice ;
2
3 $mu = 0.1682262;
4 $sigma = 0.1722922;
5 $T = 5.75;
6
7 # length of the interval [0 , T ] in time units
8 $S0 = 8242.38;
9

10 $N = 1448;
11
12 # number of end - points of the grid including T
13 $Delta = $T / $N ;
14
15 # time increment
16
17 $W = zeros ( $N + 1 ) ;
332 CHAPTER 6. STOCHASTIC CALCULUS

18
19 # initialization of the vector W approximating
20 # Wiener process
21 $t = ones ( $N + 1 ) * zeros ( $N + 1 ) -> xlinvals ( 0 , $T ) ;
22
23 # Note the use of PDL dim 1 threading rule ( PDL name for
R recycling )
24 $W ( 1 : $N ) .= cumusumover ( sqrt ( $Delta ) * grandom ( $N )
);
25
26 $GBM = $S0 * exp ( $mu * $t + $sigma * $W ) ;
27
28 # file output to use with external plotting programming
29 # such as gnuplot , R , octave , etc .
30 # Start gnuplot , then from gnuplot prompt
31 # plot " stockmarketmodel . dat " with lines ;\
32 # set xtic ("2010" 0.75 , "2011" 1.75 , "2012" 2.75 ,
"2013" 3.75 , "2014" 4.75 , "2015" 5.75)
33
34 open ( F , " > stockmarketmodel . dat " ) || die " cannot write :
$! ";
35 foreach $j ( 0 .. $N ) {
36 print F $t - > range ( [ $j ] ) , " " , $GBM - > range ( [ $j ] ) ,
"\n";
37 }
38 close ( F ) ;

SciPy Scientific Python script for Stock Market Model.


1 import scipy
2
3 mu = 0.1682262
4 sigma = 0.1722922
5 T = 5.75
6
7 # length of the interval [0 , T ] in time units
8
9 S0 = 8242.38
10
11 N = 1448
12
13 # number of end - points of the grid including T
14
15 Delta = T / N
6.4. MODELS OF STOCK MARKET PRICES 333

16
17 # time increment
18
19 W = scipy . zeros ( N + 1 , dtype = float )
20
21 # initialization of the vector W approximating
22 # Wiener process
23

24 t = scipy . ones ( N + 1 , dtype = float ) * scipy . linspace (0 , T ,


N + 1)
25
26 # Note the use of recycling
27
28 W [1: N + 1] = scipy . cumsum ( scipy . sqrt ( Delta )
29 * scipy . random . standard_normal (
N))
30
31 GBM = S0 * scipy . exp ( mu * t + sigma * W )
32
33 # optional file output to use with external plotting
programming
34 # such as gnuplot , R , octave , etc .
35 # Start gnuplot , then from gnuplot prompt
36 # plot " stockmarketmodel . dat " with lines ;\
37 # set xtic ("2010" 0.75 , "2011" 1.75 , "2012" 2.75 ,
"2013" 3.75 , "2014" 4.75 , "2015" 5.75)
38
39 f = open ( ’ stockmarketmodel . dat ’ , ’w ’)
40 for j in range (0 , N ) :
41 f . write ( str ( t [ j ]) + ’ ’ + str ( GBM [ j ]) + ’\ n ’)
42 f . close ()

Key Concepts
1. A natural definition of variation of a stock price st is the proportional
return rt at time t
rt = (st − st−1 )/st−1 .

2. The log-return
ρi = log(st /st−1 )
334 CHAPTER 6. STOCHASTIC CALCULUS

is another measure of variation on the time scale of the sequence of


prices.

3. For small returns, the difference between returns and log-returns is


small.

4. The advantage of using log-returns is that they are additive.

5. Using Brownian Motion for modeling stock prices varying over contin-
uous time has two obvious problems:

(a) Brownian Motion can attain negative values.


(b) Increments in Brownian Motion have certain variance on a given
time interval, so do not reflect proportional changes.

Vocabulary
1. A natural definition of variation of a stock price st is the proportional
return rt at time t
rt = (st − st−1 )/st−1 .

2. The log-return
ρi = log(st /st−1 )
is another measure of variation on the time scale of the sequence of
prices.

3. The compounding return at time t over n periods is


st
= (1 + rt )(1 + rt−1 ) · · · (1 + rt−n+1 )
st−n

4. The Wilshire 5000 Total Market Index, or more simply the Wilshire
5000, is an index of the market value of all stocks actively traded in
the United States.

5. A quantile-quantile (q-q) plot is a graphical technique for determin-


ing if two data sets come from populations with a common distribution.
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 335

Problems to Work for Understanding


1. Show that
ρi = log(1 + ri ) ≈ ri , for r  1 .

2. If standard Brownian Motion is started from a positive value X0 > 0,


write the expression for the positive probability that the process can
attain negative values at time t. Write the expression for the probability
that Brownian Motion can ever become negative.

3. Choose a stock index such as the S & P 500, the Dow Jones Industrial
Average etc., and obtain closing values of that index for a year-long
(or longer) interval of trading days. Find the growth rate and variance
of the closing values and create a Geometric Brownian Motion on the
same interval with the same initial value, growth rate, and variance.
Plot both sets of data on the same axes, as in Figure 6.3. Discuss the
similarities and differences.

4. Choose an individual stock or a stock index such as the S & P 500, the
Dow Jones Industrial Average, etc., and obtain values of that index at
regular intervals such as daily or hourly for a long interval of trading.
Find the log-changes, and normalize by subtracting the mean and di-
viding by the standard deviation. Create a q-q plot for the data as in
Figure 6.4. Discuss the similarities and differences.

Outside Readings and Links:

6.5 Monte Carlo Simulation of Option Prices


Section Starter Question
What is a 95% confidence interval in a statistical experiment?

Confidence Intervals for Option Prices


Monte Carlo methods (or Monte Carlo experiments) are a large and di-
verse class of solution methods using random sampling from a specified distri-
bution to generate numerical results for a mathematical model. Monte Carlo
336 CHAPTER 6. STOCHASTIC CALCULUS

methods are a statistical solution technique, among the various mathemat-


ical techniques that move from a mathematical model to a relation among
the quantities of interest.
With Geometric Brownian Motion as a stochastic process model for se-
curity prices, we can use that process for simulating option prices with a
Monte Carlo method. We assume that a security price is modeled by Geo-
metric Brownian Motion, so we know the lognormal probability distribution
at the expiration time. Draw n pseudo-random numbers x1 , . . . , xn from
the lognormal distribution modeling the stock price S. Then approximate a
put option price as the present value of the expected value of the function
g(S) = max(K − S, 0), with the sample mean
n
1X
E [g(S)] ≈ g(xi ) = ḡn .
n i=1

The examples in this section feature put options rather than the call options
illustrated previously for a reason that will become clear later when we modify
the Monte Carlo simulation with importance sampling.
The Weak and Strong Laws of Large Numbers ensure us that this approx-
imation is valid for large n, and improves as the number of samples increases.
Even more is true, since the Central Limit Theorem implies that the sam-
ple mean ḡn is approximately normally distributed with mean E [g(S)] and
variance Var [g(S)] /n,

ḡn ∼ N (E [g(S)] , Var [g(S)] /n).

This says that the value ḡn that we estimate with the Monte Carlo simulations
will have a deviation from the true expected √ value E [g(S)] that is on the
order of the standard deviation divided by n. More precisely, recall that
for the standard normal distribution P [|Z| < 1.96] ≈ 0.95. Then by the
shifting and rescaling properties of the normal distribution, we can construct
a corresponding 95% confidence interval for the estimate ḡn as
r r !
Var [g(S)] Var [g(S)]
E [g(S)] − 1.96 , E [g(S)] + 1.96 .
n n

We interpret the interval above as saying that the estimate ḡn will be in
this interval in about 95% of samples. That is, if 100 people perform the
sampling experiment with different draws from the pseudo-random number
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 337

generator, then about 95 of them will generate an expected value that falls in
this interval, but about 5 of them will be unlucky enough to draw a sample
that generates an expected value falling outside the interval.
A problem with obtaining the confidence interval is that the mean E [g(S)]
and the variance Var [g(S)] are both unknown. These are respectively esti-
mated with the sample mean ḡn and the sample variance
n
1 X
s2 = (g(xi ) − ḡn )2
n − 1 i=1

to obtain the 95% level Monte Carlo confidence interval for E [g(S)]
 
s s
ḡn − tn−1,0.975 √ , ḡn + tn−1,0.975 √ .
n n

The quantity s/ n is called the standard error. Note that the standard
error is dependent on the drawn numbers x1 , x2 , . . . , xn so it is subject to
sample variability too. In fact, the sample quantity

(ḡn − E [g(S)])

s/ n

has a probability distribution known as Student’s t-distribution, so the 95%


confidence interval limits of ±1.96 must be modified with the corresponding
95% confidence limits of the appropriate Student’s t-distribution.
Another problem with the Monte√Carlo confidence interval is that the
width of the interval decreases as 1/ n, which is not particularly fast. To
decrease the width of the confidence interval by half requires 4 times as many
sample variates.

Simplified Example
Now apply confidence interval estimation to the present value of a simple put
option price for a simplified security. The simplified security has a stochastic
differential equation dS = rS dt +σS dW with a starting price S(0) = z0 =
1 at t = 0 with risk-free interest rate r = σ 2 /2, and a standard deviation
σ = 1. Then the stochastic process is S(t) = eW (t) where W (t) is standard
Brownian Motion. (The parameters are financially unrealistic, but lead to
the simple exponential.) For the simplified put option the strike price is
338 CHAPTER 6. STOCHASTIC CALCULUS

n ḡn 95% Monte Carlo confidence interval


100 0.1580783 (0.1206047, 0.1955519)
1000 0.1539137 (0.1425191, 0.1653084)
10000 0.1451896 (0.1416714, 0.1487078)
Table 6.2: Monte Carlo confidence intervals for the present value of a simple
put option values. The present value of the put option from the Black-Scholes
formula is 0.1446101.

K = 1, and the time to expiration is T − t = T − 0 = 1. Short programs to


create 95% confidence intervals for 100, 1,000, and 10,000 samples are in the
Scripts section. The random seed is set to the arbitrary value 2015 so that
for replication of the Monte Carlo simulation the sample script always yields
the same results. The true value comes from the Black-Scholes put option
value formula in Put-Call Parity Principle. Some typical results from the R
script are in Table 6.2.
Although the Monte Carlo simulation yields good results fairly easily, a
disadvantage is that it applies for only one set of parameter values. To find
values for a variety of parameters requires more computations, but even that
does not demonstrate the functional relationship among the parameters and
the values. The next chapter will derive a complete mathematical solution for
the value of European call and put options. However, mathematical solution
is not always possible for more complex security derivatives, and then Monte
Carlo simulation is a good alternative.

Variance Reduction Techniques


Applying Monte Carlo estimation to a random variable with a large variance
creates a confidence interval that is correspondingly large. The width of the
confidence interval
√ can be reduced by increasing the sample size, but the rate
of reduction is n. Reducing the width of the confidence interval by half
requires 4 times more sample points. Sometimes we can find a way to reduce
s instead. To do this, we construct a new Monte Carlo problem with the
same answer as our original problem but with a smaller value for s. Methods
to do this are known as variance reduction techniques. Since Geomet-
ric Brownian Motion has a variance that grows exponentially, Monte Carlo
estimates of quantities based on Geometric Brownian Motion are excellent
candidates for variance reduction techniques.
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 339

Variance reduction techniques increase the efficiency of Monte Carlo es-


timation. Having methods to reduce variability with a given number of
sample points, or for efficiency to achieve the same variability with fewer
sample points, is desirable. Following are two methods that illustrate typical
variance reduction techniques.

Antithetic Sampling

An antithetic sample is a sample that gives a opposite value of g(x), being


low when g(x) is high and vice versa. Ordinarily we get an opposite g by
sampling at a point that is somehow opposite to x. The idea of antithetic
sampling can be applied when it is possible to find transformations of X that
leave its probability distribution unchanged. For example, if X is normally
distributed N (0, 1), then X̃ = −X is normally distributed as well, that
is the antithetic sample we will apply here. More generally, if X has a
symmetric distribution about 0, then X̃ = −X has the same distribution.
Another antithetic sample occurs when X is uniformly distributed on [0, 1]
so X̃ = 1 − X has the same probability distribution.
The antithetic sampling estimate of a value µ = E [g(X)] with a
sample size n is
n
1 X 
µ̂anti = g(Xj ) + g(X̃j ) .
2n j=1

Suppose the variance is σ 2 = E [(g(X) − µ)2 ] < ∞. Then the variance in


the antithetic sample of size n is
" n
#
1 X
Var [µ̂anti ] = Var g(Xj ) + g(X̃j )
2n j=1
n  h i
= 2 Var g(X) + g(X̃)
4n
1  h i h i
= Var [g(X)] + Var g(X̃) + 2 Cov g(X), g(X̃)
4n
σ2
= (1 + ρ).
2n

Previously, we have often assumed different samples are independent so that


the covariance term ρ is 0, reducing the number of terms in an expression.
340 CHAPTER 6. STOCHASTIC CALCULUS

n ḡn 95%Monte Carlo confidence interval


100 0.1429556 (0.1267189, 0.1591923)
1000 0.1432171 (0.1383814, 0.1480529)
10000 0.1452026 (0.1437125, 0.1466926)
Table 6.3: Monte Carlo confidence intervals with antithetic sampling for the
present value of a simple put option. The present value of the put option
from the Black-Scholes formula is 0.1446101.

However, here is a situation where we deliberately create statistical depen-


dence with negative covariance −1 ≤ ρ < 0 to reduce the variance in the
antithetic sampling estimate.
Table 6.3 gives the results of antithetic sampling on the simplified put
option example after a simple change of variables to make the sampling
distribution normal. Table 6.3 shows that for the put option Monte Carlo
estimation not only are the option value estimates much better with anti-
thetic sampling, but the confidence intervals are reduced to less than half of
the width compared with Table 6.2.
Note that if g(x) is a function with odd symmetry, for example g(x) =
cx, and X is symmetric about 0, for example normally distributed with
antithetic sample X̃ = −X, then µ = 0. Furthermore, the statistical estimate
µ̂anti would be always be 0 and in fact the estimate could be achieved with
just one sample point and no variance. If g is not symmetric, as in option
estimation with g(x) = max(K −x, 0), we can still expect some improvement.
The degree of improvement in antithetic sampling depends on the relative
contribution of the odd and even parts of the function g, see [52] for details.

Importance Sampling

Importance sampling is another variance reduction technique. The idea


behind importance sampling is that some values in a simulation have more
influence on the estimation than others. The probability distribution is care-
fully changed to give “important” outcomes more weight. If “important”
values are emphasized by sampling more frequently, then the estimator vari-
ance can be reduced. Hence, the key to importance sampling is to choose a
new sampling distribution that “encourages” the important values.
Let f (x) be the density of the random variable, so we are trying to esti-
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 341

mate Z
E [g(x)] = g(x)f (x) dx .
R

Estimate E [g(x)] with respect to another strictly positive density h(x). Then
easily
g(x)f (x)
Z
E [g(x)] = h(x) dx .
R h(x)
or equivalently, estimate
 
g(Y )f (Y )
E = E [g̃(Y )]
h(Y )

where Y is a new random variable with density h(y) and g̃(y) = g(y)f (y)/h(y).
For variance reduction, we wish to determine a new density h(y) so that
Var [g̃(Y )] < Var [g(X)]. Consider
Z 2
2 g (x)f 2 (x)
Var [g̃(Y )] = E g̃(Y ) − (E [g̃(Y )]) =
2
dx −E [g(X)]2 .
 
R h(x)

By inspection, we can see that we can make Var [g̃(Y )] = 0 by choosing


h(x) = g(x)f (x)/E [g(X)]. This is the ultimate variance reduction but it
relies on knowing E [g(X)], the quantity we are trying to estimate. It also
requires that g(x) is strictly positive.
To choose a good importance sampling distribution requires some edu-
cated guessing. Importance sampling is equivalent to a change of variables,
and like a change of variables often requires insight. Each instance of im-
portance sampling depends on the function and the distribution. A specific
example will illustrate importance sampling.
The example is again to calculate confidence intervals for the present
value of a Monte Carlo estimate of a European put option price, where g(x) =
max(K − x, 0) and S is distributed as a geometric Brownian motion derived
from dS = rS dt +σS dW with S(0) = z0 . To set some simple parameters,
we take the initial value z0 = 1, the risk free interest rate r = σ 2 /2, the
standard deviation σ = 1, the strike price K = 1 and the time to expiration
T = 1. The security process is then S(t) = eW (t) . At √
T = 1 the process has a
lognormal distribution with parameters µ = 0 and σ T = 1. Thus we start
with Z ∞
1 1 √
max(K − x, 0) √ √ exp(− (ln(x)/σ T )2 ) dx .
0 2πσx T 2
342 CHAPTER 6. STOCHASTIC CALCULUS

n ḡn 95% Monte Carlo confidence interval


100 0.1465861 (0.1395778, 0.1535944)
1000 0.1449724 (0.1427713, 0.1471736)
10000 0.1443417 (0.1436435, 0.1436435)
Table 6.4: Monte Carlo confidence intervals with importance sampling for
the present value of a simple put option. The present value of the put option
from the Black-Scholes formula is 0.1446101.

Using K = 1, σ = 1, and T = 1 after a first change of variable the integral


we are estimating is

∞ 2
e−x /2
Z
E [g(S)] = max(1 − e , 0) √x
dx
−∞ 2π
Z 0 −x2 /2
x e
= (1 − e ) √ dx .
−∞ 2π

Introduce the exponential distribution e−y/2 with a second change of vari-



ables x = − y. Then the expectation integral becomes


1 − e− y e−y/2
Z
√ √ dy .
0 2π y 2

This change of probability distribution has the added advantage that now
the sampling from the exponential distribution is concentrated where the
function contributes most to the integral. This explains why the examples
use put options, not call options.
Now apply this importance sampling to the confidence interval estimation
for the present value of put option prices. Short programs to create the
confidence intervals for 100, 1,000, and 10,000 samples are in the Scripts
section. Some typical results from the R script are in Table 6.2.
Table 6.4 shows that the put option Monte Carlo estimates with impor-
tance sampling are closer to the Black-Scholes value than the simple Monte
Carlo sampling. The confidence intervals are about one-fifth the width com-
pared with Table 6.2.
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 343

Application to Data
Standard and Poor’s 500 Index, with symbol SPX, is a weighted index of
500 stocks. This index is designed to measure performance of the broad
domestic economy through changes in the aggregate market value of 500
stocks representing all major industries. As such, it is a good candidate for
a stock index modeled by Geometric Brownian Motion. The index started
with a level of 10 for the 1941-43 base period.
To test Monte Carlo simulation on real data, use historical data on put
options on the SPX that provides values for K, T − t, and z0 . Values for r
and σ can be inferred from historical data.
The expectation to calculate for the Monte Carlo simulation of the value
of a put option is
Z ∞ 2 !
−1 ln(x) − ln(z0 ) − (r − σ 2 /2)t

1
max(K−x, 0) √ √ exp √ dx .
0 2πσx t 2 σ t
Then the expectation integral is equivalent to
Z ∞ √√ √√
2 2
max(K − z0 e(r−σ /2)t+σ t u , 0) + max(K − z0 e(r−σ /2)t−σ t u , 0)
0
−u
 
1
√ √ exp du .
2π 2 u 2
This is now the importance sampling estimate of the value of a put option
on the SPX index. The Scripts section has programs to evaluate confidence
intervals for the put option value using real data.

Sources
This section is adapted from: Simulation and Inference for Stochastic Dif-
ferential Equations, by Stephen Iacus, Sections 1.3 and 1.4, Springer-Verlag,
2008. The section on antithetic sample is adapted from Owen, Variance
Reduction and Lehna. Interest rates are from Treasury.gov

Algorithms, Scripts, Simulations


Algorithm
This script calculates the value of a put option on the Standard & Poor’s 500
stock index (SPX) in several ways. First the script uses the Black Scholes for-
344 CHAPTER 6. STOCHASTIC CALCULUS

mula for a put option to calculate the theoretical value for a put option. Then
the script uses Monte Carlo simulation based on the Geometric Brownian Mo-
tion with the SPX parameters to find an estimate for the put option value.
Finally, the script uses Monte Carlo simulation with antithetic sampling and
importance sampling variance reduction methods to refine the estimates. The
ultimate purpose is to compare the various Monte Carlo methods with the
put option value. The output will be a table of SPX put option value from the
Black Scholes formula, Monte Carlo simulation with 95% confidence interval,
antithetic sampling with 95% confidence interval and importance sampling
with 95% confidence interval Set the total number of trials: n = 10000 Set
the values of S, r, σ, K, T − t Calculate the theoretical value of put option
with Black-Scholes formula Fill the vector x[1..n]pwith random normal vari-
2
ates y1 = max(0, K −S exp((r−σ p /2)(T −t)+σx (T −t))) y2 = max(0, K −
2
S exp((r−σ /2)(T −t)+σ(−x) (T −t))) The antithetic sample becomes y =
(y1 + y2)/2 Fill vector u[1..n] with random normal variates. The √ importance

2
sample becomes u1 = (max(0, K − S exp((r √ −√σ /2)(T√− t) − σ T − t x))+
max(0, K − S exp((r − σ 2 /2)(T − t) + σ T − t x)))/ 2πx. Apply the t-test
to calculate mean and confidence intervals of the Monte Carlo simulations
y1[1 : 100], y1[1 : 1000]and y1[1 : n]. Apply the t-test to calculate mean
and confidence intervals of the antithetic samples y[1 : 100], y[1 : 1000] and
y[1 : n] Apply the t-test to calculate mean and confidence intervals of the
importance samples u1[1 : 100], u1[1 : 1000] and u1[1 : n]. Finally, collect
and display a table of theoretical value and means and confidence intervals.

Scripts
R R script for simplified option pricing with Monte Carlo simulation, anti-
thetic sampling, and importance sampling.
1 set . seed (2015)
2 n <- 10000
3
4 S <- 1
5 sigma <- 1
6 r <- sigma ^2 / 2
7 K <- 1
8 Tminust <- 1
9
10 # # the value of the put option by Black - Scholes
11 d2 <- ( log ( S / K ) + ( r - sigma ^2 / 2) * ( Tminust ) ) / ( sigma *
sqrt ( Tminust ) )
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 345

12 d1 <- ( log ( S / K ) + ( r + sigma ^2 / 2) * ( Tminust ) ) / ( sigma *


sqrt ( Tminust ) )
13 VP <- K * exp ( - r * Tminust ) * pnorm ( - d2 ) - S * pnorm ( - d1 )
14
15 x <- rlnorm ( n ) # Note use of default meanlog =0 , sdlog =1
16 y <- sapply (x , function ( z ) max (0 , K - z ) )
17
18 mc100 <- t . test ( exp ( - r * Tminust ) * y [1:100]) # first
100 simulations
19 mc1000 <- t . test ( exp ( - r * Tminust ) * y [1:1000]) # first
1000 simulations
20 mcall <- t . test ( exp ( - r * Tminust ) * y ) # all simulation
results
21

22 type <- c ( " Blacksholes " , " Monte Carlo 100 " , " Monte Carlo
1000 " , " Monte Carlo all " )
23 putestimate <- c ( VP , mc100 $ estimate , mc1000 $ estimate ,
mcall $ estimate )
24 putconfintleft <- c ( NA , mc100 $ conf . int [1] , mc1000 $ conf .
int [1] , mcall $ conf . int [1])
25 putconfintright <- c ( NA , mc100 $ conf . int [2] , mc1000 $ conf .
int [2] , mcall $ conf . int [2])
26 d <- data . frame ( type , putestimate , putconfintleft ,
putconfintright )
27
28 print ( d )
29
30 x <- rnorm ( n )
31 y1 <- sapply (x , function ( z ) max (0 , K - exp ( z ) ) )
32 y2 <- sapply ( -x , function ( z ) max (0 , K - exp ( z ) ) )
33 y <- ( y1 + y2 ) / 2
34

35 anti100 <- t . test ( exp ( - r * Tminust ) * y [1:100]) # first


100 simulations
36 anti1000 <- t . test ( exp ( - r * Tminust ) * y [1:1000]) #
first 1000 simulations
37 antiall <- t . test ( exp ( - r * Tminust ) * y ) # all
simulation results
38
39 type <- c ( " Blacksholes " , " Antithetic 100 " , " Antithetic
1000 " , " Antithetic all " )
40 putestimate <- c ( VP , anti100 $ estimate , anti1000 $ estimate ,
antiall $ estimate )
41 putconfintleft <- c ( NA , anti100 $ conf . int [1] , anti1000 $
conf . int [1] , antiall $ conf . int [1])
346 CHAPTER 6. STOCHASTIC CALCULUS

42 putconfintright <- c ( NA , anti100 $ conf . int [2] , anti1000 $


conf . int [2] , antiall $ conf . int [2])
43 d <- data . frame ( type , putestimate , putconfintleft ,
putconfintright )
44
45 print ( d )
46
47 xN <- rnorm ( n )
48 yN <- sapply ( xN , function ( z ) max (0 , K - exp ( z ) ) )
49
50 mcN100 <- t . test ( exp ( - r * Tminust ) * yN [1:100]) # first
100 simulations
51 mcN1000 <- t . test ( exp ( - r * Tminust ) * yN [1:1000]) #
first 1000 simulations
52 mcNall <- t . test ( exp ( - r * Tminust ) * yN ) # all
simulation results
53
54 type <- c ( " Blacksholes " , " Monte Carlo 100 " , " Monte Carlo
1000 " , " Monte Carlo all " )
55 putestimate <- c ( VP , mcN100 $ estimate , mcN1000 $ estimate ,
mcNall $ estimate )
56 putconfintleft <- c ( NA , mcN100 $ conf . int [1] , mcN1000 $ conf .
int [1] , mcNall $ conf . int [1])
57 putconfintright <- c ( NA , mcN100 $ conf . int [2] , mcN1000 $ conf
. int [2] , mcNall $ conf . int [2])
58 d <- data . frame ( type , putestimate , putconfintleft ,
putconfintright )
59
60 print ( d )
61
62 xE <- rexp (n , rate = 1 / 2)
63 yE <- sapply ( xE , function ( z ) max (0 , K - exp ( - sqrt ( z ) ) ) / (
sqrt (2 * pi ) * sqrt ( z ) ) )
64
65 mcE100 <- t . test ( exp ( - r * Tminust ) * yE [1:100]) # first
100 simulations
66 mcE1000 <- t . test ( exp ( - r * Tminust ) * yE [1:1000]) #
first 1000 simulations
67 mcEall <- t . test ( exp ( - r * Tminust ) * yE ) # all
simulation results
68
69 type <- c ( " Blacksholes " , " Monte Carlo 100 " , " Monte Carlo
1000 " , " Monte Carlo all " )
70 putestimate <- c ( VP , mcE100 $ estimate , mcE1000 $ estimate ,
mcEall $ estimate )
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 347

71 putconfintleft <- c ( NA , mcE100 $ conf . int [1] , mcE1000 $ conf .


int [1] , mcEall $ conf . int [1])
72 putconfintright <- c ( NA , mcE100 $ conf . int [2] , mcE1000 $ conf
. int [2] , mcEall $ conf . int [2])
73 d <- data . frame ( type , putestimate , putconfintleft ,
putconfintright )
74
75 print ( d )

R script for SPX option pricing.

Octave Octave script for SPX option pricing.


1 n = 10000;
2
3 S = 1614.96; # Standard and Poors 500 Index , on 07 / 01 /
2013
4 r = 0.008; # implied risk free interest rate , between 3
year and 5 year T - bill rate
5 sigma = 0.1827; # implied volatility
6 K = 1575; # strike price
7 Tminust = 110 / 365; # 07 / 01 / 2013 to 10 / 19 / 2013
8
9 ## the true value from the Black Scholes Formula for put
option
10 numerd1 = log ( S / K ) + ( r + sigma ^ 2 / 2) * ( Tminust ) ;
11 numerd2 = log ( S / K ) + ( r - sigma ^ 2 / 2) * ( Tminust ) ;
12 d1 = numerd1 / ( sigma * sqrt ( Tminust ) ) ;
13 d2 = numerd2 / ( sigma * sqrt ( Tminust ) ) ;
14 part1 = S * ( stdnormal_cdf ( d1 ) - 1) ;
15 part2 = K * exp ( - r * ( Tminust ) ) * ( stdnormal_cdf ( d2 ) -
1) ;
16 VP = part1 - part2 ;
17
18 x = stdnormal_rnd (n , 1) ;
19 y1 = max (0 , K - S * exp (( r - sigma ^ 2 / 2) * Tminust +
sigma * x * sqrt ( Tminust ) ) ) ;
20 y2 = max (0 , K - S * exp (( r - sigma ^ 2 / 2) * Tminust +
sigma * ( - x ) * sqrt ( Tminust ) ) ) ;
21 y = ( y1 + y2 ) / 2;
22
23 u = exprnd (1 / 0.5 , [n , 1]) ; # note exponential parameter
24 tildeg = ...
25 (...
348 CHAPTER 6. STOCHASTIC CALCULUS

26 max (0 , K - S * exp (( r - sigma ^ 2 / 2) * Tminust -


sigma * sqrt ( Tminust ) * sqrt ( u ) ) ) + ...
27 max (0 , K - S * exp (( r - sigma ^ 2 / 2) * Tminust +
sigma * sqrt ( Tminust ) * sqrt ( u ) ) ) ...
28 ) ./ sqrt (2 * pi * u ) ; # note use of broadcasting
29
30 function [m , confintleft , confintright ] = ttest ( data ,
confidence )
31 m = mean ( data ) ;
32 se = std ( data ) / sqrt ( length ( data ) ) ;
33 df = length ( data ) - 1;
34 q = tinv ((1 + confidence ) / 2 , df ) ;
35 confintleft = m - q * se ;
36 confintright = m + q * se ;
37 endfunction
38
39 [ mc100mu , mc100cil , mc100cir ] = ttest ( exp ( - r * Tminust )
* y1 (1:100) , 0.95) ;
40 [ mc1000mu , mc1000cil , mc1000cir ] = ttest ( exp ( - r *
Tminust ) * y1 (1:1000) , 0.95) ;
41 [ mcallmu , mcallcil , mcallcir ] = ttest ( exp ( - r * Tminust )
* y1 , 0.95) ;
42
43 [ anti100mu , anti100cil , anti100cir ] = ttest ( exp ( - r *
Tminust ) * y (1:100) , 0.95) ;
44 [ anti1000mu , anti1000cil , anti1000cir ] = ttest ( exp ( - r *
Tminust ) * y (1:1000) , 0.95) ;
45 [ antiallmu , antiallcil , antiallcir ] = ttest ( exp ( - r *
Tminust ) * y , 0.95) ;
46
47 [ imp100mu , imp100cil , imp100cir ] = ttest ( exp ( - r *
Tminust ) * tildeg (1:100) , 0.95) ;
48 [ imp1000mu , imp1000cil , imp1000cir ] = ttest ( exp ( - r *
Tminust ) * tildeg (1:1000) , 0.95) ;
49 [ impallmu , impallcil , impallcir ] = ttest ( exp ( - r *
Tminust ) * tildeg , 0.95) ;
50
51 putestimate = [ VP , ...
52 mc100mu , mc1000mu , mcallmu , ...
53 anti100mu , anti1000mu , antiallmu , ...
54 imp100mu , imp1000mu , impallmu ];
55 putconfintleft = [ NA , ...
56 mc100cil , mc1000cil , mcallcil , ...
57 anti100cil , anti1000cil , antiallcil , ...
58 imp100cil , imp1000cil , impallcil ];
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 349

59 putconfintright = [ NA , ...
60 mc100cir , mc1000cir , mcallcir , ...
61 anti100cir , anti1000cir , antiallcir , ...
62 imp100cir , imp1000cir , impallcir ];
63 d = transpose ([ putestimate ; putconfintleft ;
putconfintright ])

Perl Perl script for SPX option pricing.


1 use PDL :: NiceSlice ;
2 use PDL :: GSL :: RNG ;
3 $rng = PDL :: GSL :: RNG - > new ( ’ taus ’) ;
4 $rng - > set_seed ( time () ) ;
5 use PDL :: Constants qw ( PI E ) ;
6 use Statistics :: Distributions ;
7
8 $n = 10000;
9

10 $S = 1614.96; # Standard and Poors 500 Index , on


07/01/2013
11 $r =
12 0.008; # implied risk free interest rate , between 3
and 5 year T - bill rate
13 $sigma = 0.1827; # implied volatility
14 $K = 1575; # strike price
15 $Tminust = 110 / 365; # 07/01/2013 to 10/19/2013
16
17 sub pnorm {
18 my ( $x , $sigma , $mu ) = @_ ;
19 $sigma = 1 unless defined ( $sigma ) ;
20 $mu = 0 unless defined ( $mu ) ;
21
22 return 0.5 * ( 1 + erf ( ( $x - $mu ) / ( sqrt (2) *
$sigma ) ) ) ;
23 }
24

25 $numerd1 = log ( $S / $K ) + ( ( $r + $sigma **2 / 2 ) * (


$Tminust ) ) ;
26 $numerd2 = log ( $S / $K ) + ( ( $r - $sigma **2 / 2 ) * (
$Tminust ) ) ;
27 $d1 = $numerd1 / ( $sigma * sqrt ( $Tminust ) ) ;
28 $d2 = $numerd2 / ( $sigma * sqrt ( $Tminust ) ) ;
29 $part1 = $S * ( pnorm ( $d1 ) - 1 ) ;
30 $part2 = $K * exp ( - $r * $Tminust ) * ( pnorm ( $d2 ) - 1 ) ;
350 CHAPTER 6. STOCHASTIC CALCULUS

31 $VP = $part1 - $part2 ;


32

33 $x = $rng - > ran_gaussian ( 1 , $n ) ; # tested to here


34 $y1 = pdl (
35 zeroes ( $n ) ,
36 $K - $S * exp (
37 ( $r - $sigma **2 / 2 ) * $Tminust + $sigma * $x *
sqrt ( $Tminust )
38 )
39 ) -> transpose - > maximum ;
40 $y2 = pdl (
41 zeroes ( $n ) ,
42 $K - $S * exp (
43 ( $r - $sigma **2 / 2 ) * $Tminust + $sigma * ( -
$x ) * sqrt ( $Tminust )
44 )
45 ) -> transpose - > maximum ;
46 $y = ( $y1 + $y2 ) / 2;
47
48 $u = $rng - > ran_exponential ( 1 / 0.5 , $n ) ; # note
exponential parameter
49 $tildeg1 = pdl (
50 zeroes ( $n ) ,
51 $K - $S * exp (
52 ( $r - $sigma **2 / 2 ) * $Tminust - $sigma * sqrt
( $Tminust ) * sqrt ( $u )
53 )
54 ) -> transpose - > maximum ;
55 $tildeg2 = pdl (
56 zeroes ( $n ) ,
57 $K - $S * exp (
58 ( $r - $sigma **2 / 2 ) * $Tminust + $sigma * sqrt
( $Tminust ) * sqrt ( $u )
59 )
60 ) -> transpose - > maximum ;
61 $tildeg = ( $tildeg1 + $tildeg2 ) / sqrt ( 2 * PI * $u ) ;
62
63 sub ttest {
64 my ( $data , $confidence ) = @_ ;
65 $confidence = 0.95 unless defined ( $confidence ) ;
66 ( $mean , $prms , $median , $min , $max , $adev , $rms ) =
stats ( $data ) ;
67 $df = nelem ( $data ) - 1;
68 $q = Statistics :: Distributions :: tdistr ( $df , ( 1 -
$confidence ) / 2 ) ;
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 351

69
70 # Note use of level (1 - $confidence ) /2) instead of
percentile (1 + $confidence ) /2
71 $widthci = $q * $rms / sqrt ( nelem ( $data ) ) ;
72 $confintleft = $mean - $widthci ;
73 $confintright = $mean + $widthci ;
74 return ( $mean , $confintleft , $confintright ) ;
75 }
76
77 ( $mc100mu , $mc100cil , $mc100cir ) =
78 ttest ( exp ( - $r * $Tminust ) * $y1 ( 0 : 99 ) , 0.95 )
;
79 ( $mc1000mu , $mc1000cil , $mc1000cir ) =
80 ttest ( exp ( - $r * $Tminust ) * $y1 ( 0 : 999 ) , 0.95
);
81 ( $mcallmu , $mcallcil , $mcallcir ) =
82 ttest ( exp ( - $r * $Tminust ) * $y1 , 0.95 ) ;
83
84 ( $anti100mu , $anti100cil , $anti100cir ) =
85 ttest ( exp ( - $r * $Tminust ) * $y ( 0 : 99 ) , 0.95 ) ;
86 ( $anti1000mu , $anti1000cil , $anti1000cir ) =
87 ttest ( exp ( - $r * $Tminust ) * $y ( 0 : 999 ) , 0.95 )
;
88 ( $antiallmu , $antiallcil , $antiallcir ) =
89 ttest ( exp ( - $r * $Tminust ) * $y , 0.95 );
90

91 ( $imp100mu , $imp100cil , $imp100cir ) =


92 ttest ( exp ( - $r * $Tminust ) * $tildeg ( 0 : 99 ) ,
0.95 ) ;
93 ( $imp1000mu , $imp1000cil , $imp1000cir ) =
94 ttest ( exp ( - $r * $Tminust ) * $tildeg ( 0 : 999 ) ,
0.95 ) ;
95 ( $impallmu , $impallcil , $impallcir ) =
96 ttest ( exp ( - $r * $Tminust ) * $tildeg , 0.95 ) ;
97
98 $d = pdl (
99 [ $VP , " NaN " , " NaN " ] ,
100 [ $mc100mu , $mc100cil , $mc100cir ] ,
101 [ $mc1000mu , $mc1000cil , $mc1000cir ] ,
102 [ $mcallmu , $mcallcil , $mcallcir ] ,
103
104 [ $anti100mu , $anti100cil , $anti100cir ] ,
105 [ $anti1000mu , $anti1000cil , $anti1000cir ] ,
106 [ $antiallmu , $antiallcil , $antiallcir ] ,
107
352 CHAPTER 6. STOCHASTIC CALCULUS

108 [ $imp100mu , $imp100cil , $imp100cir ] ,


109 [ $imp1000mu , $imp1000cil , $imp1000cir ] ,
110 [ $impallmu , $impallcil , $impallcir ]
111 );
112
113 print $d ;

SciPy Python script for SPX option pricing.


1 import scipy
2 from scipy . stats import norm
3
4 n = 10000
5
6 S = 1614.96 # Standard and Poors 500 Index , on
07/01/2013
7 r = 0.008 # implied risk free interest rate , between 3
year and 5 year T - bill rate
8 sigma = 0.1827 # implied volatility
9 K = 1575 # strike price
10 Tminust = 110. / 365. # 07/01/2013 to 10/19/2013
11
12 numerd1 = scipy . log ( S / K ) + ( r + sigma ** 2 / 2) *
Tminust
13 numerd2 = scipy . log ( S / K ) + ( r - sigma ** 2 / 2) *
Tminust
14 d1 = numerd1 / ( sigma * scipy . sqrt ( Tminust ) )
15 d2 = numerd2 / ( sigma * scipy . sqrt ( Tminust ) )
16 part1 = S * ( norm . cdf ( d1 ) - 1)
17 part2 = K * scipy . exp ( - r * Tminust ) * ( norm . cdf ( d2 ) - 1)
18 VP = part1 - part2
19
20 x = norm . rvs ( size = n )
21 y1 = scipy . maximum (0 , K - S * scipy . exp (( r - sigma ** 2 /
2) * Tminust
22 + sigma * x * scipy . sqrt ( Tminust ) ) )
23 y2 = scipy . maximum (0 , K - S * scipy . exp (( r - sigma ** 2 /
2) * Tminust
24 + sigma * -x * scipy . sqrt ( Tminust ) ) )
25 y = ( y1 + y2 ) / 2
26

27 from scipy . stats import expon


28 u = expon . rvs ( size =n , scale =1. / 0.5)
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 353

29 tildeg = ( scipy . maximum (0 , K - S * scipy . exp (( r - sigma


** 2 / 2)
30 * Tminust - sigma * scipy . sqrt ( Tminust ) * scipy
. sqrt ( u ) ) )
31 + scipy . maximum (0 , K - S * scipy . exp (( r - sigma
** 2 / 2)
32 * Tminust + sigma * scipy . sqrt ( Tminust ) * scipy
. sqrt ( u ) ) ) ) \
33 / scipy . sqrt (2 * scipy . pi * u )
34
35
36 def ttest ( data , confidence =0.95) :
37 m = scipy . mean ( data )
38 se = scipy . stats . sem ( data )
39 df = len ( data ) - 1
40 h = se * scipy . stats . t . ppf ((1 + confidence ) / 2. , df )
41 return (m , m - h , m + h )
42
43
44 [ mc100mu , mc100cil , mc100cir ] = ttest ( scipy . exp ( - r *
Tminust )
45 * y1 [0:99] , 0.95)
46 [ mc1000mu , mc1000cil , mc1000cir ] = ttest ( scipy . exp ( - r *
Tminust )
47 * y1 [0:999] , 0.95)
48 [ mcallmu , mcallcil , mcallcir ] = ttest ( scipy . exp ( - r *
Tminust ) * y1 ,
49 0.95)
50
51 [ anti100mu , anti100cil , anti100cir ] = ttest ( scipy . exp ( - r
* Tminust )
52 * y [0:99] , 0.95)
53 [ anti1000mu , anti1000cil , anti1000cir ] = ttest ( scipy . exp
( - r * Tminust )
54 * y [0:999] , 0.95)
55 [ antiallmu , antiallcil , antiallcir ] = ttest ( scipy . exp ( - r
* Tminust )
56 * y , 0.95)
57
58 [ imp100mu , imp100cil , imp100cir ] = ttest ( scipy . exp ( - r *
Tminust )
59 * tildeg [0:99] , 0.95)
60 [ imp1000mu , imp1000cil , imp1000cir ] = ttest ( scipy . exp ( - r
* Tminust )
61 * tildeg [0:999] , 0.95)
354 CHAPTER 6. STOCHASTIC CALCULUS

62 [ impallmu , impallcil , impallcir ] = ttest ( scipy . exp ( - r *


Tminust )
63 * tildeg , 0.95)
64
65 putestimate = [
66 VP ,
67 mc100mu ,
68 mc1000mu ,
69 mcallmu ,
70 anti100mu ,
71 anti1000mu ,
72 antiallmu ,
73 imp100mu ,
74 imp1000mu ,
75 impallmu ,
76 ]
77 putconfintleft = [
78 scipy . nan ,
79 mc100cil ,
80 mc1000cil ,
81 mcallcil ,
82 anti100cil ,
83 anti1000cil ,
84 antiallcil ,
85 imp100cil ,
86 imp1000cil ,
87 impallcil ,
88 ]
89 putconfintright = [
90 scipy . nan ,
91 mc100cir ,
92 mc1000cir ,
93 mcallcir ,
94 anti100cir ,
95 anti1000cir ,
96 antiallcir ,
97 imp100cir ,
98 imp1000cir ,
99 impallcir ,
100 ]
101 d = scipy . transpose ( scipy . array ([ putestimate ,
putconfintleft ,
102 putconfintright ]) )
103

104 print ( d )
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 355

Key Concepts
1. Monte Carlo methods (or Monte Carlo experiments) are mathemat-
ical solution methods that rely on repeated random sampling to obtain
numerical results.

2. Variance reduction techniques create a new Monte Carlo problem


with the same answer as the original but with a smaller value for the
variance to increase the efficiency of the Monte Carlo estimation. Many
methods for variance reduction for Monte Carlo methods exist.

3. The idea behind importance sampling is that some values of the sim-
ulation have more effect on the estimation than others. The probability
distribution of the sample is carefully changed to give “important” out-
comes more weight to achieve some goal such as variance reduction.

Vocabulary
1. Monte Carlo methods (or Monte Carlo experiments) are a large
and diverse class of solution methods using random sampling from a
specified distribution to generate numerical results for a mathematical
model.

2. The 95% level Monte Carlo confidence interval for E [g(X)] is


 
s s
ḡn − t0.975 √ , ḡn + t0.975 √ .
n n

3. The quantity s/ n is called the standard error.

4. Variance reduction techniques create a new Monte Carlo problem


with the same answer as the original but with a smaller value for the
variance to increase the efficiency of Monte Carlo estimation.

5. An antithetic sample is a sample that uses an opposite value of f (x),


being low when f (x) is high and vice versa, to reduce the variance.
356 CHAPTER 6. STOCHASTIC CALCULUS

6. Importance sampling is another variance reduction technique. The


idea behind importance sampling is that some values in a simulation
have more influence on the estimation than others. The probability
distribution is carefully changed to give “important” outcomes more
weight.

Problems to Work for Understanding


1. Experiment with various values of sample size in the Monte Carlo sim-
ulation of the simplified put option to determine how the width of the
confidence interval depends on the sample size.

2. Experiment with various random seeds and values of the parameter σ


in the simplified put option model to find the relative errors of the basic
Monte Carlo method, antithetic sampling and importance sampling.

3. From Options we know the value of a put option increases with increas-
ing volatility σ. Additionally the standard deviation of the simplified
security price increases exponentially with increasing σ. Experiment
with various values of σ in the Monte Carlo simulation of the simpli-
fied put option to determine how the put option price and the width
of the confidence intervals vary with sigma.

4. Evaluate the following integrals numerically (that is, with numerical


integration software, not Monte Carlo evaluation):

(a)
Z ∞
1 1 √
max(K − x, 0) √ √ exp(− (ln(x)/σ T )2 ) dx;
0 2πσx T 2

(b)
0 2
e−x /2
Z
x
(1 − e ) √ dx;
−∞ 2π
(c)


1 − e− y e−y/2
Z
√ √ dy .
0 2π y 2
6.5. MONTE CARLO SIMULATION OF OPTION PRICES 357

Interpreting each as the expected value of a put option at expiration,


find the present value i of each if the interest rate is r = σ 2 /2 with
σ = 1 and T − t = T − 0 = 1.
5. Change the scripts to provide descriptive output.
6. Change the scripts to create a Monte Carlo simulation estimate of the
value of a put option on the Standard and Poor’s 500 index (SPX)
directly using 10, 000 random variates with a lognormal distribution.
Use parameters S = 1614.96, r = 0.008, σ = 0.1827, K = 1575,
T − t = 110/365. Also construct the 95% confidence interval for the
estimate.
7. Change the scripts to create a Monte Carlo simulation estimate of the
value of a call option on the Standard and Poor’s 500 index (SPX)
directly using 10, 000 random variates with a lognormal distribution.
Use parameters S = 1614.96, r = 0.008, σ = 0.1827, K = 1575,
T − t = 110/365.
8. Provide a detailed explanation of the changes of variables that lead
from
Z ∞ 2 !
−1 ln(x) − ln(z0 ) − (r − σ 2 /2)t

1
max(K−x, 0) √ √ exp √ dx .
0 2πσx t 2 σ t
to
Z ∞ √√ √√
2 /2)t+σ t u 2 /2)t−σ t u
max(K − z0 e(r−σ , 0) + max(K − z0 e(r−σ , 0)
0
−u
 
1
√ √ exp du .
2π 2 u 2

Outside Readings and Links:


1.
2.
3.
4.
358 CHAPTER 6. STOCHASTIC CALCULUS
Chapter 7

The Black-Scholes Model

7.1 Derivation of the Black-Scholes Equation


Section Starter Question
What is the most important idea in the derivation of the binomial option
pricing model?

Explicit Assumptions Made for Modeling and Derivation


For mathematical modeling of a market for a risky security we will ideally
assume:

1. Many identical, rational traders always have complete information about


all assets each is trading.

2. Changes in prices are given by a continuous random variable with some


probability distribution.

3. Trading transactions take negligible time.

4. Purchases and sales can be in any amounts, that is, the stock and
bond are divisible, we can buy them in any amounts including negative
amounts (which are short positions).

5. The risky security issues no dividends.

359
360 CHAPTER 7. THE BLACK-SCHOLES MODEL

The first assumption is the essence of what economists call the efficient
market hypothesis. The efficient market hypothesis leads to the second
assumption as a conclusion, called the random walk hypothesis. Another
version of the random walk hypothesis says that traders cannot predict the
direction of the market or the magnitude of the change in a stock so the
best predictor of the market value of a stock is the current price. We will
make the second assumption stronger and more precise by specifying the
probability distribution of the changes with a stochastic differential equation.
The remaining hypotheses are simplifying assumptions that can be relaxed
at the expense of more difficult mathematical modeling.
We wish to find the value V of a derivative instrument based on an
underlying security that has value S. Mathematically, we assume:

1. The price of the underlying security follows the stochastic differential


equation
dS = rS dt +σS dW
or equivalently that S(t) is a Geometric Brownian Motion with param-
eters r − σ 2 /2 and σ.

2. The risk free interest rate r and the volatility σ are constants.

3. The value V of the derivative depends only on the current value of the
underlying security S and the time t, so we can write V (S, t).

4. All variables are real-valued, and all functions are sufficiently smooth
to justify necessary calculus operations.

The first assumption is a mathematical translation of a strong form of


the efficient market hypothesis from economics. It is a reasonable modeling
assumption but finer analysis strongly suggests that security prices have a
higher probability of large price swings than Geometric Brownian Motion
predicts. Therefore the first assumption is not supported by data. However,
it is useful since we have good analytic understanding of Geometric Brownian
Motion.
The second assumption is a reasonable assumption for a modeling attempt
although good evidence indicates neither interest rates nor the volatility are
constant. On reasonably short times scales, say a period of three months
for the lifetime of most options, the interest rate and the volatility are ap-
proximately constant. The third and fourth assumptions are mathematical
7.1. DERIVATION OF THE BLACK-SCHOLES EQUATION 361

translations of the assumptions that securities can be bought and sold in


any amount and that trading times are negligible, so that standard tools of
mathematical analysis apply. Both assumptions are reasonable for modern
security trading.

Derivation of the Black-Scholes equation


We consider a simple derivative instrument, an option written on an under-
lying asset, say a stock that trades in the market at price S(t). A payoff
function Λ(S) determines the value of the option at expiration time T . For
t < T , the option value should depend on the underlying price S and the
time t. We denote the price as V (S, t). So far all we know is the value at the
final time V (S, T ) = Λ(S). We would like to know the value V (S, 0) so that
we know an appropriate buying or selling price of the option.
As time passes, the value of the option changes, both because the ex-
piration date approaches and because the stock price changes. We assume
the option price changes smoothly in both the security price and the time.
Across a short time interval δt we can write the Taylor series expansion of
V:
1
δV = Vt δt + Vs δS + VSS (δS)2 + . . . .
2
The neglected terms are of order (δt) , δSδt, and (δS)3 and higher. We rely
2

on our intuition from random walks and Brownian motion to explain why we
keep the terms of order (δS)2 but neglect the other terms. More about this
later.
To determine the price, we construct a replicating portfolio. This will
be a specific investment strategy involving only the stock and a cash account
that will yield exactly the same eventual payoff as the option in all possible
future scenarios. Its present value must therefore be the same as the present
value of the option and if we can determine one we can determine the other.
We thus define a portfolio Π consisting of φ(t) shares of stock and ψ(t) units
of the cash account B(t). The portfolio constantly changes in value as the
security price changes randomly and the cash account accumulates interest.
In a short time interval, we can take the changes in the portfolio to be

δΠ = φ(t)δS + ψ(t)rB(t)δt

since δB(t) ≈ rB(t)δt, where r is the interest rate. This says that short-
time changes in the portfolio value are due only to changes in the security
362 CHAPTER 7. THE BLACK-SCHOLES MODEL

price, and the interest growth of the cash account, and not to additions or
subtraction of the portfolio amounts. Any additions or subtractions are due
to subsequent reallocations financed through the changes in the components
themselves.
The difference in value between the two portfolios’ changes by

1
δ(V − Π) = (Vt − ψ(t)rB(t))δt + (VS − φ(t))δS + VSS (δS)2 + . . . .
2

This represents changes in a three-part portfolio consisting of an option and


short-selling φ units of the security and ψ units of bonds.
Next come a couple of linked insights: As an initial insight we will elim-
inate the first order dependence on S by taking φ(t) = VS . Note that this
means the rate of change of the derivative value with respect to the security
value determines a policy for φ(t). Looking carefully, we see that this pol-
icy removes the “randomness” from the equation for the difference in values!
(What looks like a little “trick” right here hides a world of probability theory.
This is really a Radon-Nikodym derivative that defines a change of measure
that transforms a diffusion, i.e. a transformed Brownian motion with drift,
to a standard Wiener measure.)
Second, since the difference portfolio is now non-risky, it must grow in
value at exactly the same rate as any risk-free bank account:

δ(V − Π) = r(V − Π)δt.

This insight is actually our now familiar no-arbitrage-possibility argument: If


δ(V − Π) > r(V − Π)δt, then anyone could borrow money at rate r to acquire
the portfolio V − Π, holding the portfolio for a time δt, and then selling
the portfolio, with the growth in the difference portfolio more than enough
to cover the interest costs on the loan. On the other hand if δ(V − Π) <
r(V −Π)δt, then short-sell the option in the marketplace for V , purchase φ(t)
shares of stock and lend the rest of the money out at rate r. The interest
growth of the money will more than cover the repayment of the difference
portfolio. Either way, the existence of risk-free profits in the market will
drive the inequality to an equality.
So:
1
r(V − Π)δt = (Vt − ψ(t)rB(t))δt + VSS (δS)2 .
2
7.1. DERIVATION OF THE BLACK-SCHOLES EQUATION 363

Recall the quadratic variation of Geometric Brownian Motion is determinis-


tic, namely (δS)2 = σ 2 S(t)2 δt,
1
r(V − Π)δt = (Vt − ψ(t)rB(t))δt + σ 2 S 2 VSS δt.
2
Divide out the δt factor, and recall that V − Π = V − φ(t)S − ψ(t)B(t), and
φ(t) = VS , so that on the left r(V − Π) = rV − rVS S − rψ(t)B(t). The terms
−rψ(t)B(t) on left and right cancel, and we are left with the Black-Scholes
equation:
1
Vt + σ 2 S 2 VSS + rSVS − rV = 0.
2
Note that under the assumptions made for the purposes of the modeling
the partial differential equation depends only on the constant volatility σ
and the constant risk-free interest rate r. This partial differential equation
(PDE) must be satisfied by the value of any derivative security depending
on the asset S.
There are two things to immediately notice about the PDE.
1. The PDE is linear: Since the solution of the PDE is the worth of the
option, then two options are worth twice as much as one option, and a
portfolio consisting two different options has value equal to the sum of
the individual options.

2. The PDE is backwards parabolic because it is a partial differential


equation of the form Vt +DVxx +. . . = 0 with highest derivative terms in
t of order 1 and highest derivative terms x of order 2 respectively. Thus,
terminal values V (S, T ) (in contrast to the initial values required by
many problems in physics and engineering) must be specified. The
value of a European option at expiration is known as a function of the
security price S, so we have a terminal value. The PDE determines the
value of the option at times before the expiration date.

Comment on the derivation:


The derivation above follows reasonably closely the original derivation of
Black, Scholes and Merton. Option prices can also be calculated and the
Black-Scholes equation derived by more advanced probabilistic methods. In
this equivalent formulation, the discounted price process exp(−rt)S(t) is
shifted into a “risk-free” measure using the Girsanov Theorem, so that it
364 CHAPTER 7. THE BLACK-SCHOLES MODEL

becomes a martingale. The option price V (S, t) is then the discounted ex-
pected value of the payoff Λ(t) in this measure, and the PDE is obtained as
the backward evolution equation for the expectation. The probabilistic view
is more modern and can be more easily extended to general market models.
The derivation of the Black-Scholes equation above uses the fairly intu-
itive partial derivative equation approach because of the simplicity of the
derivation. This derivation:

• is easily motivated and related to similar derivations of partial differ-


ential equations in physics and engineering;

• avoids the burden of developing additional probability theory and mea-


sure theory machinery, including filtrations, sigma-fields, previsibility,
and changes of measure including Radon-Nikodym derivatives and the
Girsanov Theorem;

• also avoids, or at least hides, martingale theory that we have not yet
developed or exploited; and

• does depend on the stochastic process knowledge that we have gained


already, but not more than that knowledge!

The disadvantages are that:

• we must skim certain details, relying on motivation instead of strict


mathematical rigor;

• we still have to solve the partial differential equation to get the price on
the derivative, whereas the probabilistic methods deliver the solution
almost automatically and give the partial differential equation as an
auxiliary by-product; and

• the probabilistic view is more modern and can be more easily extended
to general market models.

Sources
This derivation of the Black-Scholes equation is drawn from “Financial Deriva-
tives and Partial Differential Equations” by Robert Almgren, in American
Mathematical Monthly, Volume 109, January, 2002, pages 1–11.
7.1. DERIVATION OF THE BLACK-SCHOLES EQUATION 365

Key Concepts
1. The derivation of the Black-Scholes equation uses

(a) tools from calculus,


(b) the quadratic variation of Geometric Brownian Motion,
(c) the no-arbitrage condition to evaluate growth of non-risky portfo-
lios,
(d) and a simple but profound insight to eliminate the randomness or
risk.

Vocabulary
1. A backward parabolic PDE is a partial differential equation of the
form Vt + DVxx + . . . = 0 with highest derivative terms in t of order
1 and highest derivative terms x of order 2 respectively. Terminal
values V (S, T ) at an end time t = T must be satisfied in contrast to
the initial values at t = 0 required by many problems in physics and
engineering.

2. A terminal condition for a backward parabolic equation is the speci-


fication of a function at the end time of the interval of consideration to
uniquely determine the solution. It is analogous to an initial condition
for an ordinary differential equation, except that it occurs at the end
of the time interval, instead of the beginning.

Problems to Work for Understanding


1. Show by substitution that two exact solutions of the Black-Scholes
equations are

(a) V (S, t) = AS, A some constant.


(b) V (S, t) = A exp(rt)

Explain in financial terms what each of these solutions represents. That


is, describe a simple “claim”, “derivative” or “option” for which this
solution to the Black Scholes equation gives the value of the claim at
any time.
366 CHAPTER 7. THE BLACK-SCHOLES MODEL

2. Draw the expiry diagrams (that is, a graph of terminal condition of


portfolio value versus security price S) at the expiration time for the
portfolio which is

(a) Short one share, long two calls with exercise price K. (This is
called a straddle.)
(b) Long one call, and one put both exercise price K. (This is also
called a straddle.)
(c) Long one call, and two puts, all with exercise price K. (This is
called a strip.)
(d) Long one put, and two calls, all with exercise price K. (This is
called a strap.)
(e) Long one call with exercise price K1 and one put with exercise
price K2 . Compare the three cases when K1 > K2 , (known as a
strangle), K1 = K2 , and K1 < K2 .
(f) As before, but also short one call and one put with exercise price
K. (When K1 < K < K2 , this is called a butterfly spread.)

Outside Readings and Links:


1. Bradley University, School of Business Administration, Finance De-
partment, Kevin Rubash A very brief description on the development
history of option theory and the Black-Scholes model for calculating
option value, with the notations, Greeks and some explanatory graphs.
Also contains a calculators for the option value calculation. Submitted
by Yogesh Makkar, November 19, 2003.

7.2 Solution of the Black-Scholes Equation


Section Starter Question
What is the solution method for the Cauchy-Euler type of ordinary differen-
tial equation:
d2 v dv
x2 2 + ax + bv = 0 ?
dx dx
7.2. SOLUTION OF THE BLACK-SCHOLES EQUATION 367

Conditions for Solution of the Black-Scholes Equation


We have to start somewhere, and to avoid the problem of deriving everything
back to calculus, we will assert that the initial value problem for the heat
equation on the real line is well-posed. That is, consider the solution to the
partial differential equation
∂u ∂ 2u
= − ∞ < x < ∞, τ >0
∂τ ∂x2
with the initial condition
u(x, 0) = u0 (x).
Assume the initial condition and the solution satisfy the following technical
requirements:
1. u0 (x) has at most a finite number of discontinuities of the jump kind.
2
2. lim|x|→∞ u0 (x)e−ax = 0 for any a > 0.
2
3. lim|x|→∞ u(x, τ )e−ax = 0 for any a > 0.
Under these mild assumptions, the solution exists for all time and is unique.
Most importantly, the solution is represented as
Z ∞
1 −(x−s)2
u(x, τ ) = √ u0 (s)e 4τ ds .
2 πτ −∞
Remark. This solution can be derived in several different ways, the easiest
way is to use Fourier transforms. The derivation of this solution representa-
tion is standard in any course or book on partial differential equations.
Remark. Mathematically, the conditions above are unnecessarily restrictive,
and can be considerably weakened. However, they will be more than sufficient
for all practical situations we encounter in mathematical finance.
Remark. The use of τ for the time variable (instead of the more natural t)
is to avoid a conflict of notation in the several changes of variables we will
soon have to make.
The Black-Scholes terminal value problem for the value V (S, t) of a Eu-
ropean call option on a security with price S at time t is
∂V 1 ∂ 2V ∂V
+ σ 2 S 2 2 + rS − rV = 0
∂t 2 ∂S ∂S
368 CHAPTER 7. THE BLACK-SCHOLES MODEL

with V (0, t) = 0, V (S, t) ∼ S as S → ∞ and

V (S, T ) = max(S − K, 0).

Note that this looks a little like the heat equation on the infinite interval
in that it has a first derivative of the unknown with respect to time and the
second derivative of the unknown with respect to the other (space) variable.
On the other hand, notice:

1. Each time the unknown is differentiated with respect to S, it also mul-


tiplied by the independent variable S, so the equation is not a constant
coefficient equation.

2. There is a first derivative of V with respect to S in the equation.

3. There is a zero-th order derivative term V in the equation.

4. The sign on the second derivative is the opposite of the heat equation
form, so the equation is of backward parabolic form.

5. The data of the problem is given at the final time T instead of the initial
time 0, consistent with the backward parabolic form of the equation.

6. There is a boundary condition V (0, t) = 0 specifying the value of the


solution at one sensible boundary of the problem. The boundary is sen-
sible since security values must only be zero or positive. This boundary
condition says that any time the security value is 0, then the call value
(with strike price K) is also worth 0.

7. There is another boundary condition V (S, t) ∼ S, as S → ∞, but


although this is financially sensible, (it says that for very large security
prices, the call value with strike price K is approximately S) it is more
in the nature of a technical condition, and we will ignore it without
consequence.

We eliminate each objection with a suitable change of variables. The plan


is to change variables to reduce the Black-Scholes terminal value problem to
the heat equation, then to use the known solution of the heat equation to
represent the solution, and finally change variables back. This is a standard
solution technique in partial differential equations. All the transformations
are standard and well-motivated.
7.2. SOLUTION OF THE BLACK-SCHOLES EQUATION 369

Solution of the Black-Scholes Equation


τ
First we take t = T − (1/2)σ 2
and S = Kex , and we set

V (S, t) = Kv(x, τ ).

Remember, σ is the volatility, r is the interest rate on a risk-free bond, and


K is the strike price. In the changes of variables above, the choice for t
reverses the sense of time, changing the problem from backward parabolic
to forward parabolic. The choice for S is a well-known transformation based
on experience with the Euler equidimensional equation in differential equa-
tions. In addition, the variables have been carefully scaled so as to make
the transformed equation expressed in dimensionless quantities. All of these
techniques are standard and are covered in most courses and books on partial
differential equations and applied mathematics.
Some extremely wise advice adapted from Stochastic Calculus and Finan-
cial Applications by J. Michael Steele, [67, page 186], is appropriate here.
“There is nothing particularly difficult about changing vari-
ables and transforming one equation to another, but there is an
element of tedium and complexity that slows us down. There is
no universal remedy for this molasses effect, but the calculations
do seem to go more quickly if one follows a well-defined plan. If
we know that V (S, t) satisfies an equation (like the Black-Scholes
equation) we are guaranteed that we can make good use of the
equation in the derivation of the equation for a new function
v(x, τ ) defined in terms of the old if we write the old V as a func-
tion of the new v and write the new τ and x as functions of the
old t and S. This order of things puts everything in the direct
line of fire of the chain rule; the partial derivatives Vt , VS and VSS
are easy to compute and at the end, the original equation stands
ready for immediate use.”
Following the advice, write
σ2
τ= · (T − t)
2
and  
S
x = log .
K
370 CHAPTER 7. THE BLACK-SCHOLES MODEL

The first derivatives are


∂V ∂v dτ ∂v −σ 2
=K · =K ·
∂t ∂τ dt ∂τ 2
and
∂V ∂v dx ∂v 1
=K · =K · .
∂S ∂x dS ∂x S
The second derivative is
∂ 2V
 
∂ ∂V
=
∂S 2 ∂S ∂S
 
∂ ∂v 1
= K
∂S ∂x S
∂v −1
 
∂ ∂v 1
=K · 2 +K ·
∂x S ∂S ∂x S
∂v −1
 
∂ ∂v dx 1
=K · 2 +K · ·
∂x S ∂x ∂x dS S
∂v −1 ∂ 2v 1
=K · 2 + K 2 · 2.
∂x S ∂x S
The terminal condition is

V (S, T ) = max(S − K, 0) = max(Kex − K, 0)

but V (S, T ) = Kv(x, 0) so v(x, 0) = max(ex − 1, 0).


Now substitute all of the derivatives into the Black-Scholes equation to
obtain:
∂v −σ 2 σ 2 2 ∂v −1 ∂ 2v 1
   
∂v 1
K · + S K · + K 2 · 2 + rS K · − rKv = 0.
∂τ 2 2 ∂x S 2 ∂x S ∂x S
Now begin the simplification:
1. Divide out the common factor K.
σ2
2. Transpose the τ -derivative to the other side, and divide through by 2
.

3. Rename the remaining constant σ2r/2 as k which measures the ratio


between the risk-free interest rate and the volatility.

4. Cancel the S 2 terms in the second derivative.


7.2. SOLUTION OF THE BLACK-SCHOLES EQUATION 371

5. Cancel the S terms in the first derivative.

6. Gather up like order terms.

What remains is the rescaled, constant coefficient equation:

∂v ∂ 2v ∂v
= 2
+ (k − 1) − kv.
∂τ ∂x ∂x
1. Now there is only one dimensionless parameter k measuring the risk-
free interest rate as a multiple of the volatility and a rescaled time to
2
expiry σ2 T , not the original 4 dimensioned quantities K, T , σ 2 and r.

2. The equation is defined on the interval −∞ < x < ∞, since this x-


interval defines 0 < S < ∞ through the change of variables S = Kex .

3. The equation now has constant coefficients.

In principle, we could now solve the equation directly.


Instead, we will simplify further by changing the dependent variable scale
yet again, by
v = eαx+βτ u(x, τ )
where α and β are yet to be determined. Using the product rule:

vτ = βeαx+βτ u + eαx+βτ uτ

and
vx = αeαx+βτ u + eαx+βτ ux
and
vxx = α2 eαx+βτ u + 2αeαx+βτ ux + eαx+βτ uxx .
Put these into our constant coefficient partial differential equation, divide
the common factor of eαx+βτ throughout and obtain:

βu + uτ = α2 u + 2αux + uxx + (k − 1)(αu + ux ) − ku.

Gather like terms:

uτ = uxx + [2α + (k − 1)]ux + [α2 + (k − 1)α − k − β]u.


372 CHAPTER 7. THE BLACK-SCHOLES MODEL

Choose α = − k−1 2
so that the ux coefficient is 0, and then choose β =
2
α2 + (k − 1)α − k = − (k+1) 4
so the u coefficient is likewise 0. With this
choice, the equation is reduced to

uτ = uxx .

We need to transform the initial condition too. This transformation is


(k−1) (k+1)2
u(x, 0) = e−(− 2
)x−(− 4 )·0
v(x, 0)
(k−1)
=e max(ex − 1, 0)
( 2 )x

(k+1) (k−1)

= max e( 2 )x
−e( 2 )x
,0 .

For future reference, we notice that this function is strictly positive when
the argument x is strictly positive, that is u0 (x) > 0 when x > 0, otherwise,
u0 (x) = 0 for x ≤ 0.
We are in the final stage since we are ready to apply the heat-equation
solution representation formula:

1
Z
(x−s)2
u(x, τ ) = √ u0 (s)e− 4τ ds .
2 πτ −∞

However, first we want to make a change of variable in the integration, by


taking z = (s−x)


, (and thereby dz = (− √12τ ) dx) so that the integration
becomes: Z ∞  √
1  z2
u(x, τ ) = √ u0 z 2τ + x e− 2 dz .
2π −∞
We may as well only integrate over the domain √
where u0 >√ 0, that is for
x
z > − 2τ . On that domain, u0 = e

k+1
2 ( x+z 2τ )
− e 2 (x+z 2τ ) so we are
k−1

down to:
Z ∞ √
Z ∞ √
1 k+1
(x+z 2τ ) − z2 1 2 (
k−1 2
x+z 2τ ) − z2
√ √
e 2 e 2 dz − √

e e dz .
2π −x/ 2τ 2π −x/ 2τ

Call the two integrals I1 and I2 respectively.


We will evaluate I1 (the integral with the k + 1 term) first. This is easy,
completing the square in the exponent yields a standard, tabulated integral.
7.2. SOLUTION OF THE BLACK-SCHOLES EQUATION 373

The exponent is
k+1 √  z2
x + z 2τ −
2 2
−1 √
   k + 1
2
= z − 2τ (k + 1) z + x
2 2
! 
−1 √ 2
(k + 1)2
  
2 (k + 1) (k + 1)
= z − 2τ (k + 1) z + τ + x+τ
2 2 2 4
2
−1
  2 (k + 1) x τ (k + 1)
p
= z − τ /2 (k + 1) + + .
2 2 4
Therefore
Z ∞ √
1 2 (
k+1 2
x+z 2τ ) − z2
√ e e dz
2π −x/√2τ
(k+1)x (k+1)2
+τ 4 ∞  √ 2
e
Z
2 − 12 z− τ /2(k+1)
= √ √
e dz .
2π −x/ 2τ
p
Now, change variables again on the integral, choosing y = z − τ /2 (k + 1)
so dy = dz, and all we need to change are the limits of integration:
(k+1)x (k+1)2
 
+τ 4 ∞ 2
e
Z
2 − y2
√ √ √ e dz .
2π −x/ 2τ − τ /2(k+1)

The integral can be represented in terms of the cumulative distribution func-


tion of a normal random variable, usually denoted Φ. That is,
Z d
1 y2
Φ(d) = √ e− 2 dy
2π −∞
so
(k+1)x (k+1)2
I1 = e 2 +τ 4 Φ(d1 )
where d1 = √x2τ + τ2 (k + 1). Note the use of the symmetry of the integral!
p

The calculation of I2 is identical, except that (k + 1) is replaced by (k − 1)


throughout.
The solution of the transformed heat equation initial value problem is
(k+1)x τ (k+1)2 (k−1)x τ (k−1)2
+ +
u(x, τ ) = e 2 4 Φ(d1 ) − e 2 4 Φ(d2 )
374 CHAPTER 7. THE BLACK-SCHOLES MODEL

where d1 = √x2τ + τ2 (k + 1) and d2 = √x2τ + τ2 (k − 1).


p p

Now we must systematically unwind each of the changes of variables,


(k−1)x (k+1)2 τ
starting from u. First, v(x, τ ) = e− 2 − 4 u(x, τ ). Notice how many
of the exponentials neatly combine and cancel! Next put x = log (S/K),
τ = 12 σ 2 (T − t) and V (S, t) = Kv(x, τ ).
The ultimate result is the Black-Scholes formula for the value of a Eu-
ropean call option at time T with strike price K, if the current time is t
and the underlying security price is S, the risk-free interest rate is r and the
volatility is σ:

log(S/K) + (r + σ 2 /2)(T − t)
 
V (S, t) = SΦ √
σ T −t
log(S/K) + (r − σ 2 /2)(T − t)
 
−r(T −t)
− Ke Φ √ .
σ T −t

Usually one doesn’t see the solution as this full closed form solution. Most
versions of the solution write intermediate steps in small pieces, and then
present the solution as an algorithm putting the pieces together to obtain
the final answer. Specifically, let

log(S/K) + (r + σ 2 /2)(T − t)
d1 = √
σ T −t
log(S/K) + (r − σ 2 /2)(T − t)
d2 = √
σ T −t

and writing VC (S, t) to remind ourselves this is the value of a call option,

VC (S, t) = S · Φ (d1 ) − Ke−r(T −t) · Φ (d2 ) .

Solution of the Black-Scholes Equation Graphically


Consider for purposes of graphical illustration the value of a call option with
strike price K = 100. The risk-free interest rate per year, continuously
compounded is 12%, so r = 0.12, the time to expiration is T = 1 measured
in years, and the standard deviation per year on the return of the stock, or
the volatility is σ = 0.10. The value of the call option at maturity plotted
7.2. SOLUTION OF THE BLACK-SCHOLES EQUATION 375

30

Option Value
20

10

0
70 90 110 130
Share Price

Figure 7.1: Value of the call option at maturity.

40
Option Value

30

20

10

0
70 90 110 130
Share Price

Figure 7.2: Value of the call option at various times.

over a range of stock prices 70 ≤ S ≤ 130 surrounding the strike price is


illustrated in 7.1
We use the Black-Scholes formula above to compute the value of the
option before expiration. With the same parameters as above the value of
the call option is plotted over a range of stock prices 70 ≤ S ≤ 130 at time
remaining to expiration t = 1 (red), t = 0.8, (orange), t = 0.6 (yellow),
t = 0.4 (green), t = 0.2 (blue) and at expiration t = 0 (black).
Using this graph, notice two trends in the option value:
1. For a fixed time, as the stock price increases the option value increases.

2. As the time to expiration decreases, for a fixed stock value the value of
376 CHAPTER 7. THE BLACK-SCHOLES MODEL

Figure 7.3: Value surface from the Black-Scholes formula.

the option decreases to the value at expiration.

We predicted both trends from our intuitive analysis of options, see Options.
The Black-Scholes option pricing formula makes the intuition precise.
We can also plot the solution of the Black-Scholes equation as a function
of security price and the time to expiration as value surface.
This value surface shows both trends.

Sources

This discussion is drawn from Section 4.2, pages 59–63; Section 4.3, pages
66–69; Section 5.3, pages 75–76; and Section 5.4, pages 77–81 of The Math-
ematics of Financial Derivatives: A Student Introduction by P. Wilmott, S.
Howison, J. Dewynne, Cambridge University Press, Cambridge, 1995. Some
ideas are also taken from Chapter 11 of Stochastic Calculus and Financial
Applications by J. Michael Steele, Springer, New York, 2001.
7.2. SOLUTION OF THE BLACK-SCHOLES EQUATION 377

Algorithms, Scripts, Simulations


Algorithm
For given parameter values, the Black-Scholes-Merton solution formula is
sampled at a specified m × 1 array of times and at a specified 1 × n array
of security prices using vectorization and broadcasting. The result can be
plotted as functions of the security price as done in the text. The calculation
is vectorized for an array of S values and an array of t values, but it is
not vectorized for arrays in the parameters K, r, T , and σ. This approach
is taken to illustrate the use of vectorization and broadcasting for efficient
evaluation of an array of solution values from a complicated formula.
In particular, the calculation of d1 and d2 then uses broadcasting, also
called binary singleton expansion, recycling, single-instruction multiple data,
threading or replication.
The calculation relies on using the rules for calcuation and handling of
infinity and NaN (Not a Number) which come from divisions by 0, taking
logarithms of 0, and negative numbers and calculating the normal cdf at
infinity and negative infinity. The plotting routines will not plot a NaN
which accounts for the gap at S = 0 in the graph line for t = 1.

Scripts
Geogebra GeoGebra applet for graphing the Black-Scholes solution
R R script for Black-Scholes solution.
1 m <- 6;
2 n <- 61;
3 S0 <- 70;
4 S1 <- 130;
5 K <- 100;
6 r <- 0.12;
7 T <- 1.0;
8 sigma <- 0.10;
9
10 time <- seq (T ,0 , length = m ) ;
11 S <- seq ( S0 , S1 , length = n ) ;
12
13 numerd1 <- outer ( ( ( r + sigma ^2 / 2) * (T - time ) ) , log ( S / K ) ,
"+");
14 numerd2 <- outer ( ( ( r - sigma ^2 / 2) * (T - time ) ) , log ( S / K ) ,
"+");
378 CHAPTER 7. THE BLACK-SCHOLES MODEL

15
16 d1 <- numerd1 / ( sigma * sqrt (T - time ) ) ;
17 d2 <- numerd2 / ( sigma * sqrt (T - time ) ) ;
18 part1 <- t ( t ( pnorm ( d1 ) ) * S ) ;
19 part2 <- K * exp ( - r * (T - time ) ) * pnorm ( d2 ) ;
20 VC <- part1 - part2 ;
21
22 matplot (S , t ( VC ) , type = " l " ) ;
23

Octave Octave script for Black-Scholes solution.


1 m = 6;
2 n = 61;
3 S0 = 70;
4 S1 = 130;
5 K = 100;
6 r = 0.12;
7 T = 1.0;
8 sigma = 0.10;
9
10 time = transpose ( linspace (T , 0 , m ) ) ;
11 S = linspace ( S0 , S1 , n ) ;
12

13 d1 = ( log ( S / K ) + ( ( r + sigma ^2/2) *( T - time ) ) ) ./( sigma *


sqrt (T - time ) ) ;
14 d2 = ( log ( S / K ) + ( ( r - sigma ^2/2) *( T - time ) ) ) ./( sigma *
sqrt (T - time ) ) ;
15 part1 = bsxfun ( @times , normcdf ( d1 ) , S ) ;
16 part2 = bsxfun ( @times , K * exp ( - r *( T - time ) ) , normcdf ( d2 ) ) ;
17 VC = part1 - part2 ;
18
19 plot (S , VC )
20

Perl Perl PDL script for Black-Scholes solution.


1 sub pnorm {
2 my ( $x , $sigma , $mu ) = @_ ;
3 $sigma = 1 unless defined ( $sigma ) ;
4 $mu = 0 unless defined ( $mu ) ;
7.2. SOLUTION OF THE BLACK-SCHOLES EQUATION 379

5
6 return 0.5 * ( 1 + erf ( ( $x - $mu ) / ( sqrt (2) *
$sigma ) ) ) ;
7 }
8 $m = 6;
9 $n = 61;
10 $S0 = 70;
11 $S1 = 130;
12 $K = 100;
13 $r = 0.12;
14 $T = 1.0;
15 $sigma = 0.10;
16
17 $time = zeroes ( $m ) -> xlinvals ( $T ,0.0) ;
18 $S = zeroes ( $n ) -> xlinvals ( $S0 , $S1 ) ;
19
20 $logSoverK = log ( $S / $K ) ;
21 $n12 = (( $r + $sigma **2/2) *( $T - $time ) ) ;
22 $n22 = (( $r - $sigma **2/2) *( $T - $time ) ) ;
23 $numerd1 = $logSoverK + $n12 - > transpose ;
24 $numerd2 = $logSoverK + $n22 - > transpose ;
25 $d1 = $numerd1 /( ( $sigma * sqrt ( $T - $time ) ) -> transpose ) ;
26 $d2 = $numerd2 /( ( $sigma * sqrt ( $T - $time ) ) -> transpose ) ;
27
28 $part1 = $S * pnorm ( $d1 ) ;
29 $part2 = pnorm ( $d2 ) * ( $K * exp ( - $r *( $T - $time ) ) ) -> transpose
;
30 $VC = $part1 - $part2 ;
31
32 # file output to use with external plotting programming
33 # such as gnuplot , R , octave , etc .
34 # Start gnuplot , then from gnuplot prompt
35 # plot for [ n =2:7] ’ solution . dat ’ using 1:( column ( n ) )
with lines
36
37
38 open ( F , " > solution . dat " ) || die " cannot write : $ ! " ;
39 wcols $S , $VC , * F ;
40 close ( F ) ;
41

SciPy Scientific Python script for Black-Scholes solution.


380 CHAPTER 7. THE BLACK-SCHOLES MODEL

1 import scipy
2

3 m = 6
4 n = 61
5 S0 = 70
6 S1 = 130
7 K = 100
8 r = 0.12
9 T = 1.0
10 sigma = 0.10
11
12 time = scipy . linspace (T , 0.0 , m )
13 S = scipy . linspace ( S0 , S1 , n )
14

15 logSoverK = scipy . log ( S / K )


16 n12 = (( r + sigma **2/2) *( T - time ) )
17 n22 = (( r - sigma **2/2) *( T - time ) )
18 numerd1 = logSoverK [ scipy . newaxis ,:] + n12 [: , scipy .
newaxis ]
19 numerd2 = logSoverK [ scipy . newaxis ,:] + n22 [: , scipy .
newaxis ]
20 d1 = numerd1 /( sigma * scipy . sqrt (T - time ) [: , scipy . newaxis ])
21 d2 = numerd2 /( sigma * scipy . sqrt (T - time ) [: , scipy . newaxis ])
22
23 from scipy . stats import norm
24 part1 = S [ scipy . newaxis ] * norm . cdf ( d1 )
25 part2 = norm . cdf ( d2 ) * K * scipy . exp ( - r *( T - time ) ) [: , scipy .
newaxis ]
26 VC = part1 - part2
27
28 # optional file output to use with external plotting
programming
29 # such as gnuplot , R , octave , etc .
30 # Start gnuplot , then from gnuplot prompt
31 # plot for [ n =2:7] ’ solution . dat ’ using 1:( column ( n ) )
with lines
32
33 scipy . savetxt ( ’ solution . dat ’ ,
34 scipy . column_stack (( scipy . transpose ( S ) , scipy .
transpose ( VC ) ) ) ,
35 fmt =( ’ %4.3 f ’) )
7.2. SOLUTION OF THE BLACK-SCHOLES EQUATION 381

Key Concepts
1. We solve the Black-Scholes equation for the value of a European call
option on a security by judicious changes of variables that reduce the
equation to the heat equation. The heat equation has a solution for-
mula. Using the solution formula with the changes of variables gives
the solution to the Black-Scholes equation.

2. Solving the Black-Scholes equation is an example of how to choose and


execute changes of variables to solve a partial differential equation.

Vocabulary
1. A differential equation with auxiliary initial conditions and boundary
conditions, that is an initial value problem, is said to be well-posed
if the solution exists, is unique, and small changes in the equation
parameters, the initial conditions or the boundary conditions produce
only small changes in the solutions.

Problems to Work for Understanding


1. Explicitly evaluate the integral I2 in terms of the c.d.f. Φ and other
elementary functions as was done for the integral I1 .

2. What is the price of a European call option on a non-dividend-paying


stock when the stock price is $52, the strike price is $50, the risk-
free interest rate is 12% per annum (compounded continuously), the
volatility is 30% per annum, and the time to maturity is 3 months?

3. What is the price of a European call option on a non-dividend paying


stock when the stock price is $30, the exercise price is $29, the risk-free
interest rate is 5%, the volatility is 25% per annum, and the time to
maturity is 4 months?

4. Show that the Black-Scholes formula for the price of a call option tends
to max(S − K, 0) as t → T .

5. For a particular scripting language of your choice, modify the scripts


to create a function within that language that will evaluate the Black-
382 CHAPTER 7. THE BLACK-SCHOLES MODEL

Scholes formula for a call option at a time and security value for given
parameters.
6. For a particular scripting language of your choice, modify the scripts to
create a script within that language that will evaluate the Black-Scholes
formula for a call option at a specified time for given parameters, and
return a function of the security prices that can plotted by calling the
function over an interval of security prices.
7. Plot the price of a European call option on a non-dividend paying stock
over the stock prices $20 to $40, given that the exercise price is $29,
the risk-free interest rate is 5%, the volatility is 25% per annum, and
the time to maturity is 4 months.
8. For a particular scripting language of your choice, modify the scripts
to create a script within that language that will plot the Black-Scholes
solution for VC (S, t) as a surface over the two variables S and t.

Outside Readings and Links:


1. Cornell University, Department of Computer Science, Prof. T. Cole-
man Rhodes and Prof. R. Jarrow Numerical Solution of Black-Scholes
Equation, Submitted by Chun Fan, Nov. 12, 2002.
2. An applet for calculating the option value based on the Black-Scholes
model. Also contains tips on options, business news and literature on
options. Submitted by Yogesh Makkar, November 19, 2003.

7.3 Put-Call Parity


Section Starter Question
What does it mean to say that a differential equation is a linear differential
equation?

Put-Call Parity by Linearity of the Black-Scholes Equation


The Black-Scholes equation is
1
Vt + σ 2 S 2 VSS + rSVS − rV = 0.
2
7.3. PUT-CALL PARITY 383

With the additional terminal condition V (S, T ) given, a solution exists and
is unique. We observe that the Black-Scholes is a linear equation, so the
linear combination of any two solutions is again a solution.
From the problems in the previous section (or by easy verification right
now) we know that S is a solution of the Black-Scholes equation and Ke−r(T −t)
is also a solution, so S − Ke−r(T −t) is a solution. At the expiration time T ,
the solution has value S − K.
Now if C(S, t) is the value of a call option at security value S and time
t < T , then C(S, t) satisfies the Black-Scholes equation, and has terminal
value max(S − K, 0). If P (S, t) is the value of a put option at security value
S and time t < T , then P (S, t) also satisfies the Black-Scholes equation, and
has terminal value max(K − S, 0). Therefore by linearity, C(S, t) − P (S, t) is
a solution and has terminal value C(S, T )−P (S, T ) = S −K. By uniqueness,
the solutions must be the same, and so
C − P = S − Ke−r(T −t) .
This relationship is known as the put-call parity principle between the
price C of a European call option and the price P of a European put option,
each with strike price K and underlying security value S.
This same principle of linearity and the composition of more exotic op-
tions in terms of puts and calls allows us to write closed form formulas for
the values of exotic options such as straps, strangles, and butterfly options.

Put-Call Parity by Reasoning about Arbitrage


Assume that an underlying security satisfies the assumptions of the previous
sections. Assume further that:
• the security price is currently S = 100;
• the strike price is K = 100;
• the expiration time is one year, T = 1;
• the risk-free interest rate is r = 0.12; and
• the volatility is σ = 0.10.
One can then calculate that the price of a call option with these assumptions
is 11.84.
Consider an investor with the following portfolio:
384 CHAPTER 7. THE BLACK-SCHOLES MODEL

• buy one share of stock at price S = 100;

• sell one call option at C = V (100, 0) = 11.84;

• buy one put option at unknown price.


At expiration, the stock price could have many different values, and those
would determine the values of each of the derivatives. See Table 7.1 for some
representative values.
At expiration this portfolio always has a value which is the strike price.
Holding this portfolio will give a risk-free investment that will pay $100 in
any circumstance. This example portfolio has total value 100. Therefore
the value of the whole portfolio must equal the present value of a riskless
investment that will pay off $100 in one year. This is an illustration of the use
of options for hedging an investment, in this case the extremely conservative
purpose of hedging to preserve value.
The parameter values chosen above are not special and we can reason
with general S, C and P with parameters K, r, σ, and T . Consider buying
a put and selling a call, each with the same strike price K. We will find at
expiration T that:
• if the stock price S is below K we will realize a profit of K − S from
the put option that we own; and

• if the stock price is above K, we will realize a loss of S − K from


fulfilling the call option that we sold.
But this payout is exactly what we would get from a futures contract to sell
the stock at price K. The price set by arbitrage of such a futures contract
must be Ke−r(T −t) − S. Specifically, one could sell (short) the stock right
now for S, and lend Ke−r(T −t) dollars right now for a net cash outlay of

Security Call Put Portfolio


80 0 20 100
90 0 10 100
100 0 0 100
110 -10 0 100
120 -20 0 100
Table 7.1: Security, call and put option values at expiration.
7.3. PUT-CALL PARITY 385

Ke−r(T −t) − S, then at time T collect the loan at K dollars and actually
deliver the stock. This replicates the futures contract, so the future must
have the same price as the initial outlay. Therefore we obtain the put-call
parity principle:
−C + P = K exp(−r(T − t)) − S

or more naturally

S − C + P = K exp(−r(T − t)).

Synthetic Portfolios

Another way to view this formula is that it instructs us how to create syn-
thetic portfolio. A synthetic portfolio is a combination of securities, bonds,
and options that has the same payout at expiration as another financial in-
strument. Since
S + P − K exp(−r(T − t)) = C,

a portfolio “long in the underlying security, long in a put, short K exp(−r(T −


t)) in bonds” replicates a call. This same principle of linearity and the
composition of more exotic options in terms of puts and calls allows us to
create synthetic portfolios for exotic options such as straddles, strangles,
and so on. As noted above, we can easily write their values in closed form
solutions.

Explicit Formulas for the Put Option

Knowing any two of S, C or P allows us to calculate the third. Of course,


the immediate use of this formula will be to combine the security price and
the value of the call option from the solution of the Black-Scholes equation
to obtain the value of the put option:

P = C − S + K exp(−r(T − t)).

For the sake of mathematical completeness we can write the value of a


386 CHAPTER 7. THE BLACK-SCHOLES MODEL

European put option explicitly as:

log(S/K) + (r + σ 2 /2)(T − t)
 
VP (S, t) = SΦ √
σ T −t
log(S/K) + (r − σ 2 /2)(T − t)
 
−r(T −t)
− Ke Φ √
σ T −t
− S + K exp(−r(T − t)).

Usually one doesn’t see the solution as this full closed form solution.
Instead, most versions of the solution write intermediate steps in small pieces,
and then present the solution as an algorithm putting the pieces together to
obtain the final answer. Specifically, let

log(S/K) + (r + σ 2 /2)(T − t)
d1 = √
σ T −t
log(S/K) + (r − σ 2 /2)(T − t)
d2 = √
σ T −t
so that

VP (S, t) = S(Φ (d1 ) − 1) − Ke−r(T −t) (Φ (d2 ) − 1).

Using the symmetry properties of the c.d.f. Φ, we obtain

VP (S, t) = Ke−r(T −t) Φ (−d2 ) − SΦ (−d1 ) .

Graphical Views of the Put Option Value


For graphical illustration let P be the value of a put option with strike price
K = 100. The risk-free interest rate per year, continuously compounded is
12%, so r = 0.12, the time to expiration is T = 1 measured in years, and
the standard deviation per year on the return of the stock, or the volatility
is σ = 0.10. The value of the put option at maturity plotted over a range of
stock prices 0 ≤ S ≤ 150 surrounding the strike price is illustrated below:
Now we use the Black-Scholes formula to compute the value of the option
before expiration. With the same parameters as above the value of the put
7.3. PUT-CALL PARITY 387

30
Option Value

20

10

0
70 90 110 130
Share Price

Figure 7.4: Value of the put option at maturity.

30
Option Value

20

10

0
70 90 110 130
Share Price

Figure 7.5: Value of the call option at various times.


388 CHAPTER 7. THE BLACK-SCHOLES MODEL

Figure 7.6: Value surface from the Black-Scholes formula.

option is plotted over a range of stock prices 0 ≤ S ≤ 150 at time remaining


to expiration t = 1 (red), t = 0.8, (orange), t = 0.6 (yellow), t = 0.4 (green),
t = 0.2 (blue) and at expiration t = 0 (black).
Notice two trends in the value from this graph:

1. As the stock price increases, for a fixed time the option value decreases.

2. As the time to expiration decreases, for a fixed stock value price less
than the strike price the value of the option increases to the value at
expiration.

We can also plot the value of the put option as a function of security price
and the time to expiration as a value surface.
This value surface shows both trends.
7.3. PUT-CALL PARITY 389

Sources
This section is adapted from: Financial Derivatives by Robert W. Kolb,
New York Institute of Finance, Englewood Cliffs, NJ, 1993, page 107 and
following. Parts are also adapted from Stochastic Calculus and Financial
Applications by J. Michael Steele, Springer, New York, 2000, page 155.

Algorithms, Scripts, Simulations


Algorithm
For given parameter values for K, r, T , and σ, the Black-Scholes-Merton
solution formula for a put option is sampled at a specified m × 1 array of
times and at a specified 1 × n array of security prices using vectorization and
broadcasting. The result can be plotted as functions of the security price as
done in the text. The calculation is vectorized for an array of S values and
an array of t values, but it is not vectorized for arrays in the parameters K,
r, T , and σ. This approach is taken to illustrate the use of vectorization
and broadcasting for efficient evaluation of an array of solution values from
a complicated formula.
In particular, the calculation of d1 and d2 uses broadcasting, also called bi-
nary singleton expansion, recycling, single-instruction multiple data, thread-
ing or replication.
The calculation relies on using the rules for calculation and handling of
infinity and NaN (Not a Number) which come from divisions by 0, taking
logarithms of 0, and negative numbers and calculating the normal cdf at
infinity and negative infinity. The plotting routines will not plot a NaN
which accounts for the gap at S = 0 in the graph line for t = 1.

Scripts
Geogebra GeoGebra applet for graphing the Black-Scholes pricing formula
for a put option.

R R script for Black-Scholes pricing formula for a put option.


1 m <- 6;
2 n <- 61;
3 S0 <- 70;
4 S1 <- 130;
5 K <- 100;
390 CHAPTER 7. THE BLACK-SCHOLES MODEL

6 r <- 0.12;
7 T <- 1.0;
8 sigma <- 0.10;
9
10 time <- seq (T ,0 , length = m ) ;
11 S <- seq ( S0 , S1 , length = n ) ;
12
13 numerd1 <- outer ( ( ( r + sigma ^2 / 2) * (T - time ) ) , log ( S / K ) ,
"+");
14 numerd2 <- outer ( ( ( r - sigma ^2 / 2) * (T - time ) ) , log ( S / K ) ,
"+");
15
16 d1 <- numerd1 / ( sigma * sqrt (T - time ) ) ;
17 d2 <- numerd2 / ( sigma * sqrt (T - time ) ) ;
18 part1 <- K * exp ( - r * (T - time ) ) * pnorm ( - d2 ) ;
19 part2 <- t ( t ( pnorm ( - d1 ) ) * S ) ;
20 VC <- part1 - part2 ;
21
22 matplot (S , t ( VC ) , type = " l " ) ;
23

Octave Octave script for Black-Scholes pricing formula for a put option.
1 m = 6;
2 n = 61;
3 S0 = 70;
4 S1 = 130;
5 K = 100;
6 r = 0.12;
7 T = 1.0;
8 sigma = 0.10;
9
10 time = transpose ( linspace (T , 0 , m ) ) ;
11 S = linspace ( S0 , S1 , n ) ;
12
13 d1 = ( log ( S / K ) + ( ( r + sigma ^2/2) *( T - time ) ) ) ./( sigma *
sqrt (T - time ) ) ;
14 d2 = ( log ( S / K ) + ( ( r - sigma ^2/2) *( T - time ) ) ) ./( sigma *
sqrt (T - time ) ) ;
15 part1 = bsxfun ( @times , K * exp ( - r *( T - time ) ) , normcdf ( - d2 ) )
;
16 part2 = bsxfun ( @times , normcdf ( - d1 ) , S ) ;
17 VC = part1 - part2 ;
18
7.3. PUT-CALL PARITY 391

19 plot (S , VC )
20

Perl Perl PDL script for Black-Scholes pricing formula for a put option.
1 use PDL :: NiceSlice ;
2
3 sub pnorm {
4 my ( $x , $sigma , $mu ) = @_ ;
5 $sigma = 1 unless defined ( $sigma ) ;
6 $mu = 0 unless defined ( $mu ) ;
7
8 return 0.5 * ( 1 + erf ( ( $x - $mu ) / ( sqrt (2) *
$sigma ) ) ) ;
9 }
10 $m = 6;
11 $n = 61;
12 $S0 = 70;
13 $S1 = 130;
14 $K = 100;
15 $r = 0.12;
16 $T = 1.0;
17 $sigma = 0.10;
18
19 $time = zeroes ( $m ) -> xlinvals ( $T ,0.0) ;
20 $S = zeroes ( $n ) -> xlinvals ( $S0 , $S1 ) ;
21
22 $logSoverK = log ( $S / $K ) ;
23 $n12 = (( $r + $sigma **2/2) *( $T - $time ) ) ;
24 $n22 = (( $r - $sigma **2/2) *( $T - $time ) ) ;
25 $numerd1 = $logSoverK + $n12 - > transpose ;
26 $numerd2 = $logSoverK + $n22 - > transpose ;
27 $d1 = $numerd1 /( ( $sigma * sqrt ( $T - $time ) ) -> transpose ) ;
28 $d2 = $numerd2 /( ( $sigma * sqrt ( $T - $time ) ) -> transpose ) ;
29

30 $part1 = pnorm ( - $d2 ) * ( $K * exp ( - $r *( $T - $time ) ) ) ->


transpose ;
31 $part2 = $S * pnorm ( - $d1 ) ;
32 $VC = $part1 - $part2 ;
33
34 # file output to use with external plotting programming
35 # such as gnuplot , R , octave , etc .
36 # Start gnuplot , then from gnuplot prompt
392 CHAPTER 7. THE BLACK-SCHOLES MODEL

37 # plot for [ n =2:7] ’ putcallparity . dat ’ using 1:( column


( n ) ) with lines
38
39
40 open ( F , " > putcallparity . dat " ) || die " cannot write : $ !
";
41 wcols $S , $VC , * F ;
42 close ( F ) ;
43

SciPy Scientific Python script for Black-Scholes pricing formula for a put
option.
1 import scipy
2
3 m = 6
4 n = 61
5 S0 = 70
6 S1 = 130
7 K = 100
8 r = 0.12
9 T = 1.0
10 sigma = 0.10
11
12 time = scipy . linspace (T , 0.0 , m )
13 S = scipy . linspace ( S0 , S1 , n )
14
15 logSoverK = scipy . log ( S / K )
16 n12 = (( r + sigma **2/2) *( T - time ) )
17 n22 = (( r - sigma **2/2) *( T - time ) )
18 numerd1 = logSoverK [ scipy . newaxis ,:] + n12 [: , scipy .
newaxis ]
19 numerd2 = logSoverK [ scipy . newaxis ,:] + n22 [: , scipy .
newaxis ]
20 d1 = numerd1 /( sigma * scipy . sqrt (T - time ) [: , scipy . newaxis ])
21 d2 = numerd2 /( sigma * scipy . sqrt (T - time ) [: , scipy . newaxis ])
22
23 from scipy . stats import norm
24 part1 = norm . cdf ( - d2 ) * K * scipy . exp ( - r *( T - time ) ) [: , scipy .
newaxis ]
25 part2 = S [ scipy . newaxis ] * norm . cdf ( - d1 )
26 VC = part1 - part2
27
7.3. PUT-CALL PARITY 393

28 # optional file output to use with external plotting


programming
29 # such as gnuplot , R , octave , etc .
30 # Start gnuplot , then from gnuplot prompt
31 # plot for [ n =2:7] ’ putcallparity . dat ’ using 1:( column
( n ) ) with lines
32
33 scipy . savetxt ( ’ putcallparity . dat ’ ,
34 scipy . column_stack (( scipy . transpose ( S ) , scipy .
transpose ( VC ) ) ) ,
35 fmt =( ’ %4.3 f ’) )

Key Concepts
1. The put-call parity principle links the price of a put option, a call option
and the underlying security price.

2. The put-call parity principle can be used to price European put options
without having to solve the Black-Scholes equation.

3. The put-call parity principle is a consequence of the linearity of the


Black-Scholes equation.

Vocabulary
1. The put-call parity principle is the relationship

C − P = S − Ke−r(T −t)

between the price C of a European call option and the price P of a


European put option, each with strike price K and underlying security
value S.

2. A synthetic portfolio is a combination of securities, bonds, and op-


tions that has the same payout at expiration as another financial in-
strument.
394 CHAPTER 7. THE BLACK-SCHOLES MODEL

Problems to Work for Understanding


1. Calculate the price of a 3-month European put option on a non-dividend-
paying stock with a strike price of $50 when the current stock price is
$50, the risk-free interest rate is 10% per year (compounded continu-
ously) and the volatility is 30% per year.

2. What is the price of a European put option on a non-dividend paying


stock when the stock price is $69, the strike price is $70, the risk-free
interest rate is 5% per year (compounded continuously), the volatility
is 35% per year, and the time to maturity is 6 months?

3. Show that the Black-Scholes formula for the price of a put option tends
to max(K − S, 0) as t → T .

4. For a particular scripting language of your choice, modify the scripts


to create a function within that language that will evaluate the Black-
Scholes formula for a put option at a time and security value for given
parameters.

5. For a particular scripting language of your choice, modify the scripts to


create a script within that language that will evaluate the Black-Scholes
formula for a put option at a specified time for given parameters, and
return a function of the security prices that can plotted by calling the
function over an interval of security prices.

6. Plot the price of a European put option on a non-dividend paying stock


over the stock prices $20 to $40, given that the exercise price is $29,
the risk-free interest rate is 5%, the volatility is 25% per annum, and
the time to maturity is 4 months.

7. For a particular scripting language of your choice, modify the scripts


to create a script within that language that will plot the Black-Scholes
solution for VP (S, t) as a surface over the two variables S and t.

Outside Readings and Links:


1. Video with explanation of put-call parity.
7.4. IMPLIED VOLATILITY 395

2. Option Research and Technology Services Provides important option


trading terms and jargon, here is the link to definition of “Put-Call
Parity”.

7.4 Implied Volatility


Section Starter Question
What are some methods you could use to find the solution of f (x) = c for x
where f is a function that is so complicated that you cannot use elementary
functions and algebraic operations to isolate x ?

Historical volatility
Estimates of historical volatility of security prices use statistical estima-
tors, usually one of the estimators of variance. A main problem for historical
volatility is to select the sample size, or window of observations, used to es-
timate σ 2 . Different time-windows usually give different volatility estimates.
Furthermore, for some customized “over the counter” derivatives the neces-
sary price data may not exist.
Another problem with historical volatility is that it assumes future mar-
ket performance is the same as past market data. Although this is a natural
scientific assumption, it does not take into account historical anomalies such
as the October 1987 stock market drop that may be unusual. That is, com-
puting historical volatility has the usual statistical difficulty of how to handle
outliers. The assumption that future market performance is the same as past
performance also does not take into account underlying changes in the market
such as new economic conditions.
To estimate the volatility of a security price empirically observe the secu-
rity price at regular intervals, such as every day, every week, or every month.
Define:

• the number of observations n + 1;

• the security price at the end of the ith interval Si , i = 0, 1, 2, 3, . . . , n;

• the length of each of the time intervals (say in years) item τ ; and
396 CHAPTER 7. THE BLACK-SCHOLES MODEL

• the increment of the logarithms of the security prices


 
Si
ui = ln(Si ) − ln(Si−1 ) = ln
Si−1
for i = 1, 2, 3, . . ..
We are modeling the security price as a Geometric Brownian Motion, so that
ln(Si ) − ln(Si−1 ) ∼ N (rτ, σ 2 τ ).
Inverting ui = ln(Si /Si−1 ) to obtain Si = Si−1 eui , we see that ui is the
continuously compounded return (not annualized) in the ith interval. Then
the usual estimate s of the standard deviation of the ui s is
v
u n
u 1 X
s=t (ui − ū)2
n − 1 i=1

where ū is the mean of the ui ’s. Sometimes it is more convenient to use the
equivalent formula
v !2
n n
u
u 1 X 1 X
s=t u2 − ui .
n − 1 i=1 i n(n − 1) i=1

We assume the security price varies as a Geometric Brownian Motion.


That means that the logarithm of the security price is a Wiener process with
some drift and on the√period of time τ , would have a variance σ 2 τ . Therefore,
s is an estimate of σ τ . It follows that σ can be estimated as
s
σ≈√ .
τ
Choosing an appropriate value for n is not obvious. Remember the vari-
ance expression for Geometric Brownian Motion is an increasing function of
time. If we model security prices with Geometric Brownian Motion, then
σ does change over time, and data that are too old may not be relevant
for the present or the future. A compromise that seems to work reasonably
well is to use closing prices from daily data over the most recent 90 to 180
days. Empirical research indicates that only trading days should be used, so
days when the exchange is closed should be ignored for the purposes of the
volatility calculation [27, page 215].
Economists and financial analysts often estimate historical volatility with
more sophisticated statistical time series methods.
7.4. IMPLIED VOLATILITY 397

VC 3 VC

2 C

0
0 0.4
σ

Figure 7.7: Schematic diagram of using Newton’s Method to solve for implied
volatility. The current call option value is plotted in blue. The value of the
call option as a function of σ is plotted in black. The tangent line is plotted
in red

Implied Volatility
The implied volatility is the parameter σ in the Black-Scholes formula
that would give the option price that is observed in the market, all other
parameters being known.
The Black-Scholes formula is too complicated to “invert” to explicitly
express σ as a function of the other parameters. Therefore, we use numerical
techniques to implicitly solve for σ. A simple idea is to use the method of
bisection search to find σ.
Example. Suppose the value C of a call on a non-dividend-paying security is
1.85 when S = 21, K = 20, r = 0.10, and T − t = 0.25 and σ is unknown.
We start by arbitrarily guessing σ = 0.20. The Black-Scholes formula gives
C = 1.7647, which is too low. Since C is a increasing function of σ, this
suggests we try a value of σ = 0.30. This gives C = 2.1010, too high, so
we bisect the interval [0.20, 0.30] and try σ = 0.25. This value of σ gives
a value of C = 1.9268, still too high. Bisect the interval [0.20, 0.25] and
try a value of σ = 0.225, which yields C = 1.8438, slightly too low. Try
σ = 0.2375, giving C = 1.8849. Finally try σ = 0.23125 giving C = 1.8642.
To 2 significant digits, the significance of the data, σ = 0.23, with a predicted
value of C = 1.86.
Another procedure is to use Newton’s method which is also iterative.
398 CHAPTER 7. THE BLACK-SCHOLES MODEL

Essentially we are trying to solve

f (σ, S, K, r, T − t) − C = 0,

so from an initial guess σ0 , we form the Newton iterates

σi+1 = σi − f (σi )/(df (σi )/dσ).

See Figure 7.7. Using Newton’s method means one has to differentiate the
Black-Scholes formula with respect to σ. This derivative is one of the “greeks”
known as vega which we will look at more extensively in the next section. A
formula for vega for a European call option is

df √
= S T − tΦ0 (d1 ) exp(−r(T − t)).

A natural way to do the iteration is with a computer program rather than
by hand.
Implied volatility is a “forward-looking” estimation technique, in contrast
to the “backward-looking” historical volatility. That is, it incorporates the
market’s expectations about the prices of securities and their derivatives, or
more concisely, market expectations about risk. More sophisticated com-
binations and weighted averages combining estimates from several different
derivative claims can be developed.

Sources
This section is adapted from: Quantitative modeling of Derivative Securities
by Marco Avellaneda, and Peter Laurence, Chapman and Hall, Boca Raton,
2000, page 66; and Options, Futures, and other Derivative Securities second
edition, by John C. Hull, Prentice Hall, 1993, pages 229–230.

Algorithms, Scripts, Simulations


Algorithm
First define the function f = VC − C as a function of σ and parameters S, K,
r, T − t, and C. Next define the derivative of f with respect to σ. For given
numerical values for σ0 , the guess for the volatility; S, the current security
price; K, the strike price; r, the risk-free interest rate; T − t, the time to
7.4. IMPLIED VOLATILITY 399

expiration; and C, the current call option price, the script uses Newton’s
method to find the implied volatility with error tolerance . The implied
volatility is the value of σ which makes f ≈ 0 to within . The Newton’s
method iteration uses a “repeat–until” loop construction which means that
at least one iteration of the loop is computed.

Scripts
Geogebra GeoGebra applet to illustrate implied volatility
R R script for implied volatility.
1

2 f <- function ( sigma , S , K , r , Tminust , C ) {


3 d1 <- ( log ( S / K ) + ( ( r + sigma ^2 / 2) * ( Tminust ) ) ) / ( sigma *
sqrt ( Tminust ) ) ;
4 d2 <- ( log ( S / K ) + ( ( r - sigma ^2 / 2) * ( Tminust ) ) ) / ( sigma *
sqrt ( Tminust ) ) ;
5 part1 <- pnorm ( d1 ) * S ;
6 part2 <- K * exp ( - r * ( Tminust ) ) * pnorm ( d2 ) ;
7 VC <- part1 - part2 ;
8 f <- VC - C ;
9 f
10 }
11

12 fprime <- function ( sigma , S , K , r , Tminust , C ) {


13 d1 <- ( log ( S / K ) + ( ( r + sigma ^2 / 2) * ( Tminust ) ) ) / ( sigma *
sqrt ( Tminust ) ) ;
14 fprime <- S * sqrt ( Tminust ) * dnorm ( d1 ) * exp ( - r * Tminust ) ;
15 fprime
16 }
17
18 S <- 21;
19 K <- 20;
20 Tminust <- 0.25;
21 r <- 0.10;
22 C <- 1.85;
23
24 sigmaNew <- 0.20;
25 epsilon <- 10^( -5) ;
26
27 repeat {
28 sigmaOld <- sigmaNew ;
29 sigmaNew <- sigmaOld - f ( sigmaOld , S , K , r , Tminust , C )
/ fprime ( sigmaOld , S , K , r , Tminust ) ;
400 CHAPTER 7. THE BLACK-SCHOLES MODEL

30 if ( abs ( sigmaNew - sigmaOld ) < epsilon ) {


31 break ;
32 }
33 }
34
35 cat ( sprintf ( " % f \ n " , sigmaNew ) ) ;

Octave Octave script for implied volatility.


1 # Prevent Octave from thinking that this
2 # is a function file :
3
4 1;
5
6 function retval = f ( sigma , S , K , r , Tminust , C )
7 d1 = ( log ( S / K ) + ( ( r + sigma .^2/2) *( Tminust ) ) ) ./( sigma
* sqrt ( Tminust ) ) ;
8 d2 = ( log ( S / K ) + ( ( r - sigma .^2/2) *( Tminust ) ) ) ./( sigma
* sqrt ( Tminust ) ) ;
9 part1 = normcdf ( d1 ) * S ;
10 part2 = K * exp ( - r *( Tminust ) ) * normcdf ( d2 ) ;
11 VC = part1 - part2 ;
12 retval = VC - C ;
13 endfunction
14
15 function retval = fprime ( sigma , S , K , r , Tminust , C )
16 d1 = ( log ( S / K ) + ( ( r + sigma ^2/2) *( Tminust ) ) ) ./( sigma *
sqrt ( Tminust ) ) ;
17 retval = S * sqrt ( Tminust ) * normpdf ( d1 ) * exp ( - r * Tminust ) ;
18 endfunction
19
20 S = 21;
21 K = 20;
22 Tminust = 0.25;
23 r = 0.10;
24 C = 1.85;
25
26
27 sigmaNew = 0.20;
28 epsilon = 10^( -5) ;
29

30 do
31 sigmaOld = sigmaNew ;
7.4. IMPLIED VOLATILITY 401

32 sigmaNew = sigmaOld - f ( sigmaOld , S , K , r , Tminust , C ) /


fprime ( sigmaOld , S , K , r , Tminust ) ;
33 until ( abs ( sigmaNew - sigmaOld ) < epsilon )
34
35 sigmaNew

Perl Perl PDL script for implied volatility.


1
2 use PDL :: NiceSlice ;
3 use PDL :: Constants qw ( PI ) ;
4

5 sub pnorm {
6 my ( $x , $sigma , $mu ) = @_ ;
7 $sigma = 1 unless defined ( $sigma ) ;
8 $mu = 0 unless defined ( $mu ) ;
9
10 return 0.5 * ( 1 + erf ( ( $x - $mu ) / ( sqrt (2) *
$sigma ) ) ) ;
11 }
12
13 sub dnorm {
14 my ( $x ) = @_ ;
15 return (1/ sqrt (2* PI ) ) * exp ( - $x **2/2) ;
16 }
17
18 sub f {
19 my ( $sigma , $S , $K , $r , $Tminust , $C ) = @_ ;
20 $d1 = ( log ( $S / $K ) + ( ( $r + $sigma **2/2) *( $Tminust ) ) ) /(
$sigma * sqrt ( $Tminust ) ) ;
21 $d2 = ( log ( $S / $K ) + ( ( $r - $sigma **2/2) *( $Tminust ) ) ) /(
$sigma * sqrt ( $Tminust ) ) ;
22 $part1 = pnorm ( $d1 ) * $S ;
23 $part2 = $K * exp ( - $r *( $Tminust ) ) * pnorm ( $d2 ) ;
24 $VC = $part1 - $part2 ;
25

26 return $VC - $C ;
27 }
28
29 sub fprime {
30 my ( $sigma , $S , $K , $r , $Tminust , $C ) = @_ ;
31 $d1 = ( log ( $S / $K ) + ( ( $r + $sigma **2/2) *( $Tminust ) ) )
/( $sigma * sqrt ( $Tminust ) ) ;
32
402 CHAPTER 7. THE BLACK-SCHOLES MODEL

33 return $S * sqrt ( $Tminust ) * dnorm ( $d1 ) * exp ( - $r * $Tminust )


;
34 }
35
36 $S = 21;
37 $K = 20;
38 $Tminust = 0.25;
39 $r = 0.10;
40 $C = 1.85;
41
42 $sigmaNew = 0.10;
43 $epsilon = 10**( -5) ;
44
45 do {
46 $sigmaOld = $sigmaNew ;
47 $sigmaNew = $sigmaOld - f ( $sigmaOld , $S , $K , $r ,
$Tminust , $C ) / fprime ( $sigmaOld , $S , $K , $r , $Tminust ) ;
48 } until ( abs ( $sigmaNew - $sigmaOld ) < $epsilon ) ;
49
50 print $sigmaNew , " \ n " ;

SciPy Scientific Python script for implied volatility.


1

2 import scipy
3
4 from scipy . stats import norm
5
6 def f ( sigma , S , K , r , Tminust , C ) :
7

8 logSoverK = scipy . log ( S / K )


9 n12 = (( r + sigma **2/2) * Tminust )
10 n22 = (( r - sigma **2/2) * Tminust )
11 numerd1 = logSoverK + n12
12 numerd2 = logSoverK + n22
13 d1 = numerd1 /( sigma * scipy . sqrt ( Tminust ) )
14 d2 = numerd2 /( sigma * scipy . sqrt ( Tminust ) )
15 part1 = norm . cdf ( d1 ) * S
16 part2 = K * scipy . exp ( - r *( Tminust ) ) * norm . cdf ( d2 )
17 VC = part1 - part2
18 return VC - C
19

20 def fprime ( sigma , S , K , r , Tminust , C ) :


21
7.4. IMPLIED VOLATILITY 403

22 logSoverK = scipy . log ( S / K )


23 n12 = (( r + sigma **2/2) * Tminust )
24 numerd1 = logSoverK + n12
25 d1 = numerd1 /( sigma * scipy . sqrt ( Tminust ) )
26 return S * scipy . sqrt ( Tminust ) * norm . pdf ( d1 ) * scipy . exp ( -
r * Tminust )
27
28 S = 21.
29 K = 20.
30 Tminust = 0.25
31 r = 0.10
32 C = 1.85
33
34 sigmaNew = 0.20
35 epsilon = 10.**( -5)
36
37 while ( True ) :
38 sigmaOld = sigmaNew
39 sigmaNew = sigmaOld - f ( sigmaOld , S , K , r , Tminust , C
) / fprime ( sigmaOld , S , K , r , Tminust , C )
40 if ( scipy . absolute ( sigmaNew - sigmaOld ) < epsilon
):
41 break
42
43 print sigmaNew

Key Concepts
1. We estimate historical volatility by applying the standard deviation
estimator from statistics to the observations ln(Si /Si−1 ).

2. We deduce implied volatility by numerically solving the Black-Scholes


formula for σ.

Vocabulary
1. Historical volatility of a security is the variance of the changes in
the logarithm of the price of the underlying asset, obtained from past
data.
404 CHAPTER 7. THE BLACK-SCHOLES MODEL

2. Implied volatility of a security is the numerical value of the volatility


parameter that makes the market price of an option equal to the value
from the Black-Scholes formula.

Problems to Work for Understanding


1. Suppose that the observations on a security price (in dollars) at the end
of each of 15 consecutive weeks are as follows: 30.25, 32, 31.125, 30.25,
30.375, 30.625, 33, 32.875, 33, 33.5, 33.5 33.75, 33.5, 33.25. Estimate
the security price volatility.

2. Pick a publicly traded security, obtain a record of the last 90 days


of that security’s prices, and compute the historical volatility of the
security.

3. A call option on a non-dividend paying security has a market price of


$2.50. The security price is $15, the exercise price is $13, the time to
maturity is 3 months, and the risk-free interest rate is 5% per year.
Using repeated bisection, what is the implied volatility?

4. For a particular scripting language of your choice, create a script within


that language that will compute implied volatility by repeated bisec-
tion.

5. A call option on a non-dividend paying security has a market price of


$2.50. The security price is $15, the exercise price is $13, the time to
maturity is 3 months, and the risk-free interest rate is 5% per year.
Using Newton’s method, what is the implied volatility?

6. Sources of financial data on options typically provide information on


the current security price on a quote date, a variety of strike prices, the
current quote date and the expiration date, the option price and the
implied volatility. (Some even provide additional data on the values of
the greeks.) However, the risk-free interest rate is not provided. For
a particular scripting language of your choice, create a script within
that language that will compute the risk-free interest rate by repeated
bisection. Compare that computed rate to historical interest rate on
U.S. Treasury bonds. For example, on October 1, 2010, a call option
on Google stock valued at $525.62 with a strike price of $620 on the
7.5. SENSITIVITY, HEDGING AND THE “GREEKS” 405

expiration date of January 22, 2011 had a price of $4.75 and an implied
volatility of 0.2529. What was the risk-free interest rate on that date?
What was the interest rate on U.S. Treasury bonds on that date?

Outside Readings and Links:


1. Peter Hoadley, Options Strategy Analysis Tools has a Historic Volatility
Calculator that calculates and graphs historic volatility using historical
price data retrieved from Yahoo.com. Submitted by Bashar Al-Salim,
Dec. 2, 2003.

2. Analysis of asset allocation A calculator to compute implied volatility


using Black and Scholes. Submitted by Bashar Al-Salim, Dec. 2, 2003.

3. MindXpansion,a Tool for Option Traders This option calculator pack-


ages an enormous amount of functionality onto one screen, calculating
implied volatility or historical volatility with Midas Touch. Submitted
by Chun Fan, Dec. 3, 2003.

7.5 Sensitivity, Hedging and the “Greeks”


Section Starter Question
Recall when we first considered options, see Options.

1. What did we intuitively predict would happen to the value of a call


option if the underlying security value increased?

2. What did we intuitively predict would happen to the value of a call


option as the time increased to the expiration date?

3. What did we intuitively predict would happen to the value of a call


option if the volatility of the underlying security value increased?
406 CHAPTER 7. THE BLACK-SCHOLES MODEL

1
0.8
0.6

Delta
0.4
0.2
0
70 90 110 130
Share Price

Figure 7.8: Value of the call option at various times.

Sensitivity of the Black-Scholes Formula

To start the examination of each of the sensitivities, restate the Black-Scholes


formula for the value of a European call option:

log(S/K) + (r + σ 2 /2)(T − t)
d1 = √
σ T −t
log(S/K) + (r − σ 2 /2)(T − t)
d2 = √
σ T −t

and then

VC (S, t) = SΦ (d1 ) − Ke−r(T −t) Φ (d2 ) .


Note that d2 = d1 − σ T − t.
7.5. SENSITIVITY, HEDGING AND THE “GREEKS” 407

Delta
The Delta of a European call option is the rate of change of its value with
respect to the underlying security price:
∂VC
∆=
∂S
∂d1
= Φ(d1 ) + SΦ0 (d1 )
∂S
∂d2
− K exp(−r(T − t))Φ0 (d2 )
∂S
1 1
= Φ(d1 ) + S √ exp(−d21 /2) √
2π Sσ T − t
1 1
− K exp(−r(T − t)) √ exp(−d22 /2) √
2π Sσ T − t
1 1
= Φ(d1 ) + S √ exp(−d21 /2) √
2π Sσ T − t

  2 
1 1
− K exp(−r(T − t)) √ exp − d1 − σ T − t /2 √
2π Sσ T − t
2
exp(−d1 /2)
= Φ(d1 ) + √ √ ×
2πσ T − t

K exp(−r(T − t))  √ 
2
1− exp d1 σ T − t − σ (T − t)/2
S
exp(−d21 /2)
= Φ(d1 ) + √ √ ×
2πσ T − t
K exp(−r(T − t))
 
2 2

1− exp log(S/K) + (r + σ /2)(T − t) − σ (T − t)/2
S
exp(−d21 /2)
= Φ(d1 ) + √ √ ×
2πσ T − t
K exp(−r(T − t))
 
1− exp (log(S/K) + r(T − t))
S
= Φ(d1 )
Figure 7.9 is a graph of Delta as a function of S for several values of t.
Note that since 0 < Φ(d1 ) < 1 (for all reasonable values of d1 ), ∆ > 0, and
so the value of a European call option is always increasing as the underlying
security value increases. This is precisely as we intuitively predicted when
408 CHAPTER 7. THE BLACK-SCHOLES MODEL

1
0.8
0.6

Delta
0.4
0.2
0
70 90 110 130
Share Price

Figure 7.9: Delta of the call option at various times.

we first considered options, see Options. The increase in security value in S


is visible in Figure 7.8.

Delta Hedging
Notice that for any sufficiently differentiable function F (S)
dF
F (S1 ) − F (S2 ) ≈ · (S1 − S2 ).
dS
Therefore, for the Black-Scholes formula for a European call option, using
our current notation ∆ = ∂V /∂S,

V (S1 ) − V (S2 ) ≈ ∆ · (S1 − S2 ).

Equivalently for small changes in security price from S1 to S2 ,

V (S1 ) − ∆ · S1 ≈ V (S2 ) − ∆ · S2 .

In financial language, we express this relationship as:


“Being long 1 derivative and short ∆ units of the underlying
asset is approximately market neutral for small changes in the
asset value.”
We say that the sensitivity of the financial derivative value with respect
to the asset value, denoted ∆, gives the hedge-ratio. The hedge-ratio is
7.5. SENSITIVITY, HEDGING AND THE “GREEKS” 409

the number of short units of the underlying asset which combined with a call
option will offset immediate market risk. After a change in the asset value,
∆(S) will also change, and so we will need to dynamically adjust the hedge-
ratio to keep pace with the changing asset value. Thus ∆(S) as a function
of S provides a dynamic strategy for hedging against risk.
We have seen this strategy before. In the derivation of Black-Scholes
equation, we required that the amount of security in our portfolio, namely
φ(t), be chosen so that φ(t) = VS . (See Derivation of the Black-Scholes
Equation) The choice φ(t) = VS gave us a risk-free portfolio that must change
in the same way as a risk-free asset.

Gamma: The convexity factor


The Gamma (Γ) of a derivative is the sensitivity of ∆ with respect to S:

∂ 2V
Γ= .
∂S 2

The concept of Gamma is important when the hedged portfolio cannot


be adjusted continuously in time according to ∆(S(t)). If Gamma is small
then Delta changes very little with S. This means the portfolio requires only
infrequent adjustments in the hedge-ratio. However, if Gamma is large, then
the hedge-ratio Delta is sensitive to changes in the price of the underlying
security.
According to the Black-Scholes formula,

1
Γ= √ √ exp(−d21 /2)
S 2πσ T − t

Notice that Γ > 0, so the call option value is always concave-up with respect
to S. See this in Figure 7.8.

Theta: The time decay factor


The Theta (Θ) of a European claim with value function V (S, t) is

∂V
Θ= .
∂t
410 CHAPTER 7. THE BLACK-SCHOLES MODEL

Note that this definition is the rate of change with respect to the real (or
calendar) time, some other authors define the rate of change with respect to
the time-to-expiration T − t, so be careful when reading.
The Theta of a claim is sometimes refereed to as the time decay of the
claim. For a European call option on a non-dividend-paying stock,
S·σ exp(−d21 /2)
Θ=− √ · √ − rK exp(−r(T − t))Φ(d2 ).
2 T −t 2π
Note that Θ for a European call option is negative, so the value of a European
call option is decreasing as a function of time, confirming what we intuitively
deduced before. See this in Figure 7.8.
Theta does not act like a hedging parameter as do Delta and Gamma.
Although there is uncertainty about the future stock price, there is no un-
certainty about the passage of time. It does not make sense to hedge against
the passage of time on an option.
Note that the Black-Scholes partial differential equation can now be writ-
ten as
1
Θ + rS∆ + σ 2 S 2 Γ = rV.
2
2
Given the parameters r, and σ , and any 4 of Θ, ∆, Γ, S and V the remaining
quantity is implicitly determined.

Rho: The interest rate factor


The rho (ρ) of a derivative security is the rate of change of the value of
the derivative security with respect to the interest rate. It measures the
sensitivity of the value of the derivative security to interest rates. For a
European call option on a non-dividend paying stock,

ρ = K(T − t) exp(−r(T − t))Φ(d2 )

so ρ is always positive. An increase in the risk-free interest rate means a


corresponding increase in the derivative value.

Vega: The volatility factor


The Vega (Λ) of a derivative security is the rate of change of value of the
derivative with respect to the volatility of the underlying asset. (Some au-
thors denote Vega by variously λ, κ, and σ; referring to Vega by the corre-
7.5. SENSITIVITY, HEDGING AND THE “GREEKS” 411

sponding Greek letter name.) For a European call option on a non-dividend-


paying stock,
√ exp(−d21 /2)
Λ=S T −t √

so the Vega is always positive. An increase in the volatility will lead to
a corresponding increase in the call option value. These formulas implicitly
assume that the price of an option with variable volatility (which we have not
derived, we explicitly assumed volatility was a constant!) is the same as the
price of an option with constant volatility. To a reasonable approximation
this seems to be the case, for more details and references, see [27, page 316].

Hedging in Practice
It would be wrong to give the impression that traders continuously balance
their portfolios to maintain Delta neutrality, Gamma neutrality, Vega neu-
trality, and so on as would be suggested by the continuous mathematical
formulas presented above. In practice, transaction costs make frequent bal-
ancing expensive. Rather than trying to eliminate all risks, an option trader
usually concentrates on assessing risks and deciding whether they are accept-
able. Traders tend to use Delta, Gamma, and Vega measures to quantify the
different aspects of risk in their portfolios.

Sources
The material in this section is adapted from ‘Quantitative modeling of Deriva-
tive Securities by Marco Avellaneda, and Peter Laurence, Chapman and Hall,
Boca Raton, 2000, pages 44–56,; and Options, Futures, and other Derivative
Securities second edition, by John C. Hull, Prentice Hall, 1993, pages 298–
318.

Algorithms, Scripts, Simulations


Algorithm
For given parameter values, the Black-Scholes-Merton call option “greeks”
Delta and Gamma are sampled at a specified m × 1 array of times and at a
specified 1 × n array of security prices using vectorization and broadcasting.
The result can be plotted as functions of the security price as done in the text.
412 CHAPTER 7. THE BLACK-SCHOLES MODEL

The calculation is vectorized for an array of S values and an array of t values,


but it is not vectorized for arrays in the parameters K, r, T , and σ. This
approach is taken to illustrate the use of vectorization and broadcasting for
efficient evaluation of an array of solution values from a complicated formula.
In particular, the calculation of d1 uses broadcasting, also called binary
singleton expansion, recycling, single-instruction multiple data, threading, or
replication.
The calculation relies on using the rules for calculation and handling of
infinity and NaN (Not a Number) which come from divisions by 0, taking
logarithms of 0, and negative numbers and calculating the normal cdf at
infinity and negative infinity. The plotting routines will not plot a NaN
which accounts for the gaps or omissions.
The scripts plot Delta and Gamma as functions of S for the specified
m × 1 array of times in two side-by-side subplots in a single plotting frame.

Scripts
Geogebra GeoGebra applet

R R script for Black-Scholes call option greeks Delta and Gamma.


1 m <- 6
2 n <- 61
3 S0 <- 70
4 S1 <- 130
5 K <- 100
6 r <- 0.12
7 T <- 1
8 sigma <- 0.1
9
10 time <- seq (T , 0 , length = m )
11 S <- seq ( S0 , S1 , length = n )
12
13 numerd1 <- outer ((( r + sigma ^2 / 2) * ( T - time ) ) , log ( S / K )
, "+")
14 d1 <- numerd1 / ( sigma * sqrt ( T - time ) )
15 Delta <- pnorm ( d1 )
16
17 factor1 <- 1 / ( sqrt (2 * pi ) * sigma * outer ( sqrt ( T - time )
, S, "*"))
18 factor2 <- exp ( - d1 ^2 / 2)
19 Gamma <- factor1 * factor2
20
7.5. SENSITIVITY, HEDGING AND THE “GREEKS” 413

21 old . par <- par ( mfrow = c (1 , 2) )


22 matplot (S , t ( Delta ) , type = " l " )
23 matplot (S , t ( Gamma ) , type = " l " )
24 par ( old . par )

Octave Octave script for Black-Scholes call option greeks Delta and Gamma.
1 m = 6;
2 n = 61;
3 S0 = 70;
4 S1 = 130;
5 K = 100;
6 r = 0.12;
7 T = 1.0;
8 sigma = 0.10;
9
10 time = transpose ( linspace (T , 0 , m ) ) ;
11 S = linspace ( S0 , S1 , n ) ;
12
13 d1 = ( log ( S / K ) + ( ( r + sigma ^2/2) *( T - time ) ) ) ./( sigma *
sqrt (T - time ) ) ;
14 Delta = normcdf ( d1 ) ;
15
16 factor1 = 1./ bsxfun ( @times , sqrt (2* pi ) * sigma * sqrt (T - time
), S);
17 factor2 = exp ( - d1 .^2/2) ;
18 Gamma = factor1 .* factor2 ;
19
20 subplot (1 ,2 ,1)
21 plot (S , Delta )
22 title ( " Delta " )
23 subplot (1 ,2 ,2)
24 plot (S , Gamma )
25 title ( " Gamma " )

Perl Perl script for Black-Scholes call option greeks Delta and Gamma.
1 use PDL :: NiceSlice ;
2 use PDL :: Constants qw ( PI ) ;
3
4 sub pnorm {
414 CHAPTER 7. THE BLACK-SCHOLES MODEL

5 my ( $x , $sigma , $mu ) = @_ ;
6 $sigma = 1 unless defined ( $sigma ) ;
7 $mu = 0 unless defined ( $mu ) ;
8
9 return 0.5 * ( 1 + erf ( ( $x - $mu ) / ( sqrt (2) *
$sigma ) ) ) ;
10 }
11 $m = 6;
12 $n = 61;
13 $S0 = 70;
14 $S1 = 130;
15 $K = 100;
16 $r = 0.12;
17 $T = 1.0;
18 $sigma = 0.10;
19
20 $time = zeroes ( $m ) -> xlinvals ( $T ,0.0) ;
21 $S = zeroes ( $n ) -> xlinvals ( $S0 , $S1 ) ;
22
23 $logSoverK = log ( $S / $K ) ;
24 $n12 = (( $r + $sigma **2/2) *( $T - $time ) ) ;
25 $numerd1 = $logSoverK + $n12 - > transpose ;
26 $d1 = $numerd1 /( ( $sigma * sqrt ( $T - $time ) ) -> transpose ) ;
27 $Delta = pnorm ( $d1 ) ;
28
29 $denom1 = ( sqrt (2* PI ) * $sigma * sqrt ( $T - $time ) ) -> transpose ;
30 $factor1 = 1/( $denom1 * $S ) ;
31 $factor2 = exp ( - $d1 **2/2) ;
32 $Gamma = $factor1 * $factor2 ;
33
34 # file output to use with external plotting programming
35 # such as gnuplot , R , octave , etc .
36 # Start gnuplot , then from gnuplot prompt
37 # set key off # avoid cluttering plots
38 # set multiplot layout 1 ,2
39 # plot for [ n =2:7] ’ greeks . dat ’ using 1:( column ( n ) )
with lines
40 # plot for [ n =9:13] ’ greeks . dat ’ using 1:( column ( n ) )
with lines
41 ## note that column 8 is NaN , because division by 0
42 # unset multiplot
43
44 open ( F , " > greeks . dat " ) || die " cannot write : $ ! " ;
45 wcols $S , $Delta , $Gamma , * F ;
46 close ( F ) ;
7.5. SENSITIVITY, HEDGING AND THE “GREEKS” 415

SciPy Python script for Black-Scholes call option greeks Delta and Gamma.
1 import scipy
2

3 m = 6
4 n = 61
5 S0 = 70
6 S1 = 130
7 K = 100
8 r = 0.12
9 T = 1.0
10 sigma = 0.10
11
12 time = scipy . linspace (T , 0.0 , m )
13 S = scipy . linspace ( S0 , S1 , n )
14

15 logSoverK = scipy . log ( S / K )


16 n12 = ( r + sigma ** 2 / 2) * ( T - time )
17 numerd1 = logSoverK [ scipy . newaxis , :] + n12 [: , scipy .
newaxis ]
18 d1 = numerd1 / ( sigma * scipy . sqrt ( T - time ) [: , scipy .
newaxis ])
19
20 from scipy . stats import norm
21 Delta = norm . cdf ( d1 )
22
23 denom1 = ( scipy . sqrt (2 * scipy . pi ) * sigma * scipy . sqrt ( T
- time ) ) [: ,
24 scipy . newaxis ]
25 factor1 = 1 / ( denom1 * S )
26 factor2 = scipy . exp ( - d1 ** 2 / 2)
27 Gamma = factor1 * factor2
28
29 # file output to use with external plotting programming
30 # such as gnuplot , R , octave , etc .
31 # Start gnuplot , then from gnuplot prompt
32 # set key off # avoid cluttering plots
33 # set multiplot layout 1 ,2
34 # plot for [ n =2:7] ’ greeks . dat ’ using 1:( column ( n ) )
with lines
35 # plot for [ n =9:13] ’ greeks . dat ’ using 1:( column ( n ) )
with lines
416 CHAPTER 7. THE BLACK-SCHOLES MODEL

36 ## note that column 8 is NaN , because division by 0


37 # unset multiplot
38
39 scipy . savetxt ( ’ greeks . dat ’ , scipy . column_stack (( scipy .
transpose ( S ) ,
40 scipy . transpose ( Delta ) , scipy . transpose (
Gamma ) ) ) ,
41 fmt = ’ %4.3 f ’)

Key Concepts
1. The sensitivity of the Black-Scholes formula to each of the variables
and parameters is named, is fairly easily expressed, and has important
consequences for hedging investments.

2. The sensitivity of the Black-Scholes formula (or any mathematical


model) to its parameters is important for understanding the model
and its utility.

Vocabulary
1. The Delta (∆) of a financial derivative is the rate of change of the
value with respect to the value of the underlying security, in symbols

∂V
∆= .
∂S

2. The Gamma (Γ) of a derivative is the sensitivity of ∆ with respect to


S, in symbols
∂ 2V
Γ= .
∂S 2

3. The Theta (Θ) of a European claim with value function V (S, t) is

∂V
Θ= .
∂t
7.5. SENSITIVITY, HEDGING AND THE “GREEKS” 417

4. The rho (ρ) of a derivative security is the rate of change of the value
of the derivative security with respect to the interest rate, in symbols
∂V
ρ= .
∂r

5. The Vega (Λ) of derivative security is the rate of change of value of


the derivative with respect to the volatility of the underlying asset, in
symbols
∂V
Λ= .
∂σ
6. Hedging is the attempt to make a portfolio value immune to small
changes in the underlying asset value (or its parameters).

Problems to Work for Understanding


1. How can a short position in 1,000 call options be made Delta neutral
when the Delta of each option is 0.7?

2. Calculate the Delta of an at-the-money 6-month European call option


on a non-dividend paying stock, when the risk-free interest rate is 10%
per year (compounded continuously) and the stock price volatility is
25% per year.

3. Use the put-call parity relationship to derive the relationship between

(a) the Delta of a European call option and the Delta of a European
put option,
(b) the Gamma of a European call option and the Gamma of a Euro-
pean put option,
(c) the Vega of a European call option and a European put option,
and
(d) the Theta of a European call option and a European put option.

4. (a) Derive the expression for Γ for a European call option.


(b) For a particular scripting language of your choice, modify the
script to draw a graph of Γ versus S for K = 50, r = 0.10,
σ = 0.25, T − t = 0.25.
418 CHAPTER 7. THE BLACK-SCHOLES MODEL

(c) For a particular scripting language of your choice, modify the


script to draw a graph of Γ versus t for a call option on an at-the-
money stock, with K = 50, r = 0.10, σ = 0.25, T − t = 0.25.
(d) For a particular scripting language of your choice, modify the
script to draw the graph of Γ versus S and t for a European call
option with K = 50, r = 0.10, σ = 0.25, T − t = 0.25.
(e) Comparing the graph of Γ versus S and t with the graph of VC
versus S and t in of Solution the Black Scholes Equation, explain
the shape and values of the Γ graph. This only requires an under-
standing of calculus, not financial concepts.

5. (a) Derive the expression for Θ for a European call option, as given
in the notes.
(b) For a particular scripting language of your choice, modify the
script to draw a graph of Θ versus S for K = 50, r = 0.10,
σ = 0.25, T − t = 0.25.
(c) For a particular scripting language of your choice, modify the
script to draw a graph of Θ versus t for an at-the-money stock,
with K = 50, r = 0.10, σ = 0.25, T = 0.25.

6. (a) Derive the expression for ρ for a European call option as given in
this section.
(b) For a particular scripting language of your choice, modify the
script to draw a graph of ρ versus S for K = 50, r = 0.10, σ = 0.25,
T − t = 0.25.

7. (a) Derive the expression for Λ for a European call option as given in
this section.
(b) For a particular scripting language of your choice, modify the
script to draw a graph of Λ versus S for K = 50, r = 0.10,
σ = 0.25, T − t = 0.25.

8. For a particular scripting language of your choice, modify the script


to create a function within that language that will evaluate the call
option greeks Delta and Gamma at a time and security value for given
parameters.
7.6. LIMITATIONS OF THE BLACK-SCHOLES MODEL 419

Outside Readings and Links:


1. Stock Option Greeks video on the meaning and interpretation of the
rates of change of stock options with respect to parameters.

7.6 Limitations of the Black-Scholes Model


Section Starter Question
We have derived and solved the Black-Scholes equation. We have derived
parameter dependence and sensitivity of the solution. Are we done? What’s
next? How should we go about implementing and analyzing that next step,
if any?

Validity of Black-Scholes
Recall that the Black-Scholes Model is based on several assumptions:

1. The price of the underlying security for which we are considering a


derivative financial instrument follows the stochastic differential equa-
tion
dS = rS dt +σS dW
or equivalently that S(t) is a Geometric Brownian Motion

S(t) = z0 exp((r − σ 2 /2)t + σW (t)).

At each time the Geometric Brownian Motion has√a lognormal distri-


bution with parameters (ln(z0 ) + rt − σ 2 /2t) and σ t. The mean value
of the Geometric Brownian Motion is E [S(t)] = z0 exp(rt).

2. The risk free interest rate r and volatility σ are constants.

3. The value V of the derivative depends only on the current value of the
underlying security S and the time t, so we can write V (S, t).

4. All variables are real-valued, and all functions are sufficiently smooth
to justify necessary calculus operations.
420 CHAPTER 7. THE BLACK-SCHOLES MODEL

See Derivation of the Black-Scholes Equation for the context of these as-
sumptions.
One judgment on the validity of these assumptions statistically compares
the predictions of the Black-Scholes model with the market prices of call op-
tions. This is the observation or validation phase of the cycle of mathematical
modeling, see Brief Remarks on Math Models for the cycle and diagram. A
detailed examination (the financial and statistical details of this examination
are outside the scope of these notes) shows that the Black-Scholes formula
misprices options. In fact, the Black-Scholes model overprices “at the money”
options, that is with S ≈ K, and underprices options at the ends, either deep
“in the money”, S  K, or deep “out of the money”, S  K. Since the
actual option price is higher than the price from the Black-Scholes formula,
this indicates that the market assigns greater risk to events that are far from
the center than the model would predict.
Another test of some of these assumptions is to gather data on the actual
market price of call options on a security, all with the same expiration date,
with a variety of strike prices. Then one can compute the implied volatility
from the data. The implied volatility is not constant, in spite of our assump-
tion of constant volatility! The computed implied volatility is higher for
either deep “in the money”, S0  K, or deep “out of the money”, S0  K,
than “at the money”, S0 ≈ K, where S0 is the current asset price and K
is the strike price. The resulting concave up shape is called the “volatility
smile” so called because it looks like a cartoon happy-face smile. The greater
implied volatility far from the center indicates that the market assigns greater
risk to events that are far from the center. Figure 7.10 shows actual data on
implied volatility. The data are from a call option on the S & P 500 index
price on July 1, 2013, with an expiration date of July 5, 2013, just 4 calendar
days later. The S & P 500 price S0 on July 1, 2013 was 1614.96, shown with
the vertical dashed line. The implied volatility in this example is large at the
ends since the S & P 500 index would have to be very volatile to change by
200 to 400 points in just 3 trading days. (July 4 is a holiday.) This example
clearly illustrates that the market does not value options consistently with
the constant volatility assumptions of the Black-Scholes model.
We have already seen evidence in Stock Market Model that returns from
the Wilshire 5000 are more dispersed than standard normal data. The low
quantiles of the normalized Wilshire 5000 quantiles occur at more negative
values than the standard normal distribution. The high quantiles occur at
values greater than the standard normal distribution. That is, probabili-
7.6. LIMITATIONS OF THE BLACK-SCHOLES MODEL 421

Implied Volatility
0.8
0.6
0.4
0.2
0
1250 1500 1750
Strike Price

Figure 7.10: Illustration of the idea of volatility smile with implied volatility
data from call options on the S & P 500 index (SPX).

ties of extreme changes in daily returns are greater than expected from the
hypothesized normal probability model.
Some studies have shown that the event of downward jumps three stan-
dard deviations below the mean is three times more likely than a normal
distribution would predict. This means that if we used Geometric Brownian
Motion to compute the historical volatility of the S&P 500, we would find
that the normal theory seriously underestimates the likelihood of large down-
ward jumps. Jackwerth and Rubinstein [30] note that with the Geometric
Brownian Motion model, the crash of 1987 is an impossibly unlikely event:

Take for example the stock market crash of 1987. Following


the standard paradigm, assume that the stock market returns
are log-normally distributed with an annualized volatility of 20%.
. . . On October 19, 1987, the two-month S&P 500 futures price fell
29%. Under the log-normal hypothesis, this [has a probability of]
10−160 . Even if one were to have lived through the 20 billion year
life of the universe . . . 20 billion times . . . that such a decline could
have happened even once in this period is virtually impossible.

The popular term for such extreme changes is a “black swan”, reflecting the
rarity of spotting a black swan among white swans. In financial markets
“black swans” occur much more often than the standard probability models
predict [69, 47].
422 CHAPTER 7. THE BLACK-SCHOLES MODEL

Normal pdf

Cauchy pdf

−5 5
x

Figure 7.11: A schematic diagram illustrating the idea of fat tails.

All these empirical tests indicate that the price process has “fat tails”, i.e.
a distribution which has the probability of large changes in price S larger than
the lognormal distribution predicts, [4, page 9]. The assumption that the
underlying security has a price modeled by Geometric Brownian Motion, or
equivalently that at any time the security price has a lognormal distribution
is incorrect. Large changes are more frequent than the model expects.
An example of a fat-tailed distribution is the Cauchy distribution with
density function fC (x) = π1 1+x 1
2 . The rate of decay to 0 of the density as

x → ∞ is the inverse power law x−2 . This is much slower than the rate of
decay of the normal distribution density function fN (x) = √12π exp(−x2 ). For
large values, the probability of events governed by the Cauchy distribution is
greater than the probability of events governed by the normal distribution.
An obstacle to using the Cauchy distribution is that its variance is un-
defined (or more loosely stated, the variance is infinite.) The assumption
of finite variance is useful for theoretical analysis of probabilities. Consider
how many times in this text uses the assumption that the variance of a
distribution was finite.
Another example of a fat-tailed distribution is the Student’s t-distribution
with density function
− ν+1
Γ( ν+1 ) t2
 2
2
fS (t) = √ 1 + .
νπ Γ( ν2 ) ν
This distribution is intermediate in the sense that for ν = 1 it is the Cauchy
distribution, but as ν → ∞, the t-distribution approaches the normal dis-
7.6. LIMITATIONS OF THE BLACK-SCHOLES MODEL 423

tribution. For ν > 1 the variance of the distribution is finite, but now with
another parameter ν to fit. Lions [43] finds that a Student’s t-distribution
with ν = 3.4 provides a good fit to the distribution of the daily returns of
the S & P 500.
More fundamentally, one can look at whether general market prices and
security price changes fit the hypothesis of following the stochastic differential
equation for Geometric Brownian Motion. Studies of security market returns
reveal an important fact: As in Lions [43], large changes in security prices
are more likely than normally distributed random effects would predict. Put
another way, the stochastic differential equation model predicts that large
price changes are much less likely than is actually the case.
The origin of the difference between the stochastic differential equation
model for Geometric Brownian Motion and real financial markets may be
a fundamental misapplication of probability modeling. The mathematician
Benoit Mandelbrot argues that finance is prone to a “wild randomness” not
usually seen in traditional applications of statistics [70]. Mandelbrot says
that rare big changes can be more significant than the sum of many small
changes. That is, Mandelbrot calls into question the applicability of the Cen-
tral Limit Theorem in finance. It may be that the mathematical hypotheses
required for the application of the Central Limit Theorem do not hold in
finance.
Recall that we explicitly assumed that many of the parameters were con-
stant, in particular, volatility is assumed constant. Actually, we might wish
to relax that idea somewhat, and allow volatility to change in time. Non-
constant volatility introduces another dimension of uncertainty and also of
variability into the problem. Still, changing volatility is an area of active
research, both practically and academically.
We also assumed that trading was continuous in time, and that secu-
rity prices moved continuously. Of course, continuous change is an idealiz-
ing assumption. In fact, in October 1987, the markets dropped suddenly,
almost discontinuously, and market strategies based on continuous trading
were not able to keep with the selling panic. The October 1987 drop is yet
another illustration that the markets do not behave exactly as the assump-
tions made. Another relaxation of the Black-Scholes model is assume that
the price process can make sudden discontinuous jumps, leading to what are
called jump-diffusion models. The mathematics associated with these pro-
cesses is necessarily more complicated. This is another area of active research
[15].
424 CHAPTER 7. THE BLACK-SCHOLES MODEL

Black-Scholes as an Approximate Model with an Exact Solution

In the classification of mathematical modeling in the section Brief Remarks


on Mathematical Models, the Black-Scholes model is an approximate model
with an exact solution. The previous paragraphs show that each of the as-
sumptions made to derive the Black-Scholes equation is an approximation
made expressly to derive a tractable model. The assumption that security
prices act as a Geometric Brownian Motion means that we can use the tech-
niques of Itô stochastic calculus. Even more so, the resulting lognormal
distribution is based on the normal distribution which has simple mathe-
matical properties. The assumptions that the risk free interest rate r and
volatility σ are constants simplifies the derivation and reduces the size of the
resulting model. The assumption that the value V of the derivative depends
only on the current value of the underlying security S and the time t likewise
reduces the size of the resulting model. The assumption that all variables
are real-valued, and all functions are sufficiently smooth allows necessary
calculus operations.
Once the equation is derived we are able to solve it with standard math-
ematical techniques. In fact, the resulting Black-Scholes formula fits on a
single line as a combination of well-known functions. The formula is sim-
ple enough that by 1975 Texas Instruments created a hand-held calculator
specially programmed to produce Black-Scholes option prices and hedge ra-
tios. The simple exact solution puts the Black-Scholes equation in the same
position as the pendulum equation and the Ideal Gas Law, an approximate
model with an exact solution. The trust we have in solutions to mathematical
equations creates a sanitizing effect when we use mathematical models. The
mere fact that sophisticated mathematical methods created a solution makes
a conclusion, faulty or not, seem inevitable and unimpeachable, [51, page 4].
Although an exact solution is satisfying, even beautiful, exact solutions hide
the approximate origins. We often interpret the results of mathematical anal-
ysis as “objective” when it is only as objective as the underlying assumptions.
The deep mathematical analysis relies in complex ways on the assumptions,
so the result is an apparently strong, objective result that is actually neither
strong nor objective. In the worst cases, such analysis is an example of the
“garbage in, garbage out” problem, [51, page 6]. It is tempting to assume
you have the perfect answer when at best you have a noisy approximation,
[51, page 2].
The elegant one-line solution may actually encourage some of the mis-
7.6. LIMITATIONS OF THE BLACK-SCHOLES MODEL 425

uses of mathematical modeling detailed below. By programming the elegant


solution into a simple calculator everyone can use it. Had the Black-Scholes
equation been nonlinear or based on more sophisticated stochastic processes,
it probably would not have a closed-form solution. Solutions would have
relied on numerical calculation, more advanced mathematical techniques or
simulation, that is, solutions would not have been easily obtained. Those
end-users who persevered in applying the theory might have sought addi-
tional approximations more conscious of the compromises with reality.

Misuses of Mathematical Modeling


By 2005, about 5% of jobs in the finance industry were in mathematical
finance. The heavy use of flawed mathematical models contributed to the
failure and near-failure of some Wall Street firms in 2009. Some critics blamed
the mathematics and the models for the general economic troubles that re-
sulted. In spite of the flaws, mathematical modeling in finance is not going
away. Consequently, modelers and users have to be honest and aware of
the limitations in mathematical modeling, [70]. Mathematical models in fi-
nance do not have the same experimental basis and long experience as do
mathematical models in physical sciences. For the time being, we should
cautiously use mathematical models in finance as good indicators that point
to the values of financial instruments, but do not predict with high precision.
Actually, the problem goes deeper than just realizing that the precise dis-
tribution of security price movements is slightly different from the assumed
lognormal distribution. Even after specifying the probability distribution,
giving a mathematical description of the risk, we still would have the uncer-
tainty of not knowing the precise parameters of the distribution to specify it
totally. From a scientific point of view, the way to estimate the parameters is
to statistically evaluate the outcomes from the past to determine the param-
eters. We looked at one case of this when we described historical volatility as
a way to determine σ for the lognormal distribution, see Implied Volatility.
However, this implicitly assumes that the past is a reasonable predictor of
the future. While this faith is justified in the physical world where physical
parameters do not change, such a faith in constancy is suspect in the human
world of the markets. Consumers, producers, and investors all change habits
suddenly in response to fads, bubbles, rumors, news, and real changes in
the economic environment. Their change in economic behavior changes the
parameters.
426 CHAPTER 7. THE BLACK-SCHOLES MODEL

Even within finance, the models may vary in applicability. Analysis of


the 2008-2009 market collapse indicates that the markets for interest rates
and foreign exchange may have followed the models, but the markets for debt
obligations may have failed to take account of low-probability extreme events
such as the fall in house prices [70]. The models for debt obligations may
have also assumed independence of events that were actually connected and
correlated.
Models can have other problems that are more social than mathematical.
Sometimes the use of the models change the market priced by the model.
This feedback process in economics has been noted with the Black-Scholes
model, [70]. Sometimes special financial instruments can be so complex that
modeling them requires too many assumptions, yet the temptation to make
an approximate model with an exact solution overtakes the solution step in
the modeling process. Special debt derivatives called “collateralized debt
obligations” or CDOs implicated in the economic collapse of 2008 are an
example. Each CDO was a unique mix of assets, but CDO modeling used
general assumptions that were not associated with the specific mix. Addi-
tionally, the CDO models used assumptions which underestimated the corre-
lation of movements of the parts of the mix [70]. Valencia [70] says that the
“The CDO fiasco was an egregious and relatively rare case of an instrument
getting way ahead of the ability to map it mathematically.”
It is important to remember to apply mathematical models only under
circumstances where the assumptions apply [70]. For example “Value At
Risk” or VAR models use volatility to statistically estimate the likelihood
that a given portfolio’s losses will exceed a certain amount. However, VAR
works only for liquid securities over short periods in normal markets. VAR
cannot predict losses under sharp unexpected drops that are known to oc-
cur more frequently than expected under simple hypotheses. Mathematical
economists, especially Taleb, have heavily criticized the misuse of VAR mod-
els.

Alternatives to Black-Scholes
Financial economists and mathematicians have suggested several alternatives
to the Black-Scholes model. These alternatives include:

• stochastic volatility models where the future volatility of a security


price is uncertain; and
7.6. LIMITATIONS OF THE BLACK-SCHOLES MODEL 427

• jump-diffusion models where the security price experiences occa-


sional jumps rather than continuous change.

The difficulty in mathematically analyzing these models and the typical lack
of closed-form solutions means that these models are not as widely known or
celebrated as the Black-Scholes-Merton theory.
In spite of these flaws, the Black-Scholes model does an adequate job
of generally predicting market prices. Generally, the empirical research is
supportive of the Black-Scholes model. Observed differences have been small
(but real!) compared with transaction costs. Even more importantly for
mathematical economics, the Black-Scholes model shows how to assign prices
to risky assets by using the principle of no-arbitrage applied to a replicating
portfolio and reducing the pricing to applying standard mathematical tools.

Last Words

Peter Bernstein has a concise summary of mathematical modeling for eco-


nomics and finance in the first chapter of Capital Ideas Evolving, [9]. Quoting
from that summary neatly captures the cycle of modeling for economics and
finance that forms the framework for this book and provides an ending epi-
gram:

Before Eugene Fama set forth the principles of the Efficient


Market Hypothesis is 1965, there was no theory to explain why
the market is so hard to beat. . . . Before Fischer Black, Myron
Scholes and Robert Merton confronted both the valuation and es-
sential nature of derivative securities in the early 1970s, there was
no theory of option pricing – there were just rules of thumb and
folklore. . . . The academic creators of these models were not taken
by surprise by difficulties with empirical testing. The underlying
assumptions are artificial in many instances, which means that
their straight-forward application to the solution of real-time in-
vestment problems is often impossible. The academics knew as
well as anyone that the real world is different from what they
were defining. . . . They were well aware that their theories were
not a finished work. They were building a jumping-off point, a
beginning of exploration . . . . That structure is still evolving.
428 CHAPTER 7. THE BLACK-SCHOLES MODEL

Sources

This section is adapted from: “Financial Derivatives and Partial Differential


Equations” by Robert Almgren, in American Mathematical Monthly, Volume
109, January, 2002, pages 1–11 ; Options, Futures, and other Derivative
Securities second edition, by John C. Hull, Prentice Hall, 1993, pages 229–
230, 448–449 ; Black-Scholes and Beyond: Option Pricing Models, by Neil
A. Chriss, Irwin Professional Publishing, Chicago, 1997 . Some additional
ideas are adapted from When Genius Failed by Roger Lowenstein, Random
House, New York ; M. Poovey, “Can Numbers Insure Honesty”, and Cathy
O’Neil, On Being a Data Skeptic, On Being a Data Skeptic and P. Bernstein.
Capital ideas Evolving, John Wiley and Sons, 2007. The data in Figure 7.10
is from HistoricalOptionData.com, accessed on April 9, 2015.

Key Concepts
1. The Black-Scholes model overprices “at the money” call options, that
is with S ≈ K. The Black-Scholes model underprices call options at
the ends, either deep “in the money”, S  K, or deep “out of the
money”, S  K.

2. This is an indication that security price processes have “fat tails”, i.e.
a distribution which has the probability of large changes in price S
greater than the lognormal distribution predicts.

3. Mathematical models in finance do not have the same experimental ba-


sis and long experience as do mathematical models in physical sciences.
It is important to remember to apply mathematical models only under
circumstances where the assumptions apply.

4. Financial economists and mathematicians have suggested alternatives


to the Black-Scholes model. These alternatives include:

• models where the future volatility of a stock price is uncertain


(called stochastic volatility models); and
• models where the stock price experiences occasional jumps rather
than continuous change (called jump-diffusion models).
7.6. LIMITATIONS OF THE BLACK-SCHOLES MODEL 429

Vocabulary
1. The distribution of price changes for many securities exhibit fat tails:
stock price changes far from the mean are more likely than the normal
distribution predicts.

2. Stochastic volatility models are higher-order mathematical finance


models where the volatility of a security price is a stochastic process
itself.

3. Jump-diffusion models are higher-order mathematical finance mod-


els where the security price experiences occasional jumps rather than
continuous change.

Problems to Work for Understanding


1. A pharmaceutical company has a stock that is currently $25. Early to-
morrow morning the Food and Drug Administration will announce that
it has either approved or disapproved for consumer use the company’s
cure for the common cold. This announcement will either immediately
increase the stock price by $10 or decrease the price by $10. Discuss
the merits of using the Black-Scholes formula to value options on the
stock.

2. Consider
2 /2 √
1. A standard normal random variable Z with pdf fZ (x) = e−x / 2π,
2. a “double exponential random variable” X with pdf fX (x) =
(1/2)e−|x| ,
3. a standard uniform random variable U with pdf fU (x) = 1 for
x = [−1/2, 1/2] and 0 elsewhere, and
4. a Cauchy random variable Y with pdf fY (x) = 1/(π(1 + x2 )).

(a) On the same set of axes with a horizontal axis −5 ≤ x ≤ 5, graph


the pdf of each of these random variables.
(b) For each of the random variables Z, X, U and Y calculate the
probability that the r.v. is greater than 1, 2, 3, 4. Make a well=organized
and labeled table to display your results.
430 CHAPTER 7. THE BLACK-SCHOLES MODEL

(c) On the basis of the answers from the previous two questions, rank
the random variables Z, X, U and Y in terms of the fatness of
the tails.

3. Show that the variance of the Cauchy distribution is undefined.

4. Find a source of historical data on options. These sources usually list


the implied volatility along with the call and put option prices. (If the
implied volatility is not listed, calculate the implied volatility.) Plot
the implied volatility as a function of the strike price to illustrate the
volatility smile.

Outside Readings and Links:


1. Paul Wilmott on Quantitative Finance, Chapter 16, Fat tails

2. HistoricalOptionData.com
Bibliography

[1] David Adler. A reliable randomizer, turned on its head. Washington


Post, August 2 2009. randomness.

[2] Marco Allavenada and Peter Laurence. Quantitative Modeling of Deriva-


tive Securities. Chapman and Hall, 2000. HG 6024 A3A93 2000.

[3] Linda J. S. Allen. An Introduction to Stochastic Processes with Appli-


cations to biology. Pearson Prentice-Hall, 2003.

[4] R. Almgren. Financial derivatives and partial differential equations. The


American Mathematical Monthly, 109:1–12, 2002.

[5] Marco Avellaneda and Peter Laurence. Quantitative Modeling of Deriva-


tive Securities: From Theory to Practice. Chapman and Hall, 2000. HG
6024 A3A93 2000.

[6] M. Baxter and A. Rennie. Financial Calculus: An introduction to


derivative pricing. Cambridge University Press, 1996. HG 6024 A2W554.

[7] S. Benninga and Z. Wiener. The binomial option pricing model. Math-
ematical in Education and Research, 6(3):27–33, 1997.

[8] P. Bernstein. Capital Ideas: The Improbable Origins of Modern Wall


Street. Free Press, 1992. popular history.

[9] Peter L. Bernstein. Capital Ideas Evolving. John Wiley, 2007. popular
history.

[10] George E. P. Box and Norman R. Draper. Empirical Model-Building


and Response Surfaces. Wiley, 1987.

[11] Leo Breiman. Probability. Addison Wesley, 1968.

431
432 BIBLIOGRAPHY

[12] Leo Breiman. Probability. SIAM, 1992.

[13] René Carmona and Ronnie Sircar. Financial mathematics ’08: Math-
ematics and the financial crisis. SIAM News, 42(1), January 2009.
http://www.siam.org/news/news.php?id=1509.

[14] James Case. Two theories of relativity, all but identical in substance.
SIAM News, page 7 ff, September 2005. popular history.

[15] Neil Chriss. Black-Scholes and Beyond: Option Pricing Models. Irwin
Professional Publishing, 1997.

[16] Freddy Delbaen and Walter Schachermayer. What is a . . . free lunch.


Notices of the American Mathematical Society, 51(5), 2004.

[17] Darrell Duffie. Book review of Stochastic Calculus for Finance. Bulletin
of the American Mathematical Society, 46(1):165–174, January 2009.
review, history, bibliography.

[18] C. Henry Edwards and David E. Penney. Differnential Equations. Pear-


son Prentice Hall, 4th edition edition, 2008.

[19] William Feller. An Introduction to Probability Theory and Its Applica-


tions, Volume I, volume I. John Wiley and Sons, third edition, 1973.
QA 273 F3712.

[20] Niall Ferguson. The Ascent of Money: A Financial History of the World.
Penguin Press, 2008. popular history.

[21] David Freedman. Brownian Motion and Diffusions. Holden-Day, 1971.


QA274.75F74.

[22] Charles Gasparino. The Sellout. Harper Business, 2009. popular history.

[23] James Gleick. The Information: A History, a Theory, a Flood. Pan-


theon, 2011.

[24] D. Halliday and R. Resnick. Physics. J. Wiley and Sons, 1966. QC21
.R42 1966.

[25] Stephen Hawking. A Brief History of Time. Bantam, 1998.


BIBLIOGRAPHY 433

[26] Desmond J. Higham. An algorithmic introduction to numerical simula-


tion of stochastic differential equations. SIAM Review, 43(3):525–546,
2001.

[27] John C. Hull. Options, Futures, and other Derivative Securities.


Prentice-Hall, second edition, 1993. economics, finance, HG 6024
A3H85.

[28] P. J. Hunt and J. E. Kennedy. Financial Derivatives in Theory and


Practice. John Wiley and Sons, 2000. HG 6024 A3H86 2000.

[29] Stefano M. Iacus. Simulation and Inference for Stochastic Differential


Equations. Number XVIII in Springer Series in Statistics. Springer-
Verlag, 2008.

[30] J. C. Jackwerth and M. Rubenstein. Recovering probability distribtions


from contemporaneous security prices. Journal of Finance, 1995.

[31] R. Jarrow and P. Protter. A short history of stochastic integration


and mathematical finance: The early years, 1880-1970. In IMS Lecture
Notes, volume 45 of IMS Lecture Notes, pages 75–91. IMS, 2004. popular
history.

[32] Robert Jarrow. In honor of the Nobel laureates Robert C. Merton and
Myron S. Scholes: A partial differential equation that changed the world.
Journal of Economic Perspectives, 13(4):229–248, Fall 1999. popular
history.

[33] The Wall Street Journal. The making of a mortgage


cdo. http://online.wsj.com/public/resources/documents/
info-flash07.html?project=normaSubprime0712&h=530&w=980&
hasAd=1&settings=normaSubprime0712, 2008. Accessed August 25,
2010.

[34] I. Karatzas and S. E. Shreve. Brownian Motion and Stochastic Calculus.


Graduate Texts in Mathematics. Springer Verlag, second edition, 1997.

[35] S. Karlin and H. Taylor. A Second Course in Stochastic Processes. Aca-


demic Press, 1981.
434 BIBLIOGRAPHY

[36] J. B. Keller. The probability of heads. American Mathematical Monthly,


93(3):91–197, March 1986.
[37] Davar Khoshnevisan. Leture notes on donsker’s theorem. http://www.
math.utah.edu/~davar/ps-pdf-files/donsker.pdf, 2005. accessed
June 30, 2013.
[38] P. Kloeden and E. Platen. Numerical Solution of Stochastic Differential
Equations, volume 23 of Stochastic Modelling and Applied Probability.
Springer, 1992.
[39] Robert W. Kolb. Financial Derivatives. Institute of Finance, 1993.
[40] Emmanuel Kowalski. Bernstein polynomials and brownian motion.
American Mathematical Monthly, 113:865–886, December 2006.
[41] Emmanuel Lesigne. Heads or Tails: An Introduction to Limit Theorems
in Probability, volume 28 of Student Mathematical Library. American
Mathematical Society, 2005.
[42] C.C. Lin and Lee A. Segel. Mathematics applied to deterministic prob-
lems in the natural sciences. Macmillan, 1974. QA37.2 .L55.
[43] Gaetan Lions. Black swan(s) – the fat tail issue.
http://www.slideshare.net/gaetanlion/black-swan-the-fat-tail-issue,
December 2009.
[44] Leonard Lipkin. Tossing a fair coin. The College Mathematics Journal,
34(2):128–133, March 2003.
[45] J. David Logan. Applied Mathematics: A contemporary approach. John
Wiley and Sons, 1987. QA37.2 .L64 1987.
[46] Roger Lowenstein. When Genius Failed: The Rise and Fall of Long-
Term Capital Management. Random House, 2000. HG 4930 L69 2000.
[47] Benoit B. Mandelbrot and Richard L. Hudson. The (mis)Behavior of
Markets: A Fractal View of Risk, Ruin and Reward. Basic Books, 2004.
[48] Robert C. Merton. Influence of mathematical models in finance on prac-
tice: past, present and future. In S. D. Howison, F. P. Kelly, and
P. Wilmott, editors, Mathematical Models in Finance. Chapman and
Hall, 1995. popular history.
BIBLIOGRAPHY 435

[49] National Institute of Standards and Technology. Engineering statistics


handbook. http://www.itl.nist.gov/div898/handbook/index.htm, Octo-
ber 2013.

[50] Robert O’Harrow. Derivatives made simple, if that’s really possible.


Washington Post, April 21 2010. popular history.

[51] Cathy O’Neil. On being a data skeptic. http://www.oreilly.com/


data/free/being-a-data-skeptic.csp. 2013.

[52] Art Owen. Monte carlo theory, methods and examples.


http://statweb.stanford.edu/ owen/mc/, 2013.

[53] Ron Peled. Random walks and brownian motion. http://www.math.


tau.ac.il/~peledron/Teaching/RW_and_BM_2011/index.htm, 2011.

[54] M. Poovey. Can numbers ensure honesty? unrealistic expectations and


the U. S. accounting scandal. Notices of the American Mathematical
Society, pages 27–35, January 2003. popular history.

[55] Portfolio.com. What’s a c.d.o. http://www.portfolio.com/


interactive-features/2007/12/cdo. Accessed on August 25, 2010.

[56] Phillip Protter. Review of Mathematics for Finance: An Introduction to


Financial Engineering by Marek Capiǹski and Tomasz Zastawniak. The
American Mathematical Monthly, 111(10):923–927, December 2004.

[57] Phillip Protter. Review of Louis Bachelier’s Theory of Speculation.


Bulletin of the American Mathematical Society, 45(4):657–660, October
2008.

[58] Sheldon Ross. A First Course in Probability. Macmillan, 1976.

[59] Sheldon M. Ross. Introduction to Probability Models. Elsevier, 8th edi-


tion, 2003.

[60] Sheldon M. Ross. Introduction to Probability Models. Academic Press,


9th edition, 2006.

[61] Chris Sangwin. Modelling the journey from elementary word problems to
mathematical research. Notices of the American Mathematical Society,
58(10):1436–1445, November 2011.
436 BIBLIOGRAPHY

[62] Stephen Senn. Dicing with Death: Chance, Health and Risk. Cambridge
University Press, 2003.

[63] Steven E. Shreve. Stochastic Calculus For Finance, volume II of Springer


Finance. Springer Verlag, 2004.

[64] Steven E. Shreve. Stochastic Calculus For Finance, volume I of Springer


Finance. Springer Verlag, 2004.

[65] Nate Silver. The Signal and the Noise. The Penguin Press, 2012. popular
history.

[66] Staff. Over the counter, out of sight. The Economist, pages 93–96,
November 14 2009.

[67] J. Michael Steele. Stochastic Calculus and Financial Applications.


Springer-Verlag, 2001. QA 274.2 S 74.

[68] H. M. Taylor and Samuel Karlin. An Introduction to Stochastic Model-


ing. Academic Press, third edition, 1998.

[69] Matthew Valencia. The gods strike back. The Economist, pages 3–5,
February 2010. popular history.

[70] Matthew Valencia. Number-crunchers crunched. The Economist, pages


5–8, February 2010.

[71] S. R. S. Varadhan. Probability Theory. Number 7 in Courant Lecture


Notes. American Mathematical Society, 2001.

[72] Robert Waid. Wilshore 5000: Myths and misconceptions.


http://wilshire.com/media/34276/wilshire5000myths.pdf, Novem-
ber 2014.

[73] Paul Wilmott, S. Howison, and J. Dewynne. The Mathematics of Fi-


nancial Derivatives. Cambridge University Press, 1995.
Index

American Stock Exchange, 12 terminal value problem, 368


AMEX Black-Scholes equation, 368
seeAmerican Stock Exchange, 12 Black-Scholes model, 4
antithetic sample, 339 Black-Scholes pricing formula
approximate Brownian Motion, 236 call option, 374
arbitrage, 5, 27, 29, 30 put option, 386
arbitrage pricing, 29, 30 bond, 77, 86
asset, 11 bounded variation, 273
at the money, 420, 428 Boyle’s Law, 43
Bachelier process, 221, 232 Brown, Robert, 220, 231
Bachelier, Louis, 3, 221, 232 Brownian Motion
Bank for International Settlements, 7 approximate, 236
Bank of International Settlements, 3 continuity, 264
Bernoulli, Jacob, 173 Hausdorff dimension, 266
Bernstein polynomials, 237 non-monotonicity, 265
Berry-Esséen Theorem, 190 nowhere differentiable, 265
binomial probability oscillation, 266
cumulative distribution, 67 zero as accumulation point, 266
binomial model Brownian motion, 3, 4, 61, 221, 232
single period, 77 with drift, 289
binomial tree, 88 geometric, 289
birth processes, 60 scaled, 289
birth-and-death process, 60
bisection search, 397 calculator, 5, 424
black swans, 421 capital asset pricing model, 5
Black, Fisher, 4, 5 CAPM, see capital asset pricing model
Black-Scholes Cauchy-Euler equation, see Euler equidi-
option pricing model, 5 mensional equation
Black-Scholes equation CBOE, see Chicago Board Options
boundary condition, 368 Exchange

437
438 INDEX

seeChicago Board Options Exchange, difference equations, 117


12 general solution, 118
CDO, 66, 69, 73 non-homogeneous, 135
Central Limit Theorem diffusion, 4
Liapunov’s Theorem, 190 diffusion equation, 218
Central Limit Theorem diffusions, 219
Lindeberg’s Theorem, 190 Donsker’s Invariance Principle, 257
Central Limit Theorem, 188, 324 drift, 323
Chaitin, G., 55 dynamic hedging, 409
Chebyshev’s Inequality, 172 dynamic portfolio, 5
Chicago Board Options Exchange, 5,
12 economic agents, 1
coin flip, 50, 58 efficient market, 30
mechanical, 52 efficient market hypothesis, 360
collateralized debt obligation, 73 efficient markets hypothesis, 4
collateralized debt obligations, 69 Einstein, Albert, 3
Commodity Futures Trading Commis- Einstein, Albert, 220, 231
sion, 7 Enron, 7
compound Poisson process, 60 equation of state
confidence interval, 336 van der Waals, 44
continuity correction, see half-integer equation of state, 43
correction Euler equidimensional equation, 369
convenience price, 27 Euler-Maruyama method, 288, 290
convergence excess heads, 202, 204
in distribution, 186 exchanges, 3
in probability, 186 Existence-Uniqueness Theorem, 292
pointwise, 186 experiment, 103
Cox-Ross-Rubenstein, 90, 98 expiry date, 11
credit-default swap, 2 expiry date, 11, 13
cycle of modeling, 33
FASB, see Financial Accounting Stan-
de Moivre, Abraham, 189 dards Board
degenerate probability distribution, 181fat tails, 327, 428, 429
Delta, 407 Federal reserve requirement, see re-
derivative, 78, 86 serve requirement
derivatives, 2, 10 finance, 1
unregulated, 7 Financial Accounting Standards Board,
Diaconis, Persi, 52 7
INDEX 439

first-passage probabilities, 116 ideal gas law, 43


Fokker-Planck equation, 218 implied volatility, see volatility, im-
foreign exchange, 22 plied
forwards, 2, 10 importance sampling, 340
Fourier series, 237 in the money, 420, 428
fractal, 248 indicator random variable, 168
future, 11
futures, 2, 10 jump-diffusion models, 427–429

Galileo Galilei, 39 Karhunen-Loève, 237


Gambler’s Fallacy, 174 Keller, J.B., 51
gambler’s ruin, 129 Khinchin, Aleksandr, 173
gambling, 102 Kolmogorov, A., 55
experiment, 103 Kolmogorov, Andrey, 174
Gamma, 409 Kronecker delta, 167
Gaussian processes, 61
Laplace, Pierre-Simon, 189
Geometric Brownian Motion, 323
Liapunov’s theorem, 190
lognormal distribution, 309
Liapunov, Aleksandr, 190
mean, 311
Lindeberg’s Theorem, 190
parameters, 312
log-return, 321, 323
quadratic variation, 313
lognormal distribution, 309, 323
ruin and victory probabilities, 313
variance, 311 Mandelbrot, B., 423
geometric Brownian motion, 4, 61, 289 Markov chain, 59
half-integer correction, 201 Markov process, 59, 122
heat equation, 367 Markov processes
initial value problem, 367 family tree, 61
hedge ratio, 23 Markov’s Inequality, 171
hedge ratios, 5, 7 martingale, 122
hedge-ratio, 408 mathematical finance, 2
hedging, 5, 19, 22, 23, 411 modern, 4
historical volatility, see volatility, his- mathematical model, 32, 420, 424, 425
torical unit analysis, 36
hitting time, 254 mathematical models, 8
Holmes, Susan, 52 equations, 35
Huygens, C., 42 McKean, Henry, 4
Merton, Robert, 4, 5
ideal gas, 43 model robustness, 70
440 INDEX

moment, 185 over the counter, 7


moment generating function, 181
moment generating function, 185 pendulum, 39
Monte Carlo confidence interval, 337 Perrin, Jean-Baptiste, 4
Monte Carlo methods, 335 Poisson process, 60
Montgomery, Richard, 52 Poisson, Simeon, 173
probability by conditioning, 254
National Longitudinal Survey of Youth, probability space, see sample space
191 put option, 386
New York Stock Exchange, 12 put-call parity, 383
Newton’s method, 398 put-call parity principle
Nobel Prize, 5 arbitrage, 385
non-risky portfolio, 362 q-q plot, 327
normal random variable quadratic variation, 273
moment generating function, 183 quantile, 327
normal random variables, 184 quantum randomness, 55
NYSE queuing processes, 60
seeNew York Stock Exchange, 12
random time, 255
option random walk, 59, 61, 122, 213
American, 11 Central Limit Theorem, 217
Asian, 12 limiting process, 215
Bermuda, 12 mean, 215
call, 11, 20, 21 phase line, 214
European, 11 probability of position, 217
factors, 15 variance, 215
holder, 11 random walk hypothesis, 360
intrinsic value, 14 random walk theory, 53
put, 11, 12, 21 Reflection Principle, 255
writer, 11, 14 replicating portfolio, 78, 86, 361
option pricing reserve ratio, see reserve requirement
history, 5 reserve requirement, 148, 167
options, 2, 10 return, log, 321
in the money, 13 returns, 320
over-the-counter, 12 Rho, 410
Ornstein-Uhlenbeck process, 61 risk, 19, 425
out of the money, 420, 428 risk free interest rate, 360
over the counter, 3 risk management, 23
INDEX 441

sample mean, 336 van der Waals, J.D., 44


sample path, 58 variance reduction, 338
sample point, 58 Vega, 411
sample space, 58 volatility, 323, 360
Samuelson, Paul, 4 historical, 395
Scholes, Myron, 4, 5 implied, 397
security, 77, 86 volatility smile, 420
sensitivity analysis, 37
short selling, 23 weak law, 174
simple random walk, 59 Weak Law of Large Numbers, 50, 173,
speculation, 19–21 187, 203
spreadsheets, 35 well-posed, 381
SPX, 343 white noise, 61
Standard and Poor’s 500 index, 343 Wiener process
standard error, 337 conditional probability, 226
state space, 58 security prices, 224
stochastic, 57 Wiener Process, 221
stochastic differential equation, 288 independent increments, 221
stochastic process, 57, 58 joint probability density, 222
stochastic volatility, 426, 428, 429 Markov property, 222
stock, 78, 86 quadratic variation, 275
strike price, 11, 13 total variation, 277
Strong Law of Large Numbers, 174 Wiener process, 3, 4, 61, 221, 232
Student’s t-distribution, 337 hitting time, 254
swaps, 2, 10 inversion, 244, 253
symmetries, 248 maximum, 256
synthetic portfolios, 385 reflection principle, 255
ruin problem, 256
technical analysis, 53, 206 scale, 244
Texas Instruments, 5, 424 scaling, 253
Theta, 410 shift, 244
total quadratic variation, 273 translation, 253
tranche, 67, 73 Wiener, Norbert, 231
transform methods, 179 Wiener, Norbert, 4, 221
transformations, 248 Wilshire 5000, 323
uncertainty, 20, 425

Value At Risk, 426

You might also like