Polynomial must be monotone between its extrema Suppose that the polynomial function $f(x)=x^n+a_{n-1}x^{n-1}+\cdots +a_0$ has $k_1$ local maximum points and $k_2$ local minimum points. Show that $k_2=k_1+1$ if $n$ is even, and $k_2=k_1$ if $n$ is odd.
Solution to the problem:
Let $l$=$k_1+k_2$ and let $a_l\lt a_{l-1}\lt \cdots a_1$ be all the local maximum and minimum points. On the intervals between these points $f$ is either decreasing or increasing. Since $\lim_{x\to \infty}f(x)=\infty$, the function $f$ must be increasing on $(a_1,\infty)$. Thus $a_1$ must be a local minimum point. Consequently, $f$ must be decreasing on $(a_2,a_1)$, which shows that $a_2$ must be a local maximum point. Continuing in this way we see that $a_k$ is a local minimum point if $k$ is odd and a local maximum point if $k$ is even. 
Now if $n$ is even, then $a_l$ must be a local minimum point, since $\lim_{x\to -\infty}f(x)=\infty$. Thus $l$ must be odd, so $a_1,a_3,\dots,a_l$ are the local minimum points, and $a_2,\dots, a_{l-1}$ are the local maximum points. Consequently $k_2=k_1+1.$ If $n$ is odd, then $a_l$ must be a local maximum point, since $\lim_{x\to -\infty}f(x)=-\infty$. The same sort of reasoning then shows that $k_1=k_2$. QED.
I don't know how to prove the bold part. It's intuitively clear from the graph of a polynomial, however, I can't give a proof to this. The only information is $f'$ is zero at each $a_i$ and both $f$ and $f'$ are polynomials. I need to show that $f'$ is either positive or negative on these intervals. How can I show this? I would greatly appreciate any solutions, hints or suggestions.
 A: All answer so far use differentiation (which is fine).
However, we have the more general
Proposition. Let $f\colon\mathbb R\to\mathbb R$ be continuous and have only finitely many local extrema, at $x_1<x_2<\ldots < x_N$ say. If $x_1$ is a local minimum[maximum] then all $x_i$ with odd $i$ are local minima[maxima] and all $x_i$ with even $i$ are local maxima[minima].
Additionally, if $f(x)\to+\infty$[$-\infty$] as $x\to+\infty$, then $x_N$ is a local minimum[maximum].
Similarly,  if $f(x)\to+\infty$[$-\infty$] as $x\to-\infty$, then $x_1$ is a local minimum[maximum].
The first part follows immediately from
Lemma 1. Let $f\colon\mathbb R\to\mathbb R$ be continuous, let $a$ be a local minimum, $b$ a local extremum, and assume there is no local extremum in $(a,b)$. Then $b$ is a local maximum.
Proof.
Assume on the contrary that $b$ is a local minimum.
Then there exists $\epsilon>0$ such that $f(x)\ge f(a)$ for $x\in[a,a+\epsilon)$ and $f(x)\ge f(b)$ for $x\in(x-\epsilon,b]$.
The function $f|_{[a,b]}$ is continuous with compact domain, hence attains its maximum  at some $c\in[a,b]$.
If $a<c<b$ then $c$ is also a local maximum of $f$.
If $c=a$ then $f(x)\le f(c)$ for $x\in[a,a+\epsilon)$, hence $f$ is constant on $[a,a+\epsilon)$ and each point in $(a,a+\epsilon)$ is a local extremum.
Similarly if $c=b$ then each point in $(b-\epsilon,b)$ is a loacl extremum.
At any rate, we find a local extremum between $a$ and $b$, contrary to assumption. $_\square$
The rest of the proposition follows from 
Lemma 2. Let $f\colon\mathbb R\to\mathbb R$ be continuous. If $a$ is a local maximum of $f$ and $f(b)>f(a)$ for some $b>a$, then $f$ has a local minimum in $[a,b)$.
Proof. $f|_{[a,b]}$ attains its minimum in some $c\in[a,b]$, where necessarily $c<b$. If $c>a$, this is also a local minimum of $f$. If on the other hand $c=a$ then as above $f$ is constant on some $[a,a+\epsilon)$ and each point in this interval is a local minimum. $_\square$
If we apply the proposition to a polynomial with leading term $x^n$ and observe that the last local extremum must be a local minimum, whereas the first local extremum must be a maximum[minimum] if $n$ is odd[even], the main claim follows.
A: Hint
$f$ is a polynomial, so $f'$ is continuous. Let $a < b$ be two neighboring local extrema of $f$. Assume $f$ is not monotone on $(a,b)$. Then $f$ must be sometimes increasing and sometimes decreasing. Since $f$ is continuous, there must be a point where $f$ neither increases nor decreases, which would be the next extremum of $f$, contradicting $a,b$ being neighboring extrema.
You have to take care of the case when $f'(x) = f''(x) = 0$ though - there your point would be a critical point but not an extremum...
