This is regarding my other problem:
Let $f: \mathbb{R} \to \mathbb{R}$ such that $\displaystyle \lim_{x \to \infty} f(f(x))= \infty$ and $\displaystyle \lim_{x \to -\infty} f(f(x))= -\infty$ and $f$ has the intermediate value property (it is not necessarily continuous).
Prove that $\displaystyle\lim_{x \to \infty}f(x)$ and $\displaystyle\lim_{x \to -\infty}f(x)$ exist and are infinite.
I eventually found the official solution, but I don't quite understand it. It goes like this, after proving the limits exist:
Suppose $\lim_{x \to \infty}f(x)=a \in \mathbb{R}$. Let $M=\{x \in \mathbb{R} \mid f(x)=a \}$. If $M$ were unbounded above, then there is $(x_n) \to \infty$ such that $f(x_n)=a$. But we know $\lim_{n \to \infty}f(f(x_n))=\infty$ and so we would have $f(a)=\infty$, which can't be. So $M$ is either empty, or bounded above. However it is, there is $\delta>0$ such that $f(x) \neq a, \: \forall x \geq \delta$. Since f has the intermediate value property, it follows that $f(x)<a, \: \forall x \geq \delta$ or $f(x)>a, \forall x \geq \delta$. Without loss of generality, suppose $f(x)<a, \: \forall x \geq \delta$.
We will prove $\lim_{x \nearrow a}f(x)=\infty$. Let $(y_n)$ be strictly increasing and convergent to $a$. Then there is $n_0$ such that $f(\delta)<y_n<a, \: \forall n \geq n_0$. But $\lim_{x \to \infty}f(x)=a$, so by the intermediate value theorem, the set $$M_n=\{x \in (\delta, \infty) \mid f(x)=y_n \}$$ is not empty. If it were unbounded above, we would get a contradiction as we did before. Thus it is bounded and let $x_n=\sup M_n \in \mathbb{R}$. Then $x_n \in M_n$, so $f(x_n)=y_n$. Then $(x_n)$ is strictly increasing, because $(y_n)$ is strictly increasing ...
This is the point which bothers me in their solution. They don't prove why $x_n \in M_n$, which I have been trying for a while, but couldn't do it. This is the source of my recent statement from here
The key point in this proof by contradiction is that $\lim_{x \uparrow a} f(x) = \pm \infty$ or $\lim_{x \downarrow a} f(x) = \pm \infty$ for some $a \in \mathbb{R}$ cannot occur. If $f(x_n) \uparrow \infty$ for some $x_n \uparrow a$, then we can find by the intermediate value property points $y_n$ with $x_n < y_n < x_{n+1}$, in particular $y_n \uparrow a$, with $f(a) < f(y_n) =c < f(x_n)$ for all $n \geq N$. Thus $f(y_n)$ is constant! A contradiction!
First, note that we cannot assume that the $f(x)$ has a limit for $x \rightarrow \infty$. Proving by contradicition, we get that there exists a sequence $(x_n)_{n \in \mathbb{N}}$ with $x_n \rightarrow \infty$ such that $f(x_n)$ is bounded. Thus, by the theorem of Bolzano-Weierstraß, we may assume that $f(x_n) \rightarrow a$ for some $a \in \mathbb{R}$.
Now, we proceed as in the mentioned proof: Let $M:= \{x \in \mathbb{R} : f(x) =a\}$. And, as already said, if $M$ is unbounded, then we get a sequence $(z_n)_{n \in \mathbb{N}} \subset M$ with either $z_n \rightarrow \infty$ or $z_n \rightarrow - \infty$. In both cases, we get the contradiction $\pm\infty = \lim_{n \rightarrow \infty} f(f(z_n)) =f(a)$.
The set $M$ also cannot be empty! By the first condition, there exist $x < y$ such that $f(f(x)) < a < f(f(y))$. Thus the intermediate value property shows the existence of a point $x_a$ between $f(x)$ and $f(y)$ with $f(x_a) =a$.
Since $M$ is bounded, there exists $\delta >0$ such that $f(x) \neq a$ for all $|x| \geq \delta$. And by the intermediate value property we must have $f(x) > a$ or $f(x) <a$ for all $x \geq \delta$. If $f(x) < a$ and $f(y) > a$ for some $x,y \geq \delta$, then we would find an $z$ between $x$ and $y$ with $f(z) =a$. That is not possible.
Next, we assume w.l.o.g. that $f(x) <a$ for all $x \geq \delta$. Since there exists an $N \in \mathbb{N}$ such that $x_n \geq \delta$ for all $n \geq N$, we see that $f(x_n)<a$.
Let $y_n \uparrow a$. By increasing $N$, if necessary, we find that for all $n \geq N$ some numbers $A(n)<B(n)$ such that $f(x_{A(n)}) < y_n < f(x_{B(n)}) < a$. Since $y_n$ is increasing, we can assume that $A(n) \leq A(n+1)$ and $B(n) \leq B(n+1)$. Moreover, we can assume also that $A(n) \uparrow \infty$.
Now, by the intermediate value property we can find $z_n \in [x_{A(n)},x_{B(n)}]$ with $f(z_n) = y_n$. Note that $z_n \rightarrow \infty$. Thus, we get $$\lim_{n \rightarrow \infty} f(y_n) = \lim_{n \rightarrow \infty} f(f(z_n)) = \infty.$$ This shows $\lim_{x \uparrow a} f(x) = \infty$. As initially mentioned, that is not possible!