Source: https://lapth.cnrs.fr/~taillet/documents/exercice_6-2.pdf