Continuous function on compact intervals Let  be $  f: \mathbb{R} \rightarrow  \mathbb{R}$  a  continuous  function   and  denote $m(x)$ = min{$f(t) | t \in [x-1, x]$}   and  $M(x) $= max{${f(t) | t \in [x-1, x]}$}  for   every   real $x$. Prove  that if $m(x) + M(x) =0$   for  every $x$  then  functions  $m$ and $ M $ are  constant.  Can  you  give  me  a  hint? I  tried   to  use  that f   is  continuous on  the  compact   interval $[x-1, x]$ so  is  bounded   and   min  and   max   are  touched.
 A: Choose $x,y\in\mathbb{R}$ s.t. $x<y$ and $[x-1,x]\cap[y-1,y]\neq\varnothing$.
And let $M(x)=k$, $m(x)=-k$, I will call $M(x)$ and $m(x)$ "a pair". And let's assume that $M(x)>M(y)>0\implies m(x)<m(y)<0$
1) If $k\text{ or }-k\in[x-1,x]\cap[y-1,y]\implies M(x)=M(y),m(x)=m(y)$, then we're done.
2) If not 1), then let's assume that $M(x),M(y)$ are fixed in their own intervals, then choose an $a$ s.t. $x<a<y$. Since the sum of the length of these two interval always $\le 2$, so by Intermediate Value Thm, no matter how we choose $a$, $M(y)\le M(a)\le M(x)$ and $m(x)\le m(a)\le m(y)$ always hold. Because $f$ is continuous, the maximum and the minimum cannot appear arbitrarily close, so $\exists a$ s.t. either $M(x)$ or $m(x)$ belongs to $[a-1,a]$, but not this pair (I choose $M(x),m(x)$ because they control the range on the two intervals), so in this case the interval $[a-1,a]$ doesn't satisfy the assumption because now $M(a)+m(a)\neq0$. We reach a contradiction.
Thus, $M(x)=M(y)$.
Similar process also works for proving $m(x)=m(y)$.
Since we can take any two intervals in $\mathbb{R}$ such that their intersection is not empty and do this, $M(x)$, $m(x)$ are both constant functions.
Note: If anybody found flawed logic in my proof please tell me or edit it. Thanks.
