# Nakafa Learning Content

> For AI agents: use [llms.txt](https://nakafa.com/llms.txt) for the site index. Markdown versions are available by appending `.md` to content URLs or sending `Accept: text/markdown`.

URL: https://nakafa.com/en/subjects/ai-ds/linear-methods/matrix-similarity
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/ai-ds/linear-methods/matrix-similarity/en.mdx

Understand matrix similarity, basis transformations, and invariant properties. Learn eigenvalue preservation, coordinate changes, and linear transformations.

---

## Definition of Matrix Similarity

In linear algebra, the concept of matrix similarity or equivalence is very important for understanding how two different matrices can represent the same linear transformation in different spaces. Imagine two different portraits of the same object, but taken from different perspectives.

Two matrices $$A, B \in \mathbb{K}^{n \times n}$$ are said to be **similar** if there exists an invertible matrix $$S \in \mathbb{K}^{n \times n}$$ such that:

Visible text: Two matrices are said to be **similar** if there exists an invertible matrix such that:

```math
B = S^{-1} \cdot A \cdot S
```

The matrix $$S$$ in this case is called the similarity transformation matrix.

Visible text: The matrix in this case is called the similarity transformation matrix.

## Basis Transformation and Coordinate Representation

To understand why matrix similarity is so important, we need to look at its relationship with basis transformation. Let $$e_1, \ldots, e_n \in \mathbb{K}^n$$ be the canonical basis and $$v_1, \ldots, v_n \in \mathbb{K}^n$$ be another basis of $$\mathbb{K}^n$$.

Visible text: To understand why matrix similarity is so important, we need to look at its relationship with basis transformation. Let be the canonical basis and be another basis of .

If $$S$$ is an invertible matrix with columns $$v_k$$:

Visible text: If is an invertible matrix with columns :

```math
S = (v_1 \quad \ldots \quad v_n) \in \mathbb{K}^{n \times n}
```

Then we have $$v_k = S \cdot e_k$$ or $$e_k = S^{-1} \cdot v_k$$ for $$k = 1, \ldots, n$$. The matrix $$S$$ represents the **basis transformation**.

Visible text: Then we have or for . The matrix represents the **basis transformation**.

A vector $$x \in \mathbb{K}^n$$ can be expressed in the canonical basis through coordinates $$x_k$$ and in the basis $$v_1, \ldots, v_n$$ through coordinates $$\xi_k$$:

Visible text: A vector can be expressed in the canonical basis through coordinates and in the basis through coordinates :

Component: MathContainer
Children:

```math
x = \sum_{k=1}^n x_k \cdot e_k
```

```math
= \sum_{k=1}^n \xi_k \cdot v_k = S \cdot \xi
```

```math
\xi = \begin{pmatrix} \xi_1 \\ \vdots \\ \xi_n \end{pmatrix} = S^{-1} \cdot x
```

The matrix $$S^{-1}$$ represents the **coordinate transformation**.

Visible text: The matrix represents the **coordinate transformation**.

## Linear Transformation in Different Bases

Now consider the linear transformation $$y = A \cdot x$$. In the canonical basis, $$y$$ is expressed through coordinates $$y_k$$, while in the basis $$v_1, \ldots, v_n$$ through coordinates $$\eta_k$$:

Visible text: Now consider the linear transformation . In the canonical basis, is expressed through coordinates , while in the basis through coordinates :

Component: MathContainer
Children:

```math
y = \sum_{k=1}^n y_k \cdot e_k
```

```math
= \sum_{k=1}^n \eta_k \cdot v_k = S \cdot \eta
```

```math
\eta = \begin{pmatrix} \eta_1 \\ \vdots \\ \eta_n \end{pmatrix} = S^{-1} \cdot y
```

Therefore:

Component: MathContainer
Children:

```math
S \cdot \eta = y = A \cdot x
```

```math
= A \cdot S \cdot \xi
```

or in other words:

```math
\eta = S^{-1} \cdot A \cdot S \cdot \xi
```

In the basis $$v_1, \ldots, v_n$$, the linear transformation $$y = A \cdot x$$ is represented by $$\eta = B \cdot \xi$$ with the matrix:

Visible text: In the basis , the linear transformation is represented by with the matrix:

```math
B = S^{-1} \cdot A \cdot S
```

This is why similar matrices represent the same linear transformation but viewed from different bases. Similar matrices represent the same linear transformation with respect to different bases of $$\mathbb{K}^n$$.

Visible text: This is why similar matrices represent the same linear transformation but viewed from different bases. Similar matrices represent the same linear transformation with respect to different bases of .

## Invariant Properties of Similar Matrices

Similar matrices have several fundamental properties that are very useful. Since they represent the same linear transformation in different spaces, similar matrices preserve the same intrinsic characteristics.

Based on the theorem about similar matrices, if matrices $$A$$ and $$B = S^{-1} \cdot A \cdot S$$ are similar, then they both have:

Visible text: Based on the theorem about similar matrices, if matrices and are similar, then they both have:

1. **The same determinant**
2. **The same characteristic polynomial**
3. **The same eigenvalues**
4. **The same trace**

### Proof of Determinant Equality

For the determinant, we can show:

Component: MathContainer
Children:

```math
\det(B) = \det(S^{-1} \cdot A \cdot S)
```

```math
= \det(S^{-1}) \cdot \det(A) \cdot \det(S)
```

Since $$\det(S^{-1}) = \frac{1}{\det(S)}$$, then:

Visible text: Since , then:

Component: MathContainer
Children:

```math
\det(B) = \frac{1}{\det(S)} \cdot \det(A) \cdot \det(S)
```

```math
= \det(A)
```

### Eigenvalue Equality

If $$v \in \mathbb{K}^n$$ is an eigenvector of $$A$$ with eigenvalue $$\lambda \in \mathbb{K}$$, such that $$A \cdot v = \lambda \cdot v$$, then $$w = S^{-1} \cdot v$$ is an eigenvector of $$B$$ with the same eigenvalue:

Visible text: If is an eigenvector of with eigenvalue , such that , then is an eigenvector of with the same eigenvalue:

Component: MathContainer
Children:

```math
B \cdot w = S^{-1} \cdot A \cdot S \cdot w
```

```math
= S^{-1} \cdot A \cdot v
```

```math
= S^{-1} \cdot \lambda \cdot v
```

```math
= \lambda \cdot w
```

This shows that matrix similarity preserves the spectrum or set of eigenvalues, which is a fundamental characteristic of linear transformations.