# Diagonalization and similarity of matrix.

If $A,B \in \mathbb{R^n}$ are two diagnolizeable matrices with same characteristics polynomial then $A$ and $B$ are similar.

I tried to find a solution whether this is true or not.

I think this is true because if both matrices are diagnolizeable then they both have basis consisting of $n$ eigenvectors and since characteristics polynomial is also same so there eigenvalues must also be same $\rightarrow Tr(A) == Tr(B)$ and $det(A) == det(B)$.

The other way i tried is: we can write both $A$ and $B$ as diagonal matrix,such that both $A$ and $B$ only have eigen values as diagonal elements and all other entries should be zero but here i don't know whether every diagonal matrix is similar to everyother diagonal matrix, I could not find any counter example nor i know any proof?

I don't even know whether the lemma is true or not but the process above lead me to yes. Can someone tell me if this is true and how to prove it?

Hint: The similarity relation $\sim$ is transitive
$$A\sim D\:\:\:{\rm and}\:\:\:B\sim D\Longrightarrow A\sim B$$
Can you find this shared $D$? You almost got it in your second trial.
You know that $A$ is similar to a diagonal matrix $D_A$. Let $\alpha_1,\ldots,\alpha_n$ be entries of the main diagonal of $D_A$. And know that $B$ is similar to a diagonal matrix $D_B$. Let $\beta_1,\ldots,\beta_n$ be entries of the main diagonal of $D_B$. Then\begin{align}\text{characteristic polynomial of }D_A&=\text{characteristic polynomial of }A\\&=\text{characteristic polynomial of }B\\&=\text{characteristic polynomial of }D_B.\end{align}But the first and the last of these polynomials are$$(x-\alpha_1)\cdots(x-\alpha_n)\text{ and }(x-\beta_1)\cdots(x-\beta_n)$$respectively. These polynomails beaing equal means that the numbers $\alpha_1,\ldots,\alpha_n$ are the numbers $\beta_1,\ldots,\beta_n$ by another order. But then $D_A\sim D_B$ and therefore $A\sim B$.