Source: https://www.sfu.ca/~wainwrig/Econ331/notes-unconstrained-max.pdf