Jordan Canonical Form of a Matrix Given Characteristic and Minimum Polynomials

If we have the characteristic polynomial
$f( \lambda )$
and minimum polynomial
$m( \lambda )$
of a matrix
$A$
then we can find the Jordan canonical form of
$A$

Suppose
$m( \lambda)= (2- \lambda )^4(5- \lambda), \: f( \lambda)= (2- \lambda )^5(5- \lambda)^3$

The Jordan canonical form of the matrix is then
$\left( \begin{array}{cccccccc} 2 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 2 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 2 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 2 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 2 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 5 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 5 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 5 \end{array} \right)$
.