---
title: "MRI Diffusion Encoding: How Far Water Wanders Interactive Lab | Sandbox Physics"
description: "Two gradient pulses cancel for still water. How much signal do wandering molecules lose, and what changes when walls hem them in?"
canonical_url: "https://sandboxphysics.com/labs/mri-diffusion-encoding/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/mri-diffusion-encoding/"
last_modified: "2026-10-30"
---

FR35 · MRI

# MRI Diffusion Encoding: How Far Water Wanders

**Two gradient pulses cancel for still water. How much signal do wandering molecules lose, and what changes when walls hem them in?** Two equal gradient pulses around a refocusing pulse wind and exactly unwind the phase of still water. Water that wanders between them keeps a leftover phase, so the echo shrinks. In free water the echo falls exponentially with the b-value, which grows with the gradient area squared and the pulse spacing. Membranes slow the fall, so the measured diffusion coefficient is lower and timing-dependent.

Water molecules random-walk while two gradient pulses wind and unwind their phases. Free water loses signal exponentially as the weighting grows; water hemmed in by membranes loses less.

> Interactive simulation: open this page in a web browser to change the parameters and run the model.

Model assumptions

One-dimensional random walk along the gradient, in the rotating frame, for a pulsed-gradient spin echo with rectangular pulses. The 180-degree pulse is ideal and instantaneous, so it is folded into an effective gradient whose second pulse counts negative. Each echo ratio is the magnitude of the mean phase factor over 6000 seeded walkers; relaxation is the same with and without gradients and cancels in the ratio. Membranes are impermeable parallel planes; each walker reflects inside its own slab. The free diffusion coefficient 2.0 square micrometres per millisecond is an assumed round value for water near body temperature, not taken from a cited measurement. Motion across the gradient is drawn only to make the stage readable and changes no number.

Pulse sequence (white line: now)

Orange: gradient; dashed: effective (second pulse flipped). Purple: RF. Yellow dashes: echo.

Echo ratio across gradient strengths

Yellow: simulated (bars: two standard errors). Pink: held out. Grey: not fitted. Green: fit. Blue dashes: free-diffusion reference.

Walker phases at the echo

More numbers and how they are checked

- **Diffusion weighting in microscopic units**: $0$
- **Monte Carlo standard error of the echo ratio**: $0$
- **Free-diffusion reference at this weighting**: $0$
- **Held-out point against the one-exponential fit**: $0$
- **Spread of phases at the echo (simulated)**: $0$
- **Spread expected for free diffusion**: $0$
- **Gradient area times gamma**: $0$
- **Echo time**: $0$
- **Effective diffusion time**: $0$
- **Free-diffusion distance over the pulse separation**: $0$
- **Simulated walkers**: $0$

The yellow points come only from the simulated walkers. The dashed blue curve is the closed-form free-diffusion result and never uses the simulation. The fit uses only points well above the Monte Carlo noise; the largest of them is held out and predicted, so a large miss means one exponential does not describe the data.

Physics tutorial

## A spin echo that measures motion

**Background** A pulsed-gradient spin echo plays the same gradient pulse twice, with a 180-degree pulse in between. The 180-degree pulse reverses every phase, so for a molecule that stays put the second pulse undoes exactly what the first one did.

**Why it matters** Water molecules do not stay put. A molecule that has moved between the pulses keeps a leftover phase, and when thousands of leftover phases are added, the echo shrinks. The shrinkage tells how far water wandered, which is what diffusion-weighted imaging maps.

Start with the essentials

- **Focus question**: Two gradient pulses cancel for still water. How much signal do wandering molecules lose, and what changes when walls hem them in?
- **One-sentence intuition**: For free water the leftover phases are Gaussian with variance $2bD$, so the echo falls as $e^{-bD}$. The weighting $b$ grows with the square of the gradient area and with the time between pulses. Walls cap how far a molecule can go, so the echo falls more slowly than the free curve and the fitted coefficient depends on the timing.

### Core mathematical model

#### Echo ratio for free diffusion

$$
\frac{S}{S_0}=e^{-bD},\qquad b=\gamma^2G^2\delta^2\left(\Delta-\frac{\delta}{3}\right)
$$

Rectangular pulses of strength $G$ and length $\delta$, starting $\Delta$ apart (Hrabe, Kaur and Guilfoyle 2007, Eqs. 1 and 2). The ISMRM 2019 problem set works the default case: 40 mT/m, 10 ms and 50 ms give about $0.53\,\mathrm{ms/\mu m^2}$, which is $530\,\mathrm{s/mm^2}$.

#### Where the leftover phase comes from

$$
\varphi=\gamma\int_0^{T_E}G_{\mathrm{eff}}(t)\,x(t)\,\mathrm{d}t,\qquad \frac{S}{S_0}=\left|\left\langle e^{i\varphi}\right\rangle\right|
$$

The effective gradient counts the second pulse negative because of the 180-degree pulse. A molecule that does not move ends with $\varphi=0$.

### Common difficulties

#### The gradient does not push water

**Typical misconception** The diffusion gradient makes water flow, and the signal drops because water leaves the voxel.

**Better mental model** The water wanders the same way with the gradient on or off. The gradient only labels each molecule with a phase that depends on where it was; the signal drops because the labels no longer agree at the echo.

### Run the experiment

1. 01

   #### Watch phases wind and unwind

   Start with Free water, a clinical b-value and watch one cycle.

   **What to observe:** The first pulse paints a rainbow across the tissue; after the second pulse most colours return to one hue, but not all. The echo is about 0.36 of the echo without gradients, close to the free-diffusion curve.

2. 02

   #### Double the gradient

   Choose Double the gradient: four times b.

   **What to observe:** The weighting rises fourfold and the echo nearly vanishes; the phase histogram now spreads over more than a full turn.

3. 03

   #### Add membranes

   Choose Water between membranes, then Wait longer: walls matter more.

   **What to observe:** The echo stays high, the fitted coefficient drops well below the free value, and it drops further when the pulses are farther apart. The held-out point no longer sits on a single exponential.

Physical conclusion

Diffusion encoding turns motion into phase spread and phase spread into signal loss. For free water one number, the b-value, sets the loss; once walls get in the way, the measured coefficient depends on how long you watched.

## Related experiments and articles

MRI spatial encoding · Reading path

### From precessing water to k-space, undersampling and diffusion

Articles on this path that use this experiment, followed by the other experiments they suggest.

1. [Article **How a spin echo recovers a signal that seemed lost**](https://sandboxphysics.com/stories/mri-spatial-encoding/spin-echo-and-t2/)
2. [Lab **NMR Free Induction Spectrometer** See static broadening shorten the signal](https://sandboxphysics.com/labs/nmr-free-induction-spectrometer/)
3. [Lab **Spin Echo & Noise Spectroscopy** Which dephasing one inversion can undo](https://sandboxphysics.com/labs/spin-echo-noise/)
4. [Article **Diffusion encoding: how a gradient pair measures how far water moves**](https://sandboxphysics.com/stories/mri-spatial-encoding/diffusion-encoding/)

Quantum & fields · Starter path

## Start from a single measurement

Predict an outcome, then count what the measurements actually give. The path starts with one qubit and moves on to wave packets, bound states and two-photon interference.

[Start here → **Quantum State & Born Measurement** Predict a probability, turn the analyzer, then compare your prediction with the measured frequency over many shots. Observe · 15 min](https://sandboxphysics.com/labs/qubit-state/)

1. [1 Quantum State & Born Measurement](https://sandboxphysics.com/labs/qubit-state/)
2. [2 Stern–Gerlach Sequence](https://sandboxphysics.com/labs/stern-gerlach-sequence/)
3. [3 Wave Packet & Uncertainty](https://sandboxphysics.com/labs/wave-packet-uncertainty/)
4. [4 Quantum Harmonic Oscillator](https://sandboxphysics.com/labs/quantum-harmonic-oscillator/)
5. [5 Which Path & Quantum Eraser](https://sandboxphysics.com/labs/quantum-eraser/)
6. [6 Hong–Ou–Mandel Two-Photon Interference](https://sandboxphysics.com/labs/hong-ou-mandel/)

[View the full path →](https://sandboxphysics.com/topics/quantum/#starter-path)
