Sylvester Equation Solver
Calculate sylvester equation instantly with our math tool. Shows detailed work, formulas used, and multiple solution methods.
Reviewed for accuracy by Manoj Kumar, Mathematics Educator
Sylvester Equation Solver
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: AX + XB = C
Worked example โ X = [[1.25, 1.2], [1.4, 1.333]] | Residual = 0
Formula
AX + XB = C
Where A, B, and C are known matrices and X is the unknown matrix. A unique solution exists if and only if the eigenvalues of A and the negatives of the eigenvalues of B are disjoint (no common values). The solver uses the Kronecker product vectorization approach for 2x2 matrices.
Worked Examples
Example 1: Diagonal Coefficient Matrices
Problem:Solve AX + XB = C where A = [[1,0],[0,2]], B = [[3,0],[0,4]], C = [[5,6],[7,8]].
Solution:Since A and B are diagonal, the equation simplifies element-wise: (a_ii + b_jj) * x_ij = c_ij x_11 = 5/(1+3) = 1.25 x_12 = 6/(1+4) = 1.2 x_21 = 7/(2+3) = 1.4 x_22 = 8/(2+4) = 1.333 X = [[1.25, 1.2], [1.4, 1.333]]
Result:X = [[1.25, 1.2], [1.4, 1.333]] | Residual = 0
Example 2: Non-Diagonal Sylvester Equation
Problem:Solve AX + XB = C where A = [[2,1],[0,3]], B = [[1,0],[1,2]], C = [[10,8],[9,12]].
Solution:Form the 4x4 system using Kronecker products: (I kron A + B^T kron I) * vec(X) = vec(C) Solve the 4x4 system by Gaussian elimination Eigenvalues of A: 2, 3 Eigenvalues of -B: -1, -2 (disjoint from A eigenvalues) Unique solution exists
Result:Solution X found via Kronecker product method | Residual near 0
Frequently Asked Questions
What is the Sylvester equation?
The Sylvester equation is a matrix equation of the form AX + XB = C, where A, B, and C are known matrices and X is the unknown matrix to be solved for. Named after James Joseph Sylvester who studied it in the 19th century, this equation arises naturally in many areas of mathematics, engineering, and control theory. The equation has a unique solution if and only if the eigenvalues of A and the negatives of the eigenvalues of B have no values in common. When this condition holds, the solution X can be found using various numerical methods including the Bartels-Stewart algorithm, which first reduces A and B to Schur form.
When does the Sylvester equation have a unique solution?
The Sylvester equation AX + XB = C has a unique solution if and only if the spectra (sets of eigenvalues) of A and -B are disjoint, meaning no eigenvalue of A equals any eigenvalue of -B. This is equivalent to saying that for every pair of eigenvalues lambda_i of A and mu_j of B, lambda_i + mu_j is not equal to zero. When this condition fails, the equation either has no solution or infinitely many solutions, depending on the right-hand side C. This condition can be checked before attempting to solve the equation by computing the eigenvalues of both matrices and verifying no sums equal zero.
How is the Sylvester equation solved numerically?
The most efficient numerical method is the Bartels-Stewart algorithm, which first computes the Schur decompositions A = Q_A * T_A * Q_A^T and B = Q_B * T_B * Q_B^T. The equation is then transformed to T_A * Y + Y * T_B = D (where Y and D are transformed versions of X and C), which can be solved column by column using back substitution because T_A and T_B are triangular. This approach costs about 25n^3 operations for n-by-n matrices. Alternatively, the equation can be vectorized using Kronecker products to form a larger standard linear system, though this is less efficient with n^6 complexity.
What is the Kronecker product approach to solving the Sylvester equation?
The vectorization approach converts AX + XB = C into a standard linear system by stacking the columns of X into a single vector. Using the vec operator and Kronecker product properties, the equation becomes (I kron A + B-transpose kron I) * vec(X) = vec(C). This transforms the matrix equation into a system of n-squared linear equations in n-squared unknowns, which can be solved by standard methods like Gaussian elimination. While conceptually simple and useful for small matrices, this approach is computationally expensive for large matrices because the system size grows quadratically with the original matrix dimension.
What are the main applications of the Sylvester equation?
The Sylvester equation appears extensively in control theory, where it arises in observer design, controller synthesis, and model reduction. In signal processing, it connects to the solution of Wiener-Hopf equations. In numerical linear algebra, solving Sylvester equations is a subroutine in computing matrix square roots, matrix logarithms, and the matrix sign function. The closely related Lyapunov equation (AX + XA^T = C) is fundamental in stability analysis of dynamical systems. In computer science, Sylvester equations appear in model order reduction for circuit simulation and in computational methods for partial differential equations.
What is the difference between Sylvester and Lyapunov equations?
The Lyapunov equation AX + XA^T = C is a special case of the Sylvester equation where B = A^T (or B = A* for the complex case). This specialization has important theoretical and computational implications. The Lyapunov equation arises specifically in stability analysis: a linear system dx/dt = Ax is stable if and only if for any positive definite C, the Lyapunov equation has a positive definite solution X. Specialized algorithms exploit the symmetry of the Lyapunov equation for greater efficiency. The continuous Lyapunov equation uses AX + XA^T, while the discrete version uses AXA^T - X = C.
How do you verify the solution of a Sylvester equation?
To verify the solution X, compute the residual matrix R = AX + XB - C. Each element of R should be close to zero (within numerical precision). The Frobenius norm of R divided by the Frobenius norm of C gives a relative residual measure. A relative residual below machine epsilon (about 1e-16 for double precision) times the condition number indicates a satisfactory solution. For additional verification, you can check that the eigenvalues of A and -B are indeed disjoint, confirming the theoretical existence of a unique solution. Backward error analysis provides rigorous bounds on solution quality.
What is the computational complexity of solving the Sylvester equation?
The Bartels-Stewart algorithm, which is the standard method, has a computational complexity of approximately 25n^3 floating-point operations for n-by-n matrices. This includes two Schur decompositions (each costing about 10n^3) and the triangular back substitution (about 5n^3). The Kronecker product approach requires O(n^6) operations because it solves an n^2 by n^2 linear system, making it impractical for large n. For large sparse matrices, iterative methods like the alternating direction implicit (ADI) method or Krylov subspace methods can be more efficient, with complexity depending on the convergence rate and sparsity structure.
Can the Sylvester equation be generalized?
Yes, several generalizations exist. The generalized Sylvester equation AXB + CXD = E involves products of unknowns with coefficient matrices. The T-Sylvester equation AX + X^T B = C involves the transpose of X. Matrix equations with more than two terms, such as A1*X*B1 + A2*X*B2 + ... = C, are called generalized linear matrix equations. Nonlinear matrix equations like X + A^T * X^(-1) * A = Q also generalize the Sylvester framework. Tensor Sylvester equations extend to multi-dimensional arrays. Each generalization has its own solvability conditions and specialized algorithms, forming an active research area in numerical linear algebra.
How does the condition number affect the Sylvester equation solution?
The condition number of the Sylvester equation measures sensitivity of the solution X to perturbations in A, B, and C. When eigenvalues of A are close to negatives of eigenvalues of B (nearly violating the solvability condition), the problem becomes ill-conditioned and small input changes cause large solution changes. The separation of A and -B, defined as the smallest singular value of the Kronecker operator (I kron A + B^T kron I), quantifies this condition. A small separation indicates ill-conditioning. In practice, computing the separation helps assess solution reliability, and regularization techniques may be needed for nearly singular problems.
References
Reviewed for accuracy by Manoj Kumar, Mathematics Educator ยท Editorial policy
Related Calculators
๐งฎQuartic Equation Solver
Calculate quartic equation solver with inputs, formulas, and instant results.
๐งฎDifferential Equation Solver
Calculate differential equation solver with inputs, formulas, and instant results.
๐งฎEquation Solver
Solve linear, quadratic, cubic, and polynomial equations with step-by-step solutions.
๐งฎAbsolute Value Equation Calculator
Calculate absolute value equation with inputs, formulas, and instant results.
๐งฎCubic Equation Calculator
Calculate cubic equation with inputs, formulas, and instant results.
๐งฎEquation Balancer Calculator
Calculate equation balancer with inputs, formulas, and instant results.
๐งฎEquation of a Circle Calculator
Calculate equation of acircle with inputs, formulas, and instant results.
๐งฎEquation of a Sphere Calculator
Calculate equation of asphere with inputs, formulas, and instant results.