Exercise about derivability and continuity of a function 
Given $a \in \mathbb{R}$, $f:[a,\infty) \to \mathbb{R}$ continous and $\lim_{x \to \infty}f(x)=f(a)$. Knowing $f$ is derivable onto $(a,\infty)$ prove that exists $x_0 > a$ so that $f'(x_0)=0$

If $f$ is a constant function the thesis is obvious. But in the other case I have no idea how to proceed. 
 A: HINT
Assuming that $f(x)$ is not constant (trivial case), by IVT and EVT we can show that $f(x)$ has maximum or a minimum for some $x_0\in (a,\infty)$ and then $f'(x_0)=0$.
A: Correct me if wrong.
Assume $f'(x) \not =0$ for  $x>a$.
Then $f' >0$, or $f' <0$ for $x >a$.
1) Consider $f' >0$:
Then $f$ is strictly monotonically increasing.
For $x_1 >a$ , we have $f(x_1) >f(a)$.
For $x >x_1$ : $f(x) >f(x_1)>f(a).$
We are given:
$\lim_{x \rightarrow \infty} f(x)=f(a)$, i.e.
for  $\epsilon >0$:
There is $K$, real, positive, such that for $x > K$
$|f(x)-f(a)| \lt \epsilon$, or 
$ -\epsilon +  f(a) < f(x) < f(a) +\epsilon.$
Choose $\epsilon =f(x_1) - f(a)$ $(>0)$.
Let $K':= \max (K,x_1)$,
for $x \gt K' :$
$f(x)<f(a)+\epsilon = f(x_1)$ ,
a contradiction.
Hence $f'(x) \le 0$ for a $x >a$.
1) If $f'(x) = 0$ for a $x >a$ , we are finished.
2) If $f'(x) <0$ for a $x >a$, need continuity(??) of the derivative to infer $f'(x) = 0$ for a $x >a.$
A: For non-constant  $f$. 
(1). Suppose there exists $b>a$ such that $f(b)>f(a).$ Since f is  continuous on $[a,b]$ there exists $c\in (a,b)$ with $f(c)=(f(a)+f(b))/2.$ 
Since $\lim_{x\to \infty}f(x)=f(a)$ there exists $d>b$ with $f(d)<f(a)+\delta ,$ where $\delta =(f(b)-f(a))/2.$ That is, $f(d)<(f(a)+f(b))/2.$
Since $f$ is continuous on $[b,d]$ and $f(b)>(f(a)+f(b))/2>f(d),$ there exists $e\in (b,d)$ with $f(e)=(f(a)+f(b))/2.$
We now have $a<c<e$ and $f(c)=f(e),$ and since   f is differentiable on $(a,\infty),$ there exists  (by Rolle's Theorem) $x_0\in (c,e)$ with $f'(x_0)=0.$
(2). If $f(b)< f(a)$ for some $b>a$ then this is handled similarly to (1) and I will leave the details to you.
