8.2 The Diffusion Equation

Back

8.2.1 Intuitive

In this subsection I am going to give you a loose, intuitive, sloppy approach, as

done by all the best engineers and mathematicians of the eighteenth century.

In the next subsection I shall do it in a more respectable algebraic manner,

so as to guarantee intellectual respectability. Some people worry about both

these things.

Imagine, then, a long tube closed at both ends and containing a large number

of bees which were put in at one end before it was closed. If x is used to

measure the distance down the tube, t is the time, let f(x, t) measure the

density of the bees at location x and time t. To get the density of the bees

at a point, we take a little bit of tube of length _x centred on x, count the

number of bees, and divide by _x. Then we take the limit as _x gets closer

to zero. Anyone who objects to anything as silly as this on the grounds that

the answer will almost always be zero, and that bees take up some space and

aren’t points, is simply refusing to enter into the spirit of things and will lose

out on some innocent fun.

If we put the origin, 0, at the left hand end of the tube, let N(x, t) be the

number of bees between location 0 and location x at time t. Then we have

that :

f(x, t) =

@N(x, t)

@x

162 CHAPTER 8. PARTIAL DIFFERENTIAL EQUATIONS

Figure 8.2: Dynamics of a swarm of bees.

Now look at the bees in some such small slab, as shown in figure 8.2. We

suppose that the bees move about at random, quite independently except

that possibly they may bounce off each other if they collide. They are just

as likely to be going one way as another at any time, and they buzz around

in the way that bees, atoms and small children at parties are prone to do.

It is fairly plausible that the number of bees going from the slab between x

and x + _x into the slab to the right of it, from x + _x to x + 2_x, over

any time interval from t to t + _t, is proportional to the difference between

the number of bees in the two slabs. The actual number of bees will depend

on such things as the mean bee velocity, but if half the bees are going one

way and half the bees are going another, then there will be approximately

_x _ f(x)/2 bees going right across the barrier and _x _ f(x +_x)/2 going

to the left from the second slab, if the bees are going fast enough.

The rate of flow of bees then past a point x will be simply proportional to

the rate of change of density at x, @f

@x . If the density is increasing, the bees

will tend to go backwards, so N will tend to increase and we can write:

@N

@t

= c2 @f

@x

where N is the number of bees between 0 and x, and c2 is a positive constant

telling us something about the mobility of the bees.

Now we have that N is of course related to f, in fact f is the space derivative

of N, f = @N

@x . We therefore try to use these facts to say something about

the change of density in time.

8.2. THE DIFFUSION EQUATION 163

Differentiating the last equation partially with respect to x, we get:

@

@x

@N

@t

= c2 @2f

@x2

and reversing the order of partial differentiation, which is OK if the function

f is continuously differentiable, we get

@

@t

@N

@x

= c2 @2f

@x2

and given that we recognise the definition of f lurking in the equation we

can finish up with:

@f

@t

= c2 @2f

@x2 (8.1)

This equation, 8.1, is known as the Diffusion Equation in one dimension. We

can confirm the reasonableness of it as a description of heat, atoms and even,

to a crude approximation, bees, by experiment and argument. Experiment

is more convincing to everybody except theologians and philosophers, and

gives the expected answers. If you are a whiz programmer, you can set

up a program where there are a number of slabs next to each other, say

A,B,C, · · · and there are some number of bees at time zero in each slab, say

NA,NB,NC, · · · . The rules are that that there is a jump to time 1 during

which each bee makes a random choice between moving into the preceding

slab (or vanishing if there isn’t a preceding slab), moving into the following

slab (or vanishing if there isn’t one), or simply staying where it is. The

probabilities of going left or right are equal. Now iterate the process for

some initial distribution of the bees in the slabs and watch what happens3.

Eventually all the bees leave. If you want you can make it circular so there

is a conservation of bees, or you can treat the end points differently. You

are doing a discrete simulation of the diffusion equation, which is pretty

reasonable for bees. Note that it ties in with a probabilistic ‘random walk’

model. Note that the continuous approximation for bees is fundamentally

daft but still works, and it works even better for atoms, such as semiconductor

dopants diffusing into silicon. Engineers use this in designing transistors4.

3This is crying out to be made into a Mathematica animation. I hope someone with

more time than me can do it and send me the result.

4 A transistor is not, as you may have supposed, a kind of radio. It is actually the

thing inside it that allows the radio to work. It has been extended to the silicon chip in

relatively recent years.

164 CHAPTER 8. PARTIAL DIFFERENTIAL EQUATIONS

The chain of reasoning I have given is pretty much what the eighteenth

century mathematicians did to justify the diffusion of heat along a rod, the

main difference being they said it in French and left out the bees 5.

Bees are reasonably well described by the Diffusion Equation, but so are a

lot of other things, including heat conduction (which is largely a matter of

vibrating atoms), and hence the diffusion equation is also known as the Heat

Equation. The diffusion of gases through pipes and atoms of one substance in

another, from dyes in water to doping agents in silicon, are also described by

the same equation. Bees are easier to visualise, but perhaps not so important

in the grand scheme of things as heat conduction or atoms. Much depends

on your point of view.

The next stage of development of the argument is to consider a thin planar

slab of bees, which can now move in two dimensions instead of being compelled

to go either backwards or forwards. And the final stage for most books

is to go to the full three dimensional case, where the bees can float free.

In order to treat the two and three dimensional cases it is necessary to consider

the space, R2 or R3, to be decomposed into little squares or boxes in a

manner which is by this time rather familiar to you.

8.2.2 Saying it in Algebra

Watch me like a hawk here. This is tricky but cool.

Suppose we have a three dimensional space and that there are bees flying

around in it. Let T(x, t) denote the density of the bees at location x at time

t. Let U denote a region of the space (think of a solid ball shaped region if

you want to visualise this), then by definition the number of bees inside the

region u at time t is just: Z

U

T(x, t) dV

5It is remarkable that the French did such a lot of the mathematics of this subject, but

you don’t know the half of it. Most of them weren’t mathematicians, they were lawyers,

medics, engineers and blokes who, generally speaking, did it for fun in the evenings after

a hard day’s work. (Gauss, who was not French, was a privy councillor. If you know what

a privy is, you are doubtless wondering how you counsel them, but this is your problem.)

You have to have a fairly high IQ to think that this sort of thing is entertaining, but it

was thought to be the sort of activity which reflective gentlemen should do. In England

there weren’t any reflective gentlemen, the gentlemen were horsing around killing foxes,

dressing up in silly clothes and fancy hair-dos, and gambling. Of course, they didn’t have

television in those days.

8.2. THE DIFFUSION EQUATION 165

The flow of bees flying into the region U at time t is, by definition,

@

@t

Z

U

T(x, t) dV

Each bee has to fly through the boundary of U to get into U. The gradient

field of T gives us the direction in which the density of bees is increasing,

bees will fly down the gradient just as in the one dimensional case. So the

rate of flow of bees into U is just

Z

@U

c2rT q n dA

for some positive constant c2. By the Gauss Divergence Theorem, this can

be written as:

c2

Z

U

r2T dV

Equating the two expressions for the flow of bees into U we get:

@

@t

Z

U

T(x, t) dV = c2

Z

U

r2T dV

and interchanging the partial derivative with the integral:

Z

U

@T

@t

− c2r2T dV = 0

If the integral of a continuous function f over every region U is zero, then

f must be zero. Suppose it weren’t zero at some point x. Then it must be

non-zero in some little region around x, and if f(x) > 0, take U to be the

region around x where f is positive. Then

R

U f > 0, contradiction. Likewise

if f(x) < 0. It follows therefore that

@T

@t

= c2r2T (8.2)

which is the diffusion equation in three dimensions. Note that the argument

works for dimension two with minor changes.

Now we do it for heat. Let T(x, t) denote the temperature of a point x at

time t in some region of R3. This is a function T : R3 × R −! R. It gives

rise to a gradient vector field on Rn which will change in time. We write this

as rT. It matters, because heat rolls down the temperature hill.

166 CHAPTER 8. PARTIAL DIFFERENTIAL EQUATIONS

If we fix, again, some definite region U, the amount of heat in the region U

in Rn is given by a simple rule: the specific heat of a solid is the amount of

heat it takes to raise a unit mass of the solid by a temperature of 1o, so in a

region U if we assume the specific heat and the density are constants, _ and

_, we conclude that the heat in the region U at time t is given by

HU =

Z

U

__ T(x, t) dx

and we can regard the heat flow into U as

dHU

dt

=

Z

U

__

@T(x, t)

@t

dx

HU is, for a given box U, just a function of time 6.

Heat flows into the box U down the temperature gradient at a rate proportional

to the conductivity of the material, K say, and the gradient of the

temperature, rT, at some point x, is in the opposite direction to the heat

flow. If we want to get the vector telling us the rate of flow of heat at the

point x at time t, we can call it v and write

v = −KrT

Now the rate of flow of heat out of the box U is going to be

Z

@U

v q n

where n is the outward normal, which is equal, by the Divergence theorem

to Z

U

div(v) = −K

Z

U

r q r(T)

This succession of rs is written, with a rather shaky excuse, as r2, as before.

It is clear that r2f is shorthand for, in the case of two variables x and y,

@2f

@x2 +

@2f

@y2

6It might be a good idea to think of the amount of heat as the number of bees and the

temperature as the bee density, with some constants thrown in.

8.3. LAPLACE’S EQUATION 167

We may therefore equate the heat flow into the box, dHU/dt to the temperature

T in two different ways:

dHU

dt

= K

Z

U

r2T =

Z

U

__

@T

@t

Or to put it another way,

Z

U

_

Kr2T − __

@T

@t

_

= 0

Since this holds for all U, the function inside the brackets must be the zero

function, and so we get the general heat equation:

Kr2T = __

@T

@t

where _ is the specific heat, _ is the density of the material and K is the

conductivity of the material. This is just the diffusion equation, but you

have some information about the (positive) constants and the properties of

materials. Whether you prefer to think of temperature or bee density is

entirely optional.