Average of function, function of average I'm trying to find all functions $f : \mathbb{R} \to \mathbb{R}$ such that, for all $n > 1$ and all $x_1, x_2, \cdots, x_n \in \mathbb{R}$:
$$\frac{1}{n} \sum_{t = 1}^n f(x_t) = f \left ( \frac{1}{n} \sum_{t = 1}^n x_t \right )$$
My intuition is that this is only true if $f$ is a linear function. I started from the relation:
$$\sum_{t = 1}^n f(x_t) = f \left ( \sum_{t = 1}^n x_t \right )$$
That is, $f$ is additive. Then, by multiplying by $\frac{1}{n}$ each side, we obtain:
$$\frac{1}{n} \sum_{t = 1}^n f(x_t) = \frac{1}{n} f \left ( \sum_{t = 1}^n x_t \right )$$
And hence, any $f$ which has the property that $f(ax) = a f(x)$ (a linear function) will work. And since all linear functions are trivially additive, any linear function is a solution to my relation.

But all I have done is prove that linear functions are solutions, how should I go about showing that only linear equations are solutions? Is it valid to just "go backwards" in my argument, proving that if $f$ is a solution, then it must be linear? I feel it is not sufficient, since I only have implication and not equivalence. How do I proceed?
I think the $\frac{1}{n}$ term was added to confuse me, since without it, this would be straightforward.
 A: First, boil this down to something more familiar. Set $h(x)=f(x)-f(0):$
$$h\left(\frac{1}{n}\sum_1^nx_t\right)=\frac{1}{n}\left(\sum_1^n h(x_t)\right)\quad(\star)$$
Since $h(0)=0$ let $x_2=x_3=\cdots =x_n=0$
$$h\left(\frac{x_1}{n}\right)=\frac{h(x_1)}{n}$$
Let $x_1\to x_1+x_2+\cdots +x_n$ and combine with $(\star):$
$$\sum_1^n h(x_t)=h\left(\sum_1^nx_t\right)$$
Setting $x_3=x_4=\cdots =x_n=0$
$$h(x_1)+h(x_2)=h(x_1+x_2)$$
This is Cauchy's equation, whose only continuous solution is $h(x)=ax,\;\;a\in\mathbb{R}$. Set $f(0)=b:$
$$f(x)=ax+b$$
If we do not impose the restriction of continuity on $f$, there are infinitely many other solutions to your equation. See here for more.
A: What about function f that: 
$f(x+y)=f(x)+f(y)$    $\ \ \ \ \ \ x,y\in \mathbb{R}$
$f(a x)=af(x)$  $ \ \ \ \ \ a\in \mathbb{Q}, x\in \mathbb{R}$
This kind of function does not have to be continuous.
(It can be so wild that it does not have to be even measurable. And I guess(not sure at all) if it is measurable than it is linear function(in normal sense) almost everywhere.

Acording to wikipedia http://en.wikipedia.org/wiki/Harmonic_function#The_mean_value_property
All locally integrable continuous function that satisfy mean value property(in 1D it means $\frac{1}{2}(f(x)+f(y)) = f(\frac{x+y}{2})$) are infinitely differentiable and harmonics.
So I guess this answers your question.
