Proving a positive continuous function on $\mathbb{R}$ with $\lim\limits_{x\rightarrow\pm\infty}f(x) = 0$ has a maximum, with somewhat of a twist Suppose that $f(x)$ is continuous and $>0$ on $ I = \mathbb{R}$, and $\lim\limits_{x\rightarrow \pm \infty}$f(x) = 0.
(a) Prove $f(x)$ has a maximum on $I$.
For this, I gave the following proof:
Since $\lim\limits_{x\rightarrow \pm \infty}f(x) = 0$, for $\epsilon = f(0)$, there is a large enough $N$ such that
$$|f(x)| < f(0) \text{ for } x > N$$
and
$$|f(x)| < f(0) \text{ for } x < -N$$
By the Maximum Theorem, there exists $x_0 \in [-N, N]$ such that
$$f(x_0) = \max\limits_{[-N,N]} f(x)$$
But if $x\notin [-N,N]$,
$$f(x)<f(0)<f(x_0)$$
Thus, $f(x_0) = \max\limits_{(-\infty, \infty)} f(x)$.
It's all fine and dandy up to now, but the question proceeds as follows:
(b) Prove (a) under weaker hypotheses than positivity on all of $I$.
I don't really understand what (b) asks for. I did not use positivity on all of $I$ in my proof, I just used $\epsilon = f(0) > 0.$ What does the statement mean exactly? How can I introduce weaker hypotheses than what I gave?
Thank you!

If $f(x)\leq0$ on ${\mathbb R}$ there might be no maximum. Otherwise there is an $x_0\in{\mathbb R}$ with $f(x_0)=:c>0$. There is an $N>0$ such that $f(x)<c$ when $|x|>N$, and there is a $\xi\in[{-N}, N]$ with
$$f(\xi)\geq f(x)\qquad\forall\>x\in[{-N}, N]\ ,$$
and as a consequence $f(\xi)\geq f(x_0)=c>f(x)$ for all $x$ with $|x|>N$.
