I'm studying for the entrance exam to the Master's and I came across this analysis question, from one of the previous exams. The exam will ask you real analysis questions. I would like to know if my reasoning is correct (I'm studying Real Analysis but I haven't reached the Riemann Integral part yet).
Let $f \in C^2(\mathbb{R}; \mathbb{R})$ and let [a, b] an arbitrary closed interval. We know that $f'$ is continuous in [a, b] and derivable in (a, b). By the Mean Value Theorem, we have that for every $x \in (a, b]$ exists $c \in (a, x)$ such that
$$0 = f''(c) = \dfrac{f'(x) - f'(a)}{x - a}$$
$$\Rightarrow f'(x) = f'(a).$$
So, we have that $f'$ is a constant in every closed interval [a, b] arbitrary. Therefore, $f'$ is constant in $\mathbb{R}$. It suffices then to integrate $f$, to verify that $f$ is a polynomial.