Show $f$ is neither convex nor concave in $(a,b)$ Let $f: \mathbb{R} \to \mathbb{R}$ be differentiable, with $f^{'}$ continuous. In $a,b \in \mathbb{R}$ $\ f$ has local extrema, $f(a) \neq f(b)$. I want to show $f$ is neither convex nor concave in $(a,b)$. My approach:
We have $f(a) \neq f(b) \implies a \neq b$. We also notice $f^{'}(a)=f^{'}(b)=0$. Together, this means that $f^{'}$ is not injective. Then we use the following fact:
A continuous function $g$ is injective $\iff$ $g$ is strictly monotonous.
Since $f^{'}$ is not injective, it's not strictly monotonous.
Now comes the shaky part:
From what we know $f^{'}$ is either constant with $f^{'}(x)=0$ or $f^{'}$ is not monotonous (at all) in $a,b \in \mathbb{R}$. If $f^{'}$ is constant with $f^{'}(x)=0$, this would mean $f$ is constant, which contradicts $f(a) \neq f(b)$. If $f^{'}$ is not monotonous, we use the following facts:
A function $g$ is convex (concave) $\iff$ $g'$ is monotonically increasing (decreasing), not necessarily strictly.
From this, we have $f$ neither convex nor concave since $f^{'}$ is not monotonous.
I would appreciate any comments on this approach, particularly on how to formally justify that $f^{'}$ is not monotonous (at all) in $(a,b)$.
EDIT:
We can actually replace the shaky part with the following idea.
We know $f^{'}(a)=f^{'}(b)=0$. From Rolle' theorem, we have $ \exists \ x_0 : f^{''}(x_0)=0$ and $x_0$ is an inflection point. For this to work, however, we would have to know $f^{'}$ is differentiable in $(a,b)$.
 A: This works with a similar argument as the proof the Rolle's theorem. Since you have $f'(a)=f'(b)=0$, either $f'$ is $0$ the whole time in between (you handled that), or there is one value in between that is not $0$: $f(c)=v, a < c < b, v \ne 0$. 
The end of  my argument is incorrectly worded, as pointed out by user158189:

If $v > 0$, $f'$ is strictly increasing from $a$ to $c$ and strictly
  decreasing from $c$ to $b$. If $v<0$, it's the other way around.

What I meant to say is:
If $v > 0$, $f'$ is neither (non-strictly) increasing from $a$ to $b$, because that would require $f'(c) \le f'(b)$ which contradicts $v=f'(c) > 0=f'(b)$ nor (non-strictly) decreasing, because that would require $f'(a) \ge f'(c)$ which contradicts $0=f'(a) < v=f'(c)$. If we have $v < 0$, the argument works similar.
A: The 'shaky' part is false.
A non-constant continuous map which is not injective can be monotonuous in the weak sense. For example, consider the function $\mathbb{R} \to \mathbb{R}$ defined by
$$x \mapsto 
\begin{cases}
0 &\quad \text{if } x \leq 0, \\
x &\quad \text{if } 0 \leq x \leq 1, \\
1 &\quad \text{if } x \geq 1.
\end{cases} $$
To prove that the function is not convex on $[a,b]$, it suffices to show that the linear function $g:\mathbb{R} \to \mathbb{R}$ with $g(a) = f(a)$ and $g(b) = f(b)$ does not satisfy $g \geq f$ on $[a,b]$ nor $g \leq f$ on $[a,b]$ ('not every line segment should be above or below the graph of $f$' if $f$ is convex nor concave). Let $c \in \mathbb{R}$ be such that $g'(x) = c$ for all $x \in \mathbb{R}$. For simplicity we assume that $c > 0$. The function $h = f-g$ then satisfies $h'(a) = h'(b) < 0$. This shows that for some $\zeta_1,\zeta_2 \in (a,b)$ we have $h(\zeta_1) < 0$ and $h(\zeta_2) > 0$. Hence neither $g \geq f$ on $[a,b]$ nor $g \leq f$ holds on $[a,b]$. Therefore $f$ is not concave and not convex on $[a,b]$. By continuity of $f$ this extends to $(a,b)$.
