How this calculation works
Reduce a stable small continuous-time state-space system by balancing reachability and observability Gramians and discarding weaker Hankel directions. Return reduced matrices and the standard H infinity error upper bound.
AP+PAᵀ+BBᵀ=0; AᵀQ+QA+CᵀC=0; ||G−Gr||∞≤2Σ(discarded σi)A worked example
For A=diag(−1,−2), B=(1,1)ᵀ and C=(1,1), retaining one state gives Hankel singular values about0.731000156 and0.018999844, with error bound0.037999688.
Good to know
Stable continuous real minimal order2–4, one/two inputs and outputs, D=0, retained order1–n−1. Positive full-rank Gramians required; near-nonminimal and failed reduced-stability cases rejected. Floating computations and residuals, no unstable balancing, discrete systems, nonzero feedthrough, guarantee that the bound is attained or formal interval certification.
Reference: Python Control Systems Library: balanced reduction (opens in a new tab) ↗
Reduce states that matter least at the ports
A state-space model can contain directions that are easy to excite but difficult to observe, or visible directions that inputs barely excite. Balanced truncation compares both properties. It transforms a stable system into coordinates where reachability and observability have the same diagonal strengths, then removes directions with smaller shared strengths.
The reduced model preserves the input and output dimensions while using fewer states. It approximates the input-output transfer behavior rather than selecting original physical states by their names. A balanced coordinate usually combines several original state variables, so a retained state need not correspond directly to a particular mass, concentration or circuit node.
Compare this with the Finite horizon reachability Gramian and minimum energy control calculator. Construct a lower-order model and Hankel singular-value error bound from infinite-horizon reachability/observability Gramians,not just report one finite-horizon Gramian.
Supply a stable minimal continuous model
Enter a square state matrix A, an input matrix B with one row per state, and an output matrix C with one column per state. This bounded calculator assumes zero direct feedthrough. The requested retained order must be positive and strictly smaller than the original order of two through four.
Every eigenvalue of the original state matrix must lie strictly in the left half-plane. The reachability and observability Gramians must also be numerically positive definite. A stable but uncontrollable or unobservable system is not accepted as numerically minimal; removing its redundant states is a separate preparation step rather than something this balancing calculation guesses.
Understand the two Gramians
The reachability Gramian solves a continuous Lyapunov equation involving A and B B transpose. It describes the state directions that sustained input energy can reach. The observability Gramian solves the dual equation involving C transpose C and describes which state directions significantly influence the measured output over time.
Both equations are solved numerically for the supplied stable model. Their definitions depend on the continuous-time infinite-horizon setting, so substituting discrete-time data into the same equations would answer a different question. The displayed Gramians let you inspect their scales and compare the result with an independent Lyapunov solver if a custom example appears poorly conditioned.
Interpret the Hankel singular values
The Hankel singular values combine reachability and observability strength. The algorithm uses a Cholesky factor of one Gramian and a symmetric eigenproblem involving the other. Ordering the resulting positive values from largest to smallest determines which balanced state directions are retained and which are candidates for truncation.
The balancing transformation is checked by comparing the transformed Gramians with the same diagonal matrix. A small balancing residual supports the numerical calculation, while a very small final singular value can indicate an effectively nonminimal model. The calculator rejects such cases instead of dividing by a nearly zero balancing scale and presenting unstable coordinates.
Follow the two-state example
The default model has two stable independent decay rates but a shared input and shared output. Its reachability and observability Gramians are both[[1/2,1/3],[1/3,1/4]]. Their eigenvalues are approximately0.731000156 and0.018999844, which are also the Hankel singular values in this symmetric example.
Retaining the larger direction gives a one-state model with A about minus1.324438279 and input and output coefficients about1.391520455. The discarded singular value contributes twice its value to the standard error bound, yielding approximately0.037999688. That number is an upper bound on the transfer error norm, not a measured simulation discrepancy.
Use the error bound correctly
For standard balanced truncation of a stable minimal system, twice the sum of discarded Hankel singular values bounds the H infinity norm of the input-output error. This is a worst-frequency guarantee in the mathematical model. It does not assert that every time sample or every physical state error equals that same number.
A small bound can guide retained-order choices, but its usefulness depends on the units and scaling of the input-output channels. Comparing it with the full system's gain may be more informative than reading the absolute number alone. The calculator additionally checks reduced-model stability and refuses a reduction whose floating result fails that check.
Respect numerical and modeling scope
A change of original state coordinates should preserve the transfer function and the theoretical Hankel singular values, although extreme coordinate scaling can degrade floating arithmetic. If balancing becomes ill conditioned, rescale the model or use a robust numerical package. The returned residual is diagnostic information rather than a formal interval proof of all matrix identities.
The calculation excludes unstable systems, discrete-time Gramians and nonzero feedthrough inputs. It also does not choose a retained order automatically or validate the original model against observations. Preserve the original matrices, chosen order and reported singular values together when documenting a reduction, since those details explain the approximation and its stated bound.
A few questions, answered
Is the error bound the actual error?
No. It is the standard upper bound2 times the sum of discarded Hankel singular values.
Can I use a stable nonminimal model?
Numerically singular reachability or observability Gramians are rejected; remove redundant states first.
Does one state mean one original physical variable?
Usually not. Balanced states are linear combinations of the original coordinates.
Can I supply discrete-time matrices?
No. The implemented Lyapunov equations and bound use the continuous-time stable setting.