Sylvester Matrix Equation
Solve AX+XB=C for diagonal real2x2 A andB and arbitrary2x2 C: each entry obeys(a_i+b_j)Xij=Cij.
By Riano · Published · Updated · Report a correction
Sylvester Matrix Equation
The Sylvester equation AX + XB = C is a key equation in linear algebra and control theory. In general, solving for the unknown matrix X involves solving a system of linear equations obtained via the Kronecker product and vectorization. However, if both A and B are diagonal matrices, the equation decouples completely into independent scalar equations.
Worked example: Diagonal Case
Let's consider a specific example. Suppose A is a diagonal matrix with entries a1 = 1, a2 = 2. Let B be a diagonal matrix with entries b1 = 3, b2 = 4. Finally, let C = [[4, 5], [5, 6]]. We want to find a 2x2 matrix X such that AX + XB = C.
Since A and B are diagonal, the equation for the entry Xij simplifies to: (ai + bj) Xij = Cij.
- For X11 (i=1, j=1): We have (a1 + b1) X11 = C11. Substituting the values gives (1 + 3) X11 = 4, so 4 X11 = 4, which means X11 = 1.00.
- For X12 (i=1, j=2): We have (a1 + b2) X12 = C12. Substituting gives (1 + 4) X12 = 5, so 5 X12 = 5, which means X12 = 1.00.
- For X21 (i=2, j=1): We have (a2 + b1) X21 = C21. Substituting gives (2 + 3) X21 = 5, so 5 X21 = 5, which means X21 = 1.00.
- For X22 (i=2, j=2): We have (a2 + b2) X22 = C22. Substituting gives (2 + 4) X22 = 6, so 6 X22 = 6, which means X22 = 1.00.
Thus, the unique solution matrix X has all entries equal to 1.00. The residual is the sum of absolute differences |(ai+bj)Xij − Cij| from unrounded quotients; it is zero here and is displayed in scientific notation. Entries are displayed to six decimals.
Experimenting with the Sylvester Equation
Open the Sylvester Matrix Equation module to see the decoupling in action.
- Leave the default values: a1=1, a2=2, b1=3, b2=4, and C=[[4, 5], [5, 6]].
- Click the "Step" button. The first click reveals the equation for X11: (1 + 3) X11 = 4, resulting in X11 = 1.00.
- Click "Step" twice more to reveal X12 and X21; the cursor now has three of four equations.
- Click "Finish" to reveal the fourth equation and see the final matrix X and the residual. The interface will indicate a "Unique solution" since all (ai + bj) coefficients were non-zero.
- Now, change a1 to 1, a2 to 2, b1 to -1, and b2 to 3. Change C11 to 1, C12 to 0, C21 to 0, and C22 to 0. Click "Finish". For X11, the coefficient is a1 + b1 = 1 + (-1) = 0. The equation is 0 * X11 = 1, which has no solution. The system will classify the overall status as "No solution".
- Change C11 to 0 and click Finish again; this edit has rewound the trace. Now the equation for X11 is 0 * X11 = 0. This means X11 can be any value, making it a "free variable". The system will indicate "Infinitely many solutions (1 free variable)".
Limitations and Properties
This interactive module explicitly limits the scope to diagonal A and B matrices. When A and B are arbitrary, the equations for the entries of X are coupled, and a more complex method (like Bartels-Stewart algorithm or Kronecker products) is required to find the solution.
In the diagonal case, the existence and uniqueness of the solution depend entirely on the sums (ai + bj). If ai + bj = 0 for some pair (i, j):
- If the corresponding Cij is not zero, the equation 0 * Xij = Cij has no solution, so the entire Sylvester equation has no solution.
- If Cij is also zero, the equation 0 * Xij = 0 holds for any value of Xij. Thus, Xij is a free variable. If no other entry results in "no solution", there are infinitely many solutions. This module identifies such variables as "free" rather than arbitrarily setting them to 0 and claiming the solution is unique.
A unique solution exists if and only if ai + bj is non-zero for all i and j.
References
The SciPy documentation states AX + XB = Q and describes the general Bartels–Stewart method using Schur decompositions. This module instead exploits the explicitly diagonal case and independently checks each scalar coefficient; it does not implement SciPy’s general solver. See scipy.linalg.solve_sylvester.
Experience it interactively
Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Sylvester Matrix Equation module.
Try Sylvester Matrix Equation on Riano →