› Brownian Motion Simulator Back
Statistical Physics · Diffusion

Brownian Motion & Random Walk Simulator

Adjust particle count, step size, and trail options to observe diffusion in real time. Verify Einstein's MSD = 2dDt formula live and estimate the diffusion coefficient D from the simulation.

Parameters
300 K
3.0
1.0
80
Display
Boundary condition
Presets
Live values
0.0
Diffusion coefficient D [px²/s]
0
⟨r²⟩ [px²]
0.0
Time t [s]
80
Particles
Normal diffusion
Regime
Brownian motion animation
Large particles (tracers) Solvent molecules Trails (afterimage)

"Random walk": collisions with molecules make the particles move irregularly. Add more particles and you can see the initial cluster spread out, which is diffusion.

Mean squared displacement MSD ⟨r²⟩ ∝ t
Measured ⟨r²⟩ Theory 4Dt
Results
0
⟨r²⟩ (px²)
0
Estimated D (px²/s)
0
Theoretical D (px²/s)
Theory & Key Formulas
$$\langle r^2 \rangle = 2dDt = 4Dt\ \ (2\text{D})$$

d = dimension (2D), D = diffusion coefficient, t = elapsed time. From the slope, D = ⟨r²⟩/(4t).

Einstein–Stokes equation (larger / colder / more viscous → slower):

$$D = \frac{k_B T}{6\pi\eta r}$$

What Are Brownian Motion and the Random Walk?

🙋
Brownian motion just looks like particles wobbling around on the screen. What is so remarkable about it?
🎓
Roughly speaking, this "wobbling" proved that molecules are real. In 1905 Einstein explained the motion mathematically and showed that it happens because invisible water molecules are kicking the pollen grains. Increase the "number of particles" in this simulator and look at the average motion of many particles, and you will start to see a regularity.
🙋
A regularity? Even though the motion is random? The graph on the right says "MSD". Is that it?
🎓
Exactly! The MSD (mean squared displacement) is the average of the squared distance each particle has moved from its starting point. Even though the motion looks random, this value grows neatly in proportion to time (⟨r²⟩ = 4Dt). Raise the "temperature" in the simulator and the molecular kicks get stronger, the diffusion coefficient D increases, and you can see the MSD graph get steeper.
🙋
Wow! But how is this "diffusion coefficient D" determined in the real world? Is it related to the D the simulator estimates?
🎓
Good question! In the real world it is given by the Einstein–Stokes equation D = kT/(6πηr). Increase the "particle radius", raise the "viscosity" or lower the "temperature" and the particles get slower and slower. Press the "Cold & viscous" preset and watch the MSD slope flatten. In practice, this idea is the basis for predicting molecular transport inside cells and impurity diffusion in semiconductors.

Frequently Asked Questions

MSD stands for mean squared displacement, a measure of how far particles have spread from their starting positions. Following Einstein's relation ⟨r²⟩ = 2dDt (4Dt in 2D), it increases linearly with time, and the diffusion coefficient D can be estimated from the slope of the graph.
From the Einstein–Stokes equation D = kT/(6πηr), raising the temperature increases D and speeds up diffusion, while increasing the particle radius or viscosity decreases D and slows it down. More particles improve the statistical accuracy and reduce the scatter in the MSD.
Look at the slope of the straight part of the MSD graph during the simulation. In two dimensions (d = 2) the slope equals 4D, so D = ⟨r²⟩/(4t). You can check that the "Estimated D" in the live values approaches the theoretical value D = kT/(6πηr). The more particles, the more accurate the estimate.
It is implemented as a 2D random walk that obeys Einstein's relation (step variance ∝ D·dt) and reproduces the effects of temperature, viscosity and particle radius qualitatively. The display uses normalised units (px and s), however, so converting to real physical quantities requires setting length and time scales.

Real-World Applications

Drug discovery and drug delivery:Used as a basic model to predict how nanoscale drug particles diffuse through the blood and reach the affected area. The relationship between particle size and diffusion speed feeds directly into drug design.

Semiconductor processing:In the process of thermally diffusing impurities (dopants) into a silicon wafer to make transistors, the diffusion equation is used to predict how the impurities spread, and the theory of Brownian motion underlies it.

Environmental science:A basic process when modelling how fine particles in the air (PM2.5) or pollutants in water spread. It is the starting point for more complex models that include the effects of turbulence.

Financial engineering:Stock price fluctuations are modelled as geometric Brownian motion and applied to option pricing (the Black–Scholes model) and more. Here the "random walk" represents the uncertainty of prices.

Common Misconceptions and Points to Note

There are a few traps that people, especially CAE beginners, tend to fall into when they start using this simulator. The first is thinking that "the more particles, the more accurate". The statistical scatter does decrease, but the computational load grows explosively. In practice you always weigh the accuracy you need against the computing cost. For example, if you only want a rough idea of the diffusion coefficient D, 100 particles may be enough, but to know the exact shape of the distribution you may need 1000 or more. Being able to make that call is what professionals get right.

The second isconfusing "temperature, viscosity and particle radius" with "the diffusion coefficient D". In the real world D is a "result" determined by the properties of the material (temperature, viscosity, particle size). To reproduce that D, a simulation must work backwards to set an appropriate step variance and time step Δt. This tool computes the Einstein–Stokes D = kT/(6πηr) internally and feeds it into the step variance 2DΔt. Without understanding this "modelling" process, it ends up as just a game.

Finally,the pitfall of the "reflecting" boundary condition. It is a handy feature for reproducing a container, but real molecules do not reflect perfectly elastically. Near a wall, friction or chemical interactions can occur. Keep in mind that using a reflecting condition in the simulation is only a "first approximation". To mimic complex environments such as the inside of a cell, special rules at the boundary (for example, adsorption with some probability) have to be added.

How to Use

  1. Set "Temperature T", "Particle radius r" and "Viscosity η"; the diffusion coefficient is calculated automatically from the Einstein–Stokes equation D = kT/(6πηr)
  2. Change the "number of tracer particles" to observe the diffusion of many particles (the spreading of the initial cluster)
  3. Turn on "Solvent molecules" to see the fast molecules hitting the large particles
  4. Compare the measured ⟨r²⟩ with the theoretical line 4Dt in the MSD graph, and check that the estimated D in the live values approaches the theoretical value
  5. The presets (Brownian motion / single particle / diffusion / cold & viscous) reproduce typical scenarios instantly

Worked Example

With temperature T = 300 K, viscosity η = 1.0 and particle radius r = 3.0, the theoretical diffusion coefficient is proportional to D = kT/(6πηr) and is about 60 px²/s in this tool. For a 2D random walk ⟨r²⟩ = 4Dt, so the expected MSD at t = 5 s is about 1200 px². The more particles, the closer the MSD-based estimate D = ⟨r²⟩/(4t) comes to the theoretical 60 px²/s. To map this onto a real physical system, define separately how many units of length one pixel and one second correspond to, and convert.

Practical Notes

  1. Exclude the early stage where the MSD curve is not yet linear (transient region) from the diffusion-coefficient estimate, and wait until enough statistics have accumulated
  2. With few particles, the fluctuations of individual trajectories are large and the statistical error grows; many particles make the result more reliable
  3. The display uses normalised units (px and s). Normalise by dimensional analysis when relating it to a physical system
  4. The reflecting boundary is an ideal elastic reflection. When comparing with experiments, evaluate external effects such as wall adsorption and friction separately

🎬 Watch it in motion

Brownian Motion | random jitter spreads exactly with time #Shorts
Brownian Motion | random jitter spreads exactly with time #Shorts