PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabs
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry

More from Math Visualization

Other simulators in this category — or see all 46.

View category →
FeaturedSchool

Vector Addition

Place vectors and see the resultant with head-to-tail animation.

Launch Simulator
FeaturedSchool

Trigonometry Circle

Unit circle with live sin, cos, tan values as you drag.

Launch Simulator
Kids

Function Grapher

Enter f(x) and see instant plots with zoom and pan.

Launch Simulator
FeaturedSchool

Fourier Series

Build waveforms from sine waves. Add harmonics one by one.

Launch Simulator
NewSchool

FFT Magnitude Spectrum

Paint or preset a 256-point signal; radix-2 FFT shows |X[k]| vs bin (DC to Nyquist).

Launch Simulator
NewUniversity / research

2D Phase Portrait (ODE)

Direction field and click-to-trace trajectories for planar systems: harmonic, damped, saddle, nodes, foci, pendulum (RK4).

Launch Simulator
PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Math Visualization/Random Walk

Random Walk

A random walk is a fundamental stochastic process that models the path of an object taking successive steps in random directions. This simulator visualizes both one-dimensional and two-dimensional random walks, where each step is of fixed length but its direction is chosen randomly (e.g., left/right in 1D or along a grid in 2D). The core mathematical principle is that the mean squared displacement, denoted ⟨r²⟩, grows linearly with the number of steps, N. Specifically, in an unbiased walk with step length L, ⟨r²⟩ = N L² in 1D, and ⟨r²⟩ = N L² in 2D for a square lattice. This linear relationship ⟨r²⟩ ∝ N is the signature of normal, or Fickian, diffusion. The simulator plots the running average of r² versus N, allowing users to observe how this linear trend emerges from the noise of individual random paths. Key simplifications include the fixed step length, the absence of external forces or biases, and the assumption that each step is independent of all previous steps (a Markov process). By interacting with the simulation, students learn to connect the microscopic random motion of individual steps to the emergent macroscopic behavior of diffusion, building intuition for phenomena like Brownian motion, heat conduction, and population dispersal.

Who it's for: High school and undergraduate students in physics, mathematics, or biology courses introducing probability, statistics, or diffusion processes.

Key terms

  • Random Walk
  • Mean Squared Displacement
  • Diffusion
  • Stochastic Process
  • Brownian Motion
  • Markov Process
  • Normal Distribution
  • Central Limit Theorem

Walk

6
8

Running mean of r² is a discrete analog of diffusion: after many steps, mean square displacement grows ~ N (2D) with fixed step variance.

Measured values

Steps N0
Running mean ⟨r²⟩0.0

How it works

Contrasts with the smooth Brownian path in thermodynamics: here each step is a clean coin flip or uniform angle, ideal for proving scaling laws.

Frequently asked questions

Why does the path look so messy, but the average ⟨r²⟩ plot is a straight line?
An individual random walk path is unpredictable and 'jagged' because each step is random. However, the mean squared displacement ⟨r²⟩ is a statistical average over many possible paths. The linear trend emerges from the law of large numbers, showing that while individual outcomes are random, their average behavior is predictable and follows the diffusion law ⟨r²⟩ ∝ N.
Is this how real particles like pollen grains in water actually move?
Yes, this is a simplified model of Brownian motion. Real particles are constantly bombarded by water molecules, resulting in a random, jittery path. The random walk model captures the essential statistical feature—the linear growth of mean squared displacement with time—which Albert Einstein used in 1905 to prove the atomic theory of matter.
What does the 'running mean' of ⟨r²⟩ show?
The running mean calculates the average of r² up to each step number N for the single walker you are watching. It starts very noisy for small N but converges toward the theoretical straight line (N L²) as N increases. This demonstrates how statistical predictability improves with more data, a key concept in probability.
What are the main limitations of this simple random walk model?
This model assumes fixed step lengths, instantaneous steps, and no interactions between walkers or with an environment. Real-world diffusion can involve variable step sizes, waiting times between steps, and external forces (leading to biased walks). It also models 'normal' diffusion; many complex systems like transport in cells exhibit 'anomalous' diffusion where ⟨r²⟩ ∝ N^α with α ≠ 1.