# 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:

^{[2]}:

^{[3]}, then:

- , 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]}:

## Diffusion and continuity equation[edit | edit source]

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:

^{[6]}, and the unit vector orthogonal to the surface enclosing pointing outward, we can rewrite this equation as:

*continuity equation*associated to , with flow .

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

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[edit | edit source]

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]}:

*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[edit | edit source]

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, we can expand any given in terms of plane waves:

*Fourier coefficients*, given by:

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:

*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:

- 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:

^{[9]}:

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

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.

- ↑ 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. - ↑ 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.
- ↑ An example of probability distribution that satisfies this requirement is the Poisson distribution.
- ↑ In particular, the term proportional to vanishes because:
- ↑ 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 .
- ↑ 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 .
- ↑ 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*. - ↑ We can also justify this thinking that the choice of the direction of the step is regulated by the flips of a coin.
- ↑ This result could have been obtained much more easily, without doing any computation, from the fact that is a Gaussian.