I have a problem from Carother's Real Analysis, page 116.
Suppose that $f : \mathbb{R} \to \mathbb{R}$ is continuous and $f(x) \to 0$ as $x \to \pm\infty$. Prove that $f$ is uniformly continuous.
I would like to do it myself, but I have tried starting in a few ways and haven't solved it.
I figure I could start by showing that $f(x)$ is bounded. So I assume to derive a contradiction that it is not - i.e. for any $M \in \mathbb{R}$, $\exists x : |f(x)| > M$. With this I would like to contradict the continuity of $f$, which says that $\forall \epsilon > 0 \,\, \exists \delta $ such that $$|x-y| < \delta \implies |f(x)-f(y)|<\epsilon$$ However even on this I am having brain-block. So really two quetsions: is proving that $f$ is bounded the correct way forward, and how do I prove boundedness anyway?! (I know that just showing $f$ bounded would not suffice in any case).
A direct proof is much easier. Since $f(x) \to 0$ as $x \to \pm \infty$, given $\epsilon > 0$, there exists $K(\epsilon)$ such that for all $x > K(\epsilon)$, we have $\vert f(x) \vert < \epsilon/2$. Now on the compact interval $[-K,K]$, the function is continuous and therefore uniformly continuous. On the interval $(-\infty,-K] \cup [K,\infty)$, we have $\vert f(x) -f(y) \vert < \epsilon$ for any $x,y \in (-\infty,-K] \cup [K,\infty)$.