Textbook
The function $f:S\to\mathbb R$ has a nonempty domain $S$. A number $M$ is a global maximum if $f(x)\le M$ for every $x\in S$ and some $x_0\in S$ satisfies $f(x_0)=M$. The notation $M=\max_{x\in S}f(x)$ gives an output value rather than the input $x_0$.
Both conditions are necessary. A number above every function value is an upper bound, but without attainment it is not a maximum. On a nonempty finite domain, the largest of finitely many real values is always attained.
For $f(x)=(x-2)^2$ on $\{0,1,2\}$, values are 4, 1, and 0, with maximum 4. On the entire real line there is no maximum: the square is unbounded above. The expression alone does not specify an answer without its domain.
For $f(x)=x$ on $(0,1)$, all values are bounded above by 1, but there is no maximum. Any admissible input can be replaced by $(x+1)/2$, which remains below 1 and produces a larger value. Sampling large values cannot replace comparison with all inputs.
If a maximum exists, its value is unique even when several inputs attain it. Two candidate values $M_1$ and $M_2$ must satisfy both $M_1\le M_2$ and $M_2\le M_1$: each is an attained value and an upper bound on all values. Checking only nearby inputs establishes a different, local property and cannot replace a global comparison.
Definitions and notation: Basic Analysis I; Mathematics for Machine Learning.
Related concepts: Supremum: the least upper bound, Argmax: the set of maximizing inputs.
In plain language
A maximum resembles the highest score in a results table. It gives the attained score rather than its owner’s name. One impressive contestant does not establish a maximum; every other result must be no higher. A new record changes the answer without consulting the previous winner, and the comparison promises nothing beyond the specified table.
Example
The constructed finite scores are 2, 7, and 4. The last score changes and the maximum is recomputed.
A function’s maximum: the largest attained value
Score comparison
The first candidate maximum is 2.
Step 1 of 3: Score comparison
Read all steps
Score comparison
The first candidate maximum is 2.
- Scores
- 2current74
Largest value
Seven exceeds both 2 and 4, so the maximum is 7.
- Scores
- 2excluded7included4excluded
Changed data
The last score becomes 9: the previous maximum no longer bounds all values.
- Scores
- 27excluded9included
Initially, candidate 2 is justified only for the first inspected entry. Comparing it with 7 replaces it, while the following 4 leaves it unchanged. At each stage, the candidate is the maximum of the inspected portion; after the complete pass, that property covers the whole list. Replacing 4 with 9 requires updating the comparison: retaining 7 would ignore a newly admissible value.
A maximum requires both an upper bound and an input attaining it.