second exercise of matrix