Continuity on $\Bbb R$ $f:\Bbb R\to\Bbb R$ is continuous on $\Bbb R$. $\lim\limits_{x\to\infty}f(x)=0$, and $\lim\limits_{x\to-\infty}f(x)=0$. 
Prove that $f$ is bounded on $\Bbb R$ and attains either an absolute maximum or an absolute minimum!
 A: Here are some hints:
1) Suppose we restrict the domain to $[-N,N]$ for some positive integer $N$.  Then we can simply quote a big theorem to tell us that $f: [-N,N] \rightarrow \mathbb{R}$ is bounded and assumes a minimum and maximum value: what theorem is that?
Thus we can "handle $f$" for small values of $x$.  On the other hand:
2) Since $\lim_{x \rightarrow \pm \infty} f(x) = 0$, this tells us how to "handle $f$" for large values of $x$.
Can you figure out how to put 1) and 2) together?  Try to show the boundedness first.
Added: I'll venture one more hint: first choose $N$ such that the maximum $M_N$ of $|f|$ on $[−N,N]$ is positive (it is very easy to handle the case in which there is no such $N$). Then handle the case of very large $x$...so large so that $|f(x)|<M_N$ You are left with an intermediate range to handle, which again you can do using the Extreme Value Theorem. 
A: Consider $g(x) := |f(x)|$. $g$ satisfies the conditions of the problem and is a positive function. If it is identically zero, there is not much to prove. So let's assume that for some $x_0 \in \mathbb{R}$, $g(x_0) > 0$. As $g$ vanishes at infinity, there exists $N$ such that whenever $|x| \ge N$, $g(x) < \frac{g(x_0)}{2}$. On the compact interval $[-N,N]$, the continuous function $g$ attains absolute maximum which is greater than or equal to $g(x_0) > \frac{g(x_0)}{2}$. Thus $g$ is bounded and attains absolute maximum on $\mathbb{R}$. For $f$, this translates to the fact that $f$ is bounded on $\mathbb{R}$ and attains either an absolute maximum or an absolute minimum.
$f_1(x) := \frac{1}{x^2+1}$ and $f_2(x) := \frac{-1}{x^2+1}$ are examples which show that both absolute maximum and minimum need not be attained.
A: HINT: The key is showing that $f$ is bounded. If not, assume without loss of generality that it is not bounded above. Then for each $n\in\Bbb N$ there is an $x_n\in\Bbb R$ such that $f(x_n)\ge n$. Consider two possibilities:


*

*$\langle x_n:n\in\Bbb N\rangle$ is unbounded. Why is this impossible?  

*$\langle x_n:n\in\Bbb N\rangle$ is bounded and therefore has a convergent subsequence (why?); why is this impossible?


Once you’ve established that $f$ is bounded, let $m=\inf\{f(x):x\in\Bbb R\}$ and $M=\sup\{f(x):x\in\Bbb R\}$. Clearly $m\le 0\le M$; why? If $m=M=0$, the function is constantly $0$ and has an absolute maximum and minimum at every point. If $M>0$, show that there is an $x\in\Bbb R$ such that $f(x)=M$, so that $f$ attains its maximum at $x$. To do this, start by noting that there is a sequence $\langle x_n:n\in\Bbb N\rangle$ in $\Bbb R$ such that $\langle f(x_n):n\in\Bbb N\rangle\to M$. (Why?) Now do something with $\langle x_n:n\in\Bbb N\rangle$ and use the fact that $f$ is continuous.
If $m<0$, a similar argument shows that $f$ attains a minimum of $m$ at some point.
A: If $f$ tends to zero as $x$ tends to infinity, $f$ can be extended to a continuous function on the circle by compactifying $\mathbb{R}$, for example by using the map $x\mapsto \frac{x+i}{x-i}$. By the extreme value theorem a continuous function on a compact attains its maximum.
A: Consider $g(x)=f(\tan(\pi x/2))$, defined on the open interval $(-1,1)$; then your hypotheses imply that $g$ can be extended to a continuous function $\tilde{g}\colon[-1,1]\to\mathbb{R}$ which, of course, attains a maximum and a minimum.
Therefore $f$, which has the same image as $g$, is bounded. The image of $\tilde{g}$ is $\operatorname{im}(g)\cup\{0\}$. If a minimum is not attained by $f$, it means that the minimum for $\tilde{g}$ is $0$. So either the maximum of $\tilde{g}$ is zero and $f$ is constant, or the maximum of $\tilde{g}$ is greater than $0$, so it's also a maximum for $g$ and for $f$.
