Prove that a function $f:\mathbb{R}\to\mathbb{R}$ which satisfies $$f\left({\frac{x+y}3}\right)=\frac{f(x)+f(y)}2$$ is a constant function.
This is my solution: constant function have derivative $0$ for any number, so I need to prove that $f'$ is always $0$. I first calculated $\frac{d}{dx}$ and then $\frac{d}{dy}$: $$f'\left({\frac{x+y}3}\right)\frac13=\frac{f'(x)}2$$ $$f'\left({\frac{x+y}3}\right)\frac13=\frac{f'(y)}2$$ From this I can see that $\frac{f'(x)}2=\frac{f'(y)}2$. Multiplying by $2$ and integrating I got: $$f(x)=f(y)+C$$ for some constant $C\in\mathbb{R}$. By definition of $f$ it is true for any $x,y\in\mathbb{R}$, so I can write $$f(y)=f(x)+C$$ Adding this two equation and simplifying I got $$C=0$$ so $f(x)=f(y)$ for all $x,y\in\mathbb{R}$. Is my solution mathematically correct. Is this complete proof, or I missed something?