Assume that $f$ is continuous at $[a,b]$ and differentiable at $(a,b)$. Prove that if $f''(x) \neq 0$ for every $x \in (a,b)$ then $f$ gets every value at $[a,b]$ twice, at most.
I tried to prove it by assuming that there exist $x_1 > x_2 > x_3 $ such that $f(x_1) = f(x_2) = f(x_3)$. but can not really understand how to use the assumption that $f''(x) \neq 0$ for every $x \in (a,b)$
I suppose you need to use Rolle's theorem but I didn't get there just yet.