Calculator Inputs
Formula Used
Detailed balance is a stronger condition than stationarity. It implies time-reversibility for the Markov process.
- \(\pi\) is a stationary distribution (nonnegative weights, normalized to sum 1).
- \(P\) is a transition matrix with row sums equal to 1.
- Detailed balance requires: \(\pi_i P_{ij} = \pi_j P_{ji}\) for every pair \(i \ne j\).
- We report absolute mismatch \(|\pi_i P_{ij}-\pi_j P_{ji}|\) and relative mismatch.
How to Use This Calculator
- Select the number of states for your model.
- Enter stationary weights \(\pi\). Any positive scaling is fine.
- Enter the transition matrix \(P\), ensuring each row sums to 1.
- Choose a tolerance matching your numerical precision needs.
- Press Check Detailed Balance to view pairwise diagnostics.
- Use CSV/PDF buttons to export the results after calculation.
Example Data Table
This 3-state example satisfies detailed balance with \(\pi=[0.5,0.3,0.2]\).
| \(\pi_1\) | \(\pi_2\) | \(\pi_3\) | Transition matrix row 1 | ||
|---|---|---|---|---|---|
| 0.50 | 0.30 | 0.20 | 0.80 | 0.12 | 0.08 |
| Row 2 | 0.20 | 0.70 | 0.10 | ||
| Row 3 | 0.20 | 0.15 | 0.65 | ||
Professional Notes on Detailed Balance
1) What this check verifies
Detailed balance checks whether probability flow between every pair of states is symmetric under time reversal. For states i and j, the forward flow \(\pi_i P_{ij}\) should match the reverse flow \(\pi_j P_{ji}\). When this holds for all pairs, the chain is reversible and many equilibrium computations simplify.
2) Where detailed balance is expected
Reversible dynamics appear in equilibrium statistical physics, Metropolis-style sampling, and diffusion on undirected graphs. In practice, detailed balance is also used as a diagnostic for discretized models: if you intended an equilibrium process but the check fails, the mismatch can reveal rounding, estimation drift, or inconsistent parameterization of transitions.
3) Inputs and normalization rules
You provide nonnegative stationary weights and a row-stochastic transition matrix. The calculator normalizes the weights internally so they sum to 1, then evaluates flows using the normalized values. It also reports every row sum so you can detect if a row deviates from 1 due to data entry or numerical noise.
4) Pairwise flow equality test
For each unordered pair, the tool computes both flows, the absolute difference, and a scale-free relative difference. The overall summary reports the maximum mismatch across all pairs. This “worst-case” view is useful when one rare transition violates reversibility while most other pairs appear consistent.
5) Absolute versus relative mismatch
Absolute mismatch is best when flows are comparable in size and you care about raw error. Relative mismatch is safer when some flows are tiny; a small absolute error can still be large compared with a near-zero flow. Typical tolerances range from 1e-6 to 1e-9, depending on how the matrix was produced.
6) Interpreting a failure
A failed result usually comes from one of three causes: a row that is not properly normalized, weights that contradict the transition structure, or asymmetric transitions that cannot be balanced by any stationary weights. Use the pairwise table to locate the offending pair, then trace back to the two matrix entries involved.
7) How to build a reversible matrix
A practical construction is to start from symmetric edge flows \(Q_{ij}=Q_{ji}\), choose weights \(\pi_i\), then set \(P_{ij}=Q_{ij}/\pi_i\) for i\neq j and use \(P_{ii}=1-\sum_{j\neq i}P_{ij}\). This guarantees detailed balance when all rows remain nonnegative.
8) Practical uses in modeling and simulation
Detailed balance supports reliable equilibrium sampling, stable long-run averages, and interpretable steady-state fluxes. In numerical work, a clean pass can justify using reversible-specific techniques such as symmetric similarity transforms or tighter convergence bounds. When the check fails, the mismatch magnitude helps quantify how far the model is from the intended equilibrium behavior. For teaching, it illustrates equilibrium flow conservation across states in a transparent manner.
FAQs
1) Is detailed balance the same as stationarity?
No. Stationarity requires \(\pi P=\pi\). Detailed balance is stronger: it enforces pairwise equality of flows \(\pi_i P_{ij}=\pi_j P_{ji}\). Detailed balance implies stationarity, but not the other way around.
2) Why does the calculator normalize my \(\pi\) values?
Only relative weights matter for flow comparisons. Normalizing prevents accidental scaling from changing results and makes outputs easier to interpret. Your original entries are still displayed, along with the sum so you can confirm what was submitted.
3) What if a row of \(P\) does not sum to 1?
The tool flags it and the overall check will fail. Use the “Normalize Rows” helper to convert each row into a valid probability distribution. If a row is all zeros, add at least one positive entry before normalizing.
4) Which tolerance should I choose?
For hand-entered values, 1e-6 is usually adequate. For values from optimization, simulation, or floating-point postprocessing, try 1e-8 to 1e-9. Tighten tolerance only if your inputs are computed with matching precision.
5) Can a chain be reversible without knowing \(\pi\) first?
Yes, but you still need a consistent stationary distribution to verify it. If \(\pi\) is unknown, estimate it from data or solve for it using stationarity constraints, then apply the pairwise flow test to confirm reversibility.
6) What does “Max relative mismatch” tell me?
It summarizes the worst pairwise disagreement after scaling by the flow magnitude. This is useful when some flows are very small, because absolute differences alone can hide large proportional errors in near-zero transitions.
7) How do exports help practical workflows?
CSV is convenient for spreadsheets, logs, and automated checks. PDF is useful for sharing a stable report with collaborators, audits, or documentation. Both exports include the key settings, row sums, and pairwise mismatch table.