# Solving matrix equations of the form $XA = XB$

I am trying to solve the matrix equation of the form $XA = XB$. $A$, $B$ and the solution sought $X$ are $4 \times 4$ homegeneous matrices which are composed of a rotation matrix and translation vector, like in $$\begin{bmatrix} r_1 & r_2 & r_3 & tx\\ r_4 & r_5 & r_6 &ty\\ r_7 & r_8 & r_9 & tz\\ 0 & 0 & 0 & 1 \end{bmatrix}.$$ There are several methods to solve equations of the type AX = XB. These type of equations occur in domains like robotics, for which solutions have been proposed like the Tsai and Lenz method [IEEE 1987], for example. 1) I feel solving the equation XA = XB is not the same as solving the known form AX = XB. Am I right? 2) Neither can it be solved like the Sylvester equation, because even that requires $AX + XB = C$ form. What i have is $XA = XB$, a redundant set of equations. That is,
\begin{align} A_1.X & = X.B_1 \\ A_2.X & = X.B_2 \\ & \vdots \\ A_n.X & = X.B_n \end{align}

If i am correct, these could be rewritten into another form like $AX = BX$. Should i rewrite the equation and try to solve this problem using any other existing methods?

-
AX = BX is trivially equivalent to CX = 0 with C = A-B . Am I missing anything? – leonbloy Jan 20 '11 at 11:45

For $XA = XB$, solve $X(A-B) = 0$, basically the rows of $X$ can be any vector that is in the nullspace of $(A-B)^T$.
We can write $X(A-B) = 0 \Leftrightarrow (A-B)^TX^T = 0$. The columns of $X^T$ are the rows of $X$. Let $x_i$ be row $i$ of $X$. The $i$:th column of the product $(A-B)^TX^T$ is $(A-B)^Tx_i$. For this to be a zero vector, $x_i$ has to be in the null space of $(A-B)^T$. Thus all rows of $X$ have to be in this nullspace.