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
Number of particles
Step size σ
Steps per frame
Display
Trail length
Color mode
Boundary
Presets
Results
0
MSD (px²)
0
Est. D
0
Steps
Particle Trajectory

Simulation starts automatically. Adjust presets and parameters to explore diffusion.

Theory & Key Formulas
$$\langle r^2 \rangle = 2dDt$$

d = dimensions (2D here), D = diffusion coefficient

Einstein-Stokes equation:

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

What is Brownian Motion?

🙋
What exactly is Brownian motion? I see the particles in the simulator jiggling around randomly.
🎓
Basically, it's the chaotic, zig-zag movement of tiny particles suspended in a fluid, like pollen grains in water. This happens because they're constantly being bombarded by millions of invisible, fast-moving molecules from the fluid. In practice, it's a perfect example of a random walk. Try increasing the "Number of particles" in the simulator—you'll see that while each path is unique, the overall cloud of particles spreads out in a predictable way.
🙋
Wait, really? If it's random, how can it be predictable? What does "spreads out in a predictable way" mean?
🎓
Great question! While we can't predict a single particle's exact path, we can predict the statistical behavior of many particles. A common case is measuring how far, on average, the particles have wandered from their starting point over time. This is called the Mean Squared Displacement (MSD). In the simulator, turn on "Trail length" and watch how the trails fan out. The wider the fan, the larger the MSD. Einstein figured out the exact math for this spread.
🙋
So Einstein's formula is the "predictable" part? How do the simulator controls, like "Step size σ", connect to that?
🎓
Exactly! The "Step size σ" (sigma) controls the average length of each random step a particle takes. A bigger σ means each jiggle is more forceful, so the particle explores space faster. This directly affects the diffusion coefficient (D) in Einstein's equation. Try this: run the sim with a small σ, then pause and reset. Now run it with a large σ. You'll see the cloud of particles spreads out much more quickly with the larger step size, which corresponds to a higher D.

Physical Model & Key Equations

The core statistical law describing Brownian motion is Einstein's diffusion formula. It states that the average squared distance from the starting point increases linearly with time.

$$\langle r^2 \rangle = 2dDt$$

Here, $\langle r^2 \rangle$ is the Mean Squared Displacement (MSD), $d$ is the number of dimensions (2 for this simulator), $D$ is the diffusion coefficient (m²/s), and $t$ is time. The linear relationship $\langle r^2 \rangle \propto t$ is the hallmark of normal diffusion.

The diffusion coefficient $D$ itself depends on the properties of the particle and the surrounding fluid, described by the Einstein-Stokes equation.

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

Here, $k_B$ is Boltzmann's constant, $T$ is the absolute temperature, $\eta$ is the fluid viscosity, and $r$ is the radius of the spherical particle. This shows why smaller particles or higher temperatures lead to faster diffusion (larger $D$) – they are more easily knocked around by molecular collisions.

Frequently Asked Questions

MSD stands for Mean Squared Displacement, an indicator of how far particles have spread from their initial positions. According to Einstein's relation ⟨r²⟩=2dDt, it increases linearly over time. The diffusion coefficient D can be estimated from the slope of the graph.
Increasing the number of particles improves statistical accuracy and reduces the variability of MSD. Increasing the step size increases the movement distance per step, accelerating diffusion. However, if the step size is too large, the random walk assumption breaks down, so adjust it within an appropriate range.
Check the slope of the linear portion of the MSD graph during the simulation. In two dimensions (d=2), the slope corresponds to 4D, so D is obtained by dividing the slope by 4. For example, if the slope is 0.8, then D=0.2. A larger number of particles improves estimation accuracy.
It is based on an ideal random walk model and qualitatively reproduces Einstein's relation. However, in the real world, factors such as particle size, fluid viscosity, and temperature affect motion, so quantitative agreement requires parameter adjustment using the Einstein-Stokes equation.

Real-World Applications

Biosensing & Medical Diagnostics: The diffusion rate of proteins or DNA in a solution changes if they bind to a target molecule. By measuring this change in Brownian motion (a technique called Dynamic Light Scattering), scientists can detect diseases or specific pathogens without using labels.

Financial Market Modeling: The random walk is a foundational model for predicting stock price movements. While real markets have more complex trends and volatilities, the basic concept of modeling unpredictable, step-by-step changes comes directly from Brownian motion theory.

Polymer Science & Material Design: The way long polymer chains wiggle and fold in a solution is modeled as a "self-avoiding random walk." Understanding this diffusion helps design better plastics, gels, and drug delivery systems that rely on controlled release.

Environmental Science: Predicting how pollutants, nutrients, or plankton spread in oceans or groundwater relies on diffusion models. For instance, modeling an oil spill's dispersion involves calculating diffusion coefficients for different substances in water.

Common Misconceptions and Points to Note

When you start using this simulator, there are a few points that beginners in CAE often stumble over. The first is the tendency to think "the more particles, the more accurate". While statistical fluctuations do decrease, the computational load increases explosively. In practical work, you always need to consider the trade-off between required accuracy and computational cost. For instance, 100 particles might be sufficient if you just want a rough idea of the diffusion coefficient D, but you might need 1000 or more particles if you need to know the exact distribution shape. Being able to make that judgment is a key professional skill.

The second point is the easy confusion between the "step size σ" and the "diffusion coefficient D". In the simulator, increasing σ also increases D, but in the real world, D is a "result" determined by the material's properties (temperature, viscosity, particle size). To replicate that D in a simulation, you need to back-calculate and set appropriate values for σ and the time step Δt. For example, if you know the D for a protein in water, you determine the σ needed to produce the same D in the simulation from the relation $$D = \frac{\sigma^2}{2 \Delta t}$$. If you don't understand this "modeling" process, it just remains a game.

Finally, the pitfall of the "reflective" boundary condition. It's a convenient feature for recreating a container, but real molecules don't reflect perfectly elastically. Friction or chemical interactions can occur near walls. Keep in mind that using a reflection condition in simulation is only a "first approximation". To mimic a complex environment like inside a cell, you'll need to add special rules at the boundaries (e.g., adsorption with a certain probability).

How to Use

  1. Set particle count (nVal: 1–100) to simulate multiple independent random walkers or single Brownian particle trajectories
  2. Adjust time step interval (spfVal: 0.001–0.1 s) to control simulation frame rate and observation window
  3. Configure step size sigma (sigmaVal: 0.5–5.0 px) representing thermal displacement per interval
  4. Enable trail visualization (trailSlider) to track historical positions
  5. Read output statistics: MSD (mean squared displacement in px²), Est. D (estimated diffusion coefficient), and step count

Worked Example

Gold colloidal particle (diameter 20 nm) in water at 298 K. Input: nVal=10, sigmaVal=2.5 px, spfVal=0.01 s, trailVal=on. After 500 steps, MSD reaches 625 px², yielding Est. D≈6.25 μm²/s (close to Einstein prediction D=kT/6πηr≈7.1 μm²/s for viscosity η=0.001 Pa·s). Discrepancy reflects discrete approximation; increasing step count improves convergence toward theoretical diffusion coefficient.

Practical Notes

  1. Einstein relation verification: MSD=4Dt requires linear growth; sub-linear early behavior reflects ballistic regime before thermal equilibration
  2. Reduce sigmaVal for slow-moving molecules (e.g., proteins in glycerol, η~1 Pa·s); increase for fast particles in low-viscosity media
  3. Multiple particle ensemble (nVal>1) reduces statistical noise—single trajectories show high variance; average 20+ runs for publication-quality diffusion estimates
  4. Frame rate (spfVal) must exceed molecular relaxation time; typical τ~1 μs requires spfVal<0.1 ms for accurate hydrodynamic coupling