A simplified model for molecular diffusion, stock price changes, genetic drift, etc. is the random walk, which is a particle that, at each point in time, can move a given distance in a random direction. For instance, an object currently at position on a 1d line can move to , or , each with probability .
Of course, each individual particle will take a different trajectory, and so, is unpredictable. Despite this, exact statistical properties of the movement can be obtained without much work. We'll take the simple discretized case where particles move the same unit distance at each step. A diagram for the flow of particles in this process is shown below:
This means that at each time step, a particle at position can drift to the right, or the left. We can write this down as a simple differential equation for the change in the number of particles at position , , with time:
The 2 reflects the fact that particles at can drift to the right or the left, with equal probability.
Several simplifications are appropriate:
Rewriting the differential equation in the suggested way, we find:
It's not trivial to solve a differential equation like that just by staring at it. It's also not straightforward to get a nice recurrence relation. In order to solve it, we can use a probability generating function . It's usefulness is best seen by example, but first we can point out two of its properties that reveal how it can be used.
First of all, if we set , then every coefficient multiplying the in is equal to 1, and we have the sum of all probabilities at a given time. But at all times, the probabilities have to add up to 1. Therefore, .
The next property is a beautiful formula of complex analysis. The variable can be taken to be a complex number, so, we can use the full array of complex analysis theorems to dissect it. If, in general, we had an interesting expression for , and we want to know the probability being at position , , we could simply take the contour integral of around the origin. The reason for this is that has the coefficient , and the only thing that survives a contour integral about the origin are terms with . This is known as Cauchy's integral formula
Therefore, we have:
We want to find a simple expression for , for which we can take these derivatives. If we take the differential equation of the probability flow for , we can multiply it by and sum over all to get the following relation:
This can be integrated directly to produce the simple formula:
We can choose an initial condition in which all the particles start situated at the origin. I.e., except for which is equal to 1. This implies = 1, which shows that the constant is 1.
At this point, we have solved the problem in principle, but are still wanting for a solution in /. We could expand the expression for out into a Taylor series to find the coefficient on the which are the . However, carrying this out results in ugly looking sums and Bessel functions.
Instead, we can do a bit more complex analysis, and make a useful approximation to get an analytic equation for .
Recalling the contour integral described above, we have:
The only pole of this integral is at the origin and, so, we can take the contour to be the unit circle. In this case,
Also, it's clear that
So that the expression for becomes
Writing this contour integral out in full form, we are faced with evaluating
which is something complicated. However, we notice that for times , the exponential drops off very quickly for increasing , so that contributions to the integral become negligible well before , as seen in the plot below.
With this realization, we can expand the to second order with very little error. The integral is therefore
Further, as there is essentially no contribution to the integral for we can extend the upper limit of the integral to infinity without any error. We can also extend the bottom limit to negative infinity, although this introduces small error at small . However, for modestly large, the error is negligible and as , it is non-existent. Therefore
Finally, this can be solved analytically through the Hubbard-Stratonovich transformation from field theory (or simply, completing the square) and we arrive at
This is a Gaussian distribution that spreads symmetrically to the left and right as time proceeds; the variance increases linearly with time.
We show the probability distribution below for and . Remember, we started with the initial condition that all particles start at the origin. We can see that as time progresses, the particles flow out from the origin to greater values of .
In another view, here is a movie of the same process.
Now that we've done the difficult job of finding the time dependent probability distribution, we can get some values for free. First, the mean position of the diffusing particles.
We can find this by evaluating the expectation value:
We can see that this is zero because of the symmetric distribution. On average, particles diffuse about the origin without any bias, and so, are still centered about the initial position.
It is clear that the particles are spreading out with time, so, we expect that the average particle will make it away from the origin. Specifically, we can find the mean squared distance. We find this, again, by taking an expectation value:
This integral can be solved in a number of ways, most beautifully by taking a derivative underneath the integral sign. It turns out that the average squared distance grows linearly in time:
and therefore we have the classic behavior of the random walk, that the average particle diffuses steps from the origin by time , which is in good agreement with real random walkers like swimming in liquid, or gas diffusing through the air.