Suppose that I have two matrices $A$ and $B$, and I want them to share a common eigenvector $x$. For simplicity let's just assume that the eigenvalue associated with $x$ is $1$ for both matrices, so $Ax=x$ and $Bx=x$. Is there a simple condition on $A$ and $B$ which is both necessary and sufficient for this to occur?
$A$ and $B$ are real but not symmetric. I don't mind assuming for the moment that they are diagonalizable.
Side note: in my problem, $A$ is a positive matrix, and I want this shared eigenvector to be the Frobenius-Perron eigenvector of $A$. If this makes the problem easier, that's great, but if not, then ignore it for now.
Any ideas are welcome. Thanks!
Edit: Although I am grateful for both of the answers currently below, I am still hoping that there is a simple, easily computable constraint which is both necessary and sufficient. (Unfortunately, loup blanc's answer doesn't seem to be easily computable when $n$ is large, and Mustafa Said's answer is necessary but not sufficient.) Thanks again for thinking about it.