Show that if $f(0)=\displaystyle\lim_{x \rightarrow \infty}f(x)=0$ and $f$ is continuous then $f$ has a maximum in the interval $[0, \infty)$. Show that if $$f(0)=\displaystyle\lim_{x \to \infty}f(x)=0$$ and $f$ is continuous then $f$ has a maximum in the interval $[0, \infty)$.

It just seems so obvious! Yet I'm stuck... any hints would be much appreciated.
If $f$ is equal to $0$ everywhere, then the statement is trivial, so let's assume $f$ is not $0$ everywhere.

If $f(x)\leq 0$ for all $x$, then $f(0)$ is the maximum, so let's now see what happens if $f(x)&gt;0$ for at least some $x$.

We then know there exists some $x_0&gt;0$ for which $f(x_0)&gt; 0$. Now, you can find such a value $M$ that for all $x&gt;M$, you have $f(x) &lt; \frac{f(x_0)}{2}$ (why?). You can also be sure that $f$ has a maximum on $[0,M]$ (why?), and that the maximum value on $[0,M]$ is actually the maximum on $[0,\infty)$ (why?)
Hint: Since $\lim_{x\to \infty} f(x) = M$ exists, for any $\epsilon &gt; 0, \exists R &gt; 0$ such that
$$
|f(x) - M| &lt; \epsilon \quad\forall x \geq R
$$
Hence,
$$
|f(x)| \leq M+\epsilon \quad\forall x \in [R,\infty)
$$
Now what happens on $[0,R]$?

Now since $M = 0$, you can choose $\epsilon$ carefully so that the max is attained.