Limit of a convex function I would need a check on the following exercise:

Let $f:\mathbb{R} \rightarrow \mathbb{R}$ a convex function.

*

*Prove that $\lim_{x \rightarrow \infty} f(x)$ and $\lim_{x \rightarrow - \infty} f(x)$ exist


*Show that if both the limits are finite, then $f$ is constant.


My attempt:
i ) I know that if $f$ is convex, then $$f(t x_1 + (1-t)x_2)< t f(x_1) + (1-t) f(x_2)$$
If I fix an arbitrary $N>0$, then I have that for $x>x_2 \colon \quad f(x)>N$, thanks to the convexity, therefore this proves the limit to $+ \infty$ is $+\infty$.
The same argument applies to $\lim_{x \rightarrow -\infty}f(x)$: it suffices to note that for $x<x_1 \colon \quad f(x)>N$.

ii)
Graphically it's obvious, but I have some problem in make it formal.
If the limit is finite, say $L$, then for every $\varepsilon >0$ there exists an $M(\varepsilon)$ such that for $$x>M(\varepsilon) \colon \quad |f(x)-L|\leq \varepsilon$$
Assume $f (x) \ne c$. By definition of convexity, it has to hold (for $t \in [0,1]$) $$t f(M)+(1-t)f(M+1) \leq f(t M + (1-t)(M+1))$$
Now, by definition of limit, $f(M)$ and $f(M+1)$ are less than $L-\varepsilon$. Also, the argument in the rhs of the inequality can be simplified:
$$L-\varepsilon <t f(M)+(1-t)f(M+1) \leq f(t M + (1-t)(M+1)) = f(M-t)$$
Therefore $$L-\varepsilon < f(M-t)$$, which is a contradiction because $M-t<M$ and hence it can be greater than $L-\varepsilon$.
So $f$ has to be equal to $c$. Indeed in this case, it is still (trivially) convex, and the limits are of course finite.
 A: convexity usually means "$\le$", not "$\lt$" (otherwise it's "strictly convex").
You don't want to show that f always goes to infinity, because it need not.
Start with $x\rightarrow\infty$.
Suppose first there are two points $x\lt y$ with $f(x)\lt f(y)$.  Then we can show that f goes to infinity.  We can suppose without loss of generality that $x=0$ and $f(x)=0$ (if not, just slide and shift f until it does.  It won't change the behaviour we are interested in.)
Consider some $z>y$.  Since $y>x=0$, then $z=y/t$ for some $0<t<1$.  So by convexity, $$tf(z)=tf(y/t)+(1-t)f(0)\ge f(t(y/t)+(1-t)0)=f(y)$$
So $f(z)\ge f(y)/t$.  As $z\rightarrow \infty$ it's clear that $t$ goes to $0$, so $f(y)/t\rightarrow\infty$ (remember $f(y)>0$) and therefore so does $f(z)$.
Therefore in this case $f$ increases to infinity.
Otherwise our supposition was false, so f must be either constant or else non-constant and monotone decreasing.  Suppose it's the latter.  Again, move the origin so that $f(0)=0$.  Then $f(1)<0$ and it's easy to show by the convexity property that $f(t)\le t f(1)$ and so $f$ goes off to minus infinity.
You can then repeat the argument by symmetry, for the behaviour as $x\rightarrow-\infty$.
A: Hint : try to prove that a convex function is either decreasing, either increasing, either decreasing then increasing.
