# General process to find global extrema of a function?

I have been reading and watching videos about local and global extrema, but all of this material covers the topic just graphically, and nobody really explicitly cares on how to find the global maximum or global minimum of a function numerically (or mathematically), or what is the advisable process to find it, and what are the constraints, etc.

For this reason, I have been thinking and reading that one way to find the global maximum and minimum is to find respectively all the local (in the interior of the function) maximum and minimum, using for example the first derivative test or second derivative test, and then pick the largest or smallest respectively between them and compare them with the extreme points of the function, and pick them eventually if they are greater or smaller respectively to the greatest local maximum and smallest local minimum.

Now, it appears that the function must be continuous on a closed interval. Is this true for all cases? If yes, why?

Is in general the process that I have described what you mathematicians usually do by hand?

Are there any (simple) alternatives?

If the function isn't continuous then you don't know that it has extreme values on the interval. For example, consider the function $f(x)=\frac{1}{x}$ for $x\neq 0$ and $f(x)=0$ when $x=0$ on the interval $[-1, 1]$. That function has no maximum or minimum value on that interval. If the interval is open you are also not guaranteed a maximum; consider $g(x)=x$ on $(-1, 1)$... no max or min.

The assumption that $f(x)$ is continuous on a closed interval is so that you know (by the Extreme Value Theorem) that the function attains a global min and a global max on the interval. If the conditions are not met, no guarantee exists.

In general, the process of finding extrema is simple, although the methods are not.

Addressing your first question is the most important step: the function does indeed have to be continuous on a closed interval, because the function has to be differentiable in order to prove that there really exists an extreme point. One could point out that there exists functions that are nowhere differentiable but continuous everywhere. That is true, but those functions does not have extreme points in a typical sense, that is, for maxima $f(x)>f(x+h)$ in neighbourhood near $x$, where $h$ is a vector and the converse for minima.

Continuity is required in evaluating the derivative and evaluating the limit when $h$ tends to zero.

The interval has to be closed, since the extreme points lie in the zeroes of $f'$ (or $J$ if the function has more variables than one), which always doesn't exist, and in the boundary of the domain. If the interval is open, there is no guarantee of extreme points.

I may be a little late, but there is also a way, when using it for implicit functions a.k.a curves. Using the implicit function theorem to find global extrema with usage of Lagrange multiplicator. It finds every candidate for extrema, only singular points are excluded.

Other than that, derivatives are normally the way to go for finding extrema.