Lets say we have a square matrix $A \in \mathbb{C}^{n \times n}$ which is diagonalisable such that $A=XDX^{-1}$. I do not understand the following step:
$$(XDX^{-1})^2 = XDX^{-1}XDX^{-1}= XD^2X^{-1}$$
I do not understand what is happening between the LHS and RHS of the second equal sign. Can anyone explain that step?
$$X^{-1}X = I$$ from the definition inverse. You can then scratch it in a product.
Then the $D$s meet from both sides and build $D^2$.