Real Analysis Boundedness of continuous function

Suppose that $f: \Bbb R \longrightarrow \Bbb R$ is continuous on $\Bbb R$ and $\displaystyle \lim_{x \to -\infty} f(x) = 0$ and $\displaystyle \lim_{x \to \infty} f(x) = 0$. Prove that $f$ is bounded on $\Bbb R$ and attains either a maximum or a minimum on $\Bbb R$. Give an example to show that both a maximum and a minimum need not be obtained.

Ok, I am not entirely sure how to show that this is bounded. I know that if I have an interval such as $I = [-N,N]$ where $f$ is cont and closed, then by the boundedness theorem, it is bounded and by max-min theorem then $|f|$ is a max or min on some $r \in I$. But how do I show this when $f: \Bbb R \longrightarrow \Bbb R$?

-
Start by looking at the definition of "bounded." –  Arkamis Oct 22 '12 at 18:30

By assumption there exists an $L>0$ such that $|f(x)|\le 1$ if $|x|\ge L$. Also $f$ is bounded on $[-L,L]$, say by $M\ge 0$. Then $$|f(x)|\le \max(1,M)$$ for all $x\in\mathbb{R}$. The minimum need not be attained as you can see by looking e.g. at $$f(x)=\frac{1}{1+x^2}.$$ The maximum of course also doesn't need to be obtained (look at $-f$ for example).

-

For a more conceptual argument, let $X$ be a non-compact locally compact Hausdorff space. Then $X^* := X \cup \{\infty\}$, the Alexandroff compactification of $X$, has the property that every $f \in C_0(X)$ extends uniquely to a continuous function $\tilde f$ on $X^*$ with $\tilde f(\infty) = 0$.

Since $X^*$ is compact, $\tilde f$ attains its minimum and maximum on $X^*$. If it attains both min and max at $\infty$, then $\tilde f$ is obviously just the $0$ function, and if it attains at most one extremum at $\infty$, then it must at least attain the other somewhere in $X$, so $f$ attains an extremum in $X$.

-
We have not used compactness yet. I think I understand the other persons proof somewhat but do not see how they proved that either a max or a min has to exist –  Jackson Hart Oct 23 '12 at 20:07

As a small note, I'd be cautious about the use of the word "either"--as it typically connotes exclusivity (that is, "either A or B" means "A or B, but not both"). Of course, if that was the original phrasing of the problem, then it obviously isn't your fault.

It's clear that the zero function is bounded and achieves both a maximum and a minimum on $\Bbb R$. Suppose $f:\Bbb R\to\Bbb R$ is a continuous function such that $|f(x)|\to 0$ as $|x|\to\infty$, and that $f$ is not the zero function. Note that for any real $\alpha$, if we define $g_\alpha(x):=f(x-\alpha)$, then $f$ is bounded if and only if $g_\alpha$ is. Hence, we may assume without loss of generality that $f(0)\neq 0$.

Take any $\epsilon>0$. Since $f(x)\to 0$ as $|x|\to\infty$, then there is some $K_0>0$ such that $|f(x)|<\epsilon$ whenever $|x|>K_0$. Since $f$ is continuous, then so is $|f|$. In particular, $|f|$ is continuous on the closed and bounded interval $[-K_0,K_0]$, so achieves a maximum there, say $M_0$. Since $f(0)\neq 0$, then $|f(0)|>0$, and so $M_0>0$. Since $|f(x)|\leq M_0$ for $|x|\leq K_0$ and $|f(x)|<\epsilon$ for $|x|>K_0$, then $|f(x)|<\max\{M_0,\epsilon\}$ for all $x$, and so $f$ is bounded on $\Bbb R$.

Now, since $\min\{M_0,\epsilon\}>0$ and $f(x)\to 0$ as $|x|\to\infty$, then there exists some $K_1\geq K_0>0$ such that $|f(x)|<\min\{M_0,\epsilon\}$ for $|x|>K_1$. Now, as above, $|f|$ achieves a (positive) maximum on $[-K_1,K_1]$, say $M_1$. Since $[-K_0,K_0]\subseteq[-K_1,K_1]$, then $M_0\leq M_1$. Thus, $|f(x)|<\min\{M_0,\epsilon\}\leq M_0\leq M_1$ for $|x|>K_1$, and since $|f|$ achieves a maximum of $M_1$ on $[-K_1,K_1]$, then $|f|$ achieves a maximum of $M_1$ on $\Bbb R$. From this, it follows that $f$ achieves a maximum of $M_1$ on $\Bbb R$ or a minimum of $-M_1$ on $\Bbb R$.

-