The matrix $A$ is given by $$
A=\begin{pmatrix}
2&-3&-7\\
0&5&7\\
0&0&-2
\end{pmatrix}.
$$
(a) Find a matrix $P$ and a diagonal matrix $D$ such that $$A^5=PDP^{-1}.$$ [7]
(b) Use the characteristic equation of $A$ to show that $$A^4=aA^2+bI,$$ where $a$ and $b$ are integers to be determined. [4]