How to prove the intermediate value theorem when $f : \mathbb{R} \to \mathbb{R}$? Here's the theorem:
"The intermediate value theorem states the following: Consider an interval $I = [a, b]$ in the real numbers $ℝ$ and a continuous function 
$f : I → ℝ$. Then,
If $u$ is a number between $f(a)$ and $f(b)$,
  $f(a) < u < f(b)$   (or  $f(a) > u > f(b)$ ),
then there is a $c ∈ (a, b)$ such that $f(c) = u$. "
What happens if we consider $\mathbb{R}$ instead of $I$ ?
Is there a simple method to prove the theorem in this case ? I know the method for $f:I \to \mathbb{R}$ with $I=[a,b]$, but here it is different.
Thanks in advance.
 A: What exactly does the intermediate value theorem say for functions from $\mathbb R$ to $\mathbb R$?
If it says that if $a<b$ and $t$ is between $f(a)$ and $f(b)$ then there is $x$ in $[a,b]$ so $f(x)=t$ then it can be proven using what you wrote.
A: In some sense we can use 
$$
c = \lim_{x \to -\infty} f(x) \\
d = \lim_{x \to +\infty} f(x)
$$
Assuming $c, d$ are finite, w.l.o.g. put $c < d$ and pick some $u \in (c, d)$ then put 
$\epsilon = u - c$ and $\epsilon' = d - u$. We know there is some $M > 0$ such that 
$$
\lvert f(x) - c \rvert < \frac{\epsilon}{2} \text{ when } x \le - M
$$
and some $N > 0$ such that
$$
\lvert f(x) - d \rvert < \frac{\epsilon '}{2} \text{ when } x \ge N
$$
Now we have the compact interval $[-M, N]$ and we may use the usual theorem.
Note that I left out a few details that you should consider:


*

*Is $u$ in $(f(-M), f(N))$?

*What about if the limits are infinite?


Appended:
Let's look at the case when $c = - \infty, d = + \infty$ (this is to be understood in the sense of limits of course). Pick $u \in \mathbb{R}$. We have some $M$ such that whenever $x \le -M$ we have $f(x) < u$ and some $N$ so that whenever $x \ge N$ we have $f(x) > u$. Now consider $[-M, N]$ with the usual theorem.
A: To the effect of your comment asking whether allowing $a=-\infty$ and or $b=\infty$ would still work (since if they were both finite, it would reduce to the previous case). The answer is yes, because the extended real number line, wherein we add $-\infty$ and $\infty$ to the number line, is isomorphic to a closed interval. In particular,
$g(x)=\tan^{-1}(x)$ is a homeomorphism from the extended real number line to $[-\frac{1}2\pi,\frac{1}2\pi]$ where we define $g(\infty)=\frac{\pi}2$ and $g(-\infty)=-\frac{1}2\pi$. (The map is also order-preserving, which can imply the theorem too)
This implies immediately that the intermediate value theorem applies to the extended real line, since the spaces are homeomorphic. Now, if $f$ can sensibly be extended to the extended real number line - that is, if $\lim_{x\rightarrow\infty}f(x)$ and $\lim_{x\rightarrow -\infty}f(x)$, then we may apply the theorem.
