Source: https://www.freemaths.fr/annales-mathematiques/bac-s-mathematiques-inde-2016-specialite-corrige-exercice-3-arithmetique-et-matrices.pdf