An equation whose unknown is a matrix
Worth reading first: The eigenvalues that are not there · The condition number is an amplifier.
Most of the equations in this collection have a vector for an unknown. Some have a matrix, and the best known of them is Sylvester’s:
AX + XB = C
with A, B and C given and X wanted. It appears wherever two operators have to be reconciled: the transformation that block-diagonalises a Schur form, the sensitivity of an invariant subspace, the Lyapunov equation of a stable linear system when B = Aᵀ, the observability and controllability Gramians of control theory, the coupling term in a domain decomposition.
The map X ↦ AX + XB is linear in X. So it has a matrix, and writing it down is the obvious first move.
The object the equation names
Stacking the columns of X into a vector — vec(X) — turns the equation into an ordinary linear system:
( I ⊗ A + Bᵀ ⊗ I ) vec(X) = vec(C)
where ⊗ is the Kronecker product. That is exact, it is what the equation means, and it is a system of n² equations in n² unknowns.
| n | unknowns in X | entries in the coefficient matrix | flop ratio |
|---|---|---|---|
| 4 | 16 | 256 | 1× |
| 20 | 400 | 160,000 | 89× |
| 50 | 2,500 | 6,250,000 | 1,389× |
| 100 | 10,000 | 100,000,000 | 11,111× |
At n = 100 the object is 0.8 gigabytes of doubles for a problem whose answer is ten thousand numbers, and eliminating it costs (2/3)n⁶ = 6.7·10¹¹ operations.
What is done instead
Bartels and Stewart’s algorithm, from 1972, and it is three steps.
Reduce. Compute the real Schur forms A = QRQᵀ and B = ZSZᵀ. Two orthogonal similarities, O(n³) each, and orthogonal means nothing is amplified.
Substitute. The equation becomes RY + YS = QᵀCZ with R and S triangular, and then the (i, j) entry reads
(rᵢᵢ + sⱼⱼ) yᵢⱼ = cᵢⱼ − Σ_{k>i} rᵢₖ yₖⱼ − Σ_{k<j} yᵢₖ sₖⱼ
so Y comes out one column at a time, each column bottom to top, with one division per entry. That is n³ operations and no coefficient matrix exists at any point.
Transform back. X = QYZᵀ, two products.
Total about 60n³ against (2/3)n⁶: at n = 20 a factor of 89, at n = 100 a factor of eleven thousand. And the memory is n² rather than n⁴, which is the difference between running and not running.
Two routes, and they agree
At n = 6 both routes can be run. The Kronecker solve eliminates a 36×36 system; Bartels–Stewart performs two Schur reductions and a back-substitution. They share no arithmetic beyond the matrices they start from.
The two answers differ by 6.6·10⁻¹⁷ relative, and the residual ‖AX + XB − C‖/‖C‖ is 1.1·10⁻¹⁶ for both. Neither route can confirm itself; the agreement is evidence, and the residual is the check neither could have done alone.
What the Kronecker form is still for
The n²×n² matrix is not a mistake, and it is worth saying what it is good for before dismissing it as a method.
It is the definition. Every statement about the equation’s solvability, uniqueness and conditioning is a statement about that matrix, and the ones below are derived from it here rather than quoted.
It is how the conditioning is measured. sep is its smallest singular value, and this site computes it by forming the thing — which is the same licence the inverse has for the componentwise condition number: form the object when its entries or its singular values are the answer, never as a step towards something else.
It is the right object at very small n. At n = 3 the coefficient matrix is a nine-by-nine and the Kronecker route is a perfectly reasonable way to solve a Sylvester equation, and easier to write. The ratio at n = 4 is 1.
So the argument is not that the Kronecker form should never be built. It is the same argument the whole phase makes: the object a question names is a fine object and usually the wrong intermediate, and the size at which it stops being a reasonable intermediate is around n = 8.
Solvability is the eigenvalues, and conditioning is not
The equation has a unique solution exactly when no eigenvalue of A is the negative of an eigenvalue of B. That is easy to see from the triangular form — the divisor at entry (i, j) is rᵢᵢ + sⱼⱼ — and it is a clean statement about the spectra.
So the natural guess is that the difficulty is measured by how close min|λᵢ + μⱼ| comes to zero.
It is not, and the construction that says so is deliberately blunt. A and B are both upper triangular with diagonals 1, 2, …, n and an entry μ above the diagonal. The eigenvalues are the diagonals and do not move as μ changes, so every eigenvalue sum is at least 2, exactly, at every point on the axis.
| μ | min |λᵢ + μⱼ| | sep(A, B) |
|---|---|---|
| 0 | 2 | 2.000 |
| 1 | 2 | 1.654 |
| 2 | 2 | 0.978 |
| 4 | 2 | 0.131 |
| 8 | 2 | 9.47·10⁻⁴ |
The quantity that governs the answer falls by a factor of 2,100 while the quantity a reader is invited to consult does not move at all.
What sep is
sep(A, B) is defined as
sep(A, B) = min over ‖X‖_F = 1 of ‖AX + XB‖_F
which is the smallest singular value of the Kronecker matrix — the ordinary condition number of an ordinary linear map, arrived at without ever mentioning eigenvalues.
At μ = 0 the matrices are normal and sep is the eigenvalue gap, exactly: 2.000 against 2. That coincidence is why the guess is natural, and it is the same coincidence that makes the spectrum a sufficient description of a normal matrix and an inadequate one otherwise — the eigenvalues that are not there is the general statement and this is a consequence of it.
The amplification is attained rather than bounded. Perturbing C along the direction that achieves the minimum moves X by exactly 1/sep times as much: 0.5 at μ = 0 and 1,056 at μ = 8, measured, with a random perturbation reaching between 4 and 35 per cent of the worst case.
Why this matters outside the equation
sep is not a curiosity of one equation. It is the condition number of an invariant subspace, and that is where most people meet it without meeting its name.
If a Schur form is partitioned so that the leading block carries the eigenvalues of interest, the
sensitivity of the corresponding invariant subspace to a perturbation of the matrix is 1/sep(T₁₁, −T₂₂)
— which is exactly this quantity, for the two diagonal blocks. LAPACK’s xTRSEN returns it, and it is
the number that says whether the subspace a computation has isolated is a real feature of the matrix
or an artefact.
The site has drawn that subspace before and measured its stability directly. This essay is what the number in that measurement is.
Lyapunov, and the low-rank fact that makes it tractable
The symmetric special case, AX + XAᵀ = −C with A stable, is the Lyapunov equation, and it is the one that is actually solved at scale — in model reduction, in control, in the Gramians that decide which states of a system matter.
At scale it is solved neither by the Kronecker form nor by Bartels–Stewart, because n is 10⁵ and even n³ is too much. What is used instead rests on a fact about the answer: when C is low rank — which it is, because it is usually BBᵀ for a thin input matrix B — the singular values of X decay exponentially, so X can be represented as a low-rank factor and never formed as an n×n matrix.
That is this phase’s sentence again, one level up. The equation names an n×n unknown; the object worth computing is a thin factor of it; and the reason the substitution works is a theorem about the answer rather than a trick.
The two-dimensional case, which is where it becomes unavoidable
Sylvester equations are usually met as an abstraction. They arrive concretely, in enormous numbers, from separable partial differential equations.
A Poisson problem on a rectangle, discretised with the same stencil in each direction, is exactly
A U + U Aᵀ = F
where A is the one-dimensional operator and U is the grid of unknowns as a matrix. Vectorising it — which is what every finite-difference code does — turns it into the Kronecker system, and the Kronecker system is what the site’s own two-dimensional model problem is.
That is worth noticing, because it means the site has been solving Sylvester equations since the depth phase without calling them that. A 31×31 grid is 961 unknowns; as a matrix equation it is two 31×31 operators. Every multigrid, every conjugate gradient, every algebraic hierarchy the iterative field built was operating on the Kronecker form of a matrix equation that has a direct solution in n³.
The direct route is not always better — the iterative methods scale to problems that are not separable, and separability is a strong assumption — but where it holds, a fast Poisson solver via the eigendecomposition of the one-dimensional operator is O(n² log n) for n² unknowns, and it is this essay’s algorithm with the Schur reduction replaced by a sine transform.
What the equation is for
Sylvester and Lyapunov equations are not a curiosity of numerical linear algebra; they are how several whole subjects state their central quantities, and it is worth naming them because the sizes involved are what make the Kronecker form a non-starter rather than merely wasteful.
Controllability and observability. A linear system ẋ = Ax + Bu has a controllability Gramian defined by AP + PAᵀ + BBᵀ = 0, and its observability Gramian by the transposed equation. Those two matrices answer the questions which states can be reached with bounded energy and which states leave a trace in the output, and their eigenvalues are the numbers a control engineer actually looks at. The system is stabilisable when P is positive definite; the directions where it is nearly singular are the ones no input can excite.
Model reduction. Balanced truncation — the standard way to replace a system of order 10⁵ by one of order 20 with a certified error bound — is exactly a simultaneous diagonalisation of those two Gramians. The Hankel singular values it truncates on are the square roots of the eigenvalues of PQ, and the error bound is twice the sum of the ones discarded. Two Lyapunov solves are the whole of the preprocessing, and at n = 10⁵ that is not an equation anybody writes a coefficient matrix for.
Block-diagonalising a Schur form. Given a Schur form partitioned into two diagonal blocks, the
similarity that decouples them is the solution of T₁₁X − XT₂₂ = −T₁₂, which is a Sylvester equation and
is where sep came from in the first place. That is what LAPACK’s xTRSEN does, and its returned
condition estimate is 1/sep.
And the nonlinear cousin. The algebraic Riccati equation, AᵀX + XA − XBR⁻¹BᵀX + Q = 0, is the same shape with a quadratic term, and it is the equation behind every linear-quadratic regulator and every steady-state Kalman filter. It is solved by an eigenvalue method on a 2n×2n Hamiltonian matrix rather than by anything resembling elimination — which is the same move once more, since the object named in the equation is not the object the algorithm forms.
In every one of those the unknown is a matrix, the coefficient matrix of the linear map is never built, and the reduction that makes the problem tractable is a Schur form. The pattern is worth carrying rather than the equation: where an unknown has two indices, the thing to reduce is the operators acting on each of them separately.
There is one more thing the Kronecker form is genuinely the right tool for, and it is the reason this essay could measure anything at all: it is how the conditioning is defined. sep is the smallest singular value of that matrix and there is no other way to say what it is. Forming a 36×36 object to learn a number about two 6×6 ones is exactly the licence the phase’s other essays give the componentwise condition number and the diagonal of a hat matrix — form it when its singular values or its entries are the answer, never as a step towards one.
What is worth carrying
An equation that is linear in a matrix has a coefficient matrix, and forming it is n² times the problem. At n = 100 it is 0.8 gigabytes for ten thousand unknowns, and the algorithm everybody uses is three orders of magnitude cheaper and never builds it.
Solvability is the eigenvalues and conditioning is not. λᵢ(A) + μⱼ(B) ≠ 0 decides whether there is an answer; sep decides how well determined it is, and the two agree only when the matrices are normal.
And sep is a familiar quantity in unfamiliar clothes. It is the condition number of an invariant subspace, LAPACK returns it, and it is the number that says whether a computed subspace is a feature of the matrix or an accident of the perturbation.
The last essay of this phase removes the matrix altogether: an operator with no entries.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A function of a matrix is not a function of its entries — both name condition number, eigenvalues, non-normality
- A condition number for one eigenvalue — both name condition number, non-normality
- A correction cheaper than the problem — both name condition number, flop count
- A rule that is correct and unusable — both name condition number, flop count
- An iteration that only multiplies — both name condition number, flop count
- The series that has to be squared back — both name flop count, non-normality
Named objects
A flat tag is an object no other essay names yet.
Back-substitutionCondition numberEigenvaluesFlop countKronecker productMatrix equationNon-normalitySchur form