The diffusion equation

Let us now return to the one-dimensional case. The question we would like to answer now is the following: in the continuum limit, if we make many different independent particles start from the origin at the same instant, supposing that they undergo a random walk where the length of each step is regulated by a probability distribution , how many particles will there be at time in the interval ? We will see that the answer to this question leads us to the diffusion equation.

Let us suppose that and , with finite (which is rather reasonable[1]). The position of the particle at time given the one at time will be:

If we call the particle density, then at time (with a small time interval, and we will later take the limit ) we will have:
In fact, a particle starting from at time will be in at time with probability , and so integrating over all the possible initial positions of the particles (given by the particle density at time ) we get exactly the new particle distribution. Defining the variable :
Let us now suppose that the step size is small compared to the scales on which varies (which is another reasonable assumption); this way we can expand in a Taylor series[2]:
so that we can write:
If we now also expand for small and suppose for simplicity that with a constant[3], then:
and dividing by :
We are now interested in the continuum limit, namely and ; this means that in general the limit of is not well determined. In particular, we could have:

  • , in which case : there is no evolution
  • , in which case the evolution would be instantaneous

The most interesting case is the last one: in fact, if we require to be always (so also in the limits ) equal to a constant , called diffusion constant, then the terms proportional to and and all the other terms in the expansion vanish[4]. Therefore, we find that must satisfy the so called diffusion equation[5]:

which in three dimensions can be rewritten as:

Diffusion and continuity equation

We have until now not considered a very important property of : since it is a particle density, it must satisfy a continuity equation. This is an equation that expresses the fact that particles cannot "disappear" and "reappear" in different points of space, but must continuously flow from point to point. To make things more clear let us consider a region of volume of our system: this will contain a certain number of particles, which will change with time because some particles will go out of while others will enter into the volume from the outside, due to the continuous random motion they are subjected to. Therefore, in terms of the number of particles contained in the volume at time will be:

where by "in" and "out" we mean the number of particles that have entered or gone out of . If we call the flow of particles[6], and the unit vector orthogonal to the surface enclosing pointing outward, we can rewrite this equation as:
(where the last term is the net outgoing flow of particles). Dividing by :
Taking the limit and using Gauss theorem we get:
Since the volume is arbitrary, the integrands must be always equal:
This is the continuity equation associated to , with flow .

Now, how are continuity and diffusion equations related? It is immediate to see that they are equivalent if:

In fact, this way:

The physical meaning of equation is that a set of particles subjected to a random walk will move from areas of high to areas of low concentration. In other words, the diffusion of particles tends to "flatten" concentration inhomogeneities[7].

Random walks and central limit theorem

We now want to show a particular property of random walks, and so also of diffusive phenomena: we want to see that they are coherent with the central limit theorem. In fact, this states that if is a sum of independent random variables, then for large is distributed along a Gaussian: what we want to show is that this is indeed the case. To be more precise, let us reconsider the one-dimensional discrete random walk with constant step length . Let us call the position of the particle at the -th step, the number of steps that it has done to the right and to the left; of course , and we also call , so that . What we want to do is to determine the probability that the particle is at position after steps, and see how it behaves for large .

Now, since the probabilities for a step to be done to the right or to the left are the same, and equal to , the probability will be a binomial one[8]:

It is easier to handle this expression if we take its logarithm:
Using Stirling's approximation (see the appendix Stirling's approximation):
and supposing that is small compared to , we can use the logarithm expansion ; in the end we get:
Therefore, exponentiating we have that:
In other words, the probability of finding a particle in a given position for large times is distributed along a Gaussian, which is what we expected from the central limit theorem. Note that the result we have just found is completely general: we have not solved the diffusion equation in order to find it, so we can argue that the density of diffusing particles will be a Gaussian for large enough times independently of the initial conditions. In other words no matters what the initial shape of was, for large enough times it will have become a Gaussian.

A final remark: the expression of for large is formally defined also for . However, this is clearly impossible: if the particle has done steps on the right its final position can't be . Should we care about this problem? Not really much, in reality: it is in fact true that formally we should also have non-null probabilities to find the particles for , but in practice these are ridiculously small (we are considering events beyond sigmas from the mean of the Gaussian!), so they do not constitute a real problem.

The solution of the diffusion equation

We now want to solve the diffusion equation. For the sake of simplicity, we will do that in one dimension, and the first approach we will use is that of a Fourier decomposition.

We begin by noting that the operators and the translation operator , defined as , commute; in fact:

Therefore, since and commute they have a common basis of eigenfunctions. Thus, if we find the eigenfunctions of :
we have also found the eigenfunctions of :
These are plain waves, and in order to make them orthonormal we redefine them as:
so that we have indeed:

Therefore, we can expand any given in terms of plane waves:

where are the Fourier coefficients, given by:
This way we have:
and the validity of the diffusion equation implies that the integrands must be equal, i.e.:
Note that this means that the various Fourier modes of the initial conditions are "muffled" as time passes, and the larger is the the more muffled will be. Therefore, substituting in :

Everything we have stated so far is abslutely general; we now consider a very special case: let us suppose for simplicity and set , namely at the beginning all the particles are located at the origin. We have:

This is a Fresnel integral, which can be computed with complex analysis using Cauchy's theorem; however, we use a "trick" to determine without explicitly calculating it, based on the fact that:
Deriving with respect to , we have:
and the constant can be determined from the normalization condition, which leads to:
This is the solution of the diffusion equation for the initial condition . Let us see its properties:

  • After , is a Gaussian of height and width : as time passes this Gaussian lowers and widens

  • As , (comprehensibly)

  • The mean value of at time is null:

since the integrand is odd. Then calling for simplicity, we have[9]:
Therefore , a result we already knew from the general properties of random walks.

If we use as initial condition , then by definition is the Green's function of the diffusion equation:

Green's functions can be used to solve differential equations, like the diffusion one, with an approach different from the Fourier decomposition. In fact, if we can (at least formally) write as a superposition in the following form:
then the general solution of the diffusion equation is:

Of course, both Fourier's and Green's methods are equivalent, but depending on the situation and the initial conditions considered one can result more convenient than the other.

  1. The fact that of course means that the random walk is unbiased. As we will later see in Fokker-Planck and Langevin's equations, we can also consider cases where the random walk is actually biased by an external force. Note also that, however, there can be cases where does not have a finite variance, for example power law distributions. In this case the resulting motion is called Lévy flight, and the main difference with a "normal" random walk is that in a Lévy flight the particles sometimes make very long steps. Such systems have been also used to model the movement of animal herds.
  2. We also keep the third order in the expansion, to make explicit that all the terms beyond the second order vanish in the limits we will take.
  3. An example of probability distribution that satisfies this requirement is the Poisson distribution.
  4. In particular, the term proportional to vanishes because:
  5. A fun fact: the diffusion equation with an imaginary time is the Schro"dinger equation for a free particle (of course provided that is interpreted as a wave function), with a diffusion constant equal to .
  6. Remember that in general the flow of particles is defined as a vector such that is the number of particles that pass through the surface orthogonal to per unit time and unit surface. More in general, if is a unit vector orthogonal to a surface, then is the number of particles passing through the surface along the direction of per unit time and surface. If , this means that the particles are passing through the surface along the direction of .
  7. However, there are situations were diffusion (despite the presence of the negative sign in equation ) can actually highlight and increase concentration inhomogeneities, spontaneously bringing a system from a homogeneous to an inhomogeneous configuration. These are called patterning phenomena.
  8. We can also justify this thinking that the choice of the direction of the step is regulated by the flips of a coin.
  9. This result could have been obtained much more easily, without doing any computation, from the fact that is a Gaussian.