text: Q:
  
  true or false- continuous functions
  
  I'm having some hard time deciding if those sentences are true or false:
  $1$. If $f$ is continuous on $\mathbb{R}$ then if $\left|f(x)-x\right|<1$ for every $x$ on $\mathbb{R}$ then $f$ is getting every real value on $\mathbb{R}$.
  $2$.  If $f$ is continuous on R then if $\left|f(x)-x\right|>1$ for every $x$ on $\mathbb{R}$ then $f$ is getting every real value on $\mathbb{R}$.
  $3$. If $f$ is continuous on $(a,b)$ then if $f$ is getting maximum on $(a,b)$ then it isn't injective on $(a,b)$.
  I feel like the first and the third ones are true but I'm not sure so I would appreciate some guidance :)
  
  A:
  
  $1)$ True. Assume by way of contradiction that $f(x)\neq a$ for some $a\in\mathbb{R}$. By our condition on $f(x)$, we know
  $$-1<f(a-2)-(a-2)<1$$
  $$a-3<f(a-2)<a-1$$
  and
  $$-1<f(a+2)-(a+2)<1$$
  $$a+1<f(a+2)<a+3$$
  This implies
  $$f(a-2)<a<f(a+2)$$
  Then by the intermediate value theorem, there exists $c\in (a-2,a+2)$ such that $f(c)=a$. Since this contradicts our assumption, we conclude the range of $f(x)$ is all the real numbers.
  $2)$ False. $f(x)=x^2+x+2$ is a counterexample. We have
  $$|f(x)-x|=|x^2+x+2-x|=|x^2+2|\geq 2>1$$
  for all $x\in\mathbb{R}$. But $f(x)$ is minimized at $x=-\frac{1}{2}$. There, $f\left(-\frac{1}{2}\right)=\frac{7}{4}>0$. Thus, $f(x)$ is always positive and the conjecture is false.
  $3)$ True. Let $f(x)$ be maximized at $c\in(a,b)$. Now, consider the interval
  $$I=\left[c-\frac{c-b}{2},c+\frac{a-c}{2}\right]$$
  Note that
  $$c-\frac{c-b}{2}>c-(c-b)=b$$
  $$c+\frac{a-c}{2}<c+(a-c)=a$$
  This implies $I\subset (a,b)$. Now, consider $f(x)$ at
  $$s_1=f\left(c-\frac{c-b}{2}\right)$$
  $$s_2=f\left(c+\frac{a-c}{2}\right)$$
  First, if either $s_1=f(c)$ or $s_2=f(c)$, then $f(x)$ is not injective on $I$ (and therefore not injective on $(a,b)$) and we are done. Suppose $s_1<f(c)$ and $s_2<f(c)$. Now, if $s_1=s_2$, we are done. If not, consider the case where $s_1<s_2$. Then define $h(x)=f(x)-s_2$. Then
  $$h(c)=f(c)-s_2>0$$
  $$h\left(c-\frac{c-b}{2}\right)=f\left(c-\frac{c-b}{2}\right)-s_2=s_1-s_2<0$$
  $$h\left(c+\frac{a-c}{2}\right)=f\left(c+\frac{a-c}{2}\right)-s_2=s_2-s_2=0$$
  By the intermediate value theorem, there exists
  $$d\in \left(c-\frac{c-b}{2},c\right)$$
  such that $h(d)=0$. But then
  $$0=h(d)=h\left(c+\frac{a-c}{2}\right)$$
  $$s_2=f(d)=f\left(c+\frac{a-c}{2}\right)$$
  and we are done. In a similar manner, we can modify this proof for $s_1>s_2$. Having exhausted all cases, we conclude $3)$ is true.
  
  