TITLE: Show such a function has a maximum
QUESTION [5 upvotes]: 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?

REPLY [2 votes]: 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.