Source: https://irma.math.unistra.fr/~privat/documents/M1_Optim/M1_exercices_corriges.pdf