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.
 A: 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$.
A: $(f^2)''=2(f')^2\geq 0$ so that $f^2$ is convex.
If $f^2(a)=f^2(b)=0$ for $a\neq b$, then consider the following type (Others are similar) :
$f^2|[a,b]=0$ and $f^2|\mathbb{R}^2-[a,b]>0$
Here by an assumption $f''|\mathbb{R}^2-[a,b]=0$. so that $f$ is linear on $\mathbb{R}^2-[a,b]$
And $f=0$ on $[a,b]$ 
A: Elaborating on @BettyBel's comment (who
unfortunately did not come back to post an answer):
$$
 A = \{ x \in \Bbb R \mid f(x) \ne 0 \} \, .
$$
is an open set. If $A$ is empty or $A = \Bbb R$ then we are done.
Otherwise the connected components of $A$ are (bounded or unbounded)
open intervals of the form
$$
  (-\infty, a) \quad \text{or} \quad (b, \infty) \quad\text{or}\quad (a, b) \, .
$$
Now it is easy so see that the last case can not occur: 
If $I = (a, b)$ is a connected component of $A$ then $f$ is linear on $I$ with $f(a) = f(b) = 0$,
contradicting that $f(x) \ne 0$ for all $x \in I$.
Therefore
$$
 A = (-\infty, a) \cup (b, \infty)
$$
for some $a \le b$, and $f$ is linear on each of the intervals
$$
 (-\infty, a] \, , \, [a, b] \, , \, [b, \infty) \, .
$$
Since $f$ is differentiable the slope must be the same on each
interval, i.e. $f$ is linear on $\Bbb R$.
A: It suffices to prove that $f'' \equiv 0$. Here, we only assume that $f$ is twice-differentiable but not a-priori known to be $C^2$.

Let $I = \{ x \in \mathbb{R} : f(x) = 0 \}$. We immediately check that

  
*
  
*If $f''(x) \neq 0$, then $f(x) = 0$ and hence $x \in I$.
  
*If $x$ is an interior point of $I$, then $f \equiv 0$ near $x$ and hence $f''(x) = 0$.
  

This tells that $f''(x) \neq 0$ is possible only for $x \in \partial I$. Now we claim that $\partial I$ has at most 2 points. Once this is proved, a simple argument (Lemma 2 applied to $g = f'$) shows that $f''$ is identically zero.
Lemma 1. $\partial I$ has at most 2 elements.
Proof. If $a < b$ are in $I$, then $\frac{d}{dx}f(x)f'(x) = f'(x)^2$ tells that
$$ \int_{a}^{b} f'(x)^2 \, dx = \left[ f(x)f'(x) \right]_{a}^{b} = 0. $$
Since $f'$ is continuous, $f' \equiv 0$ on $[a, b]$ and hence $f$ is constant on $[a, b]$ with value $f(a) = 0$. So $[a, b] \subseteq I$. This implies that $I$ is connected. Since $I$ is closed, it is either empty, singleton or closed interval. The claim is true in any cases. ////
Lemma 2. If $g : \mathbb{R} \to \mathbb{R}$ is differentiable and $g'(x) \to \ell$ as $x \to a$, then $g'(a) = \ell$.
Proof. By the mean value theorem, for each $x \neq a$, there exists $\xi = \xi(x)$ between $x$ and $a$ such that $g(x) - g(a) = g'(\xi)(x - a)$. Since $\xi(x) \to a$ as $x\to a$, it follows that
$$ g'(a) = \lim_{x \to a} \frac{g(x) - g(a)}{x-a} = \lim_{x\to a} g'(\xi(x)) = \ell. $$
A: Let $a\in \mathbb R.$ Suppose $f''(a)\ne 0.$ Because $f''$ is continuous, $f''(x)\ne 0$ for all $x$ in an open interval $I$ containing $a.$ The given condition then implies $f=0$ in $I.$ But if $f=0$ on $I,$ then $f''=0$ on $I,$ contradiction. Therefore $f''(a)=0.$  Since $a\in \mathbb R$ was arbitrary, $f''=0$ everywhere in $\mathbb R.$ This implies $f$ is a polynomial of degree at most $1.$
