Any continuous function with the mean value property is affine 
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. 
 A: 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)$.
A: Letting $t=0$ in functional equation, we get 
$$f(\frac{s}{2})=\frac{f(s)}{2}+\frac{a}{2}$$
where $a=f(0)$, now we see that 
$$\frac{f(s+t)+a}{2}=\frac{f(s)+f(t)}{2}$$
which is 
$$f(s+t)+a=f(s)+f(t).$$
Define $A:I\rightarrow \mathbb{R}$ by
$$A(t)=f(t)-a.$$
Then $A$ is a additive function and since its continuous function, there is constant real $c$ such that $A(t)=ct$, therefore 
$$f(t)=ct+a$$
for all $t\in I$. 
Now in case that $0\notin I$, there is a bijection function $\gamma:(c,d)\rightarrow (a,b)$ such that $0\in (c,d)$. now consider $g:=f\circ \gamma$ and apply the above proof. 
Another proof you can find here.
Theorem. If $A:[a,b]\rightarrow \mathbb{R}$ be additive function on $[a,b]$, then there is an additive function $A':\mathbb{R}\rightarrow \mathbb{R}$ such that 
$$A(x)=A'(x)$$
for all $x\in [a,b]$. The above Theorem is due to Daroczy and Losonczi.
