# Diffusion equation

Reference: Daniel V. Schroeder, An Introduction to Thermal Physics, (Addison-Wesley, 2000) – Problem 1.69.

The process of diffusion obeys a partial differential equation very similar to the heat equation. In fact, the derivation is almost identical, except that we are considering the flow of molecular number rather than energy. In diffusion, the rate at which molecules diffuse per unit area and per unit time is given by the flux ${J_{x}}$. Suppose we have a narrow pipe filled with fluid or gas, and that the molecular concentration varies only along the length of the pipe. Consider two adjacent narrow slices within the pipe, each of width ${\Delta x}$. The first slice is bounded by ${x_{1}}$ and ${x_{2}}$ and the second slice by ${x_{2}}$ and ${x_{3}}$. According to Fick’s law

$\displaystyle J_{x}=-D\frac{dn}{dx} \ \ \ \ \ (1)$

the number of molecules entering slice 2 from slice 1 in time ${\Delta t}$ is

$\displaystyle J_{x,2}A\Delta t=-DA\frac{n_{2}-n_{1}}{\Delta x}\Delta t \ \ \ \ \ (2)$

where ${A}$ is the cross-sectional area of the slice.

Similarly, the number of molecules flowing out of the second slice on the other side is

$\displaystyle J_{x,1}A\Delta t=-DA\frac{n_{3}-n_{2}}{\Delta x}\Delta t \ \ \ \ \ (3)$

The difference ${\left(J_{x,2}-J_{x,1}\right)A\Delta t}$ is the net change in the number of molecules in the second slice, so

$\displaystyle \left(J_{x,2}-J_{x,1}\right)A\Delta t=\Delta N \ \ \ \ \ (4)$

Combining these equations we get

$\displaystyle \frac{\Delta N}{\Delta t}=DA\frac{n_{3}-2n_{2}+n_{1}}{\Delta x} \ \ \ \ \ (5)$

Dividing both sides by the volume of the slice ${V=A\Delta x}$ and using the molecular concentration ${n=N/V}$ on the LHS we get

$\displaystyle \frac{\Delta n}{\Delta t}=D\frac{n_{3}-2n_{2}+n_{1}}{\left(\Delta x\right)^{2}} \ \ \ \ \ (6)$

In the limit of ${\Delta t,\Delta x\rightarrow0}$ the RHS becomes the second derivative and we get the diffusion equation, or Fick’s second law:

$\displaystyle \frac{\partial n}{\partial t}=D\frac{\partial^{2}n}{\partial x^{2}} \ \ \ \ \ (7)$

Since this equation is formally equivalent to the heat equation, its solutions are the same. In particular, if we start with any concentration distribution, it will gradually spread out over time until the concentration is the same everywhere.