Show such a function has a maximum Let $f:[0, \infty)$ be a continuous function.
$f(0) = 1 $ and $\forall x \in [0, \infty)$ $f(x)\leq \frac{x+2}{x+1}$ 
Show that $f$ gets a maximal value in $[0, \infty)$.
My intuition:
if $f(0)$ is the maximum i'm done if not the function you showed me converges to $1$ I want to show that from a certain point it will be lower than $1.$ Can you help me formalize it?

(1). If $f(x)\leq 1$ for all $x\in [0.\infty)$ then $1=f(0)=\max_{x\geq 0}f(x).$
(2). If $f(x_0)>1$ for some $x_0>0$ then there exists $x_1>x_0$ such that $$\forall x\geq x_1\;( f(x)<\frac {1}{2}(1+f(x_0))$$ because $\lim_{x\to \infty}\sup_{y\geq x}f(y)\leq 1.$
There exists $x_2\in [0,x_1]$ with $f(x_2)=\max \{f(x): x\in [0,x_1]\}$.
Since $x_0\in [0,x_1]$ we have $f(x_0)\leq f(x_2)$, so  for $x>x_1$ we have $$f(x)<\frac {1}{2}(1+f(x_0))<f(x_0)\leq f(x_2).$$ 
Therefore  $f(x_2)= \max_{x\geq 0}f(x).$
