Source: https://www.lix.polytechnique.fr/~fredet/enseignements/MathAlternanceGea/DS4_proba1_correction.pdf