how can i find the matrix $P$ that diagonalizes the matrix $A$? I want to find matrix $P$ that diagonalizes the matrix $A$:
$$
        \begin{bmatrix}
        4 & 0 & 1 \\
        2 & 3 & 2 \\
        1 & 0 & 4 \\
        \end{bmatrix}
$$

Suppose that $A$ has eigenvalues $\lambda_1,\lambda_2,\lambda_3$. Let $v_1,v_2,v_3$ be the associated eigenvectors. Let $D$ be the diagonal matrix with diagonal entries $\lambda_1,\lambda_2,\lambda_3$. Let $P$ be the matrix whose columns are $v_1,v_2,v_3$ in that order. 
Then, we have $P^{-1}AP = D$, which is to say that $P$ diagonalizes $A$.
