Prove that this continuous function takes the value $0$ for every $x$ 
Let $f : [0,1] \to \mathbb{R}$ be continuous, with $f(0) = f(1) = 0$. Suppose that for every $x ∈ (0,1)$ there exists $δ > 0$ such that both $x + δ$ and $x − δ$ belong to $(0,1)$ and $f(x) = (f(x −δ)+f(x+δ))/2$. Prove that $f(x) = 0$ for every $x ∈ [0,1]$.

I notice that $f(x) = (f(x −δ)+f(x+δ))/2$ is equivalent to
$$f(x+δ)-f(x)=f(x)-f(x-δ),$$ which gives the equality between derivatives when $δ$ tends to $0$.
So I think I should show that the derivative is constant in all $(0,1)$, and being $f(0)=f(1)=0$ the derivative is $0$, so $f(x)$ is constant, and is $0$ in all $[0,1]$.
But how do I move from that discrete equality to the continuous equality?
 A: Let $M=\sup_{x\in [0,1]}f(x)$, $A=\{x\in [0,1]:f()=M\}\ne \emptyset$ ($f$ is continuous on the compact set [0,1]) and $a=\inf(A)$. By continuity $a\in A$.  We show by contradiction that $a\in\{0,1\}$: otherwise $a\in (0,1)$ and $\exists \delta>0$ such that $a-\delta,a+\delta\in(0,1)$ and
$$f(a) = \frac{f(a −\delta)+f(a+\delta)}{2}\implies f(a −\delta)=2f(a)-f(a+\delta)\geq 2M-M=M, $$
which implies $ f(a −\delta)=M$, and $a-\delta\in A$, contradicting the definition of $a$. Therefore $M=0$.
Similarly,  let $m=\inf_{x\in [0,1]}f(x)$, $B=\{x\in [0,1]:f()=m\}\ne \emptyset$ and $b=\inf(B)$. By continuity $b\in B$, and as before we show that $b\in\{0,1\}$. Therefore $m=0$.
Hence $0=m\leq f\leq M=0$, and it follows that $f$ is identically equal to $0$.
A: Since $f$ is a continuous function and $[0,1]$ is compact, $f$ must have a maximum value $M$ and a minimum value $m$. If $M=m=0$, we are done.
Suppose that $M \neq 0$. Then, since $f(0)=f(1)=0$, we must have $M>0$. Since $f$ is continuous, we know that $f^{-1}(\{M\})$ is a closed subset of $[0,1]$, and so, it is compact. Let $x_M= \min f^{-1}(\{M\})$ (such $x_M$ exists because $f^{-1}(\{M\})$ is compact). Since $x_M \in f^{-1}(\{M\})$, we have that $f(x_M)=M$. It is easy to see that $x_M \in (0,1)$.
But there must exist $\delta >0$ such that  $$M=f(x_M) = (f(x_M −δ)+f(x_M+δ))/2$$  But, $f(x_M −δ)\leq M$ and $f(x_M+δ)\leq M$. So we must have $f(x_M −δ)= f(x_M+δ)=M$. Ccontradiction since $x_M= \min f^{-1}(\{M\})$.  So, $M=0$.
In a similar way, we prove that $m=0$.
Suppose that $m \neq 0$. Then, since $f(0)=f(1)=0$, we must have $m<0$. Since $f$ is continuous, we know that $f^{-1}(\{m\})$ is a closed subset of $[0,1]$, and so, it is compact. Let $x_m= \min f^{-1}(\{m\})$ (such $x_m$ exists because $f^{-1}(\{m\})$ is compact). Since $x_m \in f^{-1}(\{m\})$, we have that $f(x_m)=m$. It is easy to see that $x_m \in (0,1)$.
But there must exist $\delta >0$ such that  $$m=f(x_m) = (f(x_m −δ)+f(x_m+δ))/2$$  But, $f(x_m −δ)\geq m$ and $f(x_m+δ)\geq m$. So we must have $f(x_m −δ)= f(x_m+δ)=m$. Contradiction since $x_m= \min f^{-1}(\{m\})$.  So, $m=0$.
