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?
 A: (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).$
A: Are you familiar with the extreme value theorem?
https://en.wikipedia.org/wiki/Extreme_value_theorem
In this case $f(x) \le 2$ so $f$ is continuous and bounded.  But we haven't found a closed interval for this to apply.
Case 1:
Suppose there is an $d$ so that $f(d) > 1$.  Let's let $\epsilon = f(d) -1 > 0$.
Let $x > \frac 1{\epsilon}$ then $\frac 1{x+1} < \frac 1{x} < \epsilon$
Then $f(x) \le \frac {x+2}{x+ 1} = \frac {x+1}{x+1} + \frac{1}{x+1} = 1 + \frac{1}{x+1} < 1 + \epsilon = f(d)$ for all $x > \frac 1{\epsilon}$.
(This means $d < \frac 1 {\epsilon}$.  Otherwise we'd have the absurd result $f(d) < f(d)$.)
Okay.  so $f$ achieves a maximum on $[0, \frac 1{\epsilon}]$ by extreme value thereom.  And as this maximimum is at least as large as $f(d)$ it is larger than $f(x)$ for all $x \in (\frac 1{\epsilon}, \infty)$  So it is a maximum on all $[0,\infty)$.
Case 2:  $f(x) \le 1$ for all $x \in [0,\infty)$.  
Then $f(0) = 1$ is maximal.
A: Assume that $\sup_{x\geq 0}f(x)>1$ and that the maximum does not exist. Then there is a sequence $(x_n)_{n\in\Bbb N}$ in $[0,\infty)$ (wlog monotonically increasing) such that $f(x_n)\to\sup_{x\geq 0}f(x)$ for $n\to\infty$. Furthermore, the sequence $(x_n)_{n\in\Bbb N}$ can be chosen as $x_n\to\infty$ (otherwise the sequence were contained in a compact set $K$ and (because of monotonicity) it would converge to a $x_0\in K$, which is necessarily the maximum of $f$ on $K$ (because of continuity) - that is a contradiction to the assumption).
Now we obtain
$$1<\sup_{x\geq 0}f(x) = \lim_{n\to\infty}f(x_n) \leq \lim_{n\to\infty}\frac{x+2}{x+1} =1,$$
which is a contradiction. Therefore the assumption was wrong and the maximum exists or $\sup_{x\geq 0}f(x)=1$ holds. But then with $f(0)=1$ the maximum exists, too.
