I have the following question:
Let $f:\mathbb R \rightarrow \mathbb R$ be a continuous function where $\lim_{x \to +\infty} f(x)=\infty$ and $\lim_{x \to -\infty} f(x)=-\infty$. Prove/disprove: $Im(f)=\mathbb R$.
My reasoning is that this is correct, because as $\lim_{x \to +\infty} f(x)=\infty$ and $\lim_{x \to -\infty} f(x)=-\infty$, then $\forall x\in\mathbb R, \exists x_{1},x_{2}\in\mathbb R$ such that $x_{1}<x<x_{2}$ and such that $f(x_{1})<f(x)<f(x_{2})$. Since the function is continuous, by the density of $\mathbb R$, then $\forall x,y \in\mathbb R, \exists z\in\mathbb R$ such that $x≤z≤y$ and $\lim_{x \to z} f(x)=f(z)$, so $Im(f)=\mathbb R$.
I feel like this is missing something but can't figure out where I'm going wrong. Any advice is appreciated!
As $\lim_{x \to +\infty} f(x) = +\infty$, so for every given real number $B$ however large, we can find a real number $A$, which may depend on our $B$, such that $f(x) > B$ for all $x > A$.
As $\lim_{x \to -\infty} f(x) = -\infty$, so for every given real number $B$ however small, we can find a real number $A$, which may depend on our $B$, such that $f(x) < B$ for all $x < A$.
Now let $y$ be an arbitrary real number. We need to show that there exists a real number $x$ for which $f(x) = y$.
Now for $B = y$, there exists a real number $A_1$ such that $f(x) < y$ for all $x < A_1$, and there exists a real number $A_2$ such that $f(x) > y$ for all $x > A_2$.
Let us put $a := \min \left\{ A_1, A_2 \right\}-1$ and $b := \max \left\{ A_1, A_2 \right\}+1$.
Then we have $f(a) < y < f(b)$. So by the intermediate-value theorem for continuous functions, there exists a real number $c \in (a, b)$ such that $f(c) = y$.