All continuous functions $f: \mathbb{R} \to \mathbb{R}$ satisfying $n^2 \int_x ^{x + {1\over n}} f(t)\,dt = nf(x) + {1\over2}$? As the question title suggests, what are all continuous functions $f: \mathbb{R} \to \mathbb{R}$ satisfying$$n^2 \int_x^{x + {1\over n}} f(t)\,dt = nf(x) + {1\over2},$$for any $x \in \mathbb{R}$ and any positive integer $n$, $n \ge 2$?
 A: As $f$ is continuous on $\mathbb{R}$, consider an antiderivative $F$. The given relation is equivalent to$$n^2\left(F\left(x + {1\over n}\right) - F(x)\right) = nf(x) + {1\over2},\tag*{$(1)$}$$for any $x \in \mathbb{R}$ and all $n \in \mathbb{N}$.
As a consequence, $f$ has finite derivative at any point. Taking derivatives in $(1)$, we get$$n\left(f\left(x + {1\over n}\right) - f(x)\right) = f'(x)\tag*{$(2)$}$$for $x \in \mathbb{R}$ and $n \in \mathbb{N}$.
From $(2)$ it follows that $f$ is twice differentiable and the following relation holds$$n\left(f'\left(x + {1\over n}\right) - f'(x)\right) = f^{\prime\prime}(x),$$implying that $f^{\prime\prime}$ is continuous.
Consider $x \in \mathbb{R}$. By the mean value theorem, relation $(2)$ implies the existence of a point $c_n = c_n(x) \in (x, x + {1\over n})$ with $f'(c_n) = f'(x)$. By Rolle's theorem, for $f'$ on the interval with endpoints $x$ and $c_n$, we get a point $\zeta_n$ belonging to the interval with endpoints $x$ and $c_n$ and having the property that$$f^{\prime\prime}(\zeta_n) = 0.\tag*{$(3)$}$$As $\lim_{n \to \infty} \zeta_n = x$, the continuity of $f^{\prime\prime}$, and $(3)$, give together$$f^{\prime\prime}(x) = \lim_{n \to \infty} f^{\prime\prime}(\zeta_n) = 0.$$As $x$ was arbitrary, we deduce that $f$ has the form $f(x) = ax + b$, where $a$, $b \in \mathbb{R}$. Substituting in the given relation, we find $a = 1$.
We conclude $f(x) = x + b$, with $b$ arbitrary.
A: By the trapezoid rule, the left side is $\frac{n}2(f(x)+f(x+\frac1n))+O(\frac1n)$. Combined with the right side
$$
n\left(f\Bigl(x+\frac1n\Bigr)-f(x)\right)=1+O(\frac1n)
$$
In the limit $n\to\infty$, this gives $f'(x)=1$. The assumption for the error term of the trapezoid rule is $f\in C^2$.

Without differentiation, consider $g(x)=f(x)-x$. Then
$$
n^2\int_x^{x+\frac1n}g(t)dt=nf(x)+\frac12-\frac12(2nx+1)=ng(x).
$$
Combining two intervals of half the length results in
$$
g(x)=n\int_x^{x+\frac1n}g(t)dt=\frac12·2n\int_x^{x+\frac1{2n}}g(t)dt+\frac12·2n\int_{x+\frac1{2n}}^{x+\frac1{n}}g(t)dt
\\
=\frac12\Bigl(g(x)+g\Bigl(x+\frac1{2n}\Bigr)\Bigr)
$$
or in short
$$
g(x)=g\Bigl(x+\frac1{2n}\Bigr)=…=g\Bigl(x+\frac{k}{2n}\Bigr)
\quad\forall k\in\Bbb Z
$$
Now combine these result for all dyadic $n=2^m$ to get $g$ constant on a dense subset of $\Bbb R$.
By continuity, $g$ has to be a constant function.
A: As $\;f\;$ is continuous it has a primitive function on any bounded integral, say $\;F\;$ , and thus:
$$\int_x^{x+\frac1n}f(t)dt=F\left(x+\frac1n\right)-F(x)$$
so we want to check when the following equality is true:
$$n^2\left(F\left(x+\frac1n\right)-F(x)\right)=nf(x)+\frac12$$
But we can write
$$n^2\left(F\left(x+\frac1n\right)-F(x)\right)=n\frac{F\left(x+\frac1n\right)-F(x)}{\frac1n\left(=x+\frac1n-x\right)}\stackrel{MVT}=nF'(t)=nf(a)\;,\;\;a\in\left[x,\,x+\frac1n\right]$$
So we in fact need that
$$nf(a)=nf(x)+\frac12$$
Try now to take it from here....
