Prove that a function that satisfies the following condition is a polynomial Assume that $ f: \mathbb{R} \to \mathbb{R} $ is a continuous function, such that
$$ f\left(x\right)=\frac{f\left(x-r\right)+f\left(x+r\right)}{2} $$
For any $ x\in \mathbb{R} $ and any $ r>0 $.
Prove that $ f $ is a polynomial of degree at most 1.
This may be related to complex analysis because I got this question in my complex analysis course, I guess I just cant see it.
Any help would be appreciated, thanks in advance.
 A: The problem becomes easier if you define
$$
g(x) = f(x) - f(0).
$$
Observe
$$
g(x) = f(x) - f(0) = \frac{f(x-r)+f(x+r)}{2} - f(0) = \frac{g(x-r)+g(x+r)}{2}
$$
and
$$
g(0) = 0.
$$
Statement 1: for any $n \in \mathbb{N}$ and $r>0$:
$$
g(nr) = ng(r).
$$
Proof: by induction

*

*seed the induction $2 g(r) = g(0) + g(2r)$ thus $g(2r) = 2g(r)$.

*step of the induction: $2 g([n-1]r) = g([n-2]r) + g(nr)$ thus $g(nr) = (2[n-1]-[n-2])g(r) = ng(r)$
Induction follows QED
Statement 2: for any $n \in \mathbb{Z}$ and $x \in \mathbb{R}$:
$$
g(nx) = ng(x).
$$
Proof: observe $2 g(0) = g(-r) + g(r)$, thus $g(-r)=-g(r)$ for any $r>0$. Now consider any $n \in \mathbb{Z}$ and $x \in \mathbb{R}\setminus\{0\}$
$$
g(nx) = g(\text{sign}(x)\text{sign}(n)|n||x|)
= \text{sign}(x)\text{sign}(n) g(|n||x|)
= \text{sign}(x)\text{sign}(n) |n| g(|x|)
= \text{sign}(n) |n| g(\text{sign}(x)|x|)
= n g(x).
$$
Case $x=0$ is trivial. QED
Statement 3: for any $n \in \mathbb{Z}$, $m \in \mathbb{Z}$, and $x \in \mathbb{R}$:
$$
g\left(\frac{n}{m}x\right) = \frac{n}{m}g(x).
$$
Proof: consider $m \in \mathbb{Z}$
$$
g(x) = g\left(\frac{m}{m}x\right) = m g\left(\frac{1}{m}x\right)
$$
thus
$$
g\left(\frac{1}{m}x\right) = \frac{1}{m} g(x)
$$
the rest is obvious. QED
Statement 4: for any $x \in \mathbb{Q}$ we can write $g(x) = kx$ for some $k \in \mathbb{R}$.
Proof: consider $x \in \mathbb{Q}$, thus $x = n/m$ for $n \in \mathbb{Z}$, $m \in \mathbb{Z}$
$$
g(x) = g\left(\frac{n}{m}\right) = \frac{n}{m} g(1) = g(1) x.
$$
We define $k = g(1)$. QED
Statement 5: for any $x \in \mathbb{R}$ we can write $g(x) = kx$ for some $k \in \mathbb{R}$.
Proof: since $f$ was continuous, $g$ is as well. By continuity and statement 4 we conclude $g(x) = kx$ for $x \in \mathbb{R}$ not only $\mathbb{Q}$ ($\mathbb{Q}$ is dense in $\mathbb{R}$). QED
Final statement: $f(x) = k x + b$.
Proof: define $b = f(0)$ and use statement 5. QED
