Solution (source code)

= Solution

Direct <matrix multiplication> gives
$$
AP=\begin{pmatrix}2&4\\-1&4\end{pmatrix},\qquad
P^{-1}AP=\frac13\begin{pmatrix}1&-1\\1&2\end{pmatrix}
\begin{pmatrix}2&4\\-1&4\end{pmatrix}
=\boxed{\begin{pmatrix}1&0\\0&4\end{pmatrix}}.
$$
Thus $D$ is diagonal. The columns of $P$ are <eigenvectors> of $A$ with <eigenvalues> one and four.