TITLE: If $f$ is twice differentiable and $f(2^{-n}) = 0 $, for all $n \in \mathbb N$, then $f^\prime(0) = f^{\prime\prime}(0) = 0$.
QUESTION [5 upvotes]: Let $f : \mathbb R \to \mathbb R$ be a twice differentiable function, such that $f(2^{-n}) = 0$, for all $n \in \mathbb N$ . Show that $$f^\prime(0) = f^{\prime\prime}(0) = 0.$$
My attempt. 
First, let us show that $f(0) = 0$ . Since $f$ is twice differentiable, it is also continuous. Suppose $f(0) = k$ where $k \ne 0$ . Then there is a $\delta > 0$ such that whenever $x \in (-\delta,\delta)$ , $f(x) \in (k/2,3k/2)$ . But $f(2^{-n}) = 0 $ for all positive integer values of $n$ . Thus we have a contradiction as no $\delta$ works for $f$ to be continuous at $x=0$ . Thus $f(x) = 0$.
$f(x)$ is differentiable , thus $f^\prime(x)$ is continuous. Suppose $f^\prime (0) = m$ such that $m\neq0$ , then by continuity of $f^\prime(x)$ there is a $\delta$ such that whenever $x \in (-\delta,\delta)$ , $f^\prime(x) \in (m/2,3m/2)$ . Choose an $N$ such that 
$2^{-N} < \delta$  . Now, $\int_{x=0}^{1/2^N} f^\prime(x) = f(2^{-N}) - f(0) = f(2^{-N})$ (I am confused whether this integral exists or not ,as in if $f^\prime(x)$ is integrable or not in the interval I am using) . Now $\int_{x=0}^{1/2^N} f^\prime(x) > m/2(1/2^N)$ as the integral would be greater than the rectangle formed using a lower bound for the value of $f$ in the interval. Thus  $\int_{x=0}^{2^{-N}} f^\prime(x) > 0$ and thus $f(2^{-N}) > 0$ but this is a contradiction as $f(2^{-N}) = 0$ by the function definition. Thus we have a contradiction and thus, $f^\prime(0)$ can't be non-zero. 
We can proceed similarly to prove that $f^{\prime\prime}(0) = 0$ . 
Is my approach correct, is there a better way to prove it ?  I am not sure if my solution is correct as I am not sure of using integrals the way I used it. Thanks.

REPLY [11 votes]: Your approach can be fixed. This can be also shown using the Mean Value Theorem (MVT).
Using MVT, we obtain that
$$
0=f(2^{-n})-f(2^{-n-1})=2^{-n-1}f'(x_n), 
$$
for some $x_n\in (2^{-n-1},2^{-n})$. Thus we can define $\{x_n\}_{n=1}^\infty$, such that $x_n\to 0$ with $f'(x_n)=0$, for all $n\in\mathbb{N}$, which implies by the continuity of $f'$, that
$$
f'(0)=\lim_{n\to\infty} f'(x_n)=0.
$$
Since $f'$ is differentiable at $x=0$, and $x_n\to 0$, then
$$
0=\lim_{n\to \infty}\frac{f'(x_n)-f'(0)}{x_n}=\lim_{h\to 0}\frac{f'(h)-f'(0)}{h}=
f''(0).
$$ 
Note. If it was given that $f$ was $k$ times differentiable, then this method explained above, would provide that $f^{(j)}(0)=0$, for all $j=1,2,\ldots,k$.