Explore modules

Wasserstein Distance One Dimensional

Transport probability mass along a line and compare its minimum travel cost with the area between two CDFs.

Free theory article

Transport probability mass along a line and compare its minimum travel cost with the area between two CDFs.

Concept & interpretation

The Wasserstein-1 distance (often called the earth mover's distance) computes the minimum cost required to transform one probability distribution into another. On a one-dimensional real line, this optimal transport has a closed-form solution: it equals the absolute area between the two cumulative distribution functions (CDFs).

Experimenting with Monotone Coupling

Open the Wasserstein Distance One Dimensional interactive module. You can independently adjust the integer weights for each distribution and see how the optimal monotone transport plan adapts.

  1. Set P weights to 1, 0, 0 (all mass at -1) and Q weights to 0, 0, 1 (all mass at 2). The CDF difference is 1 across the entire range from -1 to 2. The cost is exactly 3.
  2. Set P weights to 1, 0, 1 and Q weights to 0, 1, 0. The total distance is 3/2 (1.5). Watch the coupling arcs adjust to move mass efficiently.
  3. Try setting all weights to 0. The module correctly rejects any zero total weight rather than attempting to solve unbalanced optimal transport.
Read the full free theory article