[Math] Existence of non-trivial solution of Sylvester equation.

computer-algebra-systemsmathematicamatricesnumerical methods

I'm trying to solve a special case of Sylvester equation
in my case it looks like
$$A*X=X*B$$
so it can be written in form
$$A*X+X*(-B)=C$$ where C consist of all 0 items.

I tried to solve it in Mathematica with LyapunovSolve
but it give me all =0 trivial solution.

So I want to check if there is non-trivial solution exist. It seems I find out how to test matrices A,B for non-trivial solution(but I'm not sure) if resultant equals to 0, then such solution exist.$$resultant(det(A-λE),det(B-λE),λ)=0$$ I tried real matrices for example A matrix (0 -1 300 1 0 0 0 0 1) B matrix (-0.4009 -1.0787 446.1463 1.6180 0.8875 -159.2272 0.0003 0.0029 1) but there is maybe a problem because B matrix was defined experimentally and it has some small errors, with these matrices I have resultant -6.79 , but due to errors I don't know may be it close enough to 0?

the question is:
can you write condition of existence of non-trivial solution of Sylvester equation not in abstract form but in particular formula, preferably in Mathematica.

Also I don't understand why Mathematica gives me only trivial solution, when I trying to solve this equation with parameters
for example I tried

am = {{a11, a12, a13}, {a21, a22, a23}, {a31, a32, a33}}

bm = {{b11, b12, b13}, {b21, b22, b23}, {b31, b32, b33}}

cm = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}

LyapunovSolve[am,bm,cm]

gives me all =0
also I tried to multiply matrices and get 9 equations and solve them with function Solve which also give me all =0.

Best Answer

A Sylvester equation like $$AX + X(-B) = 0$$ can be written as $$(I_n \otimes A - B \otimes I_n) \operatorname{vec} X = 0$$ so it has a non-trivial solution if and only if $I_n \otimes A - B \otimes I_n$ has a non-trivial null space. An equivalent condition to having a non-trivial null space is having zero as an eigenvalue.

If $\lambda$ is an eigenvalue of $A$ and $\mu$ an eigenvalue of $B$, $\lambda - \mu$ is an eigenvalue of $I_n \otimes A - B \otimes I_n$, and all eigenvalues of $I_n \otimes A - B \otimes I_n$ is on this form. Thus $I_n \otimes A - B \otimes I_n$ has zero as an eigenvalue if and only if $A$ has an eigenvalue $\lambda$ and $B$ has an eigenvalue $\mu$ such that $\lambda - \mu = 0$.

Thus, to see if $AX - XB = 0$ has a solution, you can calculate the spectrums $\sigma(A), \sigma(B)$ and then see if for any $\lambda \in \sigma(A)$ you have $-\lambda \in \sigma(B)$. You can probably write this in some clever way in Mathematica, e.g. calculate the spectrums, multiply one of them with $-1$ and check for overlaps (at the moment I do not have access to Mathematica so I can not test any code.)

The resultant of two polynomials $P$ and $Q$ is zero iff $P$ and $Q$ have a common root, so your thinking seems to be correct. However, you seem to have missed that you should calculate $\det(-B - \lambda E)$, not $\det(B - \lambda E)$.

Related Question