# Supremum of continuous functions on $\mathbb{R}$

If $f(x)$ is a continuous function on all of $\mathbb R$, with the property that $\sup_{x\in\mathbb R}|f(x)|\leq 1$. If this is the case, how I can test if the sup is attained or not? (i.e., if there exists at least $x_{o}\in \mathbb R$ such that $|f(x_{o})|\geq |f(x)|, \forall x\in \mathbb R$).

Should we have something like $\lim_{x\to\pm\infty}|f(x)|=0$, or something else?

-

With $f(x)=1-e^{-x^2}$ we can see that the $\sup$ is not attained. However, under the condition $\lim_{|x|\to +\infty}f(x)=0$, it is reached. Two cases: $f$ is identically $0$ (hence it's obvious) or not. In this case, $2s:=\sup_{x\in \Bbb R}|f(x)|>0$. You can find $R$ such that if $|x|\geq R$ then $|f(x)|\leq s$. Hence, by continuity, the supremum is reached somewhere in the compact $[-R,R]$.

-
what about the function $f(x)= -e^{-x^2}$ it does does attain its supremum –  clark Jun 15 '12 at 14:04
@Davide: SO you are saying that if $f$ is not identically zero and $\lim_{x\to\pm\infty}f(x)=0$, then $s>0$, and therefore, the sup is attained somewhere in $[-R,R]$ !!! but your example function satisfies these two conditions and the sup is not reached!!! DO I miss anything? –  Catherine Jun 15 '12 at 17:08
In my example the limit is $1$ (which is also the supremum). @clark I'm not sure I understand your point: it attains its supremum at $0$ (but not the $f$ I gave). –  Davide Giraudo Jun 15 '12 at 20:59
I see I thought we were talking about the supremum of $f(x)$ not $|f(x)|$ if that is the case I am sorry for the misguided comment... –  clark Jun 15 '12 at 21:17
So, is my claim ($\lim_{x\to\pm \infty}|f(x)|=0$) true or not, I'm confused! –  Catherine Jun 17 '12 at 0:54

If,e.g., you somehow know that

$$\sup_\mathbb{R}|f|> \lim_{x\rightarrow\infty}\sup_{|y|>|x|} |f(y)|$$

you can conclude that there must be some bounded closed interval $I$ such that $\sup_I|f| =\sup_{\mathbb{R}}|f|$ and $f$ will attain it's supremum. In general you will run into problems (see Davide's answer for an example ;-).

-