What is a solution of such equation concerning the arithmetic and integral means? Let $f:[a,b] \rightarrow \mathbb R$ be integrable and satisfies 
$$
f\left(\frac{x+y}{2}\right)=\frac{1}{y-x} \int_x^y f(t)dt 
$$
for all $x \neq y$, $x,y \in [a,b]$. 
What about $f$? Is it affine function?
Thanks
 A: Without loss of generality,  $a < 0 < b$. The integral formula tells us that $f$ is continuous. Using the integral formula again, we see that $f$ is differentiable in $(-1,1)$. Then by differentiating the equivalent formulation 
$(y-x)f(\frac{x+y}{2}) = \int_x^y f(t) dt$, we see that
$$
f(y) = f\left(\frac{x+y}{2}\right) + \frac{y-x}{2}f'\left(\frac{x+y}{2}\right)
$$ 
for all $a \le x, y \le b$. Now choose $h$ such that $a \le h, -h \le b$ and set $y = h, x = -h$. It follows that
$$
f(h) = f(0) + hf'(0) .
$$ 
Therefore $f$ is affine on any symmetric interval that is contained in $[a,b]$. By shifting the interval, it follows that $f$ is affine everywhere.  
A: If $f: x \mapsto \lambda x$ for some $\lambda \in \Bbb{R}$, Then $f$ satisfies the above equality and is affine.
Otherwise suppose $f$ is not affine, that is, $f(x) \ne \lambda x$ for any $\lambda \in \Bbb{R}$. Since the graph of $f$ is not a straight line, we can find two points $x$, and $y$ such that $\left.f\right|_{(x,y)}$ lies entirely above (or below) the line segment from $(x,f(x))$ to $(y,f(y))$. Indeed, we can find $(x,y)$ such that the value at the midpoint,  $f((x+y)/2)$, is farthest from the straight line from all the other points in $(x,y)$. That is set $g(u)$ as follows:
$$g(u)=\left|\left((1-u) x + u y,f\left((1-u) x + u y\right)\right)-\left(\frac{(1-u)(x,f(x))+(u)(y,f(y))}{2}\right)\right|$$
where $u \in [0,1]$. The first term traces the graph of $f$ the second traces the line segment above.
We can always find some $x$ and $y$ such that the maximum of $g(u)$ occurs exactly at $u=(x+y)/2$. By the equality $f((x+y)/2)$ is the average of $f$ over the interval $(x,y)$ and therefore cannot be farthest from the straight line from $(x,f(x))$ to $(y,f(y))$ since $f$ is continuous (due to the integral) and must therefore continuously approach the line segment at its endpoints. Therefore on average $f$ is closer to the line than it is at its maximum distance. This is a contradiction for this case. 
Hence the only option is for $f$ to be affine.

In the figure I try to encapulate this proof. The dotted line is the average of the blue function over the segment. It cannot be as far from the straight line as it's farthest point (the apex of the blue graph).
