# Section 7.2 $\quad$ Diagonalization and Similar Matrices

>**Definition** If $A$ and $B$ are $n\times n$ matrices, we say that $B$ is **similar** to $A$ if<br /><br /><br /><br />

In many situations, we need to compute powers of a matrix $A$.<br /><br /><br /><br />

>**Theorem** Similar matrices<br /><br /><br /><br />

**Proof** <br /><br /><br /><br /><br /><br /><br />

>**Definition** If a matrix $A$ is similar to a diagonal matrix, we say<br /><br /><br /><br />

**Remark:** An $n\times n$ matrix $A$ is diagonalizable if and only if<br /><br /><br /><br />

### Example 1

Are the following matrices diagonalizable?
\begin{equation*}
  A = \left[
        \begin{array}{cc}
          1 & 1 \\
          -2 & 4 \\
        \end{array}
      \right],~~~~~
  B = \left[
        \begin{array}{cc}
          1 & 1 \\
          0 & 1 \\
        \end{array}
      \right]
\end{equation*}


```python
from sympy import *

A = Matrix([[1, 1], [-2, 4]]);
B = Matrix([[1, 1], [0, 1]]);

A.is_diagonalizable(), B.is_diagonalizable()
```




    (True, False)



If $A$ is similar to a diagonal matrix $D$, then $P^{-1}AP=D$ for some nonsingular matrix $P$.

**Question:** How to construct $P$?<br /><br /><br /><br /><br /><br /><br />

### Example 2

Let $A= \left[
        \begin{array}{cc}
          1 & 1 \\
          -2 & 4 \\
        \end{array}
      \right]$ (the same matrix in Example 1). Find a matrix $P$ such that $P^{-1}AP=D$.


```python
from sympy import *

A = Matrix([[1, 1], [-2, 4]]);

A.diagonalize()
```




    (Matrix([
     [1, 1],
     [1, 2]]), Matrix([
     [2, 0],
     [0, 3]]))



74bdf0af7d014720bc90b243826e232d1a06cd3c
ipynb
Jupyter Notebook
Jupyter_Notes/Lecture34_Sec7-2_DiagonalSimilarMat_Part1.ipynb
xiuquan0418/MAT341
2fb7ec4e5f0771f10719cb5e4a00a7ab07c49b59
MIT
Jupyter_Notes/Lecture34_Sec7-2_DiagonalSimilarMat_Part1.ipynb
xiuquan0418/MAT341
2fb7ec4e5f0771f10719cb5e4a00a7ab07c49b59
MIT
Jupyter_Notes/Lecture34_Sec7-2_DiagonalSimilarMat_Part1.ipynb
xiuquan0418/MAT341
2fb7ec4e5f0771f10719cb5e4a00a7ab07c49b59
MIT
Qwen/Qwen-72B
1. YES
2. YES