Let $f$ be a function on $\mathbb{R}$, such that it has a limit. Show that it is bounded. Suppose a continuous function $f : \mathbb{R} \mapsto \mathbb{R} $ such that it has a limit $l$ at $±\infty$.
I had a question that asked me to show that $f$ is bounded on an interval $[-M;M] \subset \mathbb{R}$. To do that I used the fact that $[-M;M]$ is closed and bounded, thus is a compact, and as $f$ is continues, it shows that it is bounded on that interval.
Now it is asked to show that $f$ is bounded on $\mathbb{R}$.
I can easily prove the case when $l \not=±\infty$ by using the definition of a limit and the fact that it is bounded on $[-M;M]$.
We have:
$\forall \epsilon > 0 \: \exists \delta>0 \:  |x-x_0|<\delta \implies |f(x)-l|<\epsilon  $
As it's true for all epsilon, it is also true for $\epsilon = 1$.
Thus we have:
$\exists \delta>0 \:  |x-x_0|<\delta \implies |f(x)-l|<1$
Thus we have $(l-1)<f(x)<(1+l)$
Thus $\forall x>x_0$, $f$ is bounded.
Now, as I have shown that $f$ is bounded on all intervals of type $[-M;M]$, we can simply put $x_0=M$, and so $f$ is bounded on the whole $\mathbb{R}$.
I hope this proof is correct. Now what I struggle to understand is how come $f$ can be bounded if $l=\pm\infty$ (there is no condition on $l$, so I suppose it can also denote infinity).
Any tips and criticism will be highly valuable.
 A: Your proof looks correct.

Update: As pointed out in the comments and in other answers, actually your proof contains the right arguments, but in the details it is wrong. There should be no such variable $x_0$ in the definition of the limit in $\pm \infty$. If $l \in \mathbf{R}$:
$$\lim_{x \to \infty} f(x)=l \iff \forall \epsilon > 0 \; \exists M \ge 0 \; \forall x > M \; |f(x)-l| < \epsilon$$
$$\lim_{x \to -\infty} f(x)=l \iff \forall \epsilon > 0 \; \exists M \le 0 \; \forall x < M \; |f(x)-l| < \epsilon$$
Taking $\epsilon=1$ in the previous definitions gives you two reals $M_1 \ge 0$ and $M_2 \le 0$ s.t. $|f(x)-l|<1$ if $x<M_2$ or $x>M_1$. $M_1$ and $M_2$ may be different, but taking $M=\max(M_1, -M_2)$, you get that $|f(x)| \le 1+l$  for all $x \in \mathbf{R} \setminus [-M, M]$. Now you know how to end the proof.

Note that the exact argument should be something like $f_{|\mathbf{R}\setminus[-M,M]}$ and $f_{|[-M,M]}$ are bounded, so $f$ itself is bounded.
If $l\in\{-\infty, +\infty\}$, then $f$ is not bounded, almost by definition. The theorem is true only if $l\in\mathbf{R}$.
For the record, $f$ is not bounded iff. $\forall M \ge 0, \exists x\in\mathbf{R}, |f(x)|>M$. It is possible to prove this statement in the case $f(x) \to \pm \infty$.
A: Take $\epsilon = 1$ as you did, then for $\displaystyle \lim_{x \to +\infty} f(x) = L_1$ with $L_1$ is a real number and not $\pm \infty$, then there is an $N_1 > 0$ such that if $x > N_1$ then $|f(x) - L_1| < 1\implies |f(x)| - |L_1| \le |f(x) - L_1| < 1\implies |f(x)| < 1+|L_1|$. Also, $\displaystyle \lim_{x \to -\infty} f(x) = L_2$ with $L_2$ is a real number and not $\pm \infty$, then there is an $N_2 < 0$ such that if $x < N_2$ then $|f(x) - L_2| < 1\implies |f(x)| - |L_2| \le |f(x)-L_2| < 1 \implies |f(x)| \le 1+|L_2|$. Thus if you take $N = \text{max}(N_1,-N_2) > 0$, and $M_1 = \text{max}(1+|L_1|, 1+|L_2|)$, then you have: if $ |x| > N$, $|f(x)| \le M_1$. And on the interval $[-N,N]$ $f$ is bounded by, say $K$, so take $M = \text{max}(M_1,K)$, then $|f(x)| \le M, \forall x \in \mathbb{R}$, hence $f$ is bounded in $\mathbb{R}$.
A: The idea of the proof is correct, but you're using the wrong definition of limit.


*

*since $\lim_{x\to\infty}f(x)=l_+$, there exists $K_+>0$ such that, for $x>K_+$, $|f(x)-l_+|<1$

*since $\lim_{x\to-\infty}f(x)=l_-$, there exists $K_->0$ such that, for $x<-K_+$, $|f(x)-l_-|<1$
Now, set $K=\max\{K_+,K_-\}$ and $a=\max\{1+|l_+|,1+|l_+|\}$: then, for $|x|>K$, you have $|f(x)|<a$.
Since $f$ is bounded on $[-K,K]$, there is $b$ such that, for $x\in[-K,K]$, $|f(x)|<b$. Set $c=\max\{a,b\}$ and you're done.

In the above argument I didn't assume the limit is the same at $-\infty$ and $\infty$. However they must be finite: if $\lim_{x\to\infty}f(x)=\infty$, for instance, then $f$ is not upper bounded.
There's a different way for proving the assertion. Consider the function
$$
g(t)=f(\tan t)
$$
defined over $(-\pi/2,\pi/2)$. By assumption, the function
$$
\hat{g}(t)=\begin{cases}
l_- & t=-\pi/2 \\[4px]
g(t) & -\pi/2<t<\pi/2 \\[4px]
l_+ & t=\pi/2
\end{cases}
$$
is continuous. So it is bounded, because $[-\pi/2,\pi/2]$ is compact. The range of $f$ is a subset of the range of $\hat{g}$.
A: Generally speaking, for a function $f : X \to Y$, the claim

$f(x)$ has a limit as $x \to a$

means that there is some $y \in Y$ such that

$\lim_{x \to a} f(x) = y$

In particular, the limit of a real-valued function cannot be $\infty$ (or $-\infty$), because $\infty$ isn't a real number.

The confusion you're facing is because introductory calculus is secretly introducing the space of extended real numbers, not real numbers, and so we can say things like $\lim_{x \to \infty} f(x) = b$ or $\lim_{x \to a} f(x) = \infty$ or even $\lim_{x \to \infty} f(x) = \infty$.
This problem is particularly awkward, because in the domain, $\mathbb{R}$ is being implicitly viewed as a subset of $\bar{\mathbb{R}}$ so that you can speak of its limits at $\infty$, but the codomain is being strictly limited to $\mathbb{R}$, so you cannot speak of the limit having infinite value.
