$f$ has a local maximum value at every point in $(a,b)$. Show that $f$ is constant. 
Assume $f$ is continuous over $[a,b]$ and $f$ has a local maximum value at every point in $(a,b)$. Show that $f$ is constant.

Intuitively it makes sense that the constant function should be the constant function, but maybe one strategy is to prove that it is a necessary and sufficient condition on $f$. In other words, $f$ is continuous over $[a,b]$ and $f$ has a local maximum value at every point in $(a,b)$ if and only if $f$ is constant. Alternatively we can think of it as such: at every point $A_i$ over $[a,b]$, there exists some interval $J_i$ such that $A_i$ is greater than or equal to every value in of $f$ in $J_i$.
I am unsure which route to take to solve this. 
 A: Let $c\in [a,b]$ be a point where $f$ attains its global minimum value $m$.
Let $A = \{ x \in [a,c] : f(y)=m \text{ for all } y\in [x,c] \}$ and let $a'=\inf A$.
Since $f$ is continuous, $f(a')=m$ and so $a'\in A$ and $A=[a',c]$.
Since $a'$ is a local maximum, there is an interval $I$ around $a'$ such that $f(x)\le f(a')=m$ for all $x \in I$. This implies that $f(x)=m$ for all $x \in I$. Therefore, $a'=a$, because otherwise $I$ would contain a point of $A$ less than $a'$. Thus, $A=[a,c]$.
Analogously, by considering $B = \{ x \in [c,b] : f(y)=m \text{ for all } y\in [c,x] \}$, we get that $b'=\sup B=b$ and $B=[c,b]$.
Therefore, $f$ is constant in $[a,b]$, because $[a,b]=[a,c]\cup[c,b]=A\cup B$ and $f$ is constant, equal to $m$, in $A\cup B$.
A: Suppose $f$ has local maximum at every $x \in (a,b)$. Let $U \subset (a,b)$ be the open set for which $x$ is a local maximum. Let $y$ be different from $x$ and in $U$. WLOG suppose $y>x$. Suppose $f(x) \not = f(y)$. Let $V$ be the open set for which $y$ is a local maximum. Then on $V \cap U$ both $x,y$ are local maximums. However, $x<y$ and $y \in U \cap V \subset U$ implies $f(x)\geq f(y)$ but $U \cap V \subset V$ and $x<y$ implies $f(x)\leq f(y)$; hence $f(x) = f(y)$. Since this we can do this for any $x \in (a,b)$ we are done i.e $f$ is constant on $(a,b)$. 
Remark: A more general statement is that if $X$ is a connected topological space, $f: X \to \mathbb{R}$ is continuous (and $\mathbb{R}$ has the usual topology) and $f$ is local constant, then $f$ is constant. 
A: Hint: you need to break the continuity of $f$.
Also, do not assume that $f$ is differentiable -- you can't use that $f'(x) = 0$.
