SlideShare a Scribd company logo
1 of 80
Download to read offline
Universitat Aut`onoma de Barcelona
Brownian Motion and Introduction to
Stochastic Calculus
Author:
David Nebra Colmenares
Supervisors:
Maria Jolis Gim´enez
Daniel Campos Moreno
July 7, 2016
Contents
1 Introduction 1
2 Random Walk 5
2.1 One-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1 Back to original position . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2 Get to a specific position . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.3 Expected time to get back to origin . . . . . . . . . . . . . . . . . . . . . 8
2.2 Two-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3 Back to the original position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 Get to a specific position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.5 Three-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.6 Back to the origin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.7 Get to a specific position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3 Simulations: Random walks 16
3.1 One-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1.1 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 Two-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2.1 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.2.2 Path samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2.3 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3 Three-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3.1 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4 Brownian motion 29
4.1 History of Brownian motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2 The Difussion Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.2.1 Einstein’s derivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.2.2 Langevin’s approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2.3 Macroscopic Derivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2.4 Solution of the diffusion equation . . . . . . . . . . . . . . . . . . . . . . 34
4.3 Recurrence of Brownian motion . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.4 Expected time to reach a specific position . . . . . . . . . . . . . . . . . . . . . 40
4.5 Other properties of Brownian motion . . . . . . . . . . . . . . . . . . . . . . . . 42
4.5.1 Quadratic variation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.5.2 Unbounded variation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5 Simulations: Brownian Motion 45
5.1 Numerical integration of stochastic differential equations with Gaussian white
noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.1.1 Runge-Kutta-Type methods . . . . . . . . . . . . . . . . . . . . . . . . . 47
2
CONTENTS 3
5.1.2 Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5.1.3 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.1.4 Path samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.2 Dirichlet problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.2.1 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6 Stochastic integrals 53
6.1 Riemann-Stieltjes integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.2 The Itˆo integral for simple processes . . . . . . . . . . . . . . . . . . . . . . . . 54
6.3 The general Itˆo integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.4 A simple version of the Itˆo formula . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.5 Extension I of the Itˆo formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.6 Extension II of the Itˆo formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.7 Stratonovich integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.8 Stratonovich or Itˆo? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7 Stochastic calculus in Finance 62
7.1 Black-Scholes simple model for option pricing . . . . . . . . . . . . . . . . . . . 65
7.1.1 A mathematical formulation for the option pricing problem . . . . . . . . 67
7.1.2 Graphical representations of the Black-Scholes formula . . . . . . . . . . 69
Appendices 72
A Fokker-Planck equation 73
B Results and definitions in Probability 74
B.1 Conditional expectation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Abstract
This bachelor thesis aims to introduce the concepts of random walks, Wiener process and
Stochastic Calculus and to illustrate some of its applications. Before going into details, we will
explain the random walk and the Wiener process, and see how the latter can be understood
as a limit of the former. In Chapter 2 we will deal with 1, 2 and 3-dimensional random walks
and we will focus on the probability that the random walker will get back to its departing
point (recurrence problem). We will then simulate some cases to see that experimental results
match theoretical ones, and simulate some cases for the 2 and 3-dimensional case for which we
don’t have theoretical results. The next part will be an introduction to Brownian motion, its
importance in Physics and how it can be modelled via a Wiener process. As we did with the
random walk we will see that, among other properties, the 1-dimensional Brownian motion is
recurrent and, finally, we will run several simulations. Chapter 6 is an introduction to Stochastic
Calculus that will provide us with useful results which will be used later in Chapter 7. This
last chapter will introduce us some financial concepts and one of the most important formulas
in modern Quantitative Finance: Black-Scholes formula for option pricing.
Chapter 1
Introduction
In this chapter we want to explain the similarities between the Brownian motion and the random
walk, and see that the former can be undersood as a limit of the latter. The next chapters will
focus more in detail on the properties of each one, here we just want to see the link existing
between them.
Definition 1.0.1. Given a probability space (Ω, F, P) and a measurable space (S, Σ) a stochas-
tic process X is a collection of random variables on Ω, indexed by a totally ordered set T, i.e,
X = {Xt : t ∈ T} (1.1)
where each Xt is a random variable on Ω with values in S, that is
X−1
t (E) ∈ F ∀E ∈ Σ ∀t ∈ R (1.2)
Definition 1.0.2. A 1-dimensional Wiener process or Browian motion B = (Bt, t ∈ [0, ∞)) is
a stochastic process characterized by the following properties
1. B0 = 0 a.s.
2. B has independent increments.
3. B has Gaussian increments: Bt+u − Bt ∼ N(0, u).
4. B has continuous paths: Bt(ω) is a.s. continuous in t.
Definition 1.0.3. A n-dimensional Wiener process or Browian motion is a vector-valued
stochastic process
Bt = (B
(1)
t , B
(2)
t , . . . , B
(n)
t ) (1.3)
whose components B
(i)
t are independent, one dimensional Wiener-processes.
Remark 1.0.1. Throughout most of this thesis we will use the terms Wiener process and
Brownian indistinctly. In Physics literature Brownian motion is often understood as the ran-
dom movement that a particle does, and the Wiener process is one of the many possible inter-
pretations of this movement. In this way, many physicists understand Brownian motion as a
physical concept that has to do with the movement itself, while here we will understand it as a
mathematical object. In some chapters however when we talk about Brownian motion we will
refer to the physical concept. In any case, it should be clear to what we refer depending on the
context.
Definition 1.0.4. Let Xn be independent random variables that can only take values 1 or −1
with equal probability, i.e., P(Xn = 1) = 1/2 and P(Xn = −1) = 1/2. A one-dimensional
random walk with n steps is the sum of n of such variables Sn = X1 + X2 + . . . + Xn
1
CHAPTER 1. INTRODUCTION 2
There are many properties in common between the random walk and the Brownian motion. In
fact, the Brownian motion can be understood as a limit of a random walk, and that’s what we
will show here. First we need to make some definitions. There are many types of convergence
for random variables, we will need now the convergence in distribution.
Definition 1.0.5. Let X, X1, X2, . . . be random variables (which don’t need to be defined on
the same probability space). Let Fn, F be the distribution functions of Xn and X respectively.
We say Xn converges in distribution to X if for every t where F is continuous we have:
lim
n
Fn(t) = F(t) (1.4)
and we write Xn
d
→ X
This is the weakest type of convergence for random variables. Indeed it can be shown that
Xn
a.s
−→ X =⇒ Xn
P
−→ X =⇒ Xn
d
−→ X (1.5)
Convergence in distribution does not have good properties, for example it is not true that the
limit of the sum is the sum of the limits. However, when one of the sequences converges to a
constant, then we have the results we would expect.
Theorem 1.0.1 (Slutsky’s theorem). Assume that Xn
d
→ X and Yn
d
→ c, where c is a constant.
Assume also that every n, Xn and Yn are defined on the same probability space. Then
1. Xn + Yn
d
→ X + c
2. Xn · Yn
d
→ cX
3.
Xn
Yn
d
→
X
c
, if c = 0
Finally we will need the Central Limit Theorem, which is the most important Theorem in
Probability Theory. It basically states that we can approximate the sum of a large number of
random variables to the normal distribution. This has a huge number of applications in many
fields.
Theorem 1.0.2 (Central Limit Theorem, L´evy-Lindeberg version). Let X1, X2, . . . be iden-
pendent and identically distributed (i.i.d) random variables with finite second order moment.
Write E(Xn) = µ and Var(Xn) = σ2
, and let
¯Xn =
1
n
n
i=1
Xi (1.6)
and Z ∼ N(0, 1). Then
¯Xn − µ
σ√
n
d
−→ Z (1.7)
Now that we have these tools, we will proceed to show the relationship between random walk
and Brownian motion. Let ξ1, ξ2, . . . be a sequence of random variables with ξi = ±1 with
probability 1/2. Let Sn = ξ1 + . . . + ξn (S0 = 0), and let Xn
t (ω) be
Xn
t (ω) =
1
√
n
S nt (ω) + (nt − nt )
1
√
n
ξ nt +1(ω)
ψn,t
(1.8)
CHAPTER 1. INTRODUCTION 3
where x is the floor function, that is, it takes the largest integer that is smaller or equal than
x. Notice that a random walk is defined for discrete values. The previous definition admits any
value t ≥ 0. Because we have S nt instead of S t for big enough n the term
1
√
n
S nt will
change quickly as t grows. In a way we have made a ‘continuous’ random walk.
Theorem 1.0.3. With {Xn
} defined by (1.8), we have that for any t > 0
Xn
t
d
−→ Bt as n → ∞ (1.9)
where {Bt, t ≥ 0} is a Brownian motion.
Proof. First we see that ψn,t
P
−→ 0 as n → ∞. We have that
|ψn,t| = Xn
t −
1
√
n
S nt ≤
1
√
n
|ξ nt +1| (1.10)
and by Chebyshev inequality
P (|ψn,t| > ε) ≤ P
1
√
n
|ξ nt +1| > ε ≤
E 1√
n
ξ nt +1
2
ε2
=
1
ε2n
→ 0 (1.11)
Because ψn,t
P
−→ 0 this also means that ψn,t
d
−→ 0 se we can use Slutsky’s theorem (1.0.1) and
we obtain Xn
t has the same limit as
1
√
n
S nt .
By the Central Limit Theorem and because nt /n → t
1
nt
S nt
d
−→ N, N ∼ N(0, 1) (1.12)
If we consider Yn =
nt
√
n
, then Y
d
−→
√
t = c and we can use Slutzky’s theorem to
1
nt
S nt · Yn:
1
√
n
S nt =
1
√
n
nt
nt
S nt =
1
nt
S nt · Yn
d
−→
√
tN (1.13)
and because Xn
t has the same limit as
1
√
n
S nt we have that
Xn
t
d
−→
√
tN
d
= Bt (1.14)
This result gives us a feeling on the concept of Brownian motion, as we can understand it as a
limit of a random walk.
We have assumed that the random variables ξi can only take discrete values 1 and −1. There
is a stronger result, in which we don’t need to assume that the random variables take only
these two discrete values. It is called Donsker’s invariance Theorem and it is a generalization
of what we have just seen. If we take i.i.d random variables ξi Theorem (1.0.3) still holds true.
We won’t show this result here, but more details can be found in the book of Billinsgley [2].
The following Proposition can translate some properties we see in random walks to properties
in Brownian motion.
CHAPTER 1. INTRODUCTION 4
Proposition 1.0.1. Let C([0, ∞)) be the space of continuous functions with the topology of
uniform convergence on compacts. Then for every continuous Ψ : C([0, ∞]) → R we have that
Ψ(Xn
)
d
−→ Ψ(B) (1.15)
where Xn is defined by (1.8) and B = (Bt, t ≥ 0) is the Brownian motion.
Example 1.0.1. Let’s consider Y n
= max
0≤t≤T
Xn
t . The functional Ψ(f) = max
0≤t≤T
f(t) is continu-
ous, so we can apply Proposition (1.0.1). It tells us that
Y n d
−→ max
0≤t≤T
Bt (1.16)
This tool sometimes can be of great help, because if one has proved some property for the
random walk this Proposition can help with the proof for the Brownian motion taking limits.
However, we will encounter non-continuous functionals such as the stopping time:
τ = inf{n > 0, Sn = a} (1.17)
Because this functional is not continuous we cannot apply theorem (1.0.1). A consequence
of this is for example that to show the recurrence of the random walk and the recurrence
of Brownian motion we will need to prove these results separately. Although it seems quite
intuitive that properties in the random walk must keep true in the Brownian motion (and as a
matter of fact it almost always happens), we cannot deduce these results just taking limits.
Chapter 2
Random Walk
2.1 One-dimensional random walk
Definition 2.1.1. Let Xn independent be random variables that can only take values 1 or −1
with equal probability, i.e., P(Xn = 1) = 1/2 and P(Xn = −1) = 1/2. A one-dimensional
random walk with n steps is the sum of n of such variables Sn = X1 + X2 + . . . + Xn
In the following we will consider a particle that can move with equal probability to the left
(Xn = −1) and to the right (Xn = 1). The position it will be after n steps will be Sn. We
consider it always starts at the origin, that is, S0 = 0.
2.1.1 Back to original position
We are now interested in knowing whether the particle will ever return to the original position,
that is
P(∃n ≥ 1 : Sn = 0) (2.1)
For this computation we consider two different events. An will be the event that the particle
comes back to its original position for the first time at time n. We have then that A0 = ∅
because the particle could not come back as it didn’t even leave the origin yet, and A1 = ∅
because it is impossible to come back after 1 step. Then for n > 1 we define
An := {Sn = 0, Sn−1 = 0, . . . S1 = 0} (2.2)
Bn will be the event that the particle is in the original position, no matter if it’s not the first
time. That is
Bn := {Sn = 0} (2.3)
and we define the probabilities
an := P(An), bn := P(Bn) (2.4)
For n = 0 we have a0 = 0 and b0 = 1. Notice that for n ≥ 1
Bn =
n
k=0
(Bn ∩ Ak) (2.5)
because these events are disjoint we have
bn =
n
k=0
P(Bn ∩ Ak) (2.6)
5
CHAPTER 2. RANDOM WALK 6
and because of the independence of Ak and {Xk+1 + . . . + Xn = 0}:
P(Bn ∩ Ak) = P(Sn = 0, Sk = 0, Sk−1 = 0, . . . S1 = 0) (2.7)
= P(Ak, Xk+1 + . . . + Xn = 0) (2.8)
= P(Ak)P(Xk+1 + . . . + Xn = 0) (2.9)
Notice that
P(Xk+1 + . . . + Xn = 0) = P(X1 + . . . + Xn−k) (2.10)
hence we have just shown that
bn =
n
k=0
akbn−k (2.11)
Lemma 2.1.1. With the previous definitions the following equation holds
∞
n=0
an = 1 −
1
∞
n=0
bn
(2.12)
Proof. For values s ∈ (−1, 1) the series
∞
n=0
ansn
and
∞
n=0
bnsn
converge. Indeed, because an and
bn are bounded by 1, then
∞
n=0
an|s|n
≤
∞
n=0
|s|n
<
1
1 − |s|
< ∞ (2.13)
and absolute convergence implies convergence. If we multiply these series
∞
n=0
ansn
·
∞
n=0
bnsn
=
∞
n=0
cnsn
(2.14)
and if we compare the coefficients of sn
on the LHS and RHS we get cn =
∞
k=0
akbn−k. We
showed that a0 = 0, hence c0 = 0 and therefore
∞
n=0
ansn
·
∞
n=0
bnsn
=
∞
n=1
bnsn
=
∞
n=0
bnsn
− 1 (2.15)
thus we obtain ∞
n=0
ansn
= 1 −
1
∞
n=0
bnsn
(2.16)
but an and bn are always positive. If we do the limit s → 1−
we obtain a monotone increasing
sequence. Then by the Monotone Convergence Theorem the limit gives
∞
n=0
an = 1 −
1
∞
n=0
bn
(2.17)
CHAPTER 2. RANDOM WALK 7
Coming back to our previous problem, we want to see the probability that the particle will
come back to its original position:
P(∃n ≥ 1 : Sn = 0) = P(
∞
n=0
An) =
∞
n=0
an = 1 −
1
∞
n=0
bn
(2.18)
We will show that
∞
n=0
bn = ∞ and, therefore, the particle will come back to its original position
with probability 1. Let’s think what are the possible values of bn. To come back, the particle
will need to go left as many times as it goes right. If it does n steps, it will have to go n/2
times right and n/2 times left. If n is odd it’s clear that bn = 0. If n = 2k then there are 2k
k
different paths it can follow, k to the left and k to the right, each with probability 1/2. Thus
for n ≥ 1
bn =



0 , if n odd
2k
k
1
2
k
1
2
k
, if n = 2k
(2.19)
Recall that the Stirling’s approximation is
k! ∼
k
e
k √
2πk (2.20)
when k → ∞. Then we have for big enough k
b2k =
(2k)!
(k!)2
1
2
2k
∼
(2k)2k
√
4πk
k2k2kπ
1
22k
=
1
√
π
1
√
k
(2.21)
so we conclude ∞
n=0
bn =
∞
k=0
b2k = ∞ (2.22)
that means, the particle will come back to its original position with probability 1.
2.1.2 Get to a specific position
After showing that the particle will come back with probability 1 to its original position, we
could further analyse whether the particle will ever visit a specific position. Let’s define
f(x) := P(∃n ≥ 1 : Sn = x) (2.23)
Lemma 2.1.2. With the previous definition,
f(x) =
1
2
f(x − 1) +
1
2
f(x + 1) (2.24)
CHAPTER 2. RANDOM WALK 8
Proof. Suppose x = 1, −1, then
f(x) = P(∃n ≥ 1 : Sn = x)
= P(∃n ≥ 1 : X1 + . . . + Xn = x)
= P(∃n ≥ 1 : X1 + . . . + Xn = x, X1 = 1) + P(∃n ≥ 1 : X1 + . . . + Xn = x, X1 = −1)
= P(∃n ≥ 1 : X1 + . . . + Xn = x|X1 = 1)P(X1 = 1)+
+ P(∃n ≥ 1 : X1 + . . . + Xn = x|X1 = −1)P(X1 = −1)
=
1
2
P(∃n ≥ 2 : X2 + . . . + Xn = x − 1) +
1
2
P(∃n ≥ 2 : X2 + . . . + Xn = x + 1)
=
1
2
P(∃n − 1 ≥ 1 : X1 + . . . + Xn−1 = x − 1) +
1
2
P(∃n − 1 ≥ 1 : X1 + . . . + Xn−1 = x + 1)
=
1
2
P(∃m ≥ 1 : X1 + . . . + Xm = x − 1) +
1
2
P(∃m ≥ 1 : X1 + . . . + Xm = x + 1)
=
1
2
f(x − 1) +
1
2
f(x + 1)
For x = 1, −1 because f(0) = 1 if S0 = 0 then f(1) =
1
2
+
1
2
f(2) and f(−1) =
1
2
f(−2)+
1
2
.
Suppose f(x) = 1 for some x, then
1 = f(x) =
1
2
f(x − 1) +
1
2
f(x + 1) (2.25)
but f(x − 1) ≤ 1 and f(x + 1) ≤ 1 because they are probability measures. Thus to obtain
the previous equality follows that f(x − 1) = 1 and f(x + 1) = 1. By induction using that we
have already seen that f(0) = 1 we can cover the whole line, so we proved that f(x) = 1 for
all x ∈ Z.
2.1.3 Expected time to get back to origin
The aim of this section will be to compute the “average” time the particle will need to get back
to the original position. One could at first think that this time will not be very large. After
all, the probability that it will go back to the origin after the first step, whichever this is, is
1/2. We will however show that the average time is infinite.
Lemma 2.1.3.
1
√
1 − 4x
=
∞
m=0
2m
m
xm
(2.26)
Proof. We will use the generalized binomial theorem, which states that
(x + y)r
=
∞
r=0
r
k
xr−k
yk
(2.27)
where
r
k
=
r(r − 1) . . . (r − k + 1)
k!
(2.28)
Let’s apply this formula to our problem:
(1 − 4x)−1/2
=
∞
m=0
m
k=1(2k − 1)
2mm!
(4x)m
=
∞
m=0
m
k=1(2k − 1)
m!
2m
xm
(2.29)
CHAPTER 2. RANDOM WALK 9
so we need to see that the coefficients coincide, that is
m
k=1(2k − 1)
m!
2m
=
2m
m
(2.30)
the last equation can be rewritten in a simpler way
m
k=1
(2k − 1)2m
=
(2m)!
m!
=
2m
k=m+1
k (2.31)
Let’s show it by induction. For m = 1 the equation holds. Suppose it true for m. For m + 1
we have
m+1
k=1
(2k − 1)2m+1
= 2(2m + 1)2m
m
k=1
(2k − 1) (2.32)
and
2m+2
k=m+2
k =
1
m + 1
(2m + 2)(2m + 1)
2m
k=m+1
k (2.33)
using the induction hypothesis
2(2m + 1) =
1
m + 1
(2m + 2)(2m + 1) (2.34)
which is true.
Theorem 2.1.1. For m ≥ 1, the probability of a first return to the origin at a time 2m is
given by
a2m =
b2m
2m − 1
=
2m
m
(2m − 1)22m
(2.35)
Proof. Let’s begin defining the functions
U(x) =
∞
m=0
b2mxm
(2.36)
and
F(x) =
∞
m=0
a2mxm
(2.37)
Since we know that for m ≥ 1
b2m =
2m
m=0
a2kb2m−2k (2.38)
then
U(x) = 1 + U(x)F(x) (2.39)
where the 1 in the RHS from the last equation comes from the fact that b0 = 1. We note that
both functions converge on the interval (−1, 1), since both an and bn are less than 1 in absolute
value. Thus solving for F(x)
F(x) =
U(x) − 1
U(x)
(2.40)
From (2.19) we have that
U(x) =
∞
m=0
2m
m
2−2m
xm
(2.41)
CHAPTER 2. RANDOM WALK 10
and from (2.26)
1
√
1 − 4x
=
∞
m=0
2m
m
xm
(2.42)
so that
U(x) =
1
√
1 − x
(2.43)
and therefore
F(x) =
U(x) − 1
U(x)
(2.44)
=
(1 − x)−1/2
− 1
(1 − x)−1/2
(2.45)
= 1 − (1 − x)1/2
(2.46)
and we note that F (x) = U(x)/2. So if we integrate the series U(x)/2 and equate the coeffi-
cients of these series to those of F(x), we can obtain an expression for a2m:
a2m =
b2m−2
2m
=
2m−2
m−1
m22m−1
=
2m
m
(2m − 1)22m
=
b2m
2m − 1
where we have used in the third step that
2m − 2
m − 1
=
m
2(2m − 1)
2m
m
Corollary 2.1.1. The expected time to get back to the origin is infinite
Proof. From (2.35) we know the expression of a2m
a2m =
b2m
2m − 1
and from (2.21) we know that
b2m ∼
1
√
m
so we conclude that
a2m ∼
1
m
√
m
(2.47)
hence the expected time to get back to the origin diverges
E(T) =
∞
m=1
a2m · 2m ∼
∞
m=1
2m
m
√
m
=
∞
m=1
2
√
m
= ∞ (2.48)
CHAPTER 2. RANDOM WALK 11
2.2 Two-dimensional random walk
Definition 2.2.1. Let Xn be independent random vectors that can take values (1, 0), (0, 1),
(0, −1) or (−1, 0) with equal probability of 1/4. A two-dimensional random walk with n steps
is the sum of such random vectors Sn = X1 + X2 + . . . + Xn
In this case the particle will be able to move up, down, left and right.
2.3 Back to the original position
We are interested in knowing if it will come back to the origin, as it happened for 1 dimension.
That is, we want to compute
P(∃n ≥ 1 : Sn = 0) (2.49)
Using the same definitions as before,
an := P(Sn = 0, Sn−1 = 0, . . . , S1 = 0)
bn := P(Sn = 0)
and
P(∃n ≥ 1 : Sn = 0) =
∞
n=0
an = 1 −
1
∞
n=0
bn
(2.50)
Hence if
∞
n=0
bn = ∞, the probability that it will come back to the origin will be 1.
Note that in order to come back to the origin we need the same amount of up and down steps,
and the same amount of left and right steps. That makes bn = 0 for n odd.
If n = 2k then each path that finishes in the origin has equal probability
1
42k
. Now let’s count
how many possible paths there are. The particle may go j steps up and j steps down, and k −j
left and k − j right (note that the number total of steps is 2k), where j can be any number for
0 to k. If every step were different, there would be (2k)! choices, but given any path we can
reorder the j down steps in j! different ways without changing the path. The same holds for
up, left and right steps. Thus the number of possible combinations is
(2k)!
j!j!(k − j)!(k − j)!
(2.51)
and the probability
bn =
1
42k
k
j=0
(2k)!
j!j!(k − j)!(k − j)!
(2.52)
CHAPTER 2. RANDOM WALK 12
We can rewrite bn as follows
b2k =
1
42k
k
j=0
(2k)!
j!j!(k − j)!(k − j)!
(2.53)
=
1
42k
k
j=0
2k
k!k!
k!k!
j!j!(k − j)!(k − j)!
(2.54)
=
1
42k
2k
k
k
j=0
k
j
2
(2.55)
=
1
42k
2k
k
2
(2.56)
where we have use the equation
k
j=0
k
j
2
=
2k
k
(2.57)
Let’s explain from where this formula comes. We know by Newton Binomial that
(x + 1)2k
=
2k
i=0
2k
i
xi
(2.58)
but this can also be writen as
(x + 1)k
(x + 1)k
=
k
j=0
k
j
xj
k
i=0
k
i
xi
(2.59)
the coefficient of xk
in both expressions have to be the same, that is
2k
k
=
k
j=0
k
j
k
k − j
=
k
j=0
k
j
k
j
=
k
j=0
k
j
2
(2.60)
then
b2k =
1
22k
2k
k
2
(2.61)
If we look closely we will see that this is the same expression as in one dimension to the square.
Using Stirling’s formula,
b2k =
1
22k
2k
k
2
∼
1
πk
(2.62)
And finally we see that the following series is divergent
∞
n
bn ≥
∞
k=0
b2k = ∞ (2.63)
and hence
P(∃n ≥ 1 : Sn = 0) = 1 (2.64)
CHAPTER 2. RANDOM WALK 13
2.4 Get to a specific position
As for the one-dimensional case, it can be seen that the particle will reach any position with
probability 1 in the plane. Let x = x1e1 + x2e2, with x1, x2 ∈ Z, e1 = (1, 0), e2 = (0, 1) and
g(x) be the probability that there exists n ≥ 1 such that Sn = x, i.e.
g(x) = P(∃n ≥ 1 : Sn = x) (2.65)
The same reasoning as in the one-dimensional case shows that
g(x) =
1
4
(g(x − e1) + g(x + e1) + g(x − e2) + g(x + e2)) (2.66)
and because g(x) are probabilities, 0 ≤ g(x) ≤ 1. So if g(x) = 1 it must follow that g(x − e1) =
g(x + e1) = g(x − e2) = g(x + e2) = 1. But we showed in the previous section that g(0) = 1,
so inductively follows that g(x) = 1 for every x.
2.5 Three-dimensional random walk
Definition 2.5.1. Let Xn be independent random vectors that can take values (1, 0, 0), (0, 1, 0),
(0, 0, 1), (−1, 0, 0), (0, −1, 0) or (0, 0, −1) with equal probability of 1/6. A three-dimensional
random walk with n steps is the sum of such random vectors Sn = X1 + X2 + . . . + Xn
Now the particle has freedom to move along up, down, left, right, backward and forward.
2.6 Back to the origin
Adapting the same definitions as in previous sections we have
P(∃n ≥ 1 : Sn = 0) =
∞
n=0
an = 1 −
1
∞
n=0
bn
(2.67)
so the particle will go back to the origin if
∞
n=0
bn = ∞.
As before for n ≥ 1 odd
bn = P(Sn = 0) = 0 (2.68)
If n = 2k then the same reasing as in the two-dimensional case applies. The particle can go j
steps up and down, i backward and forward and k − j − i left and right. If every path were
differenth there would be (2k)! possibilites, but because we can reorder all the j up and down
steps in j!j! ways, all the i!i! backward and forward steps in i! ways and all the k − j − i left
and right steps in (k − j − i)!(k − j − i)! ways without changing the path, the probability is
b2k =
1
62k
k
j=0
k−j
i=0
(2k)!
j!j!i!i!(k − j − i)!(k − j − i)!
(2.69)
CHAPTER 2. RANDOM WALK 14
where we are summing over all the possible values of j and i. If we rewrite b2k we obtain
b2k =
1
62k
k
j=0
k−j
i=0
(2k)!
j!j!i!i!(k − j − i)!(k − j − i)!
(2.70)
=
1
22k
1
32k
k
j=0
k−j
i=0
2k
k!k!
k!k!
j!j!i!i!(k − j − i)!(k − j − i)!
(2.71)
=
1
22k
2k
k
k
j=0
k−j
i=0
1
32k
k!k!
j!j!i!i!(k − j − i)!(k − j − i)!
(2.72)
=
1
22k
2k
k
k
j=0
k−j
i=0
1
3k
k!
j!i!(k − j − i)!
2
(2.73)
The terms in the last summation are the terms of a trinomial distribution. This can be thought
as the urn problem given k draws with replacement where we have white, black and red balls.
If X, Y and Z are random variables that take values on the number of white, black and red
balls drawn respectively then for j + i ≤ k
P(X = j, Y = i, Z = k − j − i) =
1
3k
k!
j!i!(k − j − i)!
(2.74)
Hence the sum of the probability of all possible outcomes has to be 1, that is
k
j=0
k−j
i=0
1
3k
k!
j!i!(k − j − i)!
= 1 (2.75)
but in the expression above we have the summation of the square terms.
If a random variable can only take n values with probabilities p1, . . . , pn then
n
j=1
p2
j ≤
n
j=1
pj( max
1≤i≤n
pi) ≤ ( max
1≤i≤n
pi)
n
j=1
pj = ( max
1≤i≤n
pi) (2.76)
therefore
b2k ≤
1
22k
2k
k
max
1≤i,j≤k
1
3k
k!
j!i!(k − j − i)!
(2.77)
Let’s think where this term achieves its maximum. It will be when the denominator is minimum.
If k = 3m from the definition of factorial itself it can be easily checked that the denominator
takes its minimum when j = m, i = m and k − j − i = m. If k = 3m + 1 then it will be when
two of them are m and one m + 1 and if k = 3m − 1 when two of them are m and one m − 1.
For k = 3m
b2k ≤
1
22k
2k
k
1
3k
k!
m!m!m!
(2.78)
and using Stirling’s approximation
1
22k
2k
k
1
3k
k!
m!m!m!
∼
1
√
πk
(3m
e
)3m
√
6mπ
(m
e
)m
√
2mπ
=
C1
k
√
k
(2.79)
where C1 is a constant.
For k = 3m + 1 and k = 3m − 1 the behaviour for big enough values will be the same as in the
case k = 3m, so
∞
k=0
b2k ≤ C
∞
k=0
1
k
√
k
< ∞ (2.80)
CHAPTER 2. RANDOM WALK 15
This shows that the probability to come back to the origin is strictly less than 1. But the
probability is also strictly positive. For example, we know that a2 =
1
6
. That is, after the
first step the probability that it will come back is the probability that it will take a step in the
opposite way to the first step.
We see that as we are including more dimensions, the power of k in the denominator of b2k
increases. In dimensions higher than 3 we would expect that the power of k is even higher,
making the probability to return to origin even smaller than for d = 3. The idea widely speaking
is that as we grow in dimensions there are more ‘choices’ for the movement of the particle and
that makes it more ‘difficult’ for the particle to come back. We will however not show that for
d > 3 the probability of coming back to the origin of the random walk is less than 1.
2.7 Get to a specific position
Adapting the same definitions as in the previous sections for the three-dimensional case,
g(d) =
1
6
(g(d + e1) + g(d + e2) + g(d + e3)+
+ g(d − e1) + g(d − e2) + g(d − e3))
if d were a point such that g(d) = 1 then
g(d + e1) + g(d + e2) + g(d + e3) + g(d − e1) + g(d − e2) + g(d − e3) = 1 (2.81)
but by induction we would arrive to g(0) = 1, which contradicts what we have just shown.
Therefore it must be g(d) < 1 for all d ∈ Z3
.
Chapter 3
Simulations: Random walks
In this chapter we will run different simulations to compare experimental results to theoretical
results explained in the previous chapters. For most simulations we will use Python, and in
some cases Java. All scripts have been made by David Nebra unless otherwise stated.
3.1 One-dimensional random walk
We will run several simulations of random walks starting at the origin and count the number of
steps it takes for the particle to get back to the origin for the first time for every simulation. We
will gather this information in two histograms. In the same plots we will draw the curve that
represents the theoretical probabilites, computed in Theorem (2.35). For the first histogram
we run 50000 simulations and every simulation will be cut off if after 60 steps the particle has
not returned to the origin.
For the second histogram we run 10000 simulations and every simulation will be cut off if after
3000 steps the particle has not returned to the origin. In order to represent the information
in the second histogram, the x-axis and y-axis will be in log scale so we can see a better
representation of the data.
Figure 3.1
For a closer look at the results depicted in 3.1 we show the following table, which compares the
16
CHAPTER 3. SIMULATIONS: RANDOM WALKS 17
values obtained by both the simulation and the theory.
N Theory Simulations Desviation (%)
2 25000 25030 0.1
4 6250 6196 -0.8
6 3125 3139 0.4
8 1953 1956 0.14
10 1367 1389 1.5
12 1025 1016 -0.9
14 806 780 -3.2
16 655 683 4.3
18 545 590 8.2
20 463 469 1.1
22 400 396 -1.1
24 350 359 2.5
26 310 293 -5.4
28 277 301 8.7
30 249 237 -4.8
N Theory Simulations Desviation (%)
32 226 240 6.3
34 206 235 14.1
36 189 176 -6.7
38 174 181 4.2
40 161 154 -4.2
42 149 149 0
44 139 128 -7.9
46 130 120 -7.6
48 122 96 -21.2
50 115 104 -9.2
52 108 115 6.5
54 102 104 2.0
56 96 91 -5.6
58 92 91 -0.5
Table 3.1: This table gather both the theoretical and experimental frequencies, and also the
desviation with respect to the theoretical values.
The desviation has been calculated as
Desviation =
Experimental frequencies − Theoretical frequencies
Theoretical frequencies
· 100 (3.1)
Looking into the data in the table we observe a trend that we could not see in the plotted
graph. We observe that the desviation (i.e the error) grows as the number of steps grows. This
is something we should expect, because the number of particles that go back to origin after
N steps decreases as N grows. That means that we have less data available for N big and
therefore the simulations are less accurate. This is a direct implication of the Law of Large
Numbers (see page 8 of the reference [5]).
For the theoretical counts, we have used the formula 2.35. The expected count Y2m of the
number of particles that reach back the origin after 2m steps will be given by
E(Y2m) = N · a2m (3.2)
where N is the total number of simulations.
For example, the expected count of particles that come back to origin after 2 steps for 50000
simulations is
E(Y2m) = 50000 ·
1
2
= 25000 (3.3)
Now we will see another simulation in log-log scale.
CHAPTER 3. SIMULATIONS: RANDOM WALKS 18
Figure 3.2: Particles to reach back origin in log-log scale
It is important to remark that even though the bins in the figure (3.2) are the same width,
the more to the right they are the more number of steps they represent. To make it easier to
understand let’s take an example, the bin 0 to 1 is the sum of all the simulations in which the
particle returned back to the origin and took between e0
= 1 and e1
= 2.71 . . . steps. So we
now that the bin 0 to 1 only represent the case when the particle returned back to the origin
after 2 steps. If we take the bin 7 to 8 it represents all the simulations in which the particle
returned back to the origin and took between e7
= 1096.63 . . . and e8
= 2980.95 . . . steps. So
this bin counts for every simulation in which it took the particle 1098 steps, or 1100 steps,...,
or 2980 steps to go back to the origin.
We can collect this data in a table:
log(N) Theory Simulations Desviation
[0 − 1) 5000 4921 -1.5
[1 − 2) 1875 1906 1.6
[2 − 3) 1363 1356 -0.5
[3 − 4) 681 680 -0.1
[4 − 5) 426 445 4.4
[5 − 6) 257 285 10.8
[6 − 7) 156 146 -6.8
[7 − 8) 94 90 -5.1
3.1.1 Code
The following script runs M different simulations of random walks of length at most N. For
every simulation when the random walk reaches 0 for the first time it stops the simulation and
keeps the number of steps in a vector v.
def SimRandomWalk(N=100, M=1000):
v=[]
for l in range (1 ,M) :
CHAPTER 3. SIMULATIONS: RANDOM WALKS 19
x=numpy . random . uniform ( −0.5 ,0.5 ,(N, 1 ) )
x[0]=0
i=1
k=0
suma=1
while suma!=0 and i<N or k==0:
i f k==0:
k=1
suma=0
i f x [ i ] >0:
x [ i ]=1
else :
x [ i ]=−1
suma=suma+x [ i ]
i=i+1
i f suma==0:
v . append ( i −1)
return v
The next script on the one hand computes the theoretical probabilities a2m (yam in the script)
and then it plots these probabilites together with an histogram of the simulations. This is the
code used for plotting figure (3.1).
def freqHistogram1D (N=30,M=50000):
f=math . f a c t o r i a l
yam=[]
xam=[]
for m in range (1 ,N) :
yam. append (M* f (2*m)/( f (m)* f (m)*(2*m−1)*2**(2*m) ) )
xam. append(1+2*m)
X=SimRandomWalk(2*N,M)
(n , bins , patches ) = plt . h i s t (X, bins=N−1)
#p l t . s c a t t e r (xam,yam, c=’r ’)
plt . plot (xam,yam, c=’ r ’ )
red patch = mp. Patch ( color=’ red ’ , l a b e l=’ Theoretical frequencies ’ )
blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ )
plt . legend ( handles =[ red patch , blue patch ] )
plt . xlabel ( ’N’ )
plt . ylabel ( ’ Frequency ’ )
plt . show ()
xam [ : ] = [ x−1 for x in xam]
yam=numpy . array (yam)
X=numpy . array (X)
for i in range (0 ,N−1):
print (( n [ i ]−yam[ i ] ) /yam[ i ] )
print (xam,yam, n)
Lastly, to make the plot in figure (3.2) we used the following code.
def freqHistogram1DLogLog (N=3000,M=10000):
f=math . f a c t o r i a l
yam=[]
CHAPTER 3. SIMULATIONS: RANDOM WALKS 20
xam=[]
bins=9
suma1 , suma2 , suma3 , suma4 , suma5 , suma6 , suma7 , suma8 , suma9 = [ 0 ] * 9
for m in range (1 ,N) :
mm=2*m
yam. append (M* f (mm)/( f (m)* f (m)*(mm−1)*2**(mm) ) )
i f 0<=math . log (mm)<1:
suma1=suma1+yam[m−1]
e l i f 1<math . log (mm)<2:
suma2=suma2+yam[m−1]
e l i f 2<math . log (mm)<3:
suma3=suma3+yam[m−1]
e l i f 3<math . log (mm)<4:
suma4=suma4+yam[m−1]
e l i f 4<math . log (mm)<5:
suma5=suma5+yam[m−1]
e l i f 5<math . log (mm)<6:
suma6=suma6+yam[m−1]
e l i f 6<math . log (mm)<7:
suma7=suma7+yam[m−1]
e l i f 7<math . log (mm)<8:
suma8=suma8+yam[m−1]
e l i f 8<math . log (mm)<9:
suma9=suma9+yam[m−1]
yam=[suma1 , suma2 , suma3 , suma4 , suma5 , suma6 , suma7 , suma8 , suma9 ]
for m in range (0 , bins ) :
xam. append (0.5+m)
X=l i s t (map(math . log , SimRandomWalk(2*N,M) ) )
(n , bins , patches ) = plt . h i s t (X, bins=numpy . arange ( bins ) , log=True )
plt . plot (xam,yam, c=’ r ’ )
plt . xlabel ( ’ log (N) ’ )
plt . ylabel ( ’ Frequency ’ )
red patch = mp. Patch ( color=’ red ’ , l a b e l=’ Theoretical frequencies ’ )
blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ )
plt . legend ( handles =[ red patch , blue patch ] )
for i in range ( 0 , 8 ) :
print (( n [ i ]−yam[ i ] ) /yam[ i ] )
print (xam,yam, n)
plt . show ()
3.2 Two-dimensional random walk
The simulations here are identical as in the previous section, but for two-dimensional random
walks. The first histogram shows the count of all the particles that come back to origin after
60 steps. The values we selected for making the second plot are N = 60 and M = 50000, being
M the number of simulations. In the second histogram, we took N = 1000 and M = 10000.
CHAPTER 3. SIMULATIONS: RANDOM WALKS 21
Figure 3.3
From this chart we could try to compute the probabilites an. We just need to read from the
plot the number of particles that returned after n steps, and then divide by the total number
of simulations, that is M = 50000. For example,
a2 ≈
12500
50000
= 1/4 = 0.25
a4 ≈
4000
50000
= 2/25 = 0.08
a6 ≈
2000
50000
= 1/25 = 0.04
. . .
If we take into account again the Law of Large Numbers, this method would allow us to re-
construct the theoretical probabilites an. Of course, it would only be an approximation, but
it can be as good as we want, we just need big values of M. For an with n big there will be
trouble because we will need much computation power, but for small values of n one can find
the probability with great accuracy.
The next plot is again in log-log scale for better visualization. Because we have no theoretical
data to compare it with, we have computed the regression line y = mx + b. For its calculation,
we have taken the middle point of every bin and its corresponding log frequency. Because the
y-axis of the plot are in logarithmic scale, we actually draw 10y
instead of y, so we would see
a line in the plot. Exact details of its calculation can be found in the code.
CHAPTER 3. SIMULATIONS: RANDOM WALKS 22
Figure 3.4: Plot and regression line y = mx + b with m = −0.14 and b = 3.38
This regression line can help us make some rough predictions. For example, if we take the value
x = 12.5 with the information of the regression line we know that a total of 10y
= 10−0.14·12.5+3.38
simulations reached back the origin between e12
and e13
steps. That is, only 43 simulations
from a total of 10000 reached back the origin for the first time after doing between 162754
and 442414 steps. In the next section we will compare this regression line to that of the three
dimensional case.
3.2.1 Code
The following script runs M different simulations of random walks of length at most N. For
every simulation when the random walk reaches 0 for the first time it stops the simulation and
keeps the number of steps in a vector v.
def SimRandomWalk2D(N=100,M=1000):
v=[]
for l in range (1 ,M) :
x=numpy . random . uniform ( −0.5 ,0.5 ,(N, 1 ) )
x[0]=0
i=1
k=0
sumax=1
sumay=1
while (sumax!=0 or sumay!=0) and i<N or k==0:
i f k==0:
k=1
sumax=0
sumay=0
i f x [ i ] >0.25:
sumax=sumax+1
CHAPTER 3. SIMULATIONS: RANDOM WALKS 23
i f x [ i ]>0 and x [ i ] <0.25:
sumax=sumax−1
i f x [ i ] < −0.25:
sumay=sumay+1
i f x [ i ]<0 and x [ i ] > −0.25:
sumay=sumay−1
i=i+1
i f sumax==0 and sumay==0:
v . append ( i −1)
return v
for plotting figure (3.3):
def freqHistogram2D (N=30,M=50000):
plt . h i s t (SimRandomWalk2D(2*N,M) , bins=N−1)
blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ )
plt . legend ( handles =[ blue patch ] )
plt . xlabel ( ’N’ )
plt . ylabel ( ’ Frequency ’ )
and for plotting figure (3.4):
def freqHistogram2DLogLogLine (N=1000,M=10000):
bins=9
xam=[]
logn =[]
x = numpy . linspace (0 ,8 ,100)
X=l i s t (map(math . log , SimRandomWalk2D(2*N,M) ) )
(n , bins , patches ) = plt . h i s t (X, bins=numpy . arange ( bins ) , log=True )
blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ )
plt . legend ( handles =[ blue patch ] )
plt . xlabel ( ’ log (N) ’ )
plt . ylabel ( ’ Frequency ’ )
for m in range ( 0 , 8 ) :
xam. append (0.5+m)
i f n [m]!=0:
logn . append (math . log10 (n [m] ) )
else :
logn . append (0)
print ( logn ,xam)
m, b = numpy . p o l y f i t (xam, logn , 1)
plt . plot (x , 10**(m*x+b ) , ’−’ )
print (m, b)
3.2.2 Path samples
CHAPTER 3. SIMULATIONS: RANDOM WALKS 24
Figure 3.5: Two different simulations for a 2D random walk. The particle (blue) will go up,
down, left or right with equal probability.
3.2.3 Code
We used a code in Java provided by Princeton:
public class randomWalk2 {
public static void main( String [ ] args ) {
int N = 60;
StdDraw . setXscale(−N, +N) ;
StdDraw . setYscale(−N, +N) ;
StdDraw . c l e a r (StdDraw .GRAY) ;
int x = 0 , y = 0;
int steps = 0;
while (Math . abs (x) < N && Math . abs (y) < N) {
StdDraw . setPenColor (StdDraw .WHITE) ;
StdDraw . f i l l e d S q u a r e (x , y , 0 . 4 5 ) ;
double r = Math . random ( ) ;
i f ( r < 0.25) x−−;
else i f ( r < 0.50) x++;
else i f ( r < 0.75) y−−;
else i f ( r < 1.00) y++;
steps++;
StdDraw . setPenColor (StdDraw .BLUE) ;
StdDraw . f i l l e d S q u a r e (x , y , . 4 5 ) ;
StdDraw . show ( 4 0 ) ;
}
StdOut . println ( ”Total steps = ” + steps ) ;
}
}
The functions StdDraw and StdOut are just for drawing and printing the results. They are
CHAPTER 3. SIMULATIONS: RANDOM WALKS 25
defined in other documents but they are not interesting for our purposes. The algorithm creates
a loop, for which in each step a random number r in the interval (0, 1] is created. The interval
is divided into four equal parts. Depending on the value of r the particle will go down, up, left
or right.
3.3 Three-dimensional random walk
The first two simulations in the section are identical as in the previous section, but for three-
dimensional random walks. The values for the first histogram are N = 60 and M = 50000 and
for the second histogram N = 1000 and M = 10000. The histograms are the following
Figure 3.6
As before, we could compute the probabilites an with the information in the plot
a2 ≈
8500
50000
= 0.17 (3.4)
a4 ≈
2000
50000
= 0.04 (3.5)
a6 ≈
1000
50000
= 0.02 (3.6)
. . . (3.7)
Next histogram is in log-log scale for better visualization, and the regression line has been
calculated
CHAPTER 3. SIMULATIONS: RANDOM WALKS 26
Figure 3.7: Plot and regression line y = mx + b with m = −0.24 and b = 3.24
Before we move on, let’s have a look at the regression lines for the 2D and 3D random walks.
For the 2D random walk we obtained y = −0.14x + 3.38 while for the 3D random walk y =
−0.24x + 3.24.
First we start with the similarities. They both have a negative slope and a positive intercept.
This all makes sense, a negative slope means that the number of particles that come back to
the origin after N steps is smaller than the number that come back after n steps, where N > n.
Alternatively, the more steps that a particle has been away from the origin, the less ‘probable’
it is to come back in the next step. For this reason, the intercept must be positive. Otherwise
it would lack of any physical sense as the number of steps would take negative values.
The big difference between them is the slope of the regression lines. For the 2D case we have
m = −0.14 and for the 3D m = −0.24 which is a difference close to 50%. This means that
the increment ∆N = N2 − N1, where N2 > N1, is smaller for 2D than for 3D. That is, the
histogram for 3D is more ‘heavy’ for small values of N and it decreases faster to 0 as N grows
than for the 2D case.
3.3.1 Code
The following script runs M different simulations of random walks of length at most N. For
every simulation when the random walk reaches 0 for the first time it stops the simulation and
keeps the number of steps in a vector v.
def SimRandomWalk3D(N=100,M=1000):
v=[]
for l in range (1 ,M) :
x=numpy . random . uniform (0 ,6 ,(N, 1 ) )
x[0]=0
i=1
k=0
sumax=1
CHAPTER 3. SIMULATIONS: RANDOM WALKS 27
sumay=1
sumaz=1
while (sumax!=0 or sumay!=0 or sumaz!=0) and i<N or k==0:
i f k==0:
k=1
sumax=0
sumay=0
i f x [ i ]>0 and x [ i ] <1:
sumax=sumax+1
i f x [ i ]>1 and x [ i ] <2:
sumax=sumax−1
i f x [ i ]>2 and x [ i ] <3:
sumay=sumay+1
i f x [ i ]>3 and x [ i ] <4:
sumay=sumay−1
i f x [ i ]>4 and x [ i ] <5:
sumaz=sumaz+1
i f x [ i ]>5 and x [ i ] <6:
sumaz=sumaz−1
i=i+1
i f sumax==0 and sumay==0 and sumaz==0:
v . append ( i −1)
return v
for plotting figure (3.6):
def freqHistogram3D (N=30,M=50000):
plt . h i s t (SimRandomWalk3D(2*N,M) , bins=N−1)
blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ )
plt . legend ( handles =[ blue patch ] )
plt . xlabel ( ’N’ )
plt . ylabel ( ’ Frequency ’ )
and for plotting figure (3.7):
def freqHistogram3DLogLogLine (N=1000,M=10000):
bins=9
xam=[]
logn =[]
x = numpy . linspace (0 ,8 ,100)
X=l i s t (map(math . log , SimRandomWalk3D(2*N,M) ) )
(n , bins , patches ) = plt . h i s t (X, bins=numpy . arange ( bins ) , log=True )
blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ )
plt . legend ( handles =[ blue patch ] )
plt . xlabel ( ’ log (N) ’ )
plt . ylabel ( ’ Frequency ’ )
for m in range ( 0 , 8 ) :
xam. append (0.5+m)
i f n [m]!=0:
logn . append (math . log10 (n [m] ) )
else :
logn . append (0)
CHAPTER 3. SIMULATIONS: RANDOM WALKS 28
print ( logn ,xam)
m, b = numpy . p o l y f i t (xam, logn , 1)
plt . plot (x , 10**(m*x+b ) , ’−’ )
print (m, b)
Chapter 4
Brownian motion
4.1 History of Brownian motion
Brownian motion takes its name after a Scottish botanist, Robert Brown. Brown was a famous
man in his time, but not for the discovery that has his name, but for the classification of the
plants of the New World. When looking through a microscope in 1827 at grains of pollens
suspended in water, Brown noticed that a group of grains always disperses and that individual
grains move around continuously, irregularly and very quickly. Such phenomena were observed
already prior to Brown, but only in organic particles. It was believed back then that it was a
property from organic molecules, having some kind of mysterious ‘vital force’. Brown was not
very excited about this idea that could fit the living pollen, so he decided to check if the same
motion was observed with non-organic particles. Both organic and non-organic particles dis-
played the same kind of motion, which showed that the motion had a physical origin. Brown’s
limited equipment could only show that this motion was not caused by currents in the liquid,
nor by convection, nor by evaporation of the solvent.
The mystery was left unsolved for many years. It was not considered as an important problem
in Physics but nevertheless many people attempted to solve it. Appart from the causes that
Brown himself showed that were not responsible for Brownian motion, chemical composition,
shape of container, and several of external influence were eliminated as possible causes. After
Maxwell and Boltzmann formulated the so-called kinetic theory, many physicists tried to ex-
plain Brownian motion in those terms, in particular by determining the velocity of the particles.
All those attempts failed.
Now all these failures are of historical interest, but back to the beginning of the 20th
they
were of great importance for two men: Albert Einstein and Marian Smoluchowski. That many
scientists had failed to explained the Brownian motion in terms of conventional Physics pre-
pared the ground for a new revolutionary explanations proposed by them. The year 1905 is
considered to be a miracle year for theoretical physics. In this year not only Einstein did pub-
lish a famous paper where he explained the mechanism of the Brownian motion, but he also
published two papers lying foundations for the Special Theory of Relativity and one explaining
the photoelectric effect, that would win him the Nobel prize in 1921. An independent paper
explaining also the Brownian motion was published in 1905 by Smoluchowski. This new and
revolutionary concepts were for many years heavily opposed by leading scientists.
Einstein’s and Smoluchowski’s idea was that the movement of Brownian particles was caused
by collisions with molecules of the solvent. This molecules move in display of their thermal
energy, of which the temperature is a measure. When a particle is suspended in any fluid,
like air or water, the atoms or molecules composing the fluid hit the particle from different
directions. While the human eye cannot see the effect of individual impacts, it can observe the
net motion caused by many impacts over a period of time. While this explanation may seem
29
CHAPTER 4. BROWNIAN MOTION 30
today trivial, it was far from trivial over 100 years ago. In fact, the atomistic hypothesis, that
is, the hypothesis that matter is grainy and cannot be continuously divided infinitely, was not
commonly accepted. Some scientists treated it as an unsupported working hypothesis and oth-
ers, including eminent figures as Wilhelm Ostwald, the 1909 Nobel Prize in chemistry, opposed
it vigorously.
Einstein and Smoluchowski claimed that this motion provided a proof of the existence of
molecules in the solvent and, what is more, that by observing the Brownian particles one
could get much insight into the properties of the molecules of the solvent. They observed that
the mean displacement of a particle (squared) was proportional to the duration of the obser-
vation, and that the proportionality constant was related to the so-called diffusion coefficient
D:
E[(Bt − B0)2
] = 2Dt, D =
KBT
γ
(4.1)
where KB is the Boltzmann constant, T the temperature and γ = 6πνR is the Stokes friction
coefficient for a spehere with radius R. These results rendered feasible many specific measures,
for example it was possible to experimentally determine the Avogadro constant.
It is interesting to know that explaining Brownian motion was not Einstein’s goal. He was
aiming to establish a relationship between the diffusion coefficient and the themperature, in
which he succeeded, but he also guessed what the thermal motion should look like. On the
contrary, Smoluchowski knew the experimental data on the Brownian motion very well and in-
tended to explain them. It is now clear that Smoluchowski obtained the results before Einsten,
but decided to publish them after he was impressed by Einstein work.
These papers have also answered several other questions. First, they provided a microscopical
explanation of diffusion (molecules of the substance that diffuses are ‘pulled through’ by the
collisions with the molecules in the solvent), second, they derived an equation known today
as the diffusion equation, and third they explained why all other attemps in describing the
Brownian motion in terms of velocities had failed. Smoluchowski noticed that displacements
of Brownian particles seen in a microscope resulted from a huge number of collisions with the
molecules of the solvent: the displacements were averaged over many such collisions. The time
between two consecutive collisions is much shorter that we can now, in the 21t
h century, ob-
serve. At any two observed zigzags there are many other zigzags that have happened and we
have failed to observe.
There is an important remark to do here. The Newtonian dynamics, commonly used in Smolu-
chowski times and today for explaining a large array of phenomena, says that the trajectory
of any particle can be described by means of a certain differential equation. To write down
this equation, you need to know all the forces acting on this particle. The forces may be
changing but as long as these changes are smooth, the trajectory of the particle will also be
smooth. Smoluchowski revolutionary point of view was that Brownian motion was not smooth,
therefore challenging a ‘sacred’ canon of Physics back then. This was truly a deviation of a
well-established paradigm, but it was succesful in explaning an experiment that other theories
could not explain. The diffusion equation mentioned above does not aim to explain perfectly
the behaviour of a single particle, but rather the behaviour a large enough amount of particles,
for example a drop of ink in a water tank. While the motion of a single particle may be erratic
and awkward, the collective behaviour can be quite decent and predictible.
This is a totally new approach in Physics, that changes from deterministic to probabilistic.
The works of Einstein and Smoluchowski have become one of the cornerstones of Probability
Calculus and the theory of Stochastic Processes
CHAPTER 4. BROWNIAN MOTION 31
4.2 The Difussion Equation
The diffusion equation is an equation that describes the behaviour of a collective motion of
particles in a material, resulting from the random movement of each particle. There are many
approaches to derive this equation, we will use two of them: the Einstein’s derivation and the
Macroscopic Derivation. First we will explain Einstein’s derivation. Then we will see Langevin’s
approach and how the diffusion equation is related to the Wiener process. After this we will
go through the Macroscopic derivation, which will give us insight on the importance of the
diffusion equation in ecology and biology. Lastly, we will see that the solution of the diffusion
equation follows the density of a Wiener process.
4.2.1 Einstein’s derivation
This derivation is very interesting from a historical point of view because it is the one that
appeared for the first time in 1905 in Albert Einstein’s papers. For mathematical simplicity we
consider the one dimensional case. We assume that that the motion is a composition of jumps
that can take arbitrary lengths z. Each possible jump is assigned a probability according to
a PDF φ(z). If we assume i.i.d jumps, the density of individuals located at x at time t + τ is
equal to the density of individuals that were located at a point at distance z at time τ before
and jumped to point x after waiting a time τ. Because the jump can be from any point, we
must consider all possible distances. Mathematically this means
ρ(x, t + τ) =
∞
−∞
ρ(x − z, t)φ(z)dz (4.2)
Notice that this equation is discrete in time and continuous in space. The function φ(z) is
known in ecology as the dispersal kernel. Equation (4.2) holds only when the population is
large enough, otherwise we should take care of possible fluctuations.
If we consider τ and z small enough, we can do a Taylor expansion. First for τ
ρ(x, t + τ) =
∞
n=0
τn
n!
∂n
ρ(x, t)
∂tn
(4.3)
and for z
ρ(x − z, t) =
∞
n=0
(−z)n
n!
∂n
ρ(x, t)
∂xn
(4.4)
and now we can insert these expressions into equation (4.2):
ρ(x, t) + τ
∂ρ(x, t)
∂t
+ ◦(τ2
) =ρ(x, t)
∞
−∞
φ(z)dz −
∂ρ(x, t)
∂x
∞
−∞
zφ(z)dz+
+
∂2
ρ(x, t)
∂x2
∞
−∞
z2
2!
φ(z)dz + ◦(z3
)
because φ(z) is a density function, it must be normalised which means
∞
−∞
φ(z)dz = 1. Besides,
we can assume isotropic movements, which means that φ(z) = φ(−z). Hence, when n is odd
we have
∞
−∞
zn
φ(z)dz = 0. With this things in mind we can rewrite the previous equation
ρ(x, t) + τ
∂ρ(x, t)
∂t
+ ◦(τ2
) = ρ(x, t) +
∂2
ρ(x, t)
∂x2
∞
−∞
z2
2!
φ(z)dz + ◦(z4
) (4.5)
CHAPTER 4. BROWNIAN MOTION 32
and now simplyfing and dividing by τ
∂ρ
∂t
=
∂ρ
∂t
∞
−∞
z2
2τ
φ(z)dz + ◦(z4
/τ) (4.6)
Finally we take the limit z → 0 and τ → 0, but in such way that z2
/τ is finite. Thus,
∂ρ
∂t
= D
∂2
ρ
∂x2
(4.7)
where
D ≡
1
2τ
∞
−∞
z2
φ(z)dz =
E(z2
)
2τ
(4.8)
Equation (4.7) is the well-known the diffusion equation. We will see later that the solution is
closely related to the Wiener process.
4.2.2 Langevin’s approach
As we mentioned earlier, explaining the Brownian motion by probabilistic means and as a
consequence of atomic collisions was revolutionary back in the time of Einstein. One of the
earliest models to describe Brownian motion was to suppose that the movement followed a pure
Wiener process. That description is quite accurate, however the Wiener process is known for
having some mathematical properties that cannot find an easy translation into the fields of
Physics. For example, we will see that if the particle starts at x = 0, then the point 0 is an
accumulation point, meaning that for every ε there exists infinitely many t ∈ (0, ε) such that
x = 0. It is difficult to imagine a real particle moving in this way.
One of the big problems about modelling Brownian motion via the Wiener process is that it
does not have a well-defined velocity, since the Wiener process is nowhere differentiable and
hence v =
dW
dt
is not defined in the ordinary sense. However, in Physics we usually assign the
velocity
v =
dW
dt
= σξ(t) (4.9)
to a particle with a random motion, where σ is a constant and ξ(t) represents white noise.
From this we see that the velocity is totally random.
Just some months after Einstein’s work, Paul Langevin presented an alternative description
to Brownian motion that is still very referenced in the literature. He also considered that the
fluctuating velocities observed in the Brownian particles should be due to noisy effects coming
from the surrounding particles in the solvent, but he also considered the friction effects on the
motion of the particles. So Langevin’s description of Brownian motion reads
dv
dt
= −γv + σξ(t) (4.10)
where the term −γv represents a friction force proportional to the particle velocity. Equation
(4.15) is usually named Ornstein-Uhlenbeck process since these two researchers provided in
1930 a detailed analysis of its statistical properties. The constant σ measures how large noise
fluctuations are. The velocity now is not simply a fluctuating variable but it changes smoothly
as a result of the joint effect of fluctuations and the friction force −γv. We can apply now
the limit of strong friction m|dv/dt| |γv|. As this suggests, the corresponding persistance
introduced in the particle motion is mainly governed by the friction term. In consequence, γ is
usually known as the persistence parameter. Under this limit equation (4.10) reads
γv = γ
dx
dt
= σξ(t) (4.11)
CHAPTER 4. BROWNIAN MOTION 33
and it can be shown that an equation of the form
dx
dt
=
√
2Dξ(t) (4.12)
leads in the macroscopic limit to a Fokker-Planck equation (see Appendix A) identical to the
diffusion equation:
∂P
∂t
= D
∂2
P
∂x2
(4.13)
For both equations to be equal it must happen that
D =
σ2
2γ2
(4.14)
From here it should already be clear the close relationship between diffusion equation and par-
ticle moving according to a Wiener process.
Now, if we don’t take the assumption that m|dv/dt| |γv| equation (4.10) can be integrated
to obtain
v(t) = v(0)e−γt
+
√
2DW(t) (4.15)
So we see that if the particle had an initial velocity, it will decrease until becoming purely
random. In the limit t → ∞ we recover the velocity of a particle moving according to the
Wiener process. The average position will be given again by integration:
E(x(t)) = E(x0) +
t
0
E(v)dt = E(x0) + E(v0)
1 − e−γt
γ
(4.16)
and we see that for the limit t → ∞ we have E(x) = E(x0) +
E(v0)
γ
, in comparison with
E(x) = E(x0) for the pure Wiener process.
4.2.3 Macroscopic Derivation
We consider a population with density ρ(x, t) located at some point x at time t (for example
a group of insects, or a drop of ink in water). To describe the movement it is necessary to
introduce another dependent quantity, the population flux J(x, t). This quantity is a vector
pointing in the direction of movement and indicates the net quantity of particles flowing in
that direction per unit time and per unit length (or area or volume). We will assume that the
density and flux are smooth functions of space and time. The balance equation states that the
rate of change of ρ(x, t) in a volume V closed by a surface Ω is due to the fluxes inward or
outward on V through Ω. Writing this in mathematical language we have
∂
∂t V
ρ(x, t)dV = −
Ω
J(x, t) · ndS (4.17)
where n is a unit vector normal to Ω and · is the scalar product.
Applying the divergence theorem
Ω
J(x, t) · ndS =
V
· J(x, t)dV (4.18)
into (4.17) yields
V
∂ρ(x, t)
∂t
+ · J(x, t) dV = 0 (4.19)
CHAPTER 4. BROWNIAN MOTION 34
where is the vector
∂
∂x
,
∂
∂y
,
∂
∂z
.
Since the volume of integration V can be arbitrarily small we obtain the continuity equation
∂ρ(x, t)
∂t
+ · J(x, t) = 0 (4.20)
In order to get an equation for the evolution of the population density we need to know how
J(x, t) depends on ρ(x, t). We will assume here that the flux J(x, t) is proportional to the
spatial population gradient ρ(x, t). This assumption is known as the Fick’s law, which can
be written as
J(x, t) = −D ρ(x, t) (4.21)
The minus sign takes into account that the flux is a vector pointing in the direction where
the population density decreases. Writing this last expression in (4.20) we get the diffusion
equation
∂ρ
∂t
= · (D ρ) (4.22)
which in the one-dimensional case it can be written simply as
∂ρ
∂t
= D
∂2
ρ
∂x2
(4.23)
and is also known as the heat equation.
4.2.4 Solution of the diffusion equation
The solution of such equation can be easily given using Fourier transforms. Tranforming (4.23)
by Fourier we obtain
∂ˆρ(k, t)
∂t
= −Dk2
ˆρ(k, t) (4.24)
where we have used the property of the transform of a derivative:
dnf(x)
dxn
= (−ik)n ˆf(k) (4.25)
Integrating (4.24) we obtain
ˆρ(k, t) = ρ(k, 0)e−Dk2t
(4.26)
In the simple case we consider that the population density is concentrated in x = x0, then we
have the initial condition ρ(x, 0) = δ(x − x0), which implies ˆρ(k, 0) = e−ikx0
. To obtain back
the original density function we apply the inverse Fourier transform
ρ(x, t) =
∞
−∞
eikx
ˆρ(k, t)dk =
∞
−∞
eik(x−x0)−Dk2t
dk =
1
√
4πDt
e−
(x−x0)2
4Dt (4.27)
which is the density function of a Wiener process (Wt, t ≥ 0).
From this result we conclude that systems governed by the diffusion equation will behave
following a Wiener process.
From result (4.27) we can calculate
E(x(t)) =
∞
−∞
xρ(x, t)dx = x0 (4.28)
CHAPTER 4. BROWNIAN MOTION 35
and
E(x2
(t)) =
∞
−∞
xρ(x, t)dx = x2
0 + 2Dt (4.29)
This result indicates that the scaling
E(x2
(t)) ∼ t (4.30)
holds in the large time limit. This is a fundamental sign of any diffusive transport. We will see
this result in more mathematical detail in a following section ‘Quadratic variation’.
4.3 Recurrence of Brownian motion
Now we will try to establish a comparison between the Brownian motion properties and those
of the random-walk reported in the previous Chapter.
Definition 4.3.1. A filtration on a probability space (Ω, F, P) is a family (F(t) : t ≥ 0} for
σ-algebras such that F(s) ⊂ F(t) ⊂ F for all s ≤ t.
If (Xt : t ≥ 0) is a stochastic process, then {F(t) : t ≥ 0} is the natural filtration for X if
F(t) = σ{Xs, s ≤ t}, where σ{X} denotes the smallest σ-algebra under which the random
variables Xs, s ≤ t are measurable.
Definition 4.3.2. Let X = (Xt, t ≥ 0) be a stochastic process and {F(t) : t ≥ 0} a filtration.
We say X is adapted to {F(t) : t ≥ 0} if
σ(Xt) ⊂ Ft, ∀t ≥ 0 (4.31)
that means that Xt is measurable with respect to Ft.
Definition 4.3.3. Let B = (Bt, t ≥ 0) be the Brownian motion and F(t) = σ{Bs, s ≤ t} its
corresponding natural filtration. A stochastic process X = (Xt, t ≥ 0) is adapted to Brownian
motion if X is adapted to {F(t) : t ≥ 0}.
Definition 4.3.4. Let (S, S) be a measure space and X = (Xt, t ≥ 0) a S-valued stochastic
process adapted to a filtration {F(t) : t ≥ 0}. We say the process X possesses the Markov
property with respect to F(t) if for each A ∈ S and each s, t ∈ T with s ≤ t:
P(Xt ∈ A|Fs) = P(Xt ∈ A|Xs) (4.32)
A Markov process is a stochastic process that satisfies the Markov property with respect its
natural filtration.
Remark 4.3.1. Said in simple terms, a Markov process is a process in which a future outcome
is only affected by the last outcome, and it doesn’t matter what happened before. For example,
we can imagine a fair coin tossing game in which every toss you win or lose 1e and you start
with 10e. If I know I have now 15e and want to guess the money I will have after the next
toss, only the information that I have 15e can help me predict the future outcome. It does not
matter how I came to have those 15e. This example is for the discrete case, but the continuous
works the same going to the limit.
Definition 4.3.5. We call a Markov process {X(t) > 0 : t ≥ 0} with values in Rd
ˆ Point recurrent, if, almost surely, for every x ∈ Rd
there is a (random) sequence tn → ∞
such that X(tn) = x for all n ∈ N.
CHAPTER 4. BROWNIAN MOTION 36
ˆ Neighbourhood recurrent, if, almost surely, for every x ∈ Rd
and ε > 0, there exists
a (random) sequence tn → ∞ such that X(tn) ∈ B(x, ε) for all n ∈ N.
ˆ Transient, if it converges to infinity almost surely
Before we can prove the Brownian motion recurrence, we will need some understanding on
harmonic functions. Especifically, we will have a look at the Dirichlet Problem. This problem
raises the following question: given a continuous function ϕ on the boundary of a domain, is
there a function u such that u(x) = ϕ(x) in the boundary of the domain and such that u(x)
is harmonic inside the domain? That is, we are trying to extend the definition of ϕ in the
boundary to a ’nice’ function in the whole domain. Gauss posed this problem in 1840, and
he thought he proved there was always a solution, but his reasoning was wrong and Zaremba
in 1911 gave counterexamples. However, if the domain is ’nice enough’ (see Poincar´e cone
condition below) there is always a solution.
The Dirichlet Problem can be solved purely by analytical tools. We will however solve it by
probabilistic means.
Definition 4.3.6. Let U be a domain, i.e., a connected open set U ⊂ Rd
. A function ϕ : U → R
is harmonic (on U) if it is twice continuously differentiable and, for any x ∈ U,
∆u(x) :=
d
j=1
∂2
u
∂x2
j
(x) = 0 (4.33)
Definition 4.3.7. Let U ⊂ Rd
be a domain. We say that U satisfies the Poincar´e cone
condition at x ∈ ∂U if there exists a cone V based at x with opening angle α > 0, and h > 0
such that V ∩ B(x, h) ⊂ Uc
.
Definition 4.3.8. A random variable T with values in [0, ∞], defined on a probability space
with filtration (F(t) : t ≥ 0) is called a stopping time with respect to (F(t) : t ≥ 0) if
{ω : T(ω) ≤ t} ∈ F(t) for every t ≥ 0.
Remark 4.3.2. Speaking intuitively, for T to be a stopping time, it should be possible to
decide whether or not {T ≤ t} has occurred on the basis of the knowledge of F(t).
Definition 4.3.9. Suppose that X = (Xt : t ≥ 0) is a stochastic process on a probability space
(Ω, F, P) with natural filtration {F(t) : t ≥ 0)}. For any t ≥ 0 we can define the sigma algebra
F(t+
) to be the intersection of all Fs for s ≥ t. Then for any stopping time τ on Ω we can
define
F(τ) = {A ∈ F : {τ = t} ∩ A ∈ F(t+
), ∀t ≥ 0} (4.34)
Then X is said to have the strong Markov property if, for each stopping time τ, conditioned on
the event {τ < ∞}, we have that for each t ≥ 0, Xτ+t is independent of F(τ) given Xτ .
Theorem 4.3.1 (Dirichlet Problem). Suppose U ∈ Rd
is a bounded domain such that every
boundary point satisfies the Poincar´e cone condition, and suppose ϕ is a continuous function
on ∂U. Let τ(∂U) = inf{t > 0 : B(t) ∈ ∂U}, which is an almost surely finite stopping time.
Then the function u : ¯U → R given by
u(x) = E(ϕ(B(τ(∂U)))|B(0) = x), for x ∈ U (4.35)
is the unique continuous function harmonic on U with u(x) = ϕ(x) for all x ∈ ∂U.
Remark 4.3.3. If the Poincar´e cone condition holds at every boundary point, one can simulate
the solution of the Dirichlet problem by running many independent Brownian motions, starting
in x ∈ U until they hit the boundary of U and letting u(x) be the average of the values of ϕ
on the hitting points.
CHAPTER 4. BROWNIAN MOTION 37
With this result in mind, let’s find explicit solutions u : cl A → R of the Dirichlet problem on
an annulus A = {x ∈ Rd
: r < |x| < R}. The reason to study this case is that the recurrence
problem will be a particular case of this solution. It is first reasonable to assume that u is
spherically symmetric, i.e. there is a function ψ : [r, R] → R such that u(x) = ψ(|x|2
). We can
express derivatives of u in terms of ψ as
∂iψ(|x|2
) = ψ (|x|2
)2xi (4.36)
∂iiψ(|x|2
) = ψ (|x|2
)4x2
i + 2ψ (|x|2
) (4.37)
Therefore, ∆u = 0 means
0 =
d
i=1
ψ (|x|2
)4x2
i + 2ψ (|x|2
) = 4|x|2
ψ (|x|2
) + 2dψ (|x|2
)
Letting y = |x|2
> 0 we can write this as
ψ (y) = −
d
2y
ψ (y)
This is solved by every ψ satisfying ψ (y) = Cy−d/2
and thus ∆u = 0 holds on {|x| = 0} for
u(x) =



|x| if d = 1
2 log |x| if d = 2
|x|2−d
if d = 3
(4.38)
We write u(r) for the value of u(x) for all x ∈ ∂B(0, r). Now define stopping times
Tr = τ(∂B(0, r)) = inf{t > 0 : |B(t)| = r} for r > 0 (4.39)
and denote by T = Tr ∧ TR the first exit time from A. By the Dirichlet Problem Theorem
(4.3.1) we have
u(x) = E(u(B(T))|B(0) = x) = u(r)P(Tr < TR|B(0) = x) + u(R)(1 − P(Tr < TR))
which can be solved
P(Tr < TR|B(0) = x) =
u(R) − u(x)
u(R) − u(r)
(4.40)
This formula gives an explicit computation of the probability that the Brownian motion hits
∂B(0, r) before ∂B(0, R). We have just proved the following theorem
Theorem 4.3.2. Suppose {B(t) : t ≥ 0} is a Brownian motion in dimension d ≥ 1 started in
x ∈ A, which is an open annulus A with radii 0 < r < R < ∞. Then,
P(Tr < TR|B(0) = x) =



R − |x|
R − r
if d = 1
log R − log |x|
log R − log r
if d = 2
R2−d
− |x|2−d
R2−d − r2−d
if d ≥ 3
(4.41)
if we take the limit R → ∞ we get the following corollary
CHAPTER 4. BROWNIAN MOTION 38
Corollary 4.3.1. For any x /∈ B(0, r), we have
P(Tr < ∞|B(0) = x) =



1 if d ≤ 2
rd−2
|x|d−2
if d ≥ 3
(4.42)
finally, we have enough tools to prove the following theorem
Theorem 4.3.3. Brownian motion is
ˆ point recurrent in dimension d = 1,
ˆ neighbourhood recurrent, but not point recurrent, in d = 2,
ˆ transient in dimension d ≥ 3.
Proof. ˆ For d = 1 fix x ∈ R. Let’s take B(x + 2, 1) and B(x − 2, 1). Notice that x
lies in between these two balls. We know by Corollary (4.3.1) that the stopping time
t1 = inf{t > 0 : B(t) ∈ B(x + 2, 1)} is almost surely finite. Also, by the same corollary,
the stopping time t2 = inf{t > 0 : B(t) ∈ B(x − 2, 1)} is almost surely finite. Because
of the continuity of the Brownian motion there exists a time t such that t1 < t < t2
and B(t) = x. Using the strong Markov property at time t2 + 1 we can repeat the
previous argument. In fact, we can repeat this argument as many times as we want, so
the Brownian motion in one dimension is recurrent.
ˆ For d = 2 fix ε > 0 and x ∈ Rd
. By Corollary (4.3.1)the stopping time t1 = inf{t > 0 :
B(t) ∈ B(x, ε)} is almost surely finite. Using the Markov property at time t1 + 1 we see
that this applies to t2 = {t > t1 + 1 : B(t) ∈ B(x, ε)}, and continuing like this, we obtain
a sequence of times tn → ∞ such that, almost surely, B(tn) ∈ B(x, ε) for all n ∈ N and
hence is neighbourhood recurrent.
ˆ For d = 3 to make notation less cumbersome we use the notation Px(A) := P(A|B(0) =
x). We first see that that the probability that the Brownian motion does not go out from
a ball is 0, that is
Px(|Bt| < R, ∀t ≥ 0) = 0 (4.43)
Indeed, if we take the first coordinate, B1
t , of Bt we have
Px(|Bt| < R, ∀t ≥ 0) ≤ Px(|B1
t | < R, ∀t ≥ 0) = 0 (4.44)
where we have used property 4.3.2.
Let x ∈ R3
and n ∈ N such that n3
> |x|. From the previous argument we have that the
exit time
Tn3 = inf{t > 0 : |Bt| = n3
} < ∞ (4.45)
almost surely. That means that if the Brownian motion starts at x then it will get out of
the ball of radius n3
with probability one. What we will see next is that for every ω ∈ Ω
CHAPTER 4. BROWNIAN MOTION 39
there exists n(ω) ∈ N such that ∀n ≥ n(ω) we have that Bt(ω) ≥ n for every t ≥ Tn3 (ω).
Px(|Bt| < n for some t > Tn3 ) = Ex(1{|Bt|<n for some t>Tn3 })
= Ex(E(1{|Bt|<n for some t>Tn3 }|BTn3 ))
= Ex(P(|Bt+Tn3 | < n for some t > 0|BTn3 ))
= Ex(PBT
n3
(|Bt| < n for some t > 0))
= Ex(PBT
n3
(Tn ≤ ∞))
= Ex
n
|BTn3 |
d−2
= Ex
n
n3
d−2
=
1
n2
d−2
where we have used the strong Markov property in the fourth equality and corollary 4.3.1
in the sixth equality. If we write An = {|Bt| < n for some t > Tn3 } then we have for
d ≥ 3
∞
n=1
P(An) < ∞ (4.46)
and thus using Borel Cantelli lemma the events An can happen with probability 1 only a
finite number of times.
Alternative proof for recurrence in 1D
For a one dimensional Brownian motion, there is a faster way to show that it is point recurrent.
We think it is interesting to add this section because appart from showing an alternative proof,
we see two important properties of the Brownian motion that help us understand it better.
Property 4.3.1 (Reflection principle). Let B = (Bt, t ∈ [0, ∞)) be one dimensional Brownian
motion and a > 0, then
P(max
0≤s≤t
Bs > a) = 2P(Bt > a) (4.47)
Proof. We will prove this property using heuristic arguments, for a formal proof requires ad-
vanced tools not covered in this thesis. We have the following equation
P(max
0≤s≤t
Bs > a, Bt > a) = P(max
0≤s≤t
Bs > a, Bt < a) (4.48)
The idea behind it is that if the Brownian motion has reached value a at some time τ < t,
then since Bτ ∼ N(0, τ) there is a bijective correspondence between paths with Bt > a and
Bt < a. In other words, for every path from τ to t there exists a reflective path with respect
the horizontal line y = a that has the same “probability” as such path. Of course the actual
probability of any path is 0, hence this argument is only heuristic. See figure ??.
Since P(Bs = a) = 0 if we add P(max
0≤s≤t
Bs > a, Bt > a) to both sides of equation (4.48) we
obtain
2P(max
0≤s≤t
Bs > a, Bt > a) = P(max
0≤s≤t
Bs > a) (4.49)
and noting that {max
0≤s≤t
Bs > a, Bt > a} = {Bt > a} we are done.
CHAPTER 4. BROWNIAN MOTION 40
Property 4.3.2. Let B = (Bt, t ∈ [0, ∞)) one dimensional Brownian motion, then
P(lim sup
t→∞
Bt = +∞) = P(lim inf
t→∞
Bt = −∞) = 1 (4.50)
Proof. Let a > 0, then using property 4.3.1
P(sup
t≥0
Bt > a) ≥ P( sup
0≤s≤t
Bs > a)
= 2P(Bt > a)
= 2P
Bt
√
t
>
a
√
t
= 2 1 − Φ
a
√
t
where Φ is the distribution function of a N(0, 1).
2 1 − Φ
a
√
t
−→ 2(1 − Φ(0)) = 1, as t −→ ∞ (4.51)
and
P(lim sup
t→∞
Bt = ∞) = P(
∞
a=1
{sup
t≥0
Bm > a}) = 1 (4.52)
And we also obtain
P(lim inf
t→∞
Bt = −∞) = P(lim sup
t→∞
(−Bt) = ∞) = 1 (4.53)
because (−Bt, t ∈ [0, ∞)) is a Brownian motion.
Corollary 4.3.2. Brownian motion is point recurrent for d = 1.
Proof. Let A = {ω : B(ω) does not have infinite zeros}. Suppose P(A) > 0. Then for ω ∈ A
there is no sequence tn → ∞ such that Btn (ω) = 0 for all n ∈ N. That means there exists
T > 0 such that Bt(ω) = 0 for all t > T. Without loss of generality suppose Bt(ω) > 0 for
all t > T, but this implies that lim inf
t→∞
Bt(ω) = −∞ since the Brownian motion cannot cross
the x-axis, because Brownian motion has continuous paths. Hence P(lim inf
t→∞
Bt(ω) = −∞) > 0
which means that P(lim inf
t→∞
Bt(ω) = −∞) < 1 in contradiction with property 4.3.2.
4.4 Expected time to reach a specific position
We showed in 2.1.1 that the expected time for a random walk to get back to the origin for
dimension 1 was infinite. We will now show a similar result for Brownian motion, but in this
case we will see that the expected time for the Brownian motion to reach any point is infinite.
Theorem 4.4.1. Let a = 0. If inf{t > 0 : Bt = a} exists we define Ta = inf{t > 0 : Bt = a}; if
inf{t > 0 : Bt = a} does not exist we define Ta = ∞. Then E(Ta) = ∞, that is, the expected
time to reach any point different than 0 for the brownian motion is infinite.
CHAPTER 4. BROWNIAN MOTION 41
Proof. We will show a relation between the density of Ta and Bt and from here deduce that
E(Ta) = ∞.
Let’s first assume that a > 0, then
P(Ta > t) = P(max
0≤s≤t
Bt < a}
= 1 − P(max
0≤s≤t
Bt > a)
= 1 − 2P(Bt > a)
where in the last step we used property 4.3.1. This implies that
P(Ta ≤ t) = 2P(Bt > a) = 2P(Bt ≤ −a) =
2
√
2π
−a/
√
t
−∞
e−x2/2
dx (4.54)
and Ta < ∞ almost surely, so the density function of Ta is
fa(t) =
d
dt
P(Ta ≤ t)
=
d
dt
2P(Bt ≤ −a)
=
d
dt
2P
Bt
√
t
≤ −
a
√
t
= 2
1
√
2π
d
dt
− a√
t
−∞
e−x2/2
dx
= 2
1
√
2π
e−a2
2t
a
2
√
t3
=
a
√
2πt3
e−a2
2t
where we have used that Bt/
√
t ∼ N(0, 1) and the fundamental theorem of calculus. Hence
E(Ta) =
∞
0
tfa(t)dt ∼
∞
0
1
√
t
e
−a
2t dt = ∞ (4.55)
The argument applies mutatis mutandi for a < 0.
We notice that for a = 0 something does not work, since if we use the density function from
theorem 4.4.1 we get fa(t) ≡ 0, which obviously is not a density function. The problem lies
that for a Brownian motion that starts at 0, the point 0 is an accumulation point for the zeroes
of the Brownian motion, i.e., for every ε > 0 there exists infinitely many t ∈ (0, ε) such that
Bt = 0. The following property will support this claim:
Property 4.4.1. Let h > 0, then
P( max
0≤s≤h
Bs > 0) = P( min
0≤s≤h
Bs < 0) = 1 (4.56)
Proof. Take a > 0, then
P( max
0≤s≤h
Bs > 0) ≥ P( max
0≤s≤h
Bs > a)
= 2 1 − Φ
a
σ
√
h
→ 1 as a → 0
CHAPTER 4. BROWNIAN MOTION 42
where we have used in the second step property 4.3.1. Hence we obtain
P( max
0≤s≤h
Bs > 0) = 1 (4.57)
Finally, if we notice that
P( min
0≤s≤h
Bs < 0) = P( max
0≤s≤h
−Bs > 0) (4.58)
we can use the same arguments and get
P( min
0≤s≤h
Bs < 0) = 1 (4.59)
4.5 Other properties of Brownian motion
In this section we will show some interesting properties of the Brownian motion that we will
use in the next sections.
4.5.1 Quadratic variation
Let πn : 0 = t0 < t1 < · · · < tn = T be a partition on [0, T]. For a smooth function we have the
following proposition.
Proposition 4.5.1. Let (πn) a sequence of refining partitions with mesh(πn) → 0 on [0, T] and
f ∈ C1
. Then
n
i=1
(f(ti) − f(ti−1))2
→ 0, as n → ∞ (4.60)
Proof. We can use the mean value theorem, since f ∈ C1
.
n
i=1
(f(ti) − f(ti−1))2
=
n
i=1
f(ξi)2
(ti − ti−1)2
≤ max
0≤i≤n
(f(ξi)2
)
n
i=1
(ti − ti−1)2
≤ max
0≤i≤n
(f(ξi)2
)mesh(πn)
n
i=1
(ti − ti−1)
= Cmesh(πn)T → 0
where ξi ∈ (ti, ti+1).
However, for the Brownian motion we have a different result.
Proposition 4.5.2. Let (πn) be a sequence of refining partitions with mesh(πn) → 0 on [0, T]
and B = (Bt, t ≥ 0) a Brownian motion. Then
Qn =
n
i=1
(B(ti) − B(ti−1))2
=
n
i=1
(∆iB)2 L2
−→ T, as n → ∞ (4.61)
and thus it converges also in probability.
CHAPTER 4. BROWNIAN MOTION 43
Proof. We want to see that
E[(Qn − T)2
] −→ 0, as n → ∞ (4.62)
First thing to notice is that E(Qn) = T. Indeed, since ∆iB ∼ N(0, ti − ti−1) we have
E(Qn) = E
n
i=1
(B(ti) − B(ti−1))2
=
n
i=1
E(B(ti) − B(ti−1))2
=
n
i=1
(ti − ti−1) = T (4.63)
From here we get the following expression
E[(Qn − T)2
] = E[(Qn − E(Qn))2
] = V ar(Qn) (4.64)
which can be written using the identity V ar(X) = E(X2
) − E(X)2
and the fact that the
increments ∆iB are independent as
V ar(Qn) =
n
i=1
V ar (∆iB)2
=
n
i=1
E(∆iB)4
− ∆2
i (4.65)
where ∆i = ti − ti−1.
It is well know that for a N(0, 1) random variable B1, EB4
1 = 3, then
E(∆iB)4
= E (∆i)1/2
B1
4
= 3∆2
i (4.66)
which implies
V ar(Qn) = 2
n
i=1
∆2
i (4.67)
thus if
mesh(πn) = max
i=1,...,n
∆i → 0 (4.68)
we obtain that
E[(Qn − T)2
] = V ar(Qn) ≤ 2mesh(πn)
n
i=1
∆i = 2Tmesh(πn) → 0 (4.69)
4.5.2 Unbounded variation
Proposition 4.5.3. Let B = (Bt, t ≥ 0) be a Brownian motion, then almost surely
sup
πn
n
i=1
|∆iB| = +∞ (4.70)
that is
P ω ∈ Ω : sup
πn
n
i=1
|∆iB(ω)| = +∞ = 1 (4.71)
where we take the suprema over all partitions πn of [0, T], where ∆iB = Bti
− Bti−1
.
CHAPTER 4. BROWNIAN MOTION 44
Proof. Let
A = ω ∈ Ω : sup
π
n
i=1
|∆iB(ω)| < C(ω) < ∞ (4.72)
and assume that
P(A) > 0 (4.73)
and consider a sequence of partitions (πn) such that mesh(πn) → 0. From proposition 4.5.2
Qn =
n
i=1
(B(ti) − B(ti−1))2 L2
−→ T (4.74)
which means that there is a subsequence of partitions, σnk
such that
Qnk
a.s
−→ T > 0 (4.75)
and thus
P ω ∈ Ω : lim
k
Qnk
(ω) = T = 1 (4.76)
which implies
P ω ∈ Ω : lim
k
Qnk
(ω) = T = 0 (4.77)
On the other hand for ω ∈ A we have
Qn(ω) =
n
i=1
(B(ti) − B(ti−1))2
≤ max
i=1,...,n
|∆iB(ω)|
n
i=1
∆iB
≤ C(ω) max
i=1,...,n
|∆iB(ω)| → 0
because Bt is continuous and then uniformly continuous on [0, T]. Hence
P ω ∈ Ω : lim
k
Qnk
(ω) = 0 = T > 0 (4.78)
in contradiction with (4.77).
Chapter 5
Simulations: Brownian Motion
In this section we want to simulate a Brownian Motion. For that, some prior knowledge of
numerical integration of stochastic differential equations will be needed. The tools developed
in this chapter will let us indeed integrate more complex SDEs than the Brownian motion.
5.1 Numerical integration of stochastic differential equa-
tions with Gaussian white noise
Let us start with a simple stochastic differential equation:
˙x(t) = f(t) + ξ(t) (5.1)
where f(t) is a deterministic function and ξ(t) is a Gaussian white noise, i.e., ξ(t) ∼ N(0, 1).
If we integrate we get
x(t) = x(0) +
t
0
f(s)ds +
t
0
ξ(s)ds (5.2)
which can be written as
x(t) = x(0) + F(t) + B(t) (5.3)
where F(t) =
t
0
f(s)ds and B(t) is the brownian motion. This expression indicates that x(t)
is a Gaussian process whose mean and correlation are given by
E(x(t)) = x(0) + F(t) (5.4)
E(x(t)x(t )) = [x(0) + F(t)][x(0) + F(t )] + min(t, t ) (5.5)
Now we will focus on a numerical solution, rather than solving the equations. Our final aim will
be to be able to generate trajectories, that is, we want to obtain x(t) at discrete time intervals
x(t + h) = x(t) +
t+h
t
˙x(s)ds = x(t) +
t+h
t
f(s)ds +
t+h
t
ξ(s)ds (5.6)
Introducing
fh(t) :=
t+h
t
f(s)ds (5.7)
and
wh(t) :=
t+h
t
ξ(s)ds = B(t + h) − B(t) (5.8)
45
CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 46
we can write
x(t + h) = x(t) + fh(t) + wh(t) (5.9)
In this equation, as wh(t) is the difference of the Brownian motion at two different times, it is
a Gaussian process and can be fully characterized by giving the mean and correlations:
E(wh(t)) =
t+h
t
E(ξ(s))ds = 0
E(wh(t)wh(t )) =
t+h
t
t +h
t
E(ξ(s)ξ(u))dsdu
=
t+h
t
t +h
t
δ(s − u)dsdu
To evaluate this integral, we make use of the properties of the Dirac δ function. We can assume,
without loss of generality, that t > t. If t > t + h, the integral is 0, as there is no overlap in
the integration intervals, and the delta function vanishes. If t ≤ t < t + h, the double integral
equals the length of the overlap interval, that is
E(wh(t)wh(t )) =
t+h
t
ds = t − t + h (5.10)
We are particularly interested for t = t,
E(wh(t)2
) = h (5.11)
which is in line with what we proved in Proposition (4.5.2). In numerical calculations, time
takes always discrete values as multiples of the integration time step. If we consider discrete
times t = ti = ih, t = tj = jh, the correlation becomes
E(wh(ti)wh(tj)) = hδij (5.12)
We introduce now a set of independent Gaussian random variables {ui} of zero mean and
variance 1:
E(ui) = 0, E(uiuj) = δij (5.13)
in terms of which we can write
wh(ti) =
√
hui (5.14)
Finally, the recurrence relation to generate numerically trajectories of the stochastic process
defined by (5.1) is
x(t0) = x0 (5.15)
x(ti+1) = x(ti) + fh(ti) +
√
hui (5.16)
For small h, the deterministic contribution fh(t) can be approximated as fh(t) = hf(t), implying
that for small h the deterministic contribution is of order h1
and successive contributions go as
h2
, h3
, and so on. In contrast the stochastic contribution is of order h1/2
, an order that never
appears in methods for numerical integration of ordinary differential equations. A consequence
of this scaling with the time step is that at very small times the stochastic contribution, being of
order h1/2
, dominates over the deterministic one, of order h. Over the course of an integration
for a large period, the stochastic contributions on average will be generally of less importance
than the deterministic ones.
A Brownian motion can be now easily simulated from equation (5.16). For a Brownian motion
that starts at the origin, we have x(t0) = 0. Furthemore, fh(ti) = 0 for all i. We obtain the
following simple formula
x(t0) = 0 (5.17)
x(ti+1) = x(ti) +
√
hui (5.18)
CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 47
Euler-Maruyama method
We start with the equation
˙x(t) = q(x) + g(x)ξ(t) (5.19)
For additive noise, g(x) does not depends on x, and g(x) =
√
D with D being a constant, then
the Euler-Maruyama method for stochastic differential equations is given by
x(t + h) = x(t) + hq(x(ti)) +
√
Dhu(t) + O[h3/2
] (5.20)
As we need Stratonovich calculus to show the derivation of this formula, we will just state it
and use it later.
5.1.1 Runge-Kutta-Type methods
Equation (5.16) is enough to simulate the pure brownian motion, but in this section we will
develop a more advance method for integrating other kind of stochastic differential equations.
We start with the equation (5.19) and we would like to develop a method inspired by the
Runge-Kutta methods used for numerical integration of ordinary differential equations. There
is a large family of Runge-Kutta methods. Here, we focus on one of the simplest methods
of this family, known as the Heun method, which is of second order. We start revisiting the
deduction of the Heun numerical algorithm for ordinary differential equations and then we
extend the ideas to the case of stochastic differential equations. Let’s start considering the
ordinary differential equation
˙x(t) = q(t, x) (5.21)
where, in general, q(t, x(t)) is a nonlinear function of x(t) which can also depend on the time
explicitly. We start by applying the Euler method to integrate this equation:
x(ti+1) = x(ti) + hq(ti, x(ti)) + O[h2
] (5.22)
This is an explicit map since the right-hand side depends only on known values of the variable
x at previous times, while the unknown variable x(ti+1) is explicitly isolated in the left-hand
side. In fact, (5.22) corresponds to the explicit Euler, also called the forward Euler method.
There is also an implicit Euler method (also called the backward Euler method) to integrate
the same equation, which is given by
x(ti+1) = x(ti) + hq(ti+1, x(ti+1)) + O[h2
] (5.23)
The implicit Euler method is more stable than the explicit one but it has the disadvantage
that, in general, it is difficult to invert the function q(t, x(ti)) appearing on the right-hand side
so that one could get an explicit expression for x(ti+1) as a function of x(ti). Finally, there is
a semi-implicit Euler method that combines both approaches and which is of order O[h3
]. It is
given by
x(ti+1) = x(ti) +
h
2
[q(ti, x(ti)) + hq(ti+1, x(ti+1))] + O[h3
] (5.24)
This method suffers from the same inconvenience as the implicit Euler: the recurrence relation
is given by an implicit map. A way to circumvent this inconvenience is to replace x(ti+1) on
the right-hand side by the value obtained by using the explicit Euler method (5.22), namely by
x(ti) + hq(t, x(ti)):
x(ti+1) = x(ti) +
h
2
[q(ti, x(ti)) + q(ti+1, x(ti) + hq(t, x(ti)))] + O[h3
] (5.25)
CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 48
This is the Heun method that is usually written as
k = hq(t, x(ti)) (5.26)
x(ti+1) = x(ti) +
h
2
[q(ti, x(ti)) + q(ti+1, x(ti) + k)] (5.27)
We now apply the same ideas to a stochastic differential equation with white noise (5.19). Let
us start with a semi-implicit version of Euler’s method given by (5.20)
x(ti+1) = x(ti) +
h
2
[q(ti, x(ti)) + q(ti+1, x(ti+1))] +
√
hui
2
[q(ti, x(ti)) + q(ti+1, x(ti+1))] (5.28)
And now replace x(ti) on the right- hand side by the prediction given by the Euler-Maruyama
algorithm (5.20). The resulting algorithm can be written as
k = hq(t, x(ti)) (5.29)
l =
√
huig(t, x(ti)) (5.30)
x(ti+1) = x(ti) +
h
2
[q(ti, x(ti)) + q(ti+1, x(ti) + k + l)] +
√
hui
2
[g(ti, x(ti)) + g(ti+1, x(ti) + k + l)]
(5.31)
This is known as the stochastic Heun method. Notice that for the pure Brownian motion one
has q(t, x(ti)) = 0 and g(t, x(ti)) = 1 which converges to the simple formula (5.18). 1
5.1.2 Simulations
In this section we will simulate the Brownian motion and will see how long it takes until it
reaches back the value a = 0.1, that is, for which t = 0 we have that Bt = 0.5. The reason
why we do not take a = 0 is not arbitrary. In the discrete case for a random walk there was
no problem in taking a = 0, but for a Brownian motion some issues arise. The most important
is regarding property 4.4.1. Since we know that next to 0 there are infinite points t such that
Bt = 0, it doesn’t make a lot of sense to simulate this case. For this reason we have decided to
take a = 0, for example a = 0.1.
We will gather the results in a histogram. The simulations will be somewhat similar to those for
the random walk. However, one big difference to notice, is that Brownian motion is a continuous
function while a random walk is a discrete one. Another to notice is that the stopping time Ta
has a continuous density, which implies that the probability of every single point is 0. Taking
into account these differences, we cannot make histograms for Brownian motion that reaches a
point after N steps, because every step is infinitely small (theoretically, although in simulations
we will discretize). For this reason counting how many come back after N steps does not make
conceptual sense and, therefore, the bins in the histogram will represent a time interval rather
than a time point. The following simulation contains 106
different points, calculated according
to the formula
x(t0) = 0 (5.32)
x(ti+1) = x(ti) +
√
hui (5.33)
1
These more sophisticated methods were developed in the thesis in order to simulate some more complex
stochastic differential equations than the pure Brownian motion. However, because of lack of time and space
we decided to give priority to other topics.
CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 49
A total of 105
simulations were run. For practical reasons, the bins of the histograms represent
intervals in log(t) rather than just t. We have also ploted the theoretical density obtained in
Theorem 4.4.1 to compare results. First, we need to do a change of variable for the density,
because we are plotting the density of Y = g(Ta) = log(Ta) instead of the density of Ta:
fY (y) = fa(g−1
(y))|(g−1
) (y)|1(−∞,∞)
=
a
√
2πey
e− a2
2ey
This is the result we obtain:
Figure 5.1: Shows the relative number of particles that reached Bt = 0.5 for the first time at
time log(t).
First thing to notice is that theoretical results and empirical results do not match as perfectly
as in the random walk. We observe that for several values the experimental data is lightly large
than the predicted value. The reason for this discrepancy is that we plotted the histogram for a
fixed number of bins and selected the option ‘normed=True’, that is, the sum of all bins is equal
to 1. For a perfect match to the theoretical curve, we should consider every bin from −∞ to
∞. However, we plotted the high probability bins and, appart from those small discrepancies,
we observe a quite good match.
5.1.3 Code
We will now write a code to plot four different Brownian motion samples, using the equation
(5.16). In our case
def plotBrownianMotion (h=1, l =1000):
x=[]
x . append (0)
y=[]
y . append (0)
CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 50
z =[]
z . append (0)
v=[]
v . append (0)
for i in range (0 , int ( l /h ) ) :
x . append (x [ i ]+np . sqrt (h)*np . random . normal ( loc =0.0 , s c a l e =1.0))
plt . plot (x , c=’b ’ )
for i in range (0 , int ( l /h ) ) :
y . append (y [ i ]+np . sqrt (h)*np . random . normal ( loc =0.0 , s c a l e =1.0))
plt . plot (y , c=’ r ’ )
for i in range (0 , int ( l /h ) ) :
z . append ( z [ i ]+np . sqrt (h)*np . random . normal ( loc =0.0 , s c a l e =1.0))
plt . plot ( z , c=’y ’ )
for i in range (0 , int ( l /h ) ) :
v . append (v [ i ]+np . sqrt (h)*np . random . normal ( loc =0.0 , s c a l e =1.0))
plt . plot (v , c=’ g ’ )
plt . show ()
This will alow us to draw Brownian motion samples. The same code is valid for plotting
Brownian motion samples in 2D, only changing plt.plot(x,c=’b’) for plt.plot(x,y,c=’b’) For
plotting the histogram 5.1 we have written the following code
def simBrownianMotion (h=1, l =10000,N=1000):
v=[]
for n in range (1 ,N) :
#x=numpy . random . normal (0 ,1 ,3)
i=0
suma=0
sumaa=0
while (0.5 −sumaa)*(0.5 −suma)>=0 and i<l :
sumaa=suma
suma=suma+np . sqrt (h)*np . random . normal (0 ,1)
i=i+h
i f (0.5 −sumaa)*(0.5 −suma)<0:
v . append ( i−h)
return v
t1 = np . arange (−6, 10 , 0.1)
plt . plot ( t1 ,
np . exp ( −0.5**2/(2*np . exp ( t1 )))* 0.5/ np . sqrt (2*math . pi *np . exp ( t1 ) ) )
def freqHistogramBrownian (h=0.01 , l =1000,N=100000):
bins=13
X=l i s t (map( log , simBrownianMotion (h , l ,N) ) )
(n , bins , patches ) = plt . h i s t (X, bins =[−5,−4.5,−4,−3.5,−3,−2.5,
−2 , −1.5 , −1 , −0.5 ,0 ,0.5 ,1 ,
1. 5 , 2 , 2.5 ,3 ,3 .5 , 4 , 4.5 ,5 ,
5 . 5 , 6 , 6 . 5 , 7 , 7 . 5 , 8 ] , normed=True )
plt . xlabel ( ’ log ( t ) ’ )
CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 51
plt . ylabel ( ’ Frequency ’ )
plt . show ()
5.1.4 Path samples
Running the code above for 1D Brownian motion, we generated the following sample paths.
Figure 5.2: Four different samples of 1D Brownian motion, starting at 0.
The time steps used are h = 1 and the total length of the Brownian motion is l/h = 1000. And
the next plot shows the simulation of two independent 2D Brownian motion starting at 0.
Figure 5.3: Two different samples of 2D Brownian motion, starting at (0, 0).
5.2 Dirichlet problem
Now we will simulate the Dirichlet problem stated in theorem 4.3.1. Our boundary ∂U will
be a square centered in the origin of side l = 10 and our function on the boundary will be
f(x, y) = x+y and want to extend it to a harmonic function inside the square. This is a simple
CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 52
example, and we know that the extension will be u(x, y) = f(x, y) = x + y for all (x, y) ∈ U, so
we can verify if the algorithm works. A Brownian motion will start at 0 and will at some point
cross the boundary. The average of all the points at which the simulations crosses the boundary
will give us the value of f(x, y). In this example we will calculate u(0, 0). Intuitively, we would
expect that u(0, 0) = 0, because of the symmetry of this case. For every Brownian motion
that crosses the boundary at some point (x, y) we would expect another Brownian motion to
cross it at the point (−x, −y), so the average of all this points looks like it should be 0. We
will run 105
Brownian motions starting at (x, y) = (0, 0) to compute this point. The result is
u(0, 0) = 0.0176. The code we used is the following.
5.2.1 Code
def f (x , y ) :
return x+y
def d i r i c h l e t (h=1, l =10000,N=100000,x=0,y=0):
v=[]
for n in range (1 ,N) :
#x=numpy . random . normal (0 ,1 ,3)
i=1
sumax=x
sumaax=x
sumay=y
sumaay=y
while (10−sumaax)*(10−sumax)>=0 and (10−sumaay)*(10−sumay)>=0
and (−10−sumaax)*(−10−sumax)>=0 and (−10−sumaay)*(−10−sumay)>=0
and i<l :
sumaax=sumax
sumax=sumax+np . sqrt (h)*np . random . normal (0 ,1)
sumaay=sumay
sumay=sumay+np . sqrt (h)*np . random . normal (0 ,1)
i=i+1
i f sumax*sumaax<0 or sumay*sumaay<0:
v . append ( f (sumax , sumay ))
print (sum(v)/ len (v ))
return sum(v)/ len (v)
We compute a two dimensional Brownian motion in a similar way than the one dimensional
case. In every step we compute the two variables x and y as
x(t0) = 0 (5.34)
y(t0) = 0 (5.35)
x(ti+1) = x(ti) +
√
hui,1 (5.36)
y(ti+1) = y(ti) +
√
hui,2 (5.37)
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg
tfg

More Related Content

What's hot

Compiled Report
Compiled ReportCompiled Report
Compiled ReportSam McStay
 
Calculus Research Lab 3: Differential Equations!
Calculus Research Lab 3: Differential Equations!Calculus Research Lab 3: Differential Equations!
Calculus Research Lab 3: Differential Equations!A Jorge Garcia
 
M.Sc_Maths Thesis Pradeep Mishra
M.Sc_Maths Thesis Pradeep MishraM.Sc_Maths Thesis Pradeep Mishra
M.Sc_Maths Thesis Pradeep MishraPradeep Mishra
 
Mathematical formula handbook
Mathematical formula handbookMathematical formula handbook
Mathematical formula handbooktilya123
 
Applied mathematics I for enginering
Applied mathematics  I for engineringApplied mathematics  I for enginering
Applied mathematics I for engineringgeletameyu
 
MSc Thesis_Francisco Franco_A New Interpolation Approach for Linearly Constra...
MSc Thesis_Francisco Franco_A New Interpolation Approach for Linearly Constra...MSc Thesis_Francisco Franco_A New Interpolation Approach for Linearly Constra...
MSc Thesis_Francisco Franco_A New Interpolation Approach for Linearly Constra...Francisco Javier Franco Espinoza
 
Principle of Integral Applications - Integral Calculus - by Arun Umrao
Principle of Integral Applications - Integral Calculus - by Arun UmraoPrinciple of Integral Applications - Integral Calculus - by Arun Umrao
Principle of Integral Applications - Integral Calculus - by Arun Umraossuserd6b1fd
 

What's hot (13)

Elementary linear algebra
Elementary linear algebraElementary linear algebra
Elementary linear algebra
 
PhDThesis
PhDThesisPhDThesis
PhDThesis
 
Compiled Report
Compiled ReportCompiled Report
Compiled Report
 
Transport
TransportTransport
Transport
 
Calculus Research Lab 3: Differential Equations!
Calculus Research Lab 3: Differential Equations!Calculus Research Lab 3: Differential Equations!
Calculus Research Lab 3: Differential Equations!
 
M.Sc_Maths Thesis Pradeep Mishra
M.Sc_Maths Thesis Pradeep MishraM.Sc_Maths Thesis Pradeep Mishra
M.Sc_Maths Thesis Pradeep Mishra
 
Mathematical formula handbook
Mathematical formula handbookMathematical formula handbook
Mathematical formula handbook
 
Applied mathematics I for enginering
Applied mathematics  I for engineringApplied mathematics  I for enginering
Applied mathematics I for enginering
 
Thesis
ThesisThesis
Thesis
 
Nb
NbNb
Nb
 
MSc Thesis_Francisco Franco_A New Interpolation Approach for Linearly Constra...
MSc Thesis_Francisco Franco_A New Interpolation Approach for Linearly Constra...MSc Thesis_Francisco Franco_A New Interpolation Approach for Linearly Constra...
MSc Thesis_Francisco Franco_A New Interpolation Approach for Linearly Constra...
 
Principle of Integral Applications - Integral Calculus - by Arun Umrao
Principle of Integral Applications - Integral Calculus - by Arun UmraoPrinciple of Integral Applications - Integral Calculus - by Arun Umrao
Principle of Integral Applications - Integral Calculus - by Arun Umrao
 
Differential equations
Differential equationsDifferential equations
Differential equations
 

Similar to tfg

Applied Stochastic Processes
Applied Stochastic ProcessesApplied Stochastic Processes
Applied Stochastic Processeshuutung96
 
Fundamentals of computational fluid dynamics
Fundamentals of computational fluid dynamicsFundamentals of computational fluid dynamics
Fundamentals of computational fluid dynamicsAghilesh V
 
Xin-She Yang - Introductory Mathematics for Earth Scientists -Dunedin Academi...
Xin-She Yang - Introductory Mathematics for Earth Scientists -Dunedin Academi...Xin-She Yang - Introductory Mathematics for Earth Scientists -Dunedin Academi...
Xin-She Yang - Introductory Mathematics for Earth Scientists -Dunedin Academi...Aditya Singh
 
Stochastic Processes and Simulations – A Machine Learning Perspective
Stochastic Processes and Simulations – A Machine Learning PerspectiveStochastic Processes and Simulations – A Machine Learning Perspective
Stochastic Processes and Simulations – A Machine Learning Perspectivee2wi67sy4816pahn
 
Memoire antoine pissoort_aout2017
Memoire antoine pissoort_aout2017Memoire antoine pissoort_aout2017
Memoire antoine pissoort_aout2017Antoine Pissoort
 
Statistics for economists
Statistics for economistsStatistics for economists
Statistics for economistsMt Ch
 
Probing new physics on the horizon of black holes with gravitational waves
Probing new physics on the horizon of black holes with gravitational wavesProbing new physics on the horizon of black holes with gravitational waves
Probing new physics on the horizon of black holes with gravitational wavesSérgio Sacani
 
David_Mateos_Núñez_thesis_distributed_algorithms_convex_optimization
David_Mateos_Núñez_thesis_distributed_algorithms_convex_optimizationDavid_Mateos_Núñez_thesis_distributed_algorithms_convex_optimization
David_Mateos_Núñez_thesis_distributed_algorithms_convex_optimizationDavid Mateos
 
Thesis Fabian Brull
Thesis Fabian BrullThesis Fabian Brull
Thesis Fabian BrullFabian Brull
 
Discrete math mathematics for computer science 2
Discrete math   mathematics for computer science 2Discrete math   mathematics for computer science 2
Discrete math mathematics for computer science 2Xavient Information Systems
 

Similar to tfg (20)

Applied Stochastic Processes
Applied Stochastic ProcessesApplied Stochastic Processes
Applied Stochastic Processes
 
Fundamentals of computational fluid dynamics
Fundamentals of computational fluid dynamicsFundamentals of computational fluid dynamics
Fundamentals of computational fluid dynamics
 
jmaruski_1
jmaruski_1jmaruski_1
jmaruski_1
 
phd_unimi_R08725
phd_unimi_R08725phd_unimi_R08725
phd_unimi_R08725
 
Xin-She Yang - Introductory Mathematics for Earth Scientists -Dunedin Academi...
Xin-She Yang - Introductory Mathematics for Earth Scientists -Dunedin Academi...Xin-She Yang - Introductory Mathematics for Earth Scientists -Dunedin Academi...
Xin-She Yang - Introductory Mathematics for Earth Scientists -Dunedin Academi...
 
Applied Math
Applied MathApplied Math
Applied Math
 
Final
FinalFinal
Final
 
Stochastic Processes and Simulations – A Machine Learning Perspective
Stochastic Processes and Simulations – A Machine Learning PerspectiveStochastic Processes and Simulations – A Machine Learning Perspective
Stochastic Processes and Simulations – A Machine Learning Perspective
 
Memoire antoine pissoort_aout2017
Memoire antoine pissoort_aout2017Memoire antoine pissoort_aout2017
Memoire antoine pissoort_aout2017
 
Quantum mechanics
Quantum mechanicsQuantum mechanics
Quantum mechanics
 
Statistics for economists
Statistics for economistsStatistics for economists
Statistics for economists
 
PhD thesis
PhD thesisPhD thesis
PhD thesis
 
Notes on probability 2
Notes on probability 2Notes on probability 2
Notes on probability 2
 
Non omniscience
Non omniscienceNon omniscience
Non omniscience
 
Probing new physics on the horizon of black holes with gravitational waves
Probing new physics on the horizon of black holes with gravitational wavesProbing new physics on the horizon of black holes with gravitational waves
Probing new physics on the horizon of black holes with gravitational waves
 
main-moonmath.pdf
main-moonmath.pdfmain-moonmath.pdf
main-moonmath.pdf
 
Time series Analysis
Time series AnalysisTime series Analysis
Time series Analysis
 
David_Mateos_Núñez_thesis_distributed_algorithms_convex_optimization
David_Mateos_Núñez_thesis_distributed_algorithms_convex_optimizationDavid_Mateos_Núñez_thesis_distributed_algorithms_convex_optimization
David_Mateos_Núñez_thesis_distributed_algorithms_convex_optimization
 
Thesis Fabian Brull
Thesis Fabian BrullThesis Fabian Brull
Thesis Fabian Brull
 
Discrete math mathematics for computer science 2
Discrete math   mathematics for computer science 2Discrete math   mathematics for computer science 2
Discrete math mathematics for computer science 2
 

tfg

  • 1. Universitat Aut`onoma de Barcelona Brownian Motion and Introduction to Stochastic Calculus Author: David Nebra Colmenares Supervisors: Maria Jolis Gim´enez Daniel Campos Moreno July 7, 2016
  • 2.
  • 3. Contents 1 Introduction 1 2 Random Walk 5 2.1 One-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.1 Back to original position . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.2 Get to a specific position . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.3 Expected time to get back to origin . . . . . . . . . . . . . . . . . . . . . 8 2.2 Two-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3 Back to the original position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.4 Get to a specific position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.5 Three-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.6 Back to the origin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.7 Get to a specific position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3 Simulations: Random walks 16 3.1 One-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.1 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.2 Two-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.2.1 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.2.2 Path samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.2.3 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.3 Three-dimensional random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.3.1 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4 Brownian motion 29 4.1 History of Brownian motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.2 The Difussion Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.2.1 Einstein’s derivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.2.2 Langevin’s approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.2.3 Macroscopic Derivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.2.4 Solution of the diffusion equation . . . . . . . . . . . . . . . . . . . . . . 34 4.3 Recurrence of Brownian motion . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.4 Expected time to reach a specific position . . . . . . . . . . . . . . . . . . . . . 40 4.5 Other properties of Brownian motion . . . . . . . . . . . . . . . . . . . . . . . . 42 4.5.1 Quadratic variation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.5.2 Unbounded variation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 5 Simulations: Brownian Motion 45 5.1 Numerical integration of stochastic differential equations with Gaussian white noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 5.1.1 Runge-Kutta-Type methods . . . . . . . . . . . . . . . . . . . . . . . . . 47 2
  • 4. CONTENTS 3 5.1.2 Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 5.1.3 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 5.1.4 Path samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 5.2 Dirichlet problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 5.2.1 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 6 Stochastic integrals 53 6.1 Riemann-Stieltjes integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 6.2 The Itˆo integral for simple processes . . . . . . . . . . . . . . . . . . . . . . . . 54 6.3 The general Itˆo integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.4 A simple version of the Itˆo formula . . . . . . . . . . . . . . . . . . . . . . . . . 56 6.5 Extension I of the Itˆo formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 6.6 Extension II of the Itˆo formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.7 Stratonovich integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.8 Stratonovich or Itˆo? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 7 Stochastic calculus in Finance 62 7.1 Black-Scholes simple model for option pricing . . . . . . . . . . . . . . . . . . . 65 7.1.1 A mathematical formulation for the option pricing problem . . . . . . . . 67 7.1.2 Graphical representations of the Black-Scholes formula . . . . . . . . . . 69 Appendices 72 A Fokker-Planck equation 73 B Results and definitions in Probability 74 B.1 Conditional expectation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
  • 5. Abstract This bachelor thesis aims to introduce the concepts of random walks, Wiener process and Stochastic Calculus and to illustrate some of its applications. Before going into details, we will explain the random walk and the Wiener process, and see how the latter can be understood as a limit of the former. In Chapter 2 we will deal with 1, 2 and 3-dimensional random walks and we will focus on the probability that the random walker will get back to its departing point (recurrence problem). We will then simulate some cases to see that experimental results match theoretical ones, and simulate some cases for the 2 and 3-dimensional case for which we don’t have theoretical results. The next part will be an introduction to Brownian motion, its importance in Physics and how it can be modelled via a Wiener process. As we did with the random walk we will see that, among other properties, the 1-dimensional Brownian motion is recurrent and, finally, we will run several simulations. Chapter 6 is an introduction to Stochastic Calculus that will provide us with useful results which will be used later in Chapter 7. This last chapter will introduce us some financial concepts and one of the most important formulas in modern Quantitative Finance: Black-Scholes formula for option pricing.
  • 6. Chapter 1 Introduction In this chapter we want to explain the similarities between the Brownian motion and the random walk, and see that the former can be undersood as a limit of the latter. The next chapters will focus more in detail on the properties of each one, here we just want to see the link existing between them. Definition 1.0.1. Given a probability space (Ω, F, P) and a measurable space (S, Σ) a stochas- tic process X is a collection of random variables on Ω, indexed by a totally ordered set T, i.e, X = {Xt : t ∈ T} (1.1) where each Xt is a random variable on Ω with values in S, that is X−1 t (E) ∈ F ∀E ∈ Σ ∀t ∈ R (1.2) Definition 1.0.2. A 1-dimensional Wiener process or Browian motion B = (Bt, t ∈ [0, ∞)) is a stochastic process characterized by the following properties 1. B0 = 0 a.s. 2. B has independent increments. 3. B has Gaussian increments: Bt+u − Bt ∼ N(0, u). 4. B has continuous paths: Bt(ω) is a.s. continuous in t. Definition 1.0.3. A n-dimensional Wiener process or Browian motion is a vector-valued stochastic process Bt = (B (1) t , B (2) t , . . . , B (n) t ) (1.3) whose components B (i) t are independent, one dimensional Wiener-processes. Remark 1.0.1. Throughout most of this thesis we will use the terms Wiener process and Brownian indistinctly. In Physics literature Brownian motion is often understood as the ran- dom movement that a particle does, and the Wiener process is one of the many possible inter- pretations of this movement. In this way, many physicists understand Brownian motion as a physical concept that has to do with the movement itself, while here we will understand it as a mathematical object. In some chapters however when we talk about Brownian motion we will refer to the physical concept. In any case, it should be clear to what we refer depending on the context. Definition 1.0.4. Let Xn be independent random variables that can only take values 1 or −1 with equal probability, i.e., P(Xn = 1) = 1/2 and P(Xn = −1) = 1/2. A one-dimensional random walk with n steps is the sum of n of such variables Sn = X1 + X2 + . . . + Xn 1
  • 7. CHAPTER 1. INTRODUCTION 2 There are many properties in common between the random walk and the Brownian motion. In fact, the Brownian motion can be understood as a limit of a random walk, and that’s what we will show here. First we need to make some definitions. There are many types of convergence for random variables, we will need now the convergence in distribution. Definition 1.0.5. Let X, X1, X2, . . . be random variables (which don’t need to be defined on the same probability space). Let Fn, F be the distribution functions of Xn and X respectively. We say Xn converges in distribution to X if for every t where F is continuous we have: lim n Fn(t) = F(t) (1.4) and we write Xn d → X This is the weakest type of convergence for random variables. Indeed it can be shown that Xn a.s −→ X =⇒ Xn P −→ X =⇒ Xn d −→ X (1.5) Convergence in distribution does not have good properties, for example it is not true that the limit of the sum is the sum of the limits. However, when one of the sequences converges to a constant, then we have the results we would expect. Theorem 1.0.1 (Slutsky’s theorem). Assume that Xn d → X and Yn d → c, where c is a constant. Assume also that every n, Xn and Yn are defined on the same probability space. Then 1. Xn + Yn d → X + c 2. Xn · Yn d → cX 3. Xn Yn d → X c , if c = 0 Finally we will need the Central Limit Theorem, which is the most important Theorem in Probability Theory. It basically states that we can approximate the sum of a large number of random variables to the normal distribution. This has a huge number of applications in many fields. Theorem 1.0.2 (Central Limit Theorem, L´evy-Lindeberg version). Let X1, X2, . . . be iden- pendent and identically distributed (i.i.d) random variables with finite second order moment. Write E(Xn) = µ and Var(Xn) = σ2 , and let ¯Xn = 1 n n i=1 Xi (1.6) and Z ∼ N(0, 1). Then ¯Xn − µ σ√ n d −→ Z (1.7) Now that we have these tools, we will proceed to show the relationship between random walk and Brownian motion. Let ξ1, ξ2, . . . be a sequence of random variables with ξi = ±1 with probability 1/2. Let Sn = ξ1 + . . . + ξn (S0 = 0), and let Xn t (ω) be Xn t (ω) = 1 √ n S nt (ω) + (nt − nt ) 1 √ n ξ nt +1(ω) ψn,t (1.8)
  • 8. CHAPTER 1. INTRODUCTION 3 where x is the floor function, that is, it takes the largest integer that is smaller or equal than x. Notice that a random walk is defined for discrete values. The previous definition admits any value t ≥ 0. Because we have S nt instead of S t for big enough n the term 1 √ n S nt will change quickly as t grows. In a way we have made a ‘continuous’ random walk. Theorem 1.0.3. With {Xn } defined by (1.8), we have that for any t > 0 Xn t d −→ Bt as n → ∞ (1.9) where {Bt, t ≥ 0} is a Brownian motion. Proof. First we see that ψn,t P −→ 0 as n → ∞. We have that |ψn,t| = Xn t − 1 √ n S nt ≤ 1 √ n |ξ nt +1| (1.10) and by Chebyshev inequality P (|ψn,t| > ε) ≤ P 1 √ n |ξ nt +1| > ε ≤ E 1√ n ξ nt +1 2 ε2 = 1 ε2n → 0 (1.11) Because ψn,t P −→ 0 this also means that ψn,t d −→ 0 se we can use Slutsky’s theorem (1.0.1) and we obtain Xn t has the same limit as 1 √ n S nt . By the Central Limit Theorem and because nt /n → t 1 nt S nt d −→ N, N ∼ N(0, 1) (1.12) If we consider Yn = nt √ n , then Y d −→ √ t = c and we can use Slutzky’s theorem to 1 nt S nt · Yn: 1 √ n S nt = 1 √ n nt nt S nt = 1 nt S nt · Yn d −→ √ tN (1.13) and because Xn t has the same limit as 1 √ n S nt we have that Xn t d −→ √ tN d = Bt (1.14) This result gives us a feeling on the concept of Brownian motion, as we can understand it as a limit of a random walk. We have assumed that the random variables ξi can only take discrete values 1 and −1. There is a stronger result, in which we don’t need to assume that the random variables take only these two discrete values. It is called Donsker’s invariance Theorem and it is a generalization of what we have just seen. If we take i.i.d random variables ξi Theorem (1.0.3) still holds true. We won’t show this result here, but more details can be found in the book of Billinsgley [2]. The following Proposition can translate some properties we see in random walks to properties in Brownian motion.
  • 9. CHAPTER 1. INTRODUCTION 4 Proposition 1.0.1. Let C([0, ∞)) be the space of continuous functions with the topology of uniform convergence on compacts. Then for every continuous Ψ : C([0, ∞]) → R we have that Ψ(Xn ) d −→ Ψ(B) (1.15) where Xn is defined by (1.8) and B = (Bt, t ≥ 0) is the Brownian motion. Example 1.0.1. Let’s consider Y n = max 0≤t≤T Xn t . The functional Ψ(f) = max 0≤t≤T f(t) is continu- ous, so we can apply Proposition (1.0.1). It tells us that Y n d −→ max 0≤t≤T Bt (1.16) This tool sometimes can be of great help, because if one has proved some property for the random walk this Proposition can help with the proof for the Brownian motion taking limits. However, we will encounter non-continuous functionals such as the stopping time: τ = inf{n > 0, Sn = a} (1.17) Because this functional is not continuous we cannot apply theorem (1.0.1). A consequence of this is for example that to show the recurrence of the random walk and the recurrence of Brownian motion we will need to prove these results separately. Although it seems quite intuitive that properties in the random walk must keep true in the Brownian motion (and as a matter of fact it almost always happens), we cannot deduce these results just taking limits.
  • 10. Chapter 2 Random Walk 2.1 One-dimensional random walk Definition 2.1.1. Let Xn independent be random variables that can only take values 1 or −1 with equal probability, i.e., P(Xn = 1) = 1/2 and P(Xn = −1) = 1/2. A one-dimensional random walk with n steps is the sum of n of such variables Sn = X1 + X2 + . . . + Xn In the following we will consider a particle that can move with equal probability to the left (Xn = −1) and to the right (Xn = 1). The position it will be after n steps will be Sn. We consider it always starts at the origin, that is, S0 = 0. 2.1.1 Back to original position We are now interested in knowing whether the particle will ever return to the original position, that is P(∃n ≥ 1 : Sn = 0) (2.1) For this computation we consider two different events. An will be the event that the particle comes back to its original position for the first time at time n. We have then that A0 = ∅ because the particle could not come back as it didn’t even leave the origin yet, and A1 = ∅ because it is impossible to come back after 1 step. Then for n > 1 we define An := {Sn = 0, Sn−1 = 0, . . . S1 = 0} (2.2) Bn will be the event that the particle is in the original position, no matter if it’s not the first time. That is Bn := {Sn = 0} (2.3) and we define the probabilities an := P(An), bn := P(Bn) (2.4) For n = 0 we have a0 = 0 and b0 = 1. Notice that for n ≥ 1 Bn = n k=0 (Bn ∩ Ak) (2.5) because these events are disjoint we have bn = n k=0 P(Bn ∩ Ak) (2.6) 5
  • 11. CHAPTER 2. RANDOM WALK 6 and because of the independence of Ak and {Xk+1 + . . . + Xn = 0}: P(Bn ∩ Ak) = P(Sn = 0, Sk = 0, Sk−1 = 0, . . . S1 = 0) (2.7) = P(Ak, Xk+1 + . . . + Xn = 0) (2.8) = P(Ak)P(Xk+1 + . . . + Xn = 0) (2.9) Notice that P(Xk+1 + . . . + Xn = 0) = P(X1 + . . . + Xn−k) (2.10) hence we have just shown that bn = n k=0 akbn−k (2.11) Lemma 2.1.1. With the previous definitions the following equation holds ∞ n=0 an = 1 − 1 ∞ n=0 bn (2.12) Proof. For values s ∈ (−1, 1) the series ∞ n=0 ansn and ∞ n=0 bnsn converge. Indeed, because an and bn are bounded by 1, then ∞ n=0 an|s|n ≤ ∞ n=0 |s|n < 1 1 − |s| < ∞ (2.13) and absolute convergence implies convergence. If we multiply these series ∞ n=0 ansn · ∞ n=0 bnsn = ∞ n=0 cnsn (2.14) and if we compare the coefficients of sn on the LHS and RHS we get cn = ∞ k=0 akbn−k. We showed that a0 = 0, hence c0 = 0 and therefore ∞ n=0 ansn · ∞ n=0 bnsn = ∞ n=1 bnsn = ∞ n=0 bnsn − 1 (2.15) thus we obtain ∞ n=0 ansn = 1 − 1 ∞ n=0 bnsn (2.16) but an and bn are always positive. If we do the limit s → 1− we obtain a monotone increasing sequence. Then by the Monotone Convergence Theorem the limit gives ∞ n=0 an = 1 − 1 ∞ n=0 bn (2.17)
  • 12. CHAPTER 2. RANDOM WALK 7 Coming back to our previous problem, we want to see the probability that the particle will come back to its original position: P(∃n ≥ 1 : Sn = 0) = P( ∞ n=0 An) = ∞ n=0 an = 1 − 1 ∞ n=0 bn (2.18) We will show that ∞ n=0 bn = ∞ and, therefore, the particle will come back to its original position with probability 1. Let’s think what are the possible values of bn. To come back, the particle will need to go left as many times as it goes right. If it does n steps, it will have to go n/2 times right and n/2 times left. If n is odd it’s clear that bn = 0. If n = 2k then there are 2k k different paths it can follow, k to the left and k to the right, each with probability 1/2. Thus for n ≥ 1 bn =    0 , if n odd 2k k 1 2 k 1 2 k , if n = 2k (2.19) Recall that the Stirling’s approximation is k! ∼ k e k √ 2πk (2.20) when k → ∞. Then we have for big enough k b2k = (2k)! (k!)2 1 2 2k ∼ (2k)2k √ 4πk k2k2kπ 1 22k = 1 √ π 1 √ k (2.21) so we conclude ∞ n=0 bn = ∞ k=0 b2k = ∞ (2.22) that means, the particle will come back to its original position with probability 1. 2.1.2 Get to a specific position After showing that the particle will come back with probability 1 to its original position, we could further analyse whether the particle will ever visit a specific position. Let’s define f(x) := P(∃n ≥ 1 : Sn = x) (2.23) Lemma 2.1.2. With the previous definition, f(x) = 1 2 f(x − 1) + 1 2 f(x + 1) (2.24)
  • 13. CHAPTER 2. RANDOM WALK 8 Proof. Suppose x = 1, −1, then f(x) = P(∃n ≥ 1 : Sn = x) = P(∃n ≥ 1 : X1 + . . . + Xn = x) = P(∃n ≥ 1 : X1 + . . . + Xn = x, X1 = 1) + P(∃n ≥ 1 : X1 + . . . + Xn = x, X1 = −1) = P(∃n ≥ 1 : X1 + . . . + Xn = x|X1 = 1)P(X1 = 1)+ + P(∃n ≥ 1 : X1 + . . . + Xn = x|X1 = −1)P(X1 = −1) = 1 2 P(∃n ≥ 2 : X2 + . . . + Xn = x − 1) + 1 2 P(∃n ≥ 2 : X2 + . . . + Xn = x + 1) = 1 2 P(∃n − 1 ≥ 1 : X1 + . . . + Xn−1 = x − 1) + 1 2 P(∃n − 1 ≥ 1 : X1 + . . . + Xn−1 = x + 1) = 1 2 P(∃m ≥ 1 : X1 + . . . + Xm = x − 1) + 1 2 P(∃m ≥ 1 : X1 + . . . + Xm = x + 1) = 1 2 f(x − 1) + 1 2 f(x + 1) For x = 1, −1 because f(0) = 1 if S0 = 0 then f(1) = 1 2 + 1 2 f(2) and f(−1) = 1 2 f(−2)+ 1 2 . Suppose f(x) = 1 for some x, then 1 = f(x) = 1 2 f(x − 1) + 1 2 f(x + 1) (2.25) but f(x − 1) ≤ 1 and f(x + 1) ≤ 1 because they are probability measures. Thus to obtain the previous equality follows that f(x − 1) = 1 and f(x + 1) = 1. By induction using that we have already seen that f(0) = 1 we can cover the whole line, so we proved that f(x) = 1 for all x ∈ Z. 2.1.3 Expected time to get back to origin The aim of this section will be to compute the “average” time the particle will need to get back to the original position. One could at first think that this time will not be very large. After all, the probability that it will go back to the origin after the first step, whichever this is, is 1/2. We will however show that the average time is infinite. Lemma 2.1.3. 1 √ 1 − 4x = ∞ m=0 2m m xm (2.26) Proof. We will use the generalized binomial theorem, which states that (x + y)r = ∞ r=0 r k xr−k yk (2.27) where r k = r(r − 1) . . . (r − k + 1) k! (2.28) Let’s apply this formula to our problem: (1 − 4x)−1/2 = ∞ m=0 m k=1(2k − 1) 2mm! (4x)m = ∞ m=0 m k=1(2k − 1) m! 2m xm (2.29)
  • 14. CHAPTER 2. RANDOM WALK 9 so we need to see that the coefficients coincide, that is m k=1(2k − 1) m! 2m = 2m m (2.30) the last equation can be rewritten in a simpler way m k=1 (2k − 1)2m = (2m)! m! = 2m k=m+1 k (2.31) Let’s show it by induction. For m = 1 the equation holds. Suppose it true for m. For m + 1 we have m+1 k=1 (2k − 1)2m+1 = 2(2m + 1)2m m k=1 (2k − 1) (2.32) and 2m+2 k=m+2 k = 1 m + 1 (2m + 2)(2m + 1) 2m k=m+1 k (2.33) using the induction hypothesis 2(2m + 1) = 1 m + 1 (2m + 2)(2m + 1) (2.34) which is true. Theorem 2.1.1. For m ≥ 1, the probability of a first return to the origin at a time 2m is given by a2m = b2m 2m − 1 = 2m m (2m − 1)22m (2.35) Proof. Let’s begin defining the functions U(x) = ∞ m=0 b2mxm (2.36) and F(x) = ∞ m=0 a2mxm (2.37) Since we know that for m ≥ 1 b2m = 2m m=0 a2kb2m−2k (2.38) then U(x) = 1 + U(x)F(x) (2.39) where the 1 in the RHS from the last equation comes from the fact that b0 = 1. We note that both functions converge on the interval (−1, 1), since both an and bn are less than 1 in absolute value. Thus solving for F(x) F(x) = U(x) − 1 U(x) (2.40) From (2.19) we have that U(x) = ∞ m=0 2m m 2−2m xm (2.41)
  • 15. CHAPTER 2. RANDOM WALK 10 and from (2.26) 1 √ 1 − 4x = ∞ m=0 2m m xm (2.42) so that U(x) = 1 √ 1 − x (2.43) and therefore F(x) = U(x) − 1 U(x) (2.44) = (1 − x)−1/2 − 1 (1 − x)−1/2 (2.45) = 1 − (1 − x)1/2 (2.46) and we note that F (x) = U(x)/2. So if we integrate the series U(x)/2 and equate the coeffi- cients of these series to those of F(x), we can obtain an expression for a2m: a2m = b2m−2 2m = 2m−2 m−1 m22m−1 = 2m m (2m − 1)22m = b2m 2m − 1 where we have used in the third step that 2m − 2 m − 1 = m 2(2m − 1) 2m m Corollary 2.1.1. The expected time to get back to the origin is infinite Proof. From (2.35) we know the expression of a2m a2m = b2m 2m − 1 and from (2.21) we know that b2m ∼ 1 √ m so we conclude that a2m ∼ 1 m √ m (2.47) hence the expected time to get back to the origin diverges E(T) = ∞ m=1 a2m · 2m ∼ ∞ m=1 2m m √ m = ∞ m=1 2 √ m = ∞ (2.48)
  • 16. CHAPTER 2. RANDOM WALK 11 2.2 Two-dimensional random walk Definition 2.2.1. Let Xn be independent random vectors that can take values (1, 0), (0, 1), (0, −1) or (−1, 0) with equal probability of 1/4. A two-dimensional random walk with n steps is the sum of such random vectors Sn = X1 + X2 + . . . + Xn In this case the particle will be able to move up, down, left and right. 2.3 Back to the original position We are interested in knowing if it will come back to the origin, as it happened for 1 dimension. That is, we want to compute P(∃n ≥ 1 : Sn = 0) (2.49) Using the same definitions as before, an := P(Sn = 0, Sn−1 = 0, . . . , S1 = 0) bn := P(Sn = 0) and P(∃n ≥ 1 : Sn = 0) = ∞ n=0 an = 1 − 1 ∞ n=0 bn (2.50) Hence if ∞ n=0 bn = ∞, the probability that it will come back to the origin will be 1. Note that in order to come back to the origin we need the same amount of up and down steps, and the same amount of left and right steps. That makes bn = 0 for n odd. If n = 2k then each path that finishes in the origin has equal probability 1 42k . Now let’s count how many possible paths there are. The particle may go j steps up and j steps down, and k −j left and k − j right (note that the number total of steps is 2k), where j can be any number for 0 to k. If every step were different, there would be (2k)! choices, but given any path we can reorder the j down steps in j! different ways without changing the path. The same holds for up, left and right steps. Thus the number of possible combinations is (2k)! j!j!(k − j)!(k − j)! (2.51) and the probability bn = 1 42k k j=0 (2k)! j!j!(k − j)!(k − j)! (2.52)
  • 17. CHAPTER 2. RANDOM WALK 12 We can rewrite bn as follows b2k = 1 42k k j=0 (2k)! j!j!(k − j)!(k − j)! (2.53) = 1 42k k j=0 2k k!k! k!k! j!j!(k − j)!(k − j)! (2.54) = 1 42k 2k k k j=0 k j 2 (2.55) = 1 42k 2k k 2 (2.56) where we have use the equation k j=0 k j 2 = 2k k (2.57) Let’s explain from where this formula comes. We know by Newton Binomial that (x + 1)2k = 2k i=0 2k i xi (2.58) but this can also be writen as (x + 1)k (x + 1)k = k j=0 k j xj k i=0 k i xi (2.59) the coefficient of xk in both expressions have to be the same, that is 2k k = k j=0 k j k k − j = k j=0 k j k j = k j=0 k j 2 (2.60) then b2k = 1 22k 2k k 2 (2.61) If we look closely we will see that this is the same expression as in one dimension to the square. Using Stirling’s formula, b2k = 1 22k 2k k 2 ∼ 1 πk (2.62) And finally we see that the following series is divergent ∞ n bn ≥ ∞ k=0 b2k = ∞ (2.63) and hence P(∃n ≥ 1 : Sn = 0) = 1 (2.64)
  • 18. CHAPTER 2. RANDOM WALK 13 2.4 Get to a specific position As for the one-dimensional case, it can be seen that the particle will reach any position with probability 1 in the plane. Let x = x1e1 + x2e2, with x1, x2 ∈ Z, e1 = (1, 0), e2 = (0, 1) and g(x) be the probability that there exists n ≥ 1 such that Sn = x, i.e. g(x) = P(∃n ≥ 1 : Sn = x) (2.65) The same reasoning as in the one-dimensional case shows that g(x) = 1 4 (g(x − e1) + g(x + e1) + g(x − e2) + g(x + e2)) (2.66) and because g(x) are probabilities, 0 ≤ g(x) ≤ 1. So if g(x) = 1 it must follow that g(x − e1) = g(x + e1) = g(x − e2) = g(x + e2) = 1. But we showed in the previous section that g(0) = 1, so inductively follows that g(x) = 1 for every x. 2.5 Three-dimensional random walk Definition 2.5.1. Let Xn be independent random vectors that can take values (1, 0, 0), (0, 1, 0), (0, 0, 1), (−1, 0, 0), (0, −1, 0) or (0, 0, −1) with equal probability of 1/6. A three-dimensional random walk with n steps is the sum of such random vectors Sn = X1 + X2 + . . . + Xn Now the particle has freedom to move along up, down, left, right, backward and forward. 2.6 Back to the origin Adapting the same definitions as in previous sections we have P(∃n ≥ 1 : Sn = 0) = ∞ n=0 an = 1 − 1 ∞ n=0 bn (2.67) so the particle will go back to the origin if ∞ n=0 bn = ∞. As before for n ≥ 1 odd bn = P(Sn = 0) = 0 (2.68) If n = 2k then the same reasing as in the two-dimensional case applies. The particle can go j steps up and down, i backward and forward and k − j − i left and right. If every path were differenth there would be (2k)! possibilites, but because we can reorder all the j up and down steps in j!j! ways, all the i!i! backward and forward steps in i! ways and all the k − j − i left and right steps in (k − j − i)!(k − j − i)! ways without changing the path, the probability is b2k = 1 62k k j=0 k−j i=0 (2k)! j!j!i!i!(k − j − i)!(k − j − i)! (2.69)
  • 19. CHAPTER 2. RANDOM WALK 14 where we are summing over all the possible values of j and i. If we rewrite b2k we obtain b2k = 1 62k k j=0 k−j i=0 (2k)! j!j!i!i!(k − j − i)!(k − j − i)! (2.70) = 1 22k 1 32k k j=0 k−j i=0 2k k!k! k!k! j!j!i!i!(k − j − i)!(k − j − i)! (2.71) = 1 22k 2k k k j=0 k−j i=0 1 32k k!k! j!j!i!i!(k − j − i)!(k − j − i)! (2.72) = 1 22k 2k k k j=0 k−j i=0 1 3k k! j!i!(k − j − i)! 2 (2.73) The terms in the last summation are the terms of a trinomial distribution. This can be thought as the urn problem given k draws with replacement where we have white, black and red balls. If X, Y and Z are random variables that take values on the number of white, black and red balls drawn respectively then for j + i ≤ k P(X = j, Y = i, Z = k − j − i) = 1 3k k! j!i!(k − j − i)! (2.74) Hence the sum of the probability of all possible outcomes has to be 1, that is k j=0 k−j i=0 1 3k k! j!i!(k − j − i)! = 1 (2.75) but in the expression above we have the summation of the square terms. If a random variable can only take n values with probabilities p1, . . . , pn then n j=1 p2 j ≤ n j=1 pj( max 1≤i≤n pi) ≤ ( max 1≤i≤n pi) n j=1 pj = ( max 1≤i≤n pi) (2.76) therefore b2k ≤ 1 22k 2k k max 1≤i,j≤k 1 3k k! j!i!(k − j − i)! (2.77) Let’s think where this term achieves its maximum. It will be when the denominator is minimum. If k = 3m from the definition of factorial itself it can be easily checked that the denominator takes its minimum when j = m, i = m and k − j − i = m. If k = 3m + 1 then it will be when two of them are m and one m + 1 and if k = 3m − 1 when two of them are m and one m − 1. For k = 3m b2k ≤ 1 22k 2k k 1 3k k! m!m!m! (2.78) and using Stirling’s approximation 1 22k 2k k 1 3k k! m!m!m! ∼ 1 √ πk (3m e )3m √ 6mπ (m e )m √ 2mπ = C1 k √ k (2.79) where C1 is a constant. For k = 3m + 1 and k = 3m − 1 the behaviour for big enough values will be the same as in the case k = 3m, so ∞ k=0 b2k ≤ C ∞ k=0 1 k √ k < ∞ (2.80)
  • 20. CHAPTER 2. RANDOM WALK 15 This shows that the probability to come back to the origin is strictly less than 1. But the probability is also strictly positive. For example, we know that a2 = 1 6 . That is, after the first step the probability that it will come back is the probability that it will take a step in the opposite way to the first step. We see that as we are including more dimensions, the power of k in the denominator of b2k increases. In dimensions higher than 3 we would expect that the power of k is even higher, making the probability to return to origin even smaller than for d = 3. The idea widely speaking is that as we grow in dimensions there are more ‘choices’ for the movement of the particle and that makes it more ‘difficult’ for the particle to come back. We will however not show that for d > 3 the probability of coming back to the origin of the random walk is less than 1. 2.7 Get to a specific position Adapting the same definitions as in the previous sections for the three-dimensional case, g(d) = 1 6 (g(d + e1) + g(d + e2) + g(d + e3)+ + g(d − e1) + g(d − e2) + g(d − e3)) if d were a point such that g(d) = 1 then g(d + e1) + g(d + e2) + g(d + e3) + g(d − e1) + g(d − e2) + g(d − e3) = 1 (2.81) but by induction we would arrive to g(0) = 1, which contradicts what we have just shown. Therefore it must be g(d) < 1 for all d ∈ Z3 .
  • 21. Chapter 3 Simulations: Random walks In this chapter we will run different simulations to compare experimental results to theoretical results explained in the previous chapters. For most simulations we will use Python, and in some cases Java. All scripts have been made by David Nebra unless otherwise stated. 3.1 One-dimensional random walk We will run several simulations of random walks starting at the origin and count the number of steps it takes for the particle to get back to the origin for the first time for every simulation. We will gather this information in two histograms. In the same plots we will draw the curve that represents the theoretical probabilites, computed in Theorem (2.35). For the first histogram we run 50000 simulations and every simulation will be cut off if after 60 steps the particle has not returned to the origin. For the second histogram we run 10000 simulations and every simulation will be cut off if after 3000 steps the particle has not returned to the origin. In order to represent the information in the second histogram, the x-axis and y-axis will be in log scale so we can see a better representation of the data. Figure 3.1 For a closer look at the results depicted in 3.1 we show the following table, which compares the 16
  • 22. CHAPTER 3. SIMULATIONS: RANDOM WALKS 17 values obtained by both the simulation and the theory. N Theory Simulations Desviation (%) 2 25000 25030 0.1 4 6250 6196 -0.8 6 3125 3139 0.4 8 1953 1956 0.14 10 1367 1389 1.5 12 1025 1016 -0.9 14 806 780 -3.2 16 655 683 4.3 18 545 590 8.2 20 463 469 1.1 22 400 396 -1.1 24 350 359 2.5 26 310 293 -5.4 28 277 301 8.7 30 249 237 -4.8 N Theory Simulations Desviation (%) 32 226 240 6.3 34 206 235 14.1 36 189 176 -6.7 38 174 181 4.2 40 161 154 -4.2 42 149 149 0 44 139 128 -7.9 46 130 120 -7.6 48 122 96 -21.2 50 115 104 -9.2 52 108 115 6.5 54 102 104 2.0 56 96 91 -5.6 58 92 91 -0.5 Table 3.1: This table gather both the theoretical and experimental frequencies, and also the desviation with respect to the theoretical values. The desviation has been calculated as Desviation = Experimental frequencies − Theoretical frequencies Theoretical frequencies · 100 (3.1) Looking into the data in the table we observe a trend that we could not see in the plotted graph. We observe that the desviation (i.e the error) grows as the number of steps grows. This is something we should expect, because the number of particles that go back to origin after N steps decreases as N grows. That means that we have less data available for N big and therefore the simulations are less accurate. This is a direct implication of the Law of Large Numbers (see page 8 of the reference [5]). For the theoretical counts, we have used the formula 2.35. The expected count Y2m of the number of particles that reach back the origin after 2m steps will be given by E(Y2m) = N · a2m (3.2) where N is the total number of simulations. For example, the expected count of particles that come back to origin after 2 steps for 50000 simulations is E(Y2m) = 50000 · 1 2 = 25000 (3.3) Now we will see another simulation in log-log scale.
  • 23. CHAPTER 3. SIMULATIONS: RANDOM WALKS 18 Figure 3.2: Particles to reach back origin in log-log scale It is important to remark that even though the bins in the figure (3.2) are the same width, the more to the right they are the more number of steps they represent. To make it easier to understand let’s take an example, the bin 0 to 1 is the sum of all the simulations in which the particle returned back to the origin and took between e0 = 1 and e1 = 2.71 . . . steps. So we now that the bin 0 to 1 only represent the case when the particle returned back to the origin after 2 steps. If we take the bin 7 to 8 it represents all the simulations in which the particle returned back to the origin and took between e7 = 1096.63 . . . and e8 = 2980.95 . . . steps. So this bin counts for every simulation in which it took the particle 1098 steps, or 1100 steps,..., or 2980 steps to go back to the origin. We can collect this data in a table: log(N) Theory Simulations Desviation [0 − 1) 5000 4921 -1.5 [1 − 2) 1875 1906 1.6 [2 − 3) 1363 1356 -0.5 [3 − 4) 681 680 -0.1 [4 − 5) 426 445 4.4 [5 − 6) 257 285 10.8 [6 − 7) 156 146 -6.8 [7 − 8) 94 90 -5.1 3.1.1 Code The following script runs M different simulations of random walks of length at most N. For every simulation when the random walk reaches 0 for the first time it stops the simulation and keeps the number of steps in a vector v. def SimRandomWalk(N=100, M=1000): v=[] for l in range (1 ,M) :
  • 24. CHAPTER 3. SIMULATIONS: RANDOM WALKS 19 x=numpy . random . uniform ( −0.5 ,0.5 ,(N, 1 ) ) x[0]=0 i=1 k=0 suma=1 while suma!=0 and i<N or k==0: i f k==0: k=1 suma=0 i f x [ i ] >0: x [ i ]=1 else : x [ i ]=−1 suma=suma+x [ i ] i=i+1 i f suma==0: v . append ( i −1) return v The next script on the one hand computes the theoretical probabilities a2m (yam in the script) and then it plots these probabilites together with an histogram of the simulations. This is the code used for plotting figure (3.1). def freqHistogram1D (N=30,M=50000): f=math . f a c t o r i a l yam=[] xam=[] for m in range (1 ,N) : yam. append (M* f (2*m)/( f (m)* f (m)*(2*m−1)*2**(2*m) ) ) xam. append(1+2*m) X=SimRandomWalk(2*N,M) (n , bins , patches ) = plt . h i s t (X, bins=N−1) #p l t . s c a t t e r (xam,yam, c=’r ’) plt . plot (xam,yam, c=’ r ’ ) red patch = mp. Patch ( color=’ red ’ , l a b e l=’ Theoretical frequencies ’ ) blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ ) plt . legend ( handles =[ red patch , blue patch ] ) plt . xlabel ( ’N’ ) plt . ylabel ( ’ Frequency ’ ) plt . show () xam [ : ] = [ x−1 for x in xam] yam=numpy . array (yam) X=numpy . array (X) for i in range (0 ,N−1): print (( n [ i ]−yam[ i ] ) /yam[ i ] ) print (xam,yam, n) Lastly, to make the plot in figure (3.2) we used the following code. def freqHistogram1DLogLog (N=3000,M=10000): f=math . f a c t o r i a l yam=[]
  • 25. CHAPTER 3. SIMULATIONS: RANDOM WALKS 20 xam=[] bins=9 suma1 , suma2 , suma3 , suma4 , suma5 , suma6 , suma7 , suma8 , suma9 = [ 0 ] * 9 for m in range (1 ,N) : mm=2*m yam. append (M* f (mm)/( f (m)* f (m)*(mm−1)*2**(mm) ) ) i f 0<=math . log (mm)<1: suma1=suma1+yam[m−1] e l i f 1<math . log (mm)<2: suma2=suma2+yam[m−1] e l i f 2<math . log (mm)<3: suma3=suma3+yam[m−1] e l i f 3<math . log (mm)<4: suma4=suma4+yam[m−1] e l i f 4<math . log (mm)<5: suma5=suma5+yam[m−1] e l i f 5<math . log (mm)<6: suma6=suma6+yam[m−1] e l i f 6<math . log (mm)<7: suma7=suma7+yam[m−1] e l i f 7<math . log (mm)<8: suma8=suma8+yam[m−1] e l i f 8<math . log (mm)<9: suma9=suma9+yam[m−1] yam=[suma1 , suma2 , suma3 , suma4 , suma5 , suma6 , suma7 , suma8 , suma9 ] for m in range (0 , bins ) : xam. append (0.5+m) X=l i s t (map(math . log , SimRandomWalk(2*N,M) ) ) (n , bins , patches ) = plt . h i s t (X, bins=numpy . arange ( bins ) , log=True ) plt . plot (xam,yam, c=’ r ’ ) plt . xlabel ( ’ log (N) ’ ) plt . ylabel ( ’ Frequency ’ ) red patch = mp. Patch ( color=’ red ’ , l a b e l=’ Theoretical frequencies ’ ) blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ ) plt . legend ( handles =[ red patch , blue patch ] ) for i in range ( 0 , 8 ) : print (( n [ i ]−yam[ i ] ) /yam[ i ] ) print (xam,yam, n) plt . show () 3.2 Two-dimensional random walk The simulations here are identical as in the previous section, but for two-dimensional random walks. The first histogram shows the count of all the particles that come back to origin after 60 steps. The values we selected for making the second plot are N = 60 and M = 50000, being M the number of simulations. In the second histogram, we took N = 1000 and M = 10000.
  • 26. CHAPTER 3. SIMULATIONS: RANDOM WALKS 21 Figure 3.3 From this chart we could try to compute the probabilites an. We just need to read from the plot the number of particles that returned after n steps, and then divide by the total number of simulations, that is M = 50000. For example, a2 ≈ 12500 50000 = 1/4 = 0.25 a4 ≈ 4000 50000 = 2/25 = 0.08 a6 ≈ 2000 50000 = 1/25 = 0.04 . . . If we take into account again the Law of Large Numbers, this method would allow us to re- construct the theoretical probabilites an. Of course, it would only be an approximation, but it can be as good as we want, we just need big values of M. For an with n big there will be trouble because we will need much computation power, but for small values of n one can find the probability with great accuracy. The next plot is again in log-log scale for better visualization. Because we have no theoretical data to compare it with, we have computed the regression line y = mx + b. For its calculation, we have taken the middle point of every bin and its corresponding log frequency. Because the y-axis of the plot are in logarithmic scale, we actually draw 10y instead of y, so we would see a line in the plot. Exact details of its calculation can be found in the code.
  • 27. CHAPTER 3. SIMULATIONS: RANDOM WALKS 22 Figure 3.4: Plot and regression line y = mx + b with m = −0.14 and b = 3.38 This regression line can help us make some rough predictions. For example, if we take the value x = 12.5 with the information of the regression line we know that a total of 10y = 10−0.14·12.5+3.38 simulations reached back the origin between e12 and e13 steps. That is, only 43 simulations from a total of 10000 reached back the origin for the first time after doing between 162754 and 442414 steps. In the next section we will compare this regression line to that of the three dimensional case. 3.2.1 Code The following script runs M different simulations of random walks of length at most N. For every simulation when the random walk reaches 0 for the first time it stops the simulation and keeps the number of steps in a vector v. def SimRandomWalk2D(N=100,M=1000): v=[] for l in range (1 ,M) : x=numpy . random . uniform ( −0.5 ,0.5 ,(N, 1 ) ) x[0]=0 i=1 k=0 sumax=1 sumay=1 while (sumax!=0 or sumay!=0) and i<N or k==0: i f k==0: k=1 sumax=0 sumay=0 i f x [ i ] >0.25: sumax=sumax+1
  • 28. CHAPTER 3. SIMULATIONS: RANDOM WALKS 23 i f x [ i ]>0 and x [ i ] <0.25: sumax=sumax−1 i f x [ i ] < −0.25: sumay=sumay+1 i f x [ i ]<0 and x [ i ] > −0.25: sumay=sumay−1 i=i+1 i f sumax==0 and sumay==0: v . append ( i −1) return v for plotting figure (3.3): def freqHistogram2D (N=30,M=50000): plt . h i s t (SimRandomWalk2D(2*N,M) , bins=N−1) blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ ) plt . legend ( handles =[ blue patch ] ) plt . xlabel ( ’N’ ) plt . ylabel ( ’ Frequency ’ ) and for plotting figure (3.4): def freqHistogram2DLogLogLine (N=1000,M=10000): bins=9 xam=[] logn =[] x = numpy . linspace (0 ,8 ,100) X=l i s t (map(math . log , SimRandomWalk2D(2*N,M) ) ) (n , bins , patches ) = plt . h i s t (X, bins=numpy . arange ( bins ) , log=True ) blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ ) plt . legend ( handles =[ blue patch ] ) plt . xlabel ( ’ log (N) ’ ) plt . ylabel ( ’ Frequency ’ ) for m in range ( 0 , 8 ) : xam. append (0.5+m) i f n [m]!=0: logn . append (math . log10 (n [m] ) ) else : logn . append (0) print ( logn ,xam) m, b = numpy . p o l y f i t (xam, logn , 1) plt . plot (x , 10**(m*x+b ) , ’−’ ) print (m, b) 3.2.2 Path samples
  • 29. CHAPTER 3. SIMULATIONS: RANDOM WALKS 24 Figure 3.5: Two different simulations for a 2D random walk. The particle (blue) will go up, down, left or right with equal probability. 3.2.3 Code We used a code in Java provided by Princeton: public class randomWalk2 { public static void main( String [ ] args ) { int N = 60; StdDraw . setXscale(−N, +N) ; StdDraw . setYscale(−N, +N) ; StdDraw . c l e a r (StdDraw .GRAY) ; int x = 0 , y = 0; int steps = 0; while (Math . abs (x) < N && Math . abs (y) < N) { StdDraw . setPenColor (StdDraw .WHITE) ; StdDraw . f i l l e d S q u a r e (x , y , 0 . 4 5 ) ; double r = Math . random ( ) ; i f ( r < 0.25) x−−; else i f ( r < 0.50) x++; else i f ( r < 0.75) y−−; else i f ( r < 1.00) y++; steps++; StdDraw . setPenColor (StdDraw .BLUE) ; StdDraw . f i l l e d S q u a r e (x , y , . 4 5 ) ; StdDraw . show ( 4 0 ) ; } StdOut . println ( ”Total steps = ” + steps ) ; } } The functions StdDraw and StdOut are just for drawing and printing the results. They are
  • 30. CHAPTER 3. SIMULATIONS: RANDOM WALKS 25 defined in other documents but they are not interesting for our purposes. The algorithm creates a loop, for which in each step a random number r in the interval (0, 1] is created. The interval is divided into four equal parts. Depending on the value of r the particle will go down, up, left or right. 3.3 Three-dimensional random walk The first two simulations in the section are identical as in the previous section, but for three- dimensional random walks. The values for the first histogram are N = 60 and M = 50000 and for the second histogram N = 1000 and M = 10000. The histograms are the following Figure 3.6 As before, we could compute the probabilites an with the information in the plot a2 ≈ 8500 50000 = 0.17 (3.4) a4 ≈ 2000 50000 = 0.04 (3.5) a6 ≈ 1000 50000 = 0.02 (3.6) . . . (3.7) Next histogram is in log-log scale for better visualization, and the regression line has been calculated
  • 31. CHAPTER 3. SIMULATIONS: RANDOM WALKS 26 Figure 3.7: Plot and regression line y = mx + b with m = −0.24 and b = 3.24 Before we move on, let’s have a look at the regression lines for the 2D and 3D random walks. For the 2D random walk we obtained y = −0.14x + 3.38 while for the 3D random walk y = −0.24x + 3.24. First we start with the similarities. They both have a negative slope and a positive intercept. This all makes sense, a negative slope means that the number of particles that come back to the origin after N steps is smaller than the number that come back after n steps, where N > n. Alternatively, the more steps that a particle has been away from the origin, the less ‘probable’ it is to come back in the next step. For this reason, the intercept must be positive. Otherwise it would lack of any physical sense as the number of steps would take negative values. The big difference between them is the slope of the regression lines. For the 2D case we have m = −0.14 and for the 3D m = −0.24 which is a difference close to 50%. This means that the increment ∆N = N2 − N1, where N2 > N1, is smaller for 2D than for 3D. That is, the histogram for 3D is more ‘heavy’ for small values of N and it decreases faster to 0 as N grows than for the 2D case. 3.3.1 Code The following script runs M different simulations of random walks of length at most N. For every simulation when the random walk reaches 0 for the first time it stops the simulation and keeps the number of steps in a vector v. def SimRandomWalk3D(N=100,M=1000): v=[] for l in range (1 ,M) : x=numpy . random . uniform (0 ,6 ,(N, 1 ) ) x[0]=0 i=1 k=0 sumax=1
  • 32. CHAPTER 3. SIMULATIONS: RANDOM WALKS 27 sumay=1 sumaz=1 while (sumax!=0 or sumay!=0 or sumaz!=0) and i<N or k==0: i f k==0: k=1 sumax=0 sumay=0 i f x [ i ]>0 and x [ i ] <1: sumax=sumax+1 i f x [ i ]>1 and x [ i ] <2: sumax=sumax−1 i f x [ i ]>2 and x [ i ] <3: sumay=sumay+1 i f x [ i ]>3 and x [ i ] <4: sumay=sumay−1 i f x [ i ]>4 and x [ i ] <5: sumaz=sumaz+1 i f x [ i ]>5 and x [ i ] <6: sumaz=sumaz−1 i=i+1 i f sumax==0 and sumay==0 and sumaz==0: v . append ( i −1) return v for plotting figure (3.6): def freqHistogram3D (N=30,M=50000): plt . h i s t (SimRandomWalk3D(2*N,M) , bins=N−1) blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ ) plt . legend ( handles =[ blue patch ] ) plt . xlabel ( ’N’ ) plt . ylabel ( ’ Frequency ’ ) and for plotting figure (3.7): def freqHistogram3DLogLogLine (N=1000,M=10000): bins=9 xam=[] logn =[] x = numpy . linspace (0 ,8 ,100) X=l i s t (map(math . log , SimRandomWalk3D(2*N,M) ) ) (n , bins , patches ) = plt . h i s t (X, bins=numpy . arange ( bins ) , log=True ) blue patch = mp. Patch ( color=’ blue ’ , l a b e l=’ Experimental frequencies ’ ) plt . legend ( handles =[ blue patch ] ) plt . xlabel ( ’ log (N) ’ ) plt . ylabel ( ’ Frequency ’ ) for m in range ( 0 , 8 ) : xam. append (0.5+m) i f n [m]!=0: logn . append (math . log10 (n [m] ) ) else : logn . append (0)
  • 33. CHAPTER 3. SIMULATIONS: RANDOM WALKS 28 print ( logn ,xam) m, b = numpy . p o l y f i t (xam, logn , 1) plt . plot (x , 10**(m*x+b ) , ’−’ ) print (m, b)
  • 34. Chapter 4 Brownian motion 4.1 History of Brownian motion Brownian motion takes its name after a Scottish botanist, Robert Brown. Brown was a famous man in his time, but not for the discovery that has his name, but for the classification of the plants of the New World. When looking through a microscope in 1827 at grains of pollens suspended in water, Brown noticed that a group of grains always disperses and that individual grains move around continuously, irregularly and very quickly. Such phenomena were observed already prior to Brown, but only in organic particles. It was believed back then that it was a property from organic molecules, having some kind of mysterious ‘vital force’. Brown was not very excited about this idea that could fit the living pollen, so he decided to check if the same motion was observed with non-organic particles. Both organic and non-organic particles dis- played the same kind of motion, which showed that the motion had a physical origin. Brown’s limited equipment could only show that this motion was not caused by currents in the liquid, nor by convection, nor by evaporation of the solvent. The mystery was left unsolved for many years. It was not considered as an important problem in Physics but nevertheless many people attempted to solve it. Appart from the causes that Brown himself showed that were not responsible for Brownian motion, chemical composition, shape of container, and several of external influence were eliminated as possible causes. After Maxwell and Boltzmann formulated the so-called kinetic theory, many physicists tried to ex- plain Brownian motion in those terms, in particular by determining the velocity of the particles. All those attempts failed. Now all these failures are of historical interest, but back to the beginning of the 20th they were of great importance for two men: Albert Einstein and Marian Smoluchowski. That many scientists had failed to explained the Brownian motion in terms of conventional Physics pre- pared the ground for a new revolutionary explanations proposed by them. The year 1905 is considered to be a miracle year for theoretical physics. In this year not only Einstein did pub- lish a famous paper where he explained the mechanism of the Brownian motion, but he also published two papers lying foundations for the Special Theory of Relativity and one explaining the photoelectric effect, that would win him the Nobel prize in 1921. An independent paper explaining also the Brownian motion was published in 1905 by Smoluchowski. This new and revolutionary concepts were for many years heavily opposed by leading scientists. Einstein’s and Smoluchowski’s idea was that the movement of Brownian particles was caused by collisions with molecules of the solvent. This molecules move in display of their thermal energy, of which the temperature is a measure. When a particle is suspended in any fluid, like air or water, the atoms or molecules composing the fluid hit the particle from different directions. While the human eye cannot see the effect of individual impacts, it can observe the net motion caused by many impacts over a period of time. While this explanation may seem 29
  • 35. CHAPTER 4. BROWNIAN MOTION 30 today trivial, it was far from trivial over 100 years ago. In fact, the atomistic hypothesis, that is, the hypothesis that matter is grainy and cannot be continuously divided infinitely, was not commonly accepted. Some scientists treated it as an unsupported working hypothesis and oth- ers, including eminent figures as Wilhelm Ostwald, the 1909 Nobel Prize in chemistry, opposed it vigorously. Einstein and Smoluchowski claimed that this motion provided a proof of the existence of molecules in the solvent and, what is more, that by observing the Brownian particles one could get much insight into the properties of the molecules of the solvent. They observed that the mean displacement of a particle (squared) was proportional to the duration of the obser- vation, and that the proportionality constant was related to the so-called diffusion coefficient D: E[(Bt − B0)2 ] = 2Dt, D = KBT γ (4.1) where KB is the Boltzmann constant, T the temperature and γ = 6πνR is the Stokes friction coefficient for a spehere with radius R. These results rendered feasible many specific measures, for example it was possible to experimentally determine the Avogadro constant. It is interesting to know that explaining Brownian motion was not Einstein’s goal. He was aiming to establish a relationship between the diffusion coefficient and the themperature, in which he succeeded, but he also guessed what the thermal motion should look like. On the contrary, Smoluchowski knew the experimental data on the Brownian motion very well and in- tended to explain them. It is now clear that Smoluchowski obtained the results before Einsten, but decided to publish them after he was impressed by Einstein work. These papers have also answered several other questions. First, they provided a microscopical explanation of diffusion (molecules of the substance that diffuses are ‘pulled through’ by the collisions with the molecules in the solvent), second, they derived an equation known today as the diffusion equation, and third they explained why all other attemps in describing the Brownian motion in terms of velocities had failed. Smoluchowski noticed that displacements of Brownian particles seen in a microscope resulted from a huge number of collisions with the molecules of the solvent: the displacements were averaged over many such collisions. The time between two consecutive collisions is much shorter that we can now, in the 21t h century, ob- serve. At any two observed zigzags there are many other zigzags that have happened and we have failed to observe. There is an important remark to do here. The Newtonian dynamics, commonly used in Smolu- chowski times and today for explaining a large array of phenomena, says that the trajectory of any particle can be described by means of a certain differential equation. To write down this equation, you need to know all the forces acting on this particle. The forces may be changing but as long as these changes are smooth, the trajectory of the particle will also be smooth. Smoluchowski revolutionary point of view was that Brownian motion was not smooth, therefore challenging a ‘sacred’ canon of Physics back then. This was truly a deviation of a well-established paradigm, but it was succesful in explaning an experiment that other theories could not explain. The diffusion equation mentioned above does not aim to explain perfectly the behaviour of a single particle, but rather the behaviour a large enough amount of particles, for example a drop of ink in a water tank. While the motion of a single particle may be erratic and awkward, the collective behaviour can be quite decent and predictible. This is a totally new approach in Physics, that changes from deterministic to probabilistic. The works of Einstein and Smoluchowski have become one of the cornerstones of Probability Calculus and the theory of Stochastic Processes
  • 36. CHAPTER 4. BROWNIAN MOTION 31 4.2 The Difussion Equation The diffusion equation is an equation that describes the behaviour of a collective motion of particles in a material, resulting from the random movement of each particle. There are many approaches to derive this equation, we will use two of them: the Einstein’s derivation and the Macroscopic Derivation. First we will explain Einstein’s derivation. Then we will see Langevin’s approach and how the diffusion equation is related to the Wiener process. After this we will go through the Macroscopic derivation, which will give us insight on the importance of the diffusion equation in ecology and biology. Lastly, we will see that the solution of the diffusion equation follows the density of a Wiener process. 4.2.1 Einstein’s derivation This derivation is very interesting from a historical point of view because it is the one that appeared for the first time in 1905 in Albert Einstein’s papers. For mathematical simplicity we consider the one dimensional case. We assume that that the motion is a composition of jumps that can take arbitrary lengths z. Each possible jump is assigned a probability according to a PDF φ(z). If we assume i.i.d jumps, the density of individuals located at x at time t + τ is equal to the density of individuals that were located at a point at distance z at time τ before and jumped to point x after waiting a time τ. Because the jump can be from any point, we must consider all possible distances. Mathematically this means ρ(x, t + τ) = ∞ −∞ ρ(x − z, t)φ(z)dz (4.2) Notice that this equation is discrete in time and continuous in space. The function φ(z) is known in ecology as the dispersal kernel. Equation (4.2) holds only when the population is large enough, otherwise we should take care of possible fluctuations. If we consider τ and z small enough, we can do a Taylor expansion. First for τ ρ(x, t + τ) = ∞ n=0 τn n! ∂n ρ(x, t) ∂tn (4.3) and for z ρ(x − z, t) = ∞ n=0 (−z)n n! ∂n ρ(x, t) ∂xn (4.4) and now we can insert these expressions into equation (4.2): ρ(x, t) + τ ∂ρ(x, t) ∂t + ◦(τ2 ) =ρ(x, t) ∞ −∞ φ(z)dz − ∂ρ(x, t) ∂x ∞ −∞ zφ(z)dz+ + ∂2 ρ(x, t) ∂x2 ∞ −∞ z2 2! φ(z)dz + ◦(z3 ) because φ(z) is a density function, it must be normalised which means ∞ −∞ φ(z)dz = 1. Besides, we can assume isotropic movements, which means that φ(z) = φ(−z). Hence, when n is odd we have ∞ −∞ zn φ(z)dz = 0. With this things in mind we can rewrite the previous equation ρ(x, t) + τ ∂ρ(x, t) ∂t + ◦(τ2 ) = ρ(x, t) + ∂2 ρ(x, t) ∂x2 ∞ −∞ z2 2! φ(z)dz + ◦(z4 ) (4.5)
  • 37. CHAPTER 4. BROWNIAN MOTION 32 and now simplyfing and dividing by τ ∂ρ ∂t = ∂ρ ∂t ∞ −∞ z2 2τ φ(z)dz + ◦(z4 /τ) (4.6) Finally we take the limit z → 0 and τ → 0, but in such way that z2 /τ is finite. Thus, ∂ρ ∂t = D ∂2 ρ ∂x2 (4.7) where D ≡ 1 2τ ∞ −∞ z2 φ(z)dz = E(z2 ) 2τ (4.8) Equation (4.7) is the well-known the diffusion equation. We will see later that the solution is closely related to the Wiener process. 4.2.2 Langevin’s approach As we mentioned earlier, explaining the Brownian motion by probabilistic means and as a consequence of atomic collisions was revolutionary back in the time of Einstein. One of the earliest models to describe Brownian motion was to suppose that the movement followed a pure Wiener process. That description is quite accurate, however the Wiener process is known for having some mathematical properties that cannot find an easy translation into the fields of Physics. For example, we will see that if the particle starts at x = 0, then the point 0 is an accumulation point, meaning that for every ε there exists infinitely many t ∈ (0, ε) such that x = 0. It is difficult to imagine a real particle moving in this way. One of the big problems about modelling Brownian motion via the Wiener process is that it does not have a well-defined velocity, since the Wiener process is nowhere differentiable and hence v = dW dt is not defined in the ordinary sense. However, in Physics we usually assign the velocity v = dW dt = σξ(t) (4.9) to a particle with a random motion, where σ is a constant and ξ(t) represents white noise. From this we see that the velocity is totally random. Just some months after Einstein’s work, Paul Langevin presented an alternative description to Brownian motion that is still very referenced in the literature. He also considered that the fluctuating velocities observed in the Brownian particles should be due to noisy effects coming from the surrounding particles in the solvent, but he also considered the friction effects on the motion of the particles. So Langevin’s description of Brownian motion reads dv dt = −γv + σξ(t) (4.10) where the term −γv represents a friction force proportional to the particle velocity. Equation (4.15) is usually named Ornstein-Uhlenbeck process since these two researchers provided in 1930 a detailed analysis of its statistical properties. The constant σ measures how large noise fluctuations are. The velocity now is not simply a fluctuating variable but it changes smoothly as a result of the joint effect of fluctuations and the friction force −γv. We can apply now the limit of strong friction m|dv/dt| |γv|. As this suggests, the corresponding persistance introduced in the particle motion is mainly governed by the friction term. In consequence, γ is usually known as the persistence parameter. Under this limit equation (4.10) reads γv = γ dx dt = σξ(t) (4.11)
  • 38. CHAPTER 4. BROWNIAN MOTION 33 and it can be shown that an equation of the form dx dt = √ 2Dξ(t) (4.12) leads in the macroscopic limit to a Fokker-Planck equation (see Appendix A) identical to the diffusion equation: ∂P ∂t = D ∂2 P ∂x2 (4.13) For both equations to be equal it must happen that D = σ2 2γ2 (4.14) From here it should already be clear the close relationship between diffusion equation and par- ticle moving according to a Wiener process. Now, if we don’t take the assumption that m|dv/dt| |γv| equation (4.10) can be integrated to obtain v(t) = v(0)e−γt + √ 2DW(t) (4.15) So we see that if the particle had an initial velocity, it will decrease until becoming purely random. In the limit t → ∞ we recover the velocity of a particle moving according to the Wiener process. The average position will be given again by integration: E(x(t)) = E(x0) + t 0 E(v)dt = E(x0) + E(v0) 1 − e−γt γ (4.16) and we see that for the limit t → ∞ we have E(x) = E(x0) + E(v0) γ , in comparison with E(x) = E(x0) for the pure Wiener process. 4.2.3 Macroscopic Derivation We consider a population with density ρ(x, t) located at some point x at time t (for example a group of insects, or a drop of ink in water). To describe the movement it is necessary to introduce another dependent quantity, the population flux J(x, t). This quantity is a vector pointing in the direction of movement and indicates the net quantity of particles flowing in that direction per unit time and per unit length (or area or volume). We will assume that the density and flux are smooth functions of space and time. The balance equation states that the rate of change of ρ(x, t) in a volume V closed by a surface Ω is due to the fluxes inward or outward on V through Ω. Writing this in mathematical language we have ∂ ∂t V ρ(x, t)dV = − Ω J(x, t) · ndS (4.17) where n is a unit vector normal to Ω and · is the scalar product. Applying the divergence theorem Ω J(x, t) · ndS = V · J(x, t)dV (4.18) into (4.17) yields V ∂ρ(x, t) ∂t + · J(x, t) dV = 0 (4.19)
  • 39. CHAPTER 4. BROWNIAN MOTION 34 where is the vector ∂ ∂x , ∂ ∂y , ∂ ∂z . Since the volume of integration V can be arbitrarily small we obtain the continuity equation ∂ρ(x, t) ∂t + · J(x, t) = 0 (4.20) In order to get an equation for the evolution of the population density we need to know how J(x, t) depends on ρ(x, t). We will assume here that the flux J(x, t) is proportional to the spatial population gradient ρ(x, t). This assumption is known as the Fick’s law, which can be written as J(x, t) = −D ρ(x, t) (4.21) The minus sign takes into account that the flux is a vector pointing in the direction where the population density decreases. Writing this last expression in (4.20) we get the diffusion equation ∂ρ ∂t = · (D ρ) (4.22) which in the one-dimensional case it can be written simply as ∂ρ ∂t = D ∂2 ρ ∂x2 (4.23) and is also known as the heat equation. 4.2.4 Solution of the diffusion equation The solution of such equation can be easily given using Fourier transforms. Tranforming (4.23) by Fourier we obtain ∂ˆρ(k, t) ∂t = −Dk2 ˆρ(k, t) (4.24) where we have used the property of the transform of a derivative: dnf(x) dxn = (−ik)n ˆf(k) (4.25) Integrating (4.24) we obtain ˆρ(k, t) = ρ(k, 0)e−Dk2t (4.26) In the simple case we consider that the population density is concentrated in x = x0, then we have the initial condition ρ(x, 0) = δ(x − x0), which implies ˆρ(k, 0) = e−ikx0 . To obtain back the original density function we apply the inverse Fourier transform ρ(x, t) = ∞ −∞ eikx ˆρ(k, t)dk = ∞ −∞ eik(x−x0)−Dk2t dk = 1 √ 4πDt e− (x−x0)2 4Dt (4.27) which is the density function of a Wiener process (Wt, t ≥ 0). From this result we conclude that systems governed by the diffusion equation will behave following a Wiener process. From result (4.27) we can calculate E(x(t)) = ∞ −∞ xρ(x, t)dx = x0 (4.28)
  • 40. CHAPTER 4. BROWNIAN MOTION 35 and E(x2 (t)) = ∞ −∞ xρ(x, t)dx = x2 0 + 2Dt (4.29) This result indicates that the scaling E(x2 (t)) ∼ t (4.30) holds in the large time limit. This is a fundamental sign of any diffusive transport. We will see this result in more mathematical detail in a following section ‘Quadratic variation’. 4.3 Recurrence of Brownian motion Now we will try to establish a comparison between the Brownian motion properties and those of the random-walk reported in the previous Chapter. Definition 4.3.1. A filtration on a probability space (Ω, F, P) is a family (F(t) : t ≥ 0} for σ-algebras such that F(s) ⊂ F(t) ⊂ F for all s ≤ t. If (Xt : t ≥ 0) is a stochastic process, then {F(t) : t ≥ 0} is the natural filtration for X if F(t) = σ{Xs, s ≤ t}, where σ{X} denotes the smallest σ-algebra under which the random variables Xs, s ≤ t are measurable. Definition 4.3.2. Let X = (Xt, t ≥ 0) be a stochastic process and {F(t) : t ≥ 0} a filtration. We say X is adapted to {F(t) : t ≥ 0} if σ(Xt) ⊂ Ft, ∀t ≥ 0 (4.31) that means that Xt is measurable with respect to Ft. Definition 4.3.3. Let B = (Bt, t ≥ 0) be the Brownian motion and F(t) = σ{Bs, s ≤ t} its corresponding natural filtration. A stochastic process X = (Xt, t ≥ 0) is adapted to Brownian motion if X is adapted to {F(t) : t ≥ 0}. Definition 4.3.4. Let (S, S) be a measure space and X = (Xt, t ≥ 0) a S-valued stochastic process adapted to a filtration {F(t) : t ≥ 0}. We say the process X possesses the Markov property with respect to F(t) if for each A ∈ S and each s, t ∈ T with s ≤ t: P(Xt ∈ A|Fs) = P(Xt ∈ A|Xs) (4.32) A Markov process is a stochastic process that satisfies the Markov property with respect its natural filtration. Remark 4.3.1. Said in simple terms, a Markov process is a process in which a future outcome is only affected by the last outcome, and it doesn’t matter what happened before. For example, we can imagine a fair coin tossing game in which every toss you win or lose 1e and you start with 10e. If I know I have now 15e and want to guess the money I will have after the next toss, only the information that I have 15e can help me predict the future outcome. It does not matter how I came to have those 15e. This example is for the discrete case, but the continuous works the same going to the limit. Definition 4.3.5. We call a Markov process {X(t) > 0 : t ≥ 0} with values in Rd ˆ Point recurrent, if, almost surely, for every x ∈ Rd there is a (random) sequence tn → ∞ such that X(tn) = x for all n ∈ N.
  • 41. CHAPTER 4. BROWNIAN MOTION 36 ˆ Neighbourhood recurrent, if, almost surely, for every x ∈ Rd and ε > 0, there exists a (random) sequence tn → ∞ such that X(tn) ∈ B(x, ε) for all n ∈ N. ˆ Transient, if it converges to infinity almost surely Before we can prove the Brownian motion recurrence, we will need some understanding on harmonic functions. Especifically, we will have a look at the Dirichlet Problem. This problem raises the following question: given a continuous function ϕ on the boundary of a domain, is there a function u such that u(x) = ϕ(x) in the boundary of the domain and such that u(x) is harmonic inside the domain? That is, we are trying to extend the definition of ϕ in the boundary to a ’nice’ function in the whole domain. Gauss posed this problem in 1840, and he thought he proved there was always a solution, but his reasoning was wrong and Zaremba in 1911 gave counterexamples. However, if the domain is ’nice enough’ (see Poincar´e cone condition below) there is always a solution. The Dirichlet Problem can be solved purely by analytical tools. We will however solve it by probabilistic means. Definition 4.3.6. Let U be a domain, i.e., a connected open set U ⊂ Rd . A function ϕ : U → R is harmonic (on U) if it is twice continuously differentiable and, for any x ∈ U, ∆u(x) := d j=1 ∂2 u ∂x2 j (x) = 0 (4.33) Definition 4.3.7. Let U ⊂ Rd be a domain. We say that U satisfies the Poincar´e cone condition at x ∈ ∂U if there exists a cone V based at x with opening angle α > 0, and h > 0 such that V ∩ B(x, h) ⊂ Uc . Definition 4.3.8. A random variable T with values in [0, ∞], defined on a probability space with filtration (F(t) : t ≥ 0) is called a stopping time with respect to (F(t) : t ≥ 0) if {ω : T(ω) ≤ t} ∈ F(t) for every t ≥ 0. Remark 4.3.2. Speaking intuitively, for T to be a stopping time, it should be possible to decide whether or not {T ≤ t} has occurred on the basis of the knowledge of F(t). Definition 4.3.9. Suppose that X = (Xt : t ≥ 0) is a stochastic process on a probability space (Ω, F, P) with natural filtration {F(t) : t ≥ 0)}. For any t ≥ 0 we can define the sigma algebra F(t+ ) to be the intersection of all Fs for s ≥ t. Then for any stopping time τ on Ω we can define F(τ) = {A ∈ F : {τ = t} ∩ A ∈ F(t+ ), ∀t ≥ 0} (4.34) Then X is said to have the strong Markov property if, for each stopping time τ, conditioned on the event {τ < ∞}, we have that for each t ≥ 0, Xτ+t is independent of F(τ) given Xτ . Theorem 4.3.1 (Dirichlet Problem). Suppose U ∈ Rd is a bounded domain such that every boundary point satisfies the Poincar´e cone condition, and suppose ϕ is a continuous function on ∂U. Let τ(∂U) = inf{t > 0 : B(t) ∈ ∂U}, which is an almost surely finite stopping time. Then the function u : ¯U → R given by u(x) = E(ϕ(B(τ(∂U)))|B(0) = x), for x ∈ U (4.35) is the unique continuous function harmonic on U with u(x) = ϕ(x) for all x ∈ ∂U. Remark 4.3.3. If the Poincar´e cone condition holds at every boundary point, one can simulate the solution of the Dirichlet problem by running many independent Brownian motions, starting in x ∈ U until they hit the boundary of U and letting u(x) be the average of the values of ϕ on the hitting points.
  • 42. CHAPTER 4. BROWNIAN MOTION 37 With this result in mind, let’s find explicit solutions u : cl A → R of the Dirichlet problem on an annulus A = {x ∈ Rd : r < |x| < R}. The reason to study this case is that the recurrence problem will be a particular case of this solution. It is first reasonable to assume that u is spherically symmetric, i.e. there is a function ψ : [r, R] → R such that u(x) = ψ(|x|2 ). We can express derivatives of u in terms of ψ as ∂iψ(|x|2 ) = ψ (|x|2 )2xi (4.36) ∂iiψ(|x|2 ) = ψ (|x|2 )4x2 i + 2ψ (|x|2 ) (4.37) Therefore, ∆u = 0 means 0 = d i=1 ψ (|x|2 )4x2 i + 2ψ (|x|2 ) = 4|x|2 ψ (|x|2 ) + 2dψ (|x|2 ) Letting y = |x|2 > 0 we can write this as ψ (y) = − d 2y ψ (y) This is solved by every ψ satisfying ψ (y) = Cy−d/2 and thus ∆u = 0 holds on {|x| = 0} for u(x) =    |x| if d = 1 2 log |x| if d = 2 |x|2−d if d = 3 (4.38) We write u(r) for the value of u(x) for all x ∈ ∂B(0, r). Now define stopping times Tr = τ(∂B(0, r)) = inf{t > 0 : |B(t)| = r} for r > 0 (4.39) and denote by T = Tr ∧ TR the first exit time from A. By the Dirichlet Problem Theorem (4.3.1) we have u(x) = E(u(B(T))|B(0) = x) = u(r)P(Tr < TR|B(0) = x) + u(R)(1 − P(Tr < TR)) which can be solved P(Tr < TR|B(0) = x) = u(R) − u(x) u(R) − u(r) (4.40) This formula gives an explicit computation of the probability that the Brownian motion hits ∂B(0, r) before ∂B(0, R). We have just proved the following theorem Theorem 4.3.2. Suppose {B(t) : t ≥ 0} is a Brownian motion in dimension d ≥ 1 started in x ∈ A, which is an open annulus A with radii 0 < r < R < ∞. Then, P(Tr < TR|B(0) = x) =    R − |x| R − r if d = 1 log R − log |x| log R − log r if d = 2 R2−d − |x|2−d R2−d − r2−d if d ≥ 3 (4.41) if we take the limit R → ∞ we get the following corollary
  • 43. CHAPTER 4. BROWNIAN MOTION 38 Corollary 4.3.1. For any x /∈ B(0, r), we have P(Tr < ∞|B(0) = x) =    1 if d ≤ 2 rd−2 |x|d−2 if d ≥ 3 (4.42) finally, we have enough tools to prove the following theorem Theorem 4.3.3. Brownian motion is ˆ point recurrent in dimension d = 1, ˆ neighbourhood recurrent, but not point recurrent, in d = 2, ˆ transient in dimension d ≥ 3. Proof. ˆ For d = 1 fix x ∈ R. Let’s take B(x + 2, 1) and B(x − 2, 1). Notice that x lies in between these two balls. We know by Corollary (4.3.1) that the stopping time t1 = inf{t > 0 : B(t) ∈ B(x + 2, 1)} is almost surely finite. Also, by the same corollary, the stopping time t2 = inf{t > 0 : B(t) ∈ B(x − 2, 1)} is almost surely finite. Because of the continuity of the Brownian motion there exists a time t such that t1 < t < t2 and B(t) = x. Using the strong Markov property at time t2 + 1 we can repeat the previous argument. In fact, we can repeat this argument as many times as we want, so the Brownian motion in one dimension is recurrent. ˆ For d = 2 fix ε > 0 and x ∈ Rd . By Corollary (4.3.1)the stopping time t1 = inf{t > 0 : B(t) ∈ B(x, ε)} is almost surely finite. Using the Markov property at time t1 + 1 we see that this applies to t2 = {t > t1 + 1 : B(t) ∈ B(x, ε)}, and continuing like this, we obtain a sequence of times tn → ∞ such that, almost surely, B(tn) ∈ B(x, ε) for all n ∈ N and hence is neighbourhood recurrent. ˆ For d = 3 to make notation less cumbersome we use the notation Px(A) := P(A|B(0) = x). We first see that that the probability that the Brownian motion does not go out from a ball is 0, that is Px(|Bt| < R, ∀t ≥ 0) = 0 (4.43) Indeed, if we take the first coordinate, B1 t , of Bt we have Px(|Bt| < R, ∀t ≥ 0) ≤ Px(|B1 t | < R, ∀t ≥ 0) = 0 (4.44) where we have used property 4.3.2. Let x ∈ R3 and n ∈ N such that n3 > |x|. From the previous argument we have that the exit time Tn3 = inf{t > 0 : |Bt| = n3 } < ∞ (4.45) almost surely. That means that if the Brownian motion starts at x then it will get out of the ball of radius n3 with probability one. What we will see next is that for every ω ∈ Ω
  • 44. CHAPTER 4. BROWNIAN MOTION 39 there exists n(ω) ∈ N such that ∀n ≥ n(ω) we have that Bt(ω) ≥ n for every t ≥ Tn3 (ω). Px(|Bt| < n for some t > Tn3 ) = Ex(1{|Bt|<n for some t>Tn3 }) = Ex(E(1{|Bt|<n for some t>Tn3 }|BTn3 )) = Ex(P(|Bt+Tn3 | < n for some t > 0|BTn3 )) = Ex(PBT n3 (|Bt| < n for some t > 0)) = Ex(PBT n3 (Tn ≤ ∞)) = Ex n |BTn3 | d−2 = Ex n n3 d−2 = 1 n2 d−2 where we have used the strong Markov property in the fourth equality and corollary 4.3.1 in the sixth equality. If we write An = {|Bt| < n for some t > Tn3 } then we have for d ≥ 3 ∞ n=1 P(An) < ∞ (4.46) and thus using Borel Cantelli lemma the events An can happen with probability 1 only a finite number of times. Alternative proof for recurrence in 1D For a one dimensional Brownian motion, there is a faster way to show that it is point recurrent. We think it is interesting to add this section because appart from showing an alternative proof, we see two important properties of the Brownian motion that help us understand it better. Property 4.3.1 (Reflection principle). Let B = (Bt, t ∈ [0, ∞)) be one dimensional Brownian motion and a > 0, then P(max 0≤s≤t Bs > a) = 2P(Bt > a) (4.47) Proof. We will prove this property using heuristic arguments, for a formal proof requires ad- vanced tools not covered in this thesis. We have the following equation P(max 0≤s≤t Bs > a, Bt > a) = P(max 0≤s≤t Bs > a, Bt < a) (4.48) The idea behind it is that if the Brownian motion has reached value a at some time τ < t, then since Bτ ∼ N(0, τ) there is a bijective correspondence between paths with Bt > a and Bt < a. In other words, for every path from τ to t there exists a reflective path with respect the horizontal line y = a that has the same “probability” as such path. Of course the actual probability of any path is 0, hence this argument is only heuristic. See figure ??. Since P(Bs = a) = 0 if we add P(max 0≤s≤t Bs > a, Bt > a) to both sides of equation (4.48) we obtain 2P(max 0≤s≤t Bs > a, Bt > a) = P(max 0≤s≤t Bs > a) (4.49) and noting that {max 0≤s≤t Bs > a, Bt > a} = {Bt > a} we are done.
  • 45. CHAPTER 4. BROWNIAN MOTION 40 Property 4.3.2. Let B = (Bt, t ∈ [0, ∞)) one dimensional Brownian motion, then P(lim sup t→∞ Bt = +∞) = P(lim inf t→∞ Bt = −∞) = 1 (4.50) Proof. Let a > 0, then using property 4.3.1 P(sup t≥0 Bt > a) ≥ P( sup 0≤s≤t Bs > a) = 2P(Bt > a) = 2P Bt √ t > a √ t = 2 1 − Φ a √ t where Φ is the distribution function of a N(0, 1). 2 1 − Φ a √ t −→ 2(1 − Φ(0)) = 1, as t −→ ∞ (4.51) and P(lim sup t→∞ Bt = ∞) = P( ∞ a=1 {sup t≥0 Bm > a}) = 1 (4.52) And we also obtain P(lim inf t→∞ Bt = −∞) = P(lim sup t→∞ (−Bt) = ∞) = 1 (4.53) because (−Bt, t ∈ [0, ∞)) is a Brownian motion. Corollary 4.3.2. Brownian motion is point recurrent for d = 1. Proof. Let A = {ω : B(ω) does not have infinite zeros}. Suppose P(A) > 0. Then for ω ∈ A there is no sequence tn → ∞ such that Btn (ω) = 0 for all n ∈ N. That means there exists T > 0 such that Bt(ω) = 0 for all t > T. Without loss of generality suppose Bt(ω) > 0 for all t > T, but this implies that lim inf t→∞ Bt(ω) = −∞ since the Brownian motion cannot cross the x-axis, because Brownian motion has continuous paths. Hence P(lim inf t→∞ Bt(ω) = −∞) > 0 which means that P(lim inf t→∞ Bt(ω) = −∞) < 1 in contradiction with property 4.3.2. 4.4 Expected time to reach a specific position We showed in 2.1.1 that the expected time for a random walk to get back to the origin for dimension 1 was infinite. We will now show a similar result for Brownian motion, but in this case we will see that the expected time for the Brownian motion to reach any point is infinite. Theorem 4.4.1. Let a = 0. If inf{t > 0 : Bt = a} exists we define Ta = inf{t > 0 : Bt = a}; if inf{t > 0 : Bt = a} does not exist we define Ta = ∞. Then E(Ta) = ∞, that is, the expected time to reach any point different than 0 for the brownian motion is infinite.
  • 46. CHAPTER 4. BROWNIAN MOTION 41 Proof. We will show a relation between the density of Ta and Bt and from here deduce that E(Ta) = ∞. Let’s first assume that a > 0, then P(Ta > t) = P(max 0≤s≤t Bt < a} = 1 − P(max 0≤s≤t Bt > a) = 1 − 2P(Bt > a) where in the last step we used property 4.3.1. This implies that P(Ta ≤ t) = 2P(Bt > a) = 2P(Bt ≤ −a) = 2 √ 2π −a/ √ t −∞ e−x2/2 dx (4.54) and Ta < ∞ almost surely, so the density function of Ta is fa(t) = d dt P(Ta ≤ t) = d dt 2P(Bt ≤ −a) = d dt 2P Bt √ t ≤ − a √ t = 2 1 √ 2π d dt − a√ t −∞ e−x2/2 dx = 2 1 √ 2π e−a2 2t a 2 √ t3 = a √ 2πt3 e−a2 2t where we have used that Bt/ √ t ∼ N(0, 1) and the fundamental theorem of calculus. Hence E(Ta) = ∞ 0 tfa(t)dt ∼ ∞ 0 1 √ t e −a 2t dt = ∞ (4.55) The argument applies mutatis mutandi for a < 0. We notice that for a = 0 something does not work, since if we use the density function from theorem 4.4.1 we get fa(t) ≡ 0, which obviously is not a density function. The problem lies that for a Brownian motion that starts at 0, the point 0 is an accumulation point for the zeroes of the Brownian motion, i.e., for every ε > 0 there exists infinitely many t ∈ (0, ε) such that Bt = 0. The following property will support this claim: Property 4.4.1. Let h > 0, then P( max 0≤s≤h Bs > 0) = P( min 0≤s≤h Bs < 0) = 1 (4.56) Proof. Take a > 0, then P( max 0≤s≤h Bs > 0) ≥ P( max 0≤s≤h Bs > a) = 2 1 − Φ a σ √ h → 1 as a → 0
  • 47. CHAPTER 4. BROWNIAN MOTION 42 where we have used in the second step property 4.3.1. Hence we obtain P( max 0≤s≤h Bs > 0) = 1 (4.57) Finally, if we notice that P( min 0≤s≤h Bs < 0) = P( max 0≤s≤h −Bs > 0) (4.58) we can use the same arguments and get P( min 0≤s≤h Bs < 0) = 1 (4.59) 4.5 Other properties of Brownian motion In this section we will show some interesting properties of the Brownian motion that we will use in the next sections. 4.5.1 Quadratic variation Let πn : 0 = t0 < t1 < · · · < tn = T be a partition on [0, T]. For a smooth function we have the following proposition. Proposition 4.5.1. Let (πn) a sequence of refining partitions with mesh(πn) → 0 on [0, T] and f ∈ C1 . Then n i=1 (f(ti) − f(ti−1))2 → 0, as n → ∞ (4.60) Proof. We can use the mean value theorem, since f ∈ C1 . n i=1 (f(ti) − f(ti−1))2 = n i=1 f(ξi)2 (ti − ti−1)2 ≤ max 0≤i≤n (f(ξi)2 ) n i=1 (ti − ti−1)2 ≤ max 0≤i≤n (f(ξi)2 )mesh(πn) n i=1 (ti − ti−1) = Cmesh(πn)T → 0 where ξi ∈ (ti, ti+1). However, for the Brownian motion we have a different result. Proposition 4.5.2. Let (πn) be a sequence of refining partitions with mesh(πn) → 0 on [0, T] and B = (Bt, t ≥ 0) a Brownian motion. Then Qn = n i=1 (B(ti) − B(ti−1))2 = n i=1 (∆iB)2 L2 −→ T, as n → ∞ (4.61) and thus it converges also in probability.
  • 48. CHAPTER 4. BROWNIAN MOTION 43 Proof. We want to see that E[(Qn − T)2 ] −→ 0, as n → ∞ (4.62) First thing to notice is that E(Qn) = T. Indeed, since ∆iB ∼ N(0, ti − ti−1) we have E(Qn) = E n i=1 (B(ti) − B(ti−1))2 = n i=1 E(B(ti) − B(ti−1))2 = n i=1 (ti − ti−1) = T (4.63) From here we get the following expression E[(Qn − T)2 ] = E[(Qn − E(Qn))2 ] = V ar(Qn) (4.64) which can be written using the identity V ar(X) = E(X2 ) − E(X)2 and the fact that the increments ∆iB are independent as V ar(Qn) = n i=1 V ar (∆iB)2 = n i=1 E(∆iB)4 − ∆2 i (4.65) where ∆i = ti − ti−1. It is well know that for a N(0, 1) random variable B1, EB4 1 = 3, then E(∆iB)4 = E (∆i)1/2 B1 4 = 3∆2 i (4.66) which implies V ar(Qn) = 2 n i=1 ∆2 i (4.67) thus if mesh(πn) = max i=1,...,n ∆i → 0 (4.68) we obtain that E[(Qn − T)2 ] = V ar(Qn) ≤ 2mesh(πn) n i=1 ∆i = 2Tmesh(πn) → 0 (4.69) 4.5.2 Unbounded variation Proposition 4.5.3. Let B = (Bt, t ≥ 0) be a Brownian motion, then almost surely sup πn n i=1 |∆iB| = +∞ (4.70) that is P ω ∈ Ω : sup πn n i=1 |∆iB(ω)| = +∞ = 1 (4.71) where we take the suprema over all partitions πn of [0, T], where ∆iB = Bti − Bti−1 .
  • 49. CHAPTER 4. BROWNIAN MOTION 44 Proof. Let A = ω ∈ Ω : sup π n i=1 |∆iB(ω)| < C(ω) < ∞ (4.72) and assume that P(A) > 0 (4.73) and consider a sequence of partitions (πn) such that mesh(πn) → 0. From proposition 4.5.2 Qn = n i=1 (B(ti) − B(ti−1))2 L2 −→ T (4.74) which means that there is a subsequence of partitions, σnk such that Qnk a.s −→ T > 0 (4.75) and thus P ω ∈ Ω : lim k Qnk (ω) = T = 1 (4.76) which implies P ω ∈ Ω : lim k Qnk (ω) = T = 0 (4.77) On the other hand for ω ∈ A we have Qn(ω) = n i=1 (B(ti) − B(ti−1))2 ≤ max i=1,...,n |∆iB(ω)| n i=1 ∆iB ≤ C(ω) max i=1,...,n |∆iB(ω)| → 0 because Bt is continuous and then uniformly continuous on [0, T]. Hence P ω ∈ Ω : lim k Qnk (ω) = 0 = T > 0 (4.78) in contradiction with (4.77).
  • 50. Chapter 5 Simulations: Brownian Motion In this section we want to simulate a Brownian Motion. For that, some prior knowledge of numerical integration of stochastic differential equations will be needed. The tools developed in this chapter will let us indeed integrate more complex SDEs than the Brownian motion. 5.1 Numerical integration of stochastic differential equa- tions with Gaussian white noise Let us start with a simple stochastic differential equation: ˙x(t) = f(t) + ξ(t) (5.1) where f(t) is a deterministic function and ξ(t) is a Gaussian white noise, i.e., ξ(t) ∼ N(0, 1). If we integrate we get x(t) = x(0) + t 0 f(s)ds + t 0 ξ(s)ds (5.2) which can be written as x(t) = x(0) + F(t) + B(t) (5.3) where F(t) = t 0 f(s)ds and B(t) is the brownian motion. This expression indicates that x(t) is a Gaussian process whose mean and correlation are given by E(x(t)) = x(0) + F(t) (5.4) E(x(t)x(t )) = [x(0) + F(t)][x(0) + F(t )] + min(t, t ) (5.5) Now we will focus on a numerical solution, rather than solving the equations. Our final aim will be to be able to generate trajectories, that is, we want to obtain x(t) at discrete time intervals x(t + h) = x(t) + t+h t ˙x(s)ds = x(t) + t+h t f(s)ds + t+h t ξ(s)ds (5.6) Introducing fh(t) := t+h t f(s)ds (5.7) and wh(t) := t+h t ξ(s)ds = B(t + h) − B(t) (5.8) 45
  • 51. CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 46 we can write x(t + h) = x(t) + fh(t) + wh(t) (5.9) In this equation, as wh(t) is the difference of the Brownian motion at two different times, it is a Gaussian process and can be fully characterized by giving the mean and correlations: E(wh(t)) = t+h t E(ξ(s))ds = 0 E(wh(t)wh(t )) = t+h t t +h t E(ξ(s)ξ(u))dsdu = t+h t t +h t δ(s − u)dsdu To evaluate this integral, we make use of the properties of the Dirac δ function. We can assume, without loss of generality, that t > t. If t > t + h, the integral is 0, as there is no overlap in the integration intervals, and the delta function vanishes. If t ≤ t < t + h, the double integral equals the length of the overlap interval, that is E(wh(t)wh(t )) = t+h t ds = t − t + h (5.10) We are particularly interested for t = t, E(wh(t)2 ) = h (5.11) which is in line with what we proved in Proposition (4.5.2). In numerical calculations, time takes always discrete values as multiples of the integration time step. If we consider discrete times t = ti = ih, t = tj = jh, the correlation becomes E(wh(ti)wh(tj)) = hδij (5.12) We introduce now a set of independent Gaussian random variables {ui} of zero mean and variance 1: E(ui) = 0, E(uiuj) = δij (5.13) in terms of which we can write wh(ti) = √ hui (5.14) Finally, the recurrence relation to generate numerically trajectories of the stochastic process defined by (5.1) is x(t0) = x0 (5.15) x(ti+1) = x(ti) + fh(ti) + √ hui (5.16) For small h, the deterministic contribution fh(t) can be approximated as fh(t) = hf(t), implying that for small h the deterministic contribution is of order h1 and successive contributions go as h2 , h3 , and so on. In contrast the stochastic contribution is of order h1/2 , an order that never appears in methods for numerical integration of ordinary differential equations. A consequence of this scaling with the time step is that at very small times the stochastic contribution, being of order h1/2 , dominates over the deterministic one, of order h. Over the course of an integration for a large period, the stochastic contributions on average will be generally of less importance than the deterministic ones. A Brownian motion can be now easily simulated from equation (5.16). For a Brownian motion that starts at the origin, we have x(t0) = 0. Furthemore, fh(ti) = 0 for all i. We obtain the following simple formula x(t0) = 0 (5.17) x(ti+1) = x(ti) + √ hui (5.18)
  • 52. CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 47 Euler-Maruyama method We start with the equation ˙x(t) = q(x) + g(x)ξ(t) (5.19) For additive noise, g(x) does not depends on x, and g(x) = √ D with D being a constant, then the Euler-Maruyama method for stochastic differential equations is given by x(t + h) = x(t) + hq(x(ti)) + √ Dhu(t) + O[h3/2 ] (5.20) As we need Stratonovich calculus to show the derivation of this formula, we will just state it and use it later. 5.1.1 Runge-Kutta-Type methods Equation (5.16) is enough to simulate the pure brownian motion, but in this section we will develop a more advance method for integrating other kind of stochastic differential equations. We start with the equation (5.19) and we would like to develop a method inspired by the Runge-Kutta methods used for numerical integration of ordinary differential equations. There is a large family of Runge-Kutta methods. Here, we focus on one of the simplest methods of this family, known as the Heun method, which is of second order. We start revisiting the deduction of the Heun numerical algorithm for ordinary differential equations and then we extend the ideas to the case of stochastic differential equations. Let’s start considering the ordinary differential equation ˙x(t) = q(t, x) (5.21) where, in general, q(t, x(t)) is a nonlinear function of x(t) which can also depend on the time explicitly. We start by applying the Euler method to integrate this equation: x(ti+1) = x(ti) + hq(ti, x(ti)) + O[h2 ] (5.22) This is an explicit map since the right-hand side depends only on known values of the variable x at previous times, while the unknown variable x(ti+1) is explicitly isolated in the left-hand side. In fact, (5.22) corresponds to the explicit Euler, also called the forward Euler method. There is also an implicit Euler method (also called the backward Euler method) to integrate the same equation, which is given by x(ti+1) = x(ti) + hq(ti+1, x(ti+1)) + O[h2 ] (5.23) The implicit Euler method is more stable than the explicit one but it has the disadvantage that, in general, it is difficult to invert the function q(t, x(ti)) appearing on the right-hand side so that one could get an explicit expression for x(ti+1) as a function of x(ti). Finally, there is a semi-implicit Euler method that combines both approaches and which is of order O[h3 ]. It is given by x(ti+1) = x(ti) + h 2 [q(ti, x(ti)) + hq(ti+1, x(ti+1))] + O[h3 ] (5.24) This method suffers from the same inconvenience as the implicit Euler: the recurrence relation is given by an implicit map. A way to circumvent this inconvenience is to replace x(ti+1) on the right-hand side by the value obtained by using the explicit Euler method (5.22), namely by x(ti) + hq(t, x(ti)): x(ti+1) = x(ti) + h 2 [q(ti, x(ti)) + q(ti+1, x(ti) + hq(t, x(ti)))] + O[h3 ] (5.25)
  • 53. CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 48 This is the Heun method that is usually written as k = hq(t, x(ti)) (5.26) x(ti+1) = x(ti) + h 2 [q(ti, x(ti)) + q(ti+1, x(ti) + k)] (5.27) We now apply the same ideas to a stochastic differential equation with white noise (5.19). Let us start with a semi-implicit version of Euler’s method given by (5.20) x(ti+1) = x(ti) + h 2 [q(ti, x(ti)) + q(ti+1, x(ti+1))] + √ hui 2 [q(ti, x(ti)) + q(ti+1, x(ti+1))] (5.28) And now replace x(ti) on the right- hand side by the prediction given by the Euler-Maruyama algorithm (5.20). The resulting algorithm can be written as k = hq(t, x(ti)) (5.29) l = √ huig(t, x(ti)) (5.30) x(ti+1) = x(ti) + h 2 [q(ti, x(ti)) + q(ti+1, x(ti) + k + l)] + √ hui 2 [g(ti, x(ti)) + g(ti+1, x(ti) + k + l)] (5.31) This is known as the stochastic Heun method. Notice that for the pure Brownian motion one has q(t, x(ti)) = 0 and g(t, x(ti)) = 1 which converges to the simple formula (5.18). 1 5.1.2 Simulations In this section we will simulate the Brownian motion and will see how long it takes until it reaches back the value a = 0.1, that is, for which t = 0 we have that Bt = 0.5. The reason why we do not take a = 0 is not arbitrary. In the discrete case for a random walk there was no problem in taking a = 0, but for a Brownian motion some issues arise. The most important is regarding property 4.4.1. Since we know that next to 0 there are infinite points t such that Bt = 0, it doesn’t make a lot of sense to simulate this case. For this reason we have decided to take a = 0, for example a = 0.1. We will gather the results in a histogram. The simulations will be somewhat similar to those for the random walk. However, one big difference to notice, is that Brownian motion is a continuous function while a random walk is a discrete one. Another to notice is that the stopping time Ta has a continuous density, which implies that the probability of every single point is 0. Taking into account these differences, we cannot make histograms for Brownian motion that reaches a point after N steps, because every step is infinitely small (theoretically, although in simulations we will discretize). For this reason counting how many come back after N steps does not make conceptual sense and, therefore, the bins in the histogram will represent a time interval rather than a time point. The following simulation contains 106 different points, calculated according to the formula x(t0) = 0 (5.32) x(ti+1) = x(ti) + √ hui (5.33) 1 These more sophisticated methods were developed in the thesis in order to simulate some more complex stochastic differential equations than the pure Brownian motion. However, because of lack of time and space we decided to give priority to other topics.
  • 54. CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 49 A total of 105 simulations were run. For practical reasons, the bins of the histograms represent intervals in log(t) rather than just t. We have also ploted the theoretical density obtained in Theorem 4.4.1 to compare results. First, we need to do a change of variable for the density, because we are plotting the density of Y = g(Ta) = log(Ta) instead of the density of Ta: fY (y) = fa(g−1 (y))|(g−1 ) (y)|1(−∞,∞) = a √ 2πey e− a2 2ey This is the result we obtain: Figure 5.1: Shows the relative number of particles that reached Bt = 0.5 for the first time at time log(t). First thing to notice is that theoretical results and empirical results do not match as perfectly as in the random walk. We observe that for several values the experimental data is lightly large than the predicted value. The reason for this discrepancy is that we plotted the histogram for a fixed number of bins and selected the option ‘normed=True’, that is, the sum of all bins is equal to 1. For a perfect match to the theoretical curve, we should consider every bin from −∞ to ∞. However, we plotted the high probability bins and, appart from those small discrepancies, we observe a quite good match. 5.1.3 Code We will now write a code to plot four different Brownian motion samples, using the equation (5.16). In our case def plotBrownianMotion (h=1, l =1000): x=[] x . append (0) y=[] y . append (0)
  • 55. CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 50 z =[] z . append (0) v=[] v . append (0) for i in range (0 , int ( l /h ) ) : x . append (x [ i ]+np . sqrt (h)*np . random . normal ( loc =0.0 , s c a l e =1.0)) plt . plot (x , c=’b ’ ) for i in range (0 , int ( l /h ) ) : y . append (y [ i ]+np . sqrt (h)*np . random . normal ( loc =0.0 , s c a l e =1.0)) plt . plot (y , c=’ r ’ ) for i in range (0 , int ( l /h ) ) : z . append ( z [ i ]+np . sqrt (h)*np . random . normal ( loc =0.0 , s c a l e =1.0)) plt . plot ( z , c=’y ’ ) for i in range (0 , int ( l /h ) ) : v . append (v [ i ]+np . sqrt (h)*np . random . normal ( loc =0.0 , s c a l e =1.0)) plt . plot (v , c=’ g ’ ) plt . show () This will alow us to draw Brownian motion samples. The same code is valid for plotting Brownian motion samples in 2D, only changing plt.plot(x,c=’b’) for plt.plot(x,y,c=’b’) For plotting the histogram 5.1 we have written the following code def simBrownianMotion (h=1, l =10000,N=1000): v=[] for n in range (1 ,N) : #x=numpy . random . normal (0 ,1 ,3) i=0 suma=0 sumaa=0 while (0.5 −sumaa)*(0.5 −suma)>=0 and i<l : sumaa=suma suma=suma+np . sqrt (h)*np . random . normal (0 ,1) i=i+h i f (0.5 −sumaa)*(0.5 −suma)<0: v . append ( i−h) return v t1 = np . arange (−6, 10 , 0.1) plt . plot ( t1 , np . exp ( −0.5**2/(2*np . exp ( t1 )))* 0.5/ np . sqrt (2*math . pi *np . exp ( t1 ) ) ) def freqHistogramBrownian (h=0.01 , l =1000,N=100000): bins=13 X=l i s t (map( log , simBrownianMotion (h , l ,N) ) ) (n , bins , patches ) = plt . h i s t (X, bins =[−5,−4.5,−4,−3.5,−3,−2.5, −2 , −1.5 , −1 , −0.5 ,0 ,0.5 ,1 , 1. 5 , 2 , 2.5 ,3 ,3 .5 , 4 , 4.5 ,5 , 5 . 5 , 6 , 6 . 5 , 7 , 7 . 5 , 8 ] , normed=True ) plt . xlabel ( ’ log ( t ) ’ )
  • 56. CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 51 plt . ylabel ( ’ Frequency ’ ) plt . show () 5.1.4 Path samples Running the code above for 1D Brownian motion, we generated the following sample paths. Figure 5.2: Four different samples of 1D Brownian motion, starting at 0. The time steps used are h = 1 and the total length of the Brownian motion is l/h = 1000. And the next plot shows the simulation of two independent 2D Brownian motion starting at 0. Figure 5.3: Two different samples of 2D Brownian motion, starting at (0, 0). 5.2 Dirichlet problem Now we will simulate the Dirichlet problem stated in theorem 4.3.1. Our boundary ∂U will be a square centered in the origin of side l = 10 and our function on the boundary will be f(x, y) = x+y and want to extend it to a harmonic function inside the square. This is a simple
  • 57. CHAPTER 5. SIMULATIONS: BROWNIAN MOTION 52 example, and we know that the extension will be u(x, y) = f(x, y) = x + y for all (x, y) ∈ U, so we can verify if the algorithm works. A Brownian motion will start at 0 and will at some point cross the boundary. The average of all the points at which the simulations crosses the boundary will give us the value of f(x, y). In this example we will calculate u(0, 0). Intuitively, we would expect that u(0, 0) = 0, because of the symmetry of this case. For every Brownian motion that crosses the boundary at some point (x, y) we would expect another Brownian motion to cross it at the point (−x, −y), so the average of all this points looks like it should be 0. We will run 105 Brownian motions starting at (x, y) = (0, 0) to compute this point. The result is u(0, 0) = 0.0176. The code we used is the following. 5.2.1 Code def f (x , y ) : return x+y def d i r i c h l e t (h=1, l =10000,N=100000,x=0,y=0): v=[] for n in range (1 ,N) : #x=numpy . random . normal (0 ,1 ,3) i=1 sumax=x sumaax=x sumay=y sumaay=y while (10−sumaax)*(10−sumax)>=0 and (10−sumaay)*(10−sumay)>=0 and (−10−sumaax)*(−10−sumax)>=0 and (−10−sumaay)*(−10−sumay)>=0 and i<l : sumaax=sumax sumax=sumax+np . sqrt (h)*np . random . normal (0 ,1) sumaay=sumay sumay=sumay+np . sqrt (h)*np . random . normal (0 ,1) i=i+1 i f sumax*sumaax<0 or sumay*sumaay<0: v . append ( f (sumax , sumay )) print (sum(v)/ len (v )) return sum(v)/ len (v) We compute a two dimensional Brownian motion in a similar way than the one dimensional case. In every step we compute the two variables x and y as x(t0) = 0 (5.34) y(t0) = 0 (5.35) x(ti+1) = x(ti) + √ hui,1 (5.36) y(ti+1) = y(ti) + √ hui,2 (5.37)