`(dn)/dt=nabla cdot n bb v (1)`
where `n` is the number density of particles in a small volume located at position (`x,y,z`) and `bb v` is the average velocity of the particles in that small volume. Equation 1 is called the continuity equation. Please note that a bold character like ` bb u` signifies a vector that has (`x,y,z`) components (`u_x,u_y,u_z`). Some might recognize the term `n bb v` as the particle current, which is the particle flow per unit area per second. This differential equation just says that the rate `(dn)/dt` of flow of particles into the small volume is related to the slope of the density times the velocity of groups of particles in the neighboring vicinity of that small volume. The divergence operator `nabla cdot` has the followng effect on its vector argument:`nabla cdot n bb v=(del (n v_x))/(del x)+(del (n v_y))/(del y)+(del (n v_z))/(del z) (1a)`
Of course both `n` and `bb v` can be variables of (`x,y,z`) so we must expand each of the 3 terms e.g. for the x component:`(del n v_x)/(del x)=(del n )/(del x)v_x+n(del v_x )/(del x)`
If we could have enough particles so that each small volume is well populated we could solve equation 1 numerically but with the number of particles we can actually achieve, the results would be very coarse-grained and volatile.`nabla cdot n bb v=(dn)/dt (1)`
to determine the rate of change of particle density in a small volume. Let us rename the `n bb v` and call it `bb C` which is similar to the current density, `bb J`, used in electromagnetics. Thus we have`bb C=n bb v (2)`
For our case, the sign of any velocity component, say `v_x`, of any particle is random. The particle velocity is constant from one collision to the next and then, on average, the particles have a completely new velocity. So the change in position of the particles is limited by the mean distance they travel between collisions. This mean distance is called the mean free path `l`. The mean free path is defined by`l=1/(n sigma)`
where `n` is the local average density and`sigma=pi(r_{red}+r_{blue})^2`
and where `r` are the radii of the particles. The average time between collisions is then`tau_c=l/|bar v|`
where`bar v=sqrt(bar (v^2))=sqrt((2 bar E)/m)`
where `bar E` is the average kinetic energy. Thus the only asymmetry that results in the flow of groups of particles is the spatial variation of `n` (its gradient) so the rate of flow of groups of particles is`bb C= bar v l nabla n`
Another way of saying this is to define the x component the group velocity as:`v_x^(group)= 1/n bar v l (del n)/(del x)`
and that group velocity component is the what goes into equation (1a).`nabla cdot n bb v=(del (n v_x))/(del x)+(del (n v_y))/(del y)+(del (n v_z))/(del z)= bar v l [del ((del n)/(del x))/(del x)+(del ((del n)/(del y)))/(del y)+(del ((del n)/(del z)))/(del z)]`
`C_x= bar v l(n(x+dx/2)-n(x-dx/2))/dx=bar v l(del n)/(del x)`
Then taking the divergence of `bb C` we have the the expression`(dn)/dt=bar v l nabla cdot nabla n=bar v l(del^2 n )/(del x^2)`
Expanding this equation we have:`(dn)/dt=D[( del^2 n)/(del x^2)+( del^2 n)/(del y^2)+( del^2 n)/(del z^2)] (3)`
where D is called the difusivity . D is made up of the product .`D=l sqrt(bar (v^2))`
and has units `(meters^2)/(sec)`.`n(x,t)=(n_0)/2[erfc(x/(2sqrt(Dt)))] (4)`
where `n_0` is the starting density of particles on each side of the container and `erfc(u)` is the complement of the error function and is defined as:`erfc(u)=1-2/sqrt(pi)int_0^u exp(-v^2)dv`
I will now differentiate both sides of equation 4 to show that it is a solution of equation 3:`(del n)/(del t)=D(n_0)/4 x/t [exp(-(x^2)/(4 sqrt(D t)))]/sqrt(pi D t)`
`(del^2 n)/(del t^2)=(n_0)/4 x/t [exp(-(x^2)/(4 sqrt(D t)))]/sqrt(pi D t)`
where I have taken into account that the derivative of the integral with respect to its upper limit is just the integrand`( d (erfc(u)))/(du)=-2/sqrt(pi) exp(-u^2)=-2/sqrt(pi) exp(-(x^2)/(4Dt))`
Equation 4 is the one that is plotted as the theory for the diffusion of particles.