If twice-differiantiable $f$ satisfies $f(x)f''(x)=0$ for all $x\in\mathbb R$, then $f$ is a polynomial of degree at most $1$ Let $f: \mathbb R \to \mathbb R$ be a twice differentiable function such that$$f(x)f''(x)=0.\quad \forall x \in \mathbb R$$Then is it true that $f$ is a polynomial of degree at most $1$? I could not find any other function satisfying the condition, but could not prove that there are no other functions. Please help.

Here is a simpler approach which does not involve extending intervals on which $f$ does not vanish.
Suppose there exists $x_0 \in \mathbb{R}$ such that $f''(x_0) ≠ 0$. Without loss of generality, assume that $f''(x_0) > 0$. Since $f(x_0) f''(x_0) = 0$, then $f(x_0) = 0$. If there exists $δ > 0$ such that $f(x) ≠ 0$ for any $x \in (x_0, x_0 + δ)$, then$$
f(x) f''(x) = 0 \Longrightarrow f''(x) = 0, \quad \forall x \in (x_0, x_0 + δ)
$$
which is contradictory to the fact that $f''(x_0) ≠ 0$ and Darboux's theorem. Therefore, there exists $\{x_n\} \subseteq (x_0, x_0 + δ)$ such that $x_n → x_0\ (n → ∞)$ and $f(x_n) = 0$ for all $n \geqslant 1$, which implies $f'(x_0) = 0$.
Now, because $f''(x_0) > 0$, there exists $δ_0 > 0$ such that $f'(x) > f'(x_0) = 0$ for any $x \in (x_0, x_0 + δ_0)$, which implies $f$ is strictly increasing on $[x_0, x_0 + δ_0]$. Therefore,$$
f(x) > f(x_0) = 0,\ f(x) f''(x) = 0 \Longrightarrow f''(x) = 0, \quad \forall x \in (x_0, x_0 + δ_0]
$$
which again leads to contradiction by Darboux's theorem.
Hence, $f''(x) = 0$ for all $x \in \mathbb{R}$, which implies $f(x)$ is a polynomial of $x$ with degree no greater than $1$.
