A twice continuously differentiable function 
$f(x)$ is a twice differentiable function on $(a,b)$ and $f''(x)$ $\ne$
  $0$  is continuous on $(a,b)$. Show that for any $x \in (a,b) $ there
  are $x_1,x_2 \in (a,b) $ so that $f(x_2) - f(x_1) = f'(x)(x_2 - x_1)$

I was thinking about applying the mean value theorem, but I have no idea how I can use the fact that my function is twice continuously differentiable.
Thank you a lot in advance!
 A: The key point is that since $f''(x)\neq 0$ for all $x\in (a,b)$ and $(a,b)$ is an open interval, the function $f'$ has neither a maximum, nor a minimum on $(a,b)$. In other words, for any $x\in (a,b)$, one can find $u,v\in (a,b)$ such that $f'(u)<f'(x)<f'(v)$. (This is the only way in which the assumption will be used).
It follows the the set $J:=f'((a,b))$ is an open interval. Indeed, this is an interval by the intermediate value theorem (no need to use the more subtle Darboux theorem here), and this interval is open by the above remark.
Consider the triangle $\Delta=\{ (x_1,x_2)\in (a,b)\times (a,b);\; x_1<x_2\}$, and the map $\Phi:\Delta\to \mathbb R$ defined by 
$$\Phi(x_1,x_2):=\frac{f(x_2)-f(x_1)}{x_2-x_1}\cdot $$
The map $\Phi$ is continuous. Since $\Delta$ is a connected set, it follows that $I:=\Phi(\Delta)$ is a connected subset of $\mathbb R$, i.e. an interval.
Now, observe that $J=f'((a,b))$ is contained in the closure of $I=\Phi(\Delta)$. Indeed, since $(a,b)$ is right-open, we may write $f'(x)=\lim_{z\to x^+}\frac{f(z)-f(x)}{z-a}$ for any $ x\in (a,b)$, so that $f'(x)\in \overline{\Phi(\Delta)}$.
Since $J$ is an open set and $I$ is an interval, it follows that in fact $J\subset I$. So we have $$f'((a,b))\subset \Phi(\Delta)\, ,$$ which gives the required result.
Edit Note that the result may be wrong is $f'$ has a maximum or a minimum on $(a,b)$. For example consider $f(x)=\sin x$ on $(a,b)=(-\frac\pi2,\frac\pi2)$. Then $f'(0)=1$, but $f(x_2)-f(x_1)=\int_{x_1}^{x_2} \cos t\, dt< x_2-x_1$ whenever $x_1<x_2$, because $\cos t<1$ for all but one $t\in (a,b)$. More generally, the result fails if $f'$ has an isolated maximum or an isolated minimum at some point $x\in (a,b)$.
