A function $f(t)$ on an interval $I=(a,b)$ has the mean value property if $$f\left(\frac{s+t}{2}\right)=\frac{f(s)+f(t)}{2} \quad s,t\in I$$ Show that any affine function $f(t)=At+B$ has the mean value property. Show that any continuous function on $I$ with the mean value property is affine.
We have $f\left(\displaystyle \frac {s+t}{2}\right)=A\left(\frac{s+t}{2}\right)+B= \frac{As+At+2B}{2}=\frac{As+B+At+B}{2}=\frac{f(t)+f(s)}{2}$
I showed the first part successfully but I now have trouble proving the second part (any continuous function with the mean value property is affine). Please help me.
Hint: Pick $c$ and $d$ with $a < c < d < b$. Given $f(c)$ and $f(d)$ you can work out what $A$ and $B$ must be if $f$ is to have the mean value property. Then show that $f(t) = At + B$ for any $t \in (a, b)$ that can be written in the form $\frac{mc + nd}{2^k}$ for positive integers $m$, $n$ and $k$. The set of such $t$ is dense in $(a, b)$, so, if $f$ is continuous, $f(t) = At + B$ must hold for every $t \in (a, b)$.