# Finding matrix of similarity (conjugation)

Let $A$ and $B$ be two similar matrix, that is there exists a matrix $T$ such that $$TAT^{-1} = B$$ How do you find $T$?

I tried to write a linear system of equation by putting $TA=BT$ with the entries of $T$ as unknowns, but this system has not a unique solution (by the way, $A$ and $B$ are $3 \times 3$ matrices...). I think I should add $\det T \neq 0$, since $T= \boldsymbol 0$ is also a solution of $TA=BT$, but that would make the computation too bad. Is there another way to do it, or am I missing something? Note that $B$ is not diagonal.

If $A$ and $B$ are not diagonalizable, then use Jordan Canonical form: If $A$ and $B$ are similar, then they admit same Jordan Canonical forms meaning that, you can find $P^{-1}$ and $Q^{-1}$ such that: $$J = P^{-1}AP$$ and $$J = Q^{-1}BQ$$ Following the same steps as the above answer, you have again $T = QP^{-1}$, where $Q$ and $P$ transform the matrices $A$ and $B$ to a Jordan Canonical form $J$.
IF $A$ and $B$ are similar then they admit same eigenvalues, so diagonalise them first you have: $$\Sigma = P^{-1} A P$$ and $$\Sigma = Q^{-1} B Q$$ Note that $P$ and $Q$ are done through eigendecomposition, now you have $$P^{-1} A P = Q^{-1} B Q$$ which gives $$Q P^{-1} A = B Q P^{-1}$$ where $T = QP^{-1}$
Depends on how you want to compute a solution? From a theoretical perspective any matrix can be Jordan normalized $T_1 A T_1^{-1}=D$ where $D$ consists of Jordan blocks and $T_1$ is invertible. When $A$ and $B$ are assumed similar then there is also $T_2$ so that $T_2 B T_2^{-1}=D$ (same $D$). From this you get your $T=T_2^{-1} T_1$. To compute e.g. $T_1$ you start by finding eigenvalues $\lambda_i$ of $A$ and compute kernels $Z_k=\ker (A-\lambda_i)^k$, $k=1,2,3,...$ (if $Z_1\neq Z_2$ it means that there is a Jordan block)... You may in fact do that at the same time for $B$ and then construct $T$ as a map between these kernels.
Now, another way to compute (notably using a computer) the conjugation is to look at the linear map: $$F : M_d({\Bbb C}) \rightarrow M_d({\Bbb C}), \ \ \ T \mapsto TA-BT$$ It is a linear map of a $d^2$ dimensional space and you compute its kernel. $A$ and $B$ are similar iff this kernel contains invertible elements. In terms of indices you may write the map explicitly as: $(F(T))_{ij} = \sum_{kl} M_{ij,kl} T_{kl}$ where $$M_{ij,kl} = \delta_{ik} A_{lj} - B_{ik}\delta_{jl}$$ It's quite easy and amuzing to program (using e.g. matlab, scilab,...)