$f(\frac{a+b}{2})=\frac{f(a)}{2}+\frac{f(b)}{2}, \forall a,b\in\mathbb{R}$ I am required to show that if $$f\left(\frac{a+b}{2}\right)=\frac{f(a)}{2}+\frac{f(b)}{2}, \forall a,b\in\mathbb{R},$$ then $$f\left(\frac{a_1+a_2+\cdots+a_n}{n}\right)=\frac{f(a_1)}{n}+\frac{f(a_2)}{n}+\cdots+\frac{f(a_n)}{n}, \forall a_i\in\mathbb{R}$$
I tried to use PMI, but I could not get anywhere.
 A: Let S(n) be the statement $f(\frac{a_1+a_2+ \ldots + a_n}{n})= \frac{f(a_1)+f(a_2)+ \ldots + f(a_n)}{n}$.
Then show that S(n) implies S(2n), by using S(2) (which you are given) with $a=\frac{a_1+a_2+ \ldots + a_n}{n}$ and $b= \frac{a_{n+1}+a_{n+2}+ \ldots + a_{2n}}{n}$.
Also, show that S(n) implies S(n-1), using $a_n = \frac{a_1+a_2+ \ldots + a_{n-1}}{n-1}$; you know that $f(\frac{a_1+a_2+ \ldots + a_{n-1}+ a_n}{n})= \frac{f(a_1)+f(a_2)+ \ldots +f(a_{n-1})+ f(a_n)}{n}$: $n$ times the left hand side of this is $nf(\frac{(n-1)a_n + a_n}{n}) = nf(a_n)$ and $n$ times the right hand side is $(n-1)(\frac{f(a_1)+f(a_2)+ \ldots +f(a_{n-1})}{n-1})+ f(a_n)$.
A: Using induction, you can easily prove the formula for $n$ as power of $2$. Indeed, for $k\ge 1$
$$f\left(\frac1{2^{k+1}}\sum_{i=1}^{2^{k+1}} a_i\right) = f\left(\frac12\left(\frac1{2^{k}}\sum_{i=1}^{2^k} a_i + \frac1{2^{k}}\sum_{i=1}^{2^k} a_{2^k+i}\right)\right) = \frac12 f\left(\frac1{2^{k}}\sum_{i=1}^{2^k} a_i\right) + \frac12 f\left(\frac1{2^{k}}\sum_{i=1}^{2^k} a_{2^k+i}\right).$$
Now for general $n$, let $A = \frac{1}{n} \sum_{i=1}^n a_i$ and $k\in \mathbb N$, such that $n \le 2^k$. The idea uses the fact that the mean of numbers does not change if we add the mean of previous numbers multiple times. For instance, let $$b_i = \begin{cases}a_i & \text{if $i\le n$}\\
A &\text{if $n < i \le 2^k$ }\end{cases}$$
You have:
$$\frac1{2^k}\sum_{i=1}^{2^k} b_i = \frac1{2^k}\sum_{i=1}^{n} a_i + \frac1{2^k}\sum_{i=n}^{2^k} A = \frac1{2^k}\left(nA + \left(2^k - n\right) A\right)= A$$
and $$\frac1{2^k}\sum_{i=1}^{2^k} f\left(b_i\right) = \frac1{2^k}\sum_{i=1}^{n} f\left(a_i\right) + \frac1{2^k}\sum_{i=n}^{2^k} f(A) = \frac1{2^k}\sum_{i=1}^{n} f\left(a_i\right) + \left(1-\frac{n}{2^k}\right)f(A)$$
Since $$f\left(\frac1{2^k}\sum_{i=1}^{2^k} b_i\right) = \frac1{2^k}\sum_{i=1}^{2^k} f\left(b_i\right)$$
so $$f(A) = \frac1{2^k}\sum_{i=1}^{n} f\left(a_i\right) + \left(1-\frac{n}{2^k}\right)f(A)$$ implies that $$\frac{n}{2^k}f(A) = \frac1{2^k}\sum_{i=1}^{n} f\left(a_i\right)\implies f(A) = \frac1n\sum_{i=1}^n f\left(a_i\right)$$
A: There is an easy way out, I think.
The condition of the equality implies clearly that  $f(\dfrac{a+b}{2})\leq\,\dfrac{1}{2}f(a)+\dfrac{1}{2}f(b)$. But there is a well known exercise (see Spivak) which shows that this inequality implies that $f$ is convex.
So we get $f(\dfrac{x_{1}+x_{2}+...+x_{n}}{n})\,\leq\,\dfrac{1}{n}f(x_{1})+.....+\dfrac{1}{n}f(x_{n})$.  On the other hand the inverse inequality implies (using the same proof) that $f$ is concave. So, by the two inequalities we obtain the required equality.
The proof of the statement that $f(\dfrac{a+b}{2})\leq\,\dfrac{1}{2}f(a)+\dfrac{1}{2}f(b)$ implies that $f$ is convex is not simple.
I have a proof of my own of Spivak's exercise, based on induction. If someone is interested he can make a comment, and I can send him the proof which is based on Spivak's hint.
A: You can do it by Jensen's functional equation.
If $f(\frac{a+b}{2})=\frac{f(a)}{2}+\frac{f(b)}{2}, \forall \space a,b\in\mathbb{R}$,
then it is required that $f(x)$ is linear, given some other conditions. (It is reducible to Cauchy's functional equation, which has a linear solution with no constant term, given some other conditions, e.g: If $f$ is continuous at atleast one point, the possiblities of all monstrous solutions are eliminated).
Once you get a linear solution, i.e, $f(x) = cx+d \space$ for some $c,d\in\mathbb{R}$, the next result will follow easily.
P.S: This will only be true if there are some conditions on $f$ which allow Cauchy's functional equation to have a linear solution passing through origin. Refer this link.
