**Algorithm for Diagonalizing a Matrix**

Find *n* linearly independent eigenvectors of *A,* marked as **x**<sup>1</sup> , **x**<sup>2</sup> , ⋯, **x***<sup>n</sup>*.

Form the matrix *P* having **x**<sup>1</sup> , **x**<sup>2</sup> , ⋯, **x***<sup>n</sup>*., at its column vectors.

The matrix *P*<sup>−</sup>**<sup>1</sup>** *AP* then will be diagonal with *λ*1, *λ*2, ⋯, *λ<sup>n</sup>* successive diagonal entries, where *λi* is eigenvalue corresponding to **x**<sup>i</sup> , for *i* = 1, 2, ⋯, *n*.
