# A derivation of the diffusion equation

## Branko Ćurgus

Mathematical facts used in the derivation
• The Fundamental theorem of calculus: Let $f$ be a continuous real-valued function defined on an open interval which includes a real number $x$. Then $\lim_{\Delta x \to 0} \frac{1}{\Delta x} \int_{x}^{x+\Delta x} \!\!\! f(\xi)\, d\xi = f(x).$
• Leibniz's rule for differentiation under the integral sign: Let $F$ be a function of two independent variables $x$ and $t$ which is defined on a rectangle $(a,b)\times(c,d)$. Assume that the functions $F$ and $\displaystyle \frac{\partial F}{\partial t}$ are continuous. Let $x_1, x_2 \in (a,b)$. Then $\frac{d}{d t} \int_{x_1}^{x_2} F(\xi,t) d\xi = \int_{x_1}^{x_2} \frac{\partial F}{\partial t}(\xi,t) d\xi, \quad \text{for all} \quad t \in (c,d).$
The physical quantities at play in diffusion of dye
• Density of dye: at the position $x$ at time $t$ the density of the dye is $u(x,t)$.
• Dye flux: at the position $x$ at time $t$ the dye flows from left to right at the rate of $\phi(x,t)$.
The physical laws that govern diffusion of dye
• The conservation of dye law: The rate of change of the amount of dye in a region equals the difference between the total inflow and the total outflow of the dye. That is: $\frac{d}{d t} \int_{x_1}^{x_2} u(\xi,t)d\xi = -\bigl(\phi(x_2,t) - \phi(x_1,t)\bigr).$
• Fick's law: The dye flows from the region of higher density to the region of lower density. More precisely, the dye flux is proportional to the difference in dye density. Or, even more precisely, $\phi(x,t) = -k\, \frac{\partial u}{\partial x}(x,t), \quad k > 0.$ The above equation assumes that dye is being diffused in a uniform medium. If the medium is nonuniform, then $k$ might depend on $x$: $\phi(x,t) = -k(x)\, \frac{\partial u}{\partial x}(x,t), \quad k(x) > 0.$
Putting things together
• The first two steps:  $\displaystyle \int_{x}^{x+\Delta x} \frac{\partial u}{\partial t}(\xi,t)d\xi$ $\displaystyle = \frac{d}{dt} \int_{x}^{x+\Delta x} u(\xi,t)d\xi$ by Leibniz's rule $\displaystyle = -\bigl(\phi\bigl(x+\Delta x,t\bigr) - \phi(x,t)\bigr) \quad$ by conservation of dye law
• Divide the first and the last expression in the previous item by $\Delta x \neq 0$: $\frac{1}{\Delta x} \int_{x}^{x+\Delta x} \frac{\partial u}{\partial t}(\xi,t)d\xi = -\frac{1}{\Delta x} \bigl(\phi(x+\Delta x,t)- \phi(x,t) \bigr) .$
• Let $\Delta x \to 0$ in the previous identity and use the Fundamental theorem of calculus and the definition of the partial derivative to get $\frac{\partial u}{\partial t}(x,t) = - \frac{\partial \phi}{\partial x}(x,t).$
• Substituting Fick's law into the last equation we get $\frac{\partial u}{\partial t}(x,t) = \frac{\partial }{\partial x} \left( k(x) \frac{\partial u}{\partial x}(x,t) \right).$ This is the diffusion equation.

Place the cursor over the image to see the diffusion of the dye.