---
id: wiki-2026-0508-ergodic-theory
title: Ergodic Theory
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Ergodicity, Time Average vs Ensemble Average]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [math, dynamics, probability, statistics, finance]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: Python
  framework: NumPy
---

# Ergodic Theory

## 매 한 줄
> **"매 time average = ensemble average — 매 system 의 ergodic 면"**. Birkhoff (1931), Boltzmann origin 매 statistical mechanics, modern resurgence 매 Ole Peters' "ergodicity economics" (2011-) 매 expected value 의 critique. 매 finance, RL, MCMC convergence, decision theory 의 deep relevance.

## 매 핵심

### 매 두 averages
- **Ensemble average** (⟨x⟩): mean over many parallel realizations at fixed time.
- **Time average** (x̄): mean of single trajectory over long time.
- **Ergodic**: 매 ⟨x⟩ = x̄ (a.s.) for all integrable f.
- **Non-ergodic**: trajectories diverge — ensemble average misleads about typical outcome (multiplicative dynamics).

### 매 implications
- **Multiplicative process** (e.g. wealth × random factor): non-ergodic; geometric mean rules, expected value misleads.
- **Kelly criterion**: optimal bet sizing under non-ergodicity.
- **MCMC**: chains must be ergodic to converge to target distribution.
- **Statistical physics**: ergodic hypothesis underpins phase-space averaging.

### 매 응용
1. Investment decisions (avoid ruin via geometric returns).
2. RL convergence theory (Markov chain ergodicity).
3. Statistical mechanics (Boltzmann distribution).
4. MCMC sampling (Metropolis-Hastings, HMC).
5. Insurance / risk modeling.

## 💻 패턴

### Ensemble vs time average (multiplicative)
```python
import numpy as np

T, N = 1000, 10000
# Multiplicative: 50% gain 50% loss, fair coin
returns = np.where(np.random.rand(T, N) < 0.5, 1.5, 0.6)
wealth = np.cumprod(returns, axis=0)

ensemble_mean = wealth[-1].mean()       # large positive
time_mean     = np.exp(np.log(wealth[-1]).mean())  # geometric, often << 1
print(f"E[W_T]={ensemble_mean:.2f}  exp(E[log W_T])={time_mean:.4f}")
```

### Kelly criterion
```python
def kelly_fraction(p_win, b_win, b_loss):
    # f* = p/b_loss - (1-p)/b_win  (simplified)
    return p_win / b_loss - (1 - p_win) / b_win

f = kelly_fraction(0.55, 1.0, 1.0)  # 0.10 of bankroll
```

### Geometric mean return
```python
def geo_return(rets):
    return np.prod(1 + rets) ** (1/len(rets)) - 1
```

### Ergodic check (Birkhoff sum)
```python
def is_ergodic_emp(traj, f, ensemble):
    time_avg = np.mean([f(x) for x in traj])
    ens_avg  = np.mean([f(x) for x in ensemble])
    return abs(time_avg - ens_avg) < 0.01
```

### Markov chain ergodicity (irreducible + aperiodic)
```python
import numpy as np
P = np.array([[0.5, 0.5], [0.3, 0.7]])
eigvals, eigvecs = np.linalg.eig(P.T)
# Stationary distribution = eigenvector for eigenvalue 1
pi = np.real(eigvecs[:, np.isclose(eigvals, 1)].flatten())
pi /= pi.sum()
```

### Ergodicity-economics rebalancing
```python
def expected_log_growth(p, weights, returns):
    # Maximize sum(p_i * log(1 + w·r_i))
    return np.sum([p_i * np.log(1 + np.dot(weights, r))
                   for p_i, r in zip(p, returns)])
```

## 매 결정 기준
| 상황 | Average to use |
|---|---|
| Single agent, repeated bets | Time average (geometric) |
| Many independent agents | Ensemble average |
| Wealth / multiplicative | Geometric, never arithmetic |
| Insurance / pooling | Ensemble (true sharing) |
| MCMC convergence | Verify ergodicity of chain |
| Long-run RL | Ergodicity of Markov chain |

**기본값**: assume non-ergodic in finance/biology/social; verify before using ensemble average.

## 🔗 Graph
- 부모: [[Probability-Theory]]
- 응용: [[MCMC]] · [[Reinforcement-Learning]]
- Adjacent: [[Markov-Chains]] · [[Entropy-in-Information-Theory]]

## 🤖 LLM 활용
**언제**: explain ergodicity intuitions, simulate ensemble vs time, derive Kelly fractions, debug MCMC non-convergence.
**언제 X**: rigorous proofs (consult Walters, Petersen), high-stakes financial decisions (need quant + risk pro).

## ❌ 안티패턴
- **Expected-value reasoning under multiplicative dynamics**: leads to ruin.
- **Confusing arithmetic and geometric means**: arithmetic > geometric always (Jensen).
- **Assuming ergodicity by default**: most real-world economic/social systems aren't.
- **Ignoring path dependence**: order of returns matters when non-ergodic.
- **Misusing law of large numbers**: applies to ensemble, not single trajectory of multiplicative process.

## 🧪 검증 / 중복
- Verified (Birkhoff 1931, Walters "Introduction to Ergodic Theory", Peters "The ergodicity problem in economics" Nature Physics 2019).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Birkhoff + ergodicity economics + Kelly + MCMC |
