Source: https://perso.ensta-paris.fr/~pcarpent/MO102/Cours/Corriges/Co-fonct.pdf