Source: https://www.epfl.ch/labs/lai/wp-content/uploads/2018/10/Chapitre_3-Exercices-SGM.pdf