Does finite number of extrema in an interval imply piecewise monotonicity in that interval? If a function $f$ has finite number of extrema in $I$, then is the function piecewise monotone in $I$? If necessary, assume $f$ is continuous on $I$. The reason I'm asking this is I've seen two versions of the Dirichlet condition. One with "finite number of extrema" and another with "piecewise monotonicity". Naturally I assumed one implies the other, and since I know the proof with the latter, I hoped it would imply the former.
 A: I claim that the conjecture is true.
Assume that $f$ has a finite number of extrema and is continuous but not piecewise monotone. Then there is no way to break the domain into a finite number of intervals on which $f$ is monotone. In particular, if we break the domain up into the subintervals between consecutive extrema, there is at least one interval where $f$ is not monotone. Call this interval $[a,c]$.
Now, by construction, $f$ has no extrema on $(a,c)$, but is not monotone there.
Assume WLOG that $f(a) \le f(c).$ (Otherwise, consider $-f$). By the mean value theorem, there exists a maximizer, $b_1$ on the interval. Any maximizer is an extremum, so it must be one of the endpoints. 
(Warning: I reuse the names $b_1$ and $b_2$ later. It should be clear from the context though.)
If $b_1=a$, then $f(a) = f(c)$. Then seek a minimizer, $b_2$, which is again either $a$ or $c$. If $b_2=a$ then $f$ is constant, a contradiction. If $b_2=c$, then $f$ is also constant, a contradiction.
So $b_1=c$. Now seek a minimizer on $[a,c]$, $b_2$, which is again either $a$ or $c$. If if is $c$, then $f$ is constant, a contradiction. So it is $a$.
So $f$ attains its global minima and maxima at $a$ and $c$, respectively, and $f(a)<f(c)$.
Now, by non-monotonicity, there are $b_1 < b_2$ and $f(b_1) > f(b_2)$. consider the maximizer of $f$ on $[b_1,b_2]$. It is one of the endpoints, so it must be $b_1.$ Now, consider the maximizer on $[a,b_1]$, which is either $a$ or $b_1$.
If $a\ne b_1$, then the maximizer can't be $a$, since $a$ is a global minimizer and $f$ is not constant. So it is $b_1$. Thus $b_1$ is maximal on $[a,b_1]$ and $[b_1,b_2]$, so it is an extremum, which is a contradiction.
Therefore, $a=b_1$. But this is impossible, since $a$ is a global minimizer, and $f(b_1)>f(b_2)$.
So the assumption that $f$ is not monotone on $[a,c]$ inevitably leads to a contradiction, and we are done.
