If A and B are n × n matrices, A is similar to B if there exists an invertible matrix P such that

$\mathbf{B=PA{P}^{-1}}$ | (27) |

Every matrix is similar to itself with P = I. The only similarity transformation that holds for the identity matrix or the zero matrix is this trivial one.

Similarity is a symmetric relation. If A$\sim$B, then
B$\sim$A. Therefore, premultiplying Equation
27 by
P^{-1} and postmultiplying it by P yields

$\mathbf{A={P}^{-1}BP}$ | (28) |

Similarity is also a transitive relation. If A$\sim$B and B$\sim$C, then A$\sim$C.

Since similarity is reflexive, symmetric, and transitive, it is an equivalence relation. A common example of a similarity transformation in linear algebra is changing the basis of a vector space.