Show that if $f :[0,\infty[ \rightarrow\mathbb{R}$ is continous with $\lim \limits_{x \to 0} f(x) = 0$ and $\lim\limits_{x \to\infty} f(x) = 0$ then $f$ attain a maximum.
Suppose by contradiction that the real $M=\max_{x\in[0,\infty[}f(x)$ does not exist and suppose that $f \not\le 0$, $\forall x\in[0,\infty[$. Otherwise, $M=0$
Then by definition, $\forall M\in\mathbb{R}$, $ \exists x \in[0, \infty[$ such that $f(x) \ge M$.
So, let $M\ge 0$,
By assumption, $\lim\limits_{x \to\infty} f(x) = 0$ $\Leftrightarrow$ $\exists A_M$, $\forall x \gt A_M \Rightarrow$ $\lvert f(x)\rvert \le M$. So, $\not\exists x \in]A_M, \infty[$ that verified $f(x) \ge M$.
Since, $ x \not\in]A_M, \infty[$, $x$ has to be in the interval $[0,A_M]$. But, since $f$ is continous on a closed interval, by the extreme value theorem, $\exists \beta \in \mathbf{Im_f} =\{f(x) \in\mathbb{R}: x \in[0,A_M]\} $ $\mathbf {s.t}$ $\forall x \in [0,A_M]$ we have $f(x)\le\beta$. This is a contradiction to our conclusion that there is not a maximum for $f$.
Can someone tell me if my proof is correct, if not why and how to make it true ?
There are two errors (at least):
But these are minor details. Globally, it's fine.