Source: https://helios2.mi.parisdescartes.fr/~glaunes/M1S1Optim/archives/examen2016_corrige.pdf