sylvester

Solves the Sylvester equation A*X + X*B = C.

Category: Mathematics > Linear Algebra

Syntax

X = sylvester(A, B, C)

Returns the matrix X satisfying A*X + X*B = C.

Description

The equation has a unique solution exactly when A and -B share no eigenvalue. It is solved through Schur decompositions of A and B, which is far cheaper than the equivalent m*n-by-m*n linear system built with Kronecker products.

The Lyapunov equation of control theory is the special case with B = A'.

Input arguments

A
Square m-by-m matrix.
B
Square n-by-n matrix.
C
Matrix of size m-by-n.

Output arguments

X
Solution, of size m-by-n.

Example

Solve and verify

A = [1 0; 0 2];
B = [3 0; 0 4];
C = [1 1; 1 1];
X = sylvester(A, B, C)
A*X + X*B
Output
X = 2×2

    0.2500    0.2000
    0.2000    0.1667
ans = 2×2

     1     1
     1     1

See also

kron schur mldivide