Suppose $f$ is a Continuous function on $\Bbb R$ and $g: \Bbb R \to \Bbb R$ a function such that $$ \frac{1}{2r}\int_{x-r}^{x+r}f(t)dt \to g(x) \text{ uniformly }$$ when $r\rightarrow \infty$, then show that $g(x)=ax+b$ for some $a,b \in \Bbb R$.
I really have no idea on how to approach the problem. Thanks in advance for help!
We have
$$\frac{1}{2r}\int_{x-a-r}^{x-a +r} f(t)\, dt + \frac{1}{2r}\int_{x+a-r}^{x+a+r} f(t)\, dt \\= \frac{r+a}{r}\frac{1}{2(r+a)}\int_{x - (r+a)}^{ x + (r+a)}f(t) \, dt + \frac{r-a}{r}\frac{1}{{2(r-a)}}\int_{x - (r-a)}^{ x + (r-a)}f(t) \, dt $$
Taking limits with $a$ fixed we get $g(x- a) + g(x+a) = 2g(x)$ since $(r \pm a)/r \to 1$ as $r \to \infty$. Substituting with $u = x-a$ and $v = x+a$, it follows that
$$g(u) + g(v) = 2 g ((u+v)/2)$$
Now take $h(x) := g(x) - g(0)$, whence $ h(u) + h(v) = 2h((u+v)/2)$ and $h(0) = 0$.
Thus,
$$h(u+v) = h(u+v) + h(0) = 2h((u+v+0)/2) = 2h((u+v)/2) = h(u) + h(v),$$
and we see that $h$ must be a linear function. It is also continuous as the uniform limit of continuous functions.
Finally, it can be shown that a linear function with points of continuity must be of the form $h(x) = h(1)x$ and, therefore,
$$g(x) = h(x) + g(0) = h(1)x + g(0) = ax+b$$