# Diffusion

To simplify the analysis, we consider a one dimensional problem, where molecules can only flow along the $x$-axis through a surface of unit area. If we consider a volume element, that starts at $x$ and ends at $x+\Delta x$, the change in number of molecules $dN/dt$ in this element is given by the number of molecules that enter the volume element (influx times the area) minus the number of molecules that leave the volume element (efflux times the area).
Using the concentration $c$ and the volume $V=\Delta x \Delta y \Delta z$ we can write the change in number of molecules per volume element as \begin{align} \frac{dN}{dt}=\frac{d(c \cdot V)}{dt}=\frac{dc}{dt}\Delta x \Delta y \Delta z \tag{1} \end{align} The number of molecules entering (or leaving) is given by the product of the flux and the area of the cross section $\Delta x \Delta y$. \begin{align} \frac{dN_{in}}{dt}=J(x,y,z)\Delta x \Delta y \\ \frac{dN_{out}}{dt}=J(x+\Delta x,y,z)\Delta x \Delta y \\ \end{align} And we have for the total number of molecules \begin{align} \frac{dN}{dt}=\frac{dN_{in}}{dt}-\frac{dN_{out}}{dt}=J(x,y,z)\Delta x \Delta y -J(x+\Delta x,y,z)\Delta y \Delta z \tag{2} \end{align} Using (1) and taylor expansion of equation (2) around $x$ gives \begin{align} \frac{dc}{dt}\Delta x \Delta y \Delta z&=J(x,y,z)\Delta y \Delta z -J(x+\Delta x,y,z)\Delta x \Delta y\\ &=J(x,y,z)\Delta y \Delta z - \left(J(x,y,z)+\frac{\partial J}{\partial x} \Delta x \right)\Delta y \Delta z\\ \end{align} $J$ simply cancles. Dividing by the volume $\Delta x \Delta y \Delta z$ gives an equation that describes the time evolution of the concentration $c(x,t)$ at an arbitrary point $x$ known as the Diffusion Equation
Diffusion Equation \begin{align} \frac{dc}{dt}&=-\frac{\partial J}{\partial x} \end{align} Using Fick's First Law $J=-D \, \partial c / \partial x$ we can write the Diffusion Equation in its well known form \begin{align} \frac{d \,c}{dt}&=D \frac{\partial }{\partial x}\frac{\partial c}{\partial x} =D \, \frac{\partial ^2 \,c}{\partial x^2} \end{align}