# How can I guarantee that $f$ applied to the mean of all $x$'s is equal to the mean of $f$ applied to all $x$'s?

I would like to know which properties a function $f:\mathbb{R}\rightarrow\mathbb{R}$ must have so that I can say: $$f(\overline{x}) = \overline{f(x)}$$

with $\overline{x}$ being the mean of the $x$'s. Or, more explicitly written:

$$f \left(\frac{x_1 + x_2 + \cdots + x_n}{n}\right) = \frac{f(x_1) + f(x_2) + \cdots + f(x_n)}{n}$$

Given a function $f$ with the property $$\tag{P} f\left(\frac{1}{n}\sum_{i=1}^nx_i\right)=\frac{1}{n}\sum_{i=1}^nf(x_i) \quad \forall\ n \in \mathbb{N},\ x_1,\ldots, x_n \in \mathbb{R},$$ we set $$F(x)=f(x)-f(0).$$ Then $$\tag{1} F(0)=0, \quad F\left(\frac{x}{n}\right)=\frac{1}{n}F(x) \quad \forall n \in \mathbb{N},\ x \in \mathbb{R}.$$ Since $$0=F\left(\frac{x-x}{2}\right)=f\left(\frac{x-x}{2}\right)-f(0)=\frac{f(x)+f(-x)-2f(0)}{2}=\frac{F(x)+F(-x)}{2} \quad \forall\ x \in \mathbb{R}$$ we have $$\tag{2} F(-x)=-F(x) \quad \forall\ x \in \mathbb{R}$$ Thanks to (1) and (2) we get $$F\left(\frac{x}{n}\right)=F\left(\frac{-x}{-n}\right)=\frac{1}{-n}F(-x)=\frac{1}{n}F(x) \quad \forall n \in -\mathbb{N},\ x \in \mathbb{R}.$$ Hence $$\tag{3} F\left(\frac{x}{m}\right)=\frac{1}{m}F(x),\ F(nx)=nF(x) \quad \forall m \in \mathbb{Z}\setminus\{0\},\ n \in \mathbb{Z},\ x \in \mathbb{R}.$$ It follows from (3) that $$\tag{4} F(rx)=rF(x) \quad \forall r \in \mathbb{Q},\ x \in \mathbb{R}.$$ Again, thanks to (3) we have $$F(x+y)=F\left(\frac{2x+2y}{2}\right)=\frac{F(2x)+F(2y)}{2}=F(x)+F(y) \quad \forall\ x \in \mathbb{R}.$$ Thus, $F: \mathbb{R} \to \mathbb{R}$ is a $\mathbb{Q}$-linear map, and any function of the form $f=F+\alpha$ satisfies (P), where $\alpha$ is a real constant, and $F$ a $\mathbb{Q}$-linear on $\mathbb{R}$.

• You do not neccesarily get $f(0)=0$. For example every constant function fulfills the functional equation, because then $f\left(\frac{1}{n}\sum_{i=1}^nx_i\right)=c=\frac{nc}{n}=\frac{1}{n}\sum_{i=1}^nf(x_i)$ holds. – Dominik Dec 5 '12 at 19:11
• My bad, I see the point! – Mercy King Dec 5 '12 at 20:27

Define $g(x)=f(x)-f(0)$. Then, setting $x_2=...=x_n=0$ you see $f(x/n)=f(x)/n+f(0)-f(0)/n$ or equivalently $g(x/n)=g(x)/n$. This implies $g(x+y)=2(g(x+y)/2)=2g((x+y)/2)=2(g(x)+g(y))/2=g(x)+g(y)$.

Furthermore, we obtain $$g(m/n x)=g(mx)/n=m/n (g(mx)/m)=m/n g(x)$$ for all $m,n \in \Bbb N$. So $g(qx)=qg(x)$ for every positive rational $q$. Indeed, this holds for any rational $q$ since $g(-x)+g(x)=g(0)=f(0)-f(0)=0$, which implies $g(-qx)=-g(qx)=-qg(x)$.

In general, $g$ can be any linear map of $\Bbb R$ to $\Bbb R$, where $\Bbb R$ is viewed as a $\Bbb Q$ vector space, but if you demand that $f$ is continuous, $g(q)=qg(1)=cq$ implies $g(r)=cr$ for every real $r$. So $f(x)=cx+f(0)=cx+b$ are the only continuous solutions.