Let's consider square matrices $A\_{n \times n}$, $B\_{n \times n}$ and $X\_{n \times n}$ with elements from $\mathbb{R}$. Could you tell me please, what would be the necessary conditions for the existence of solution (may be not unique) of Sylvester equation:
$$
AX=XB.
$$
As I know, sufficient condition looks like (but probably it is a necessary and sufficient condition)
$$
\sigma\_p(A) \cap \sigma\_p(B) \neq \varnothing,
$$
here $\sigma\_p(A)$ and $\sigma\_p(B)$ are the spectra of matrices $A$ and $B$. 



Necessary conditions for the existence of solution of Sylvester equation AX=XB
This equation always has *a* solution: $X = O$. I'll assume throughout this answer that you're interested in a non-zero solution.


The equation $AX = XB$ is equivalent to $(A \otimes I - I \otimes B^T)\mathbf{x} = \mathbf{0}$, where $\otimes$ denotes the Kronecker product and $\mathbf{x}$ is the vectorization of $X$. Your question is thus equivalent to asking when the matrix $A \otimes I - I \otimes B^T$ is not invertible (i.e., when $0$ is not an eigenvalue of $A \otimes I - I \otimes B^T$).


Since the eigenvalues of $A \otimes I - I \otimes B^T$ are exactly the sums of the eigenvalues of $A$ and $-B$, the condition that you wrote ($\sigma\_p(A) \cap \sigma\_p(B) \neq \varnothing$) is in fact both necessary and sufficient.


