Source: https://documents.epfl.ch/users/f/fa/favi/www/Analyse%20II%20-%20SV/Cours/gradient.pdf