TITLE: Sufficient condition for a function to be affine
QUESTION [4 upvotes]: If for a function $f:\mathbb{R}\to\mathbb{R}$, I can prove for any real $x,y$, that $f(\frac{x+y}{2})=\frac{f(x)}{2}+\frac{f(y)}{2}$, can I say for sure that it is affine, as in of the form $f(x)=ax+b$?
I am referring to the case of equality in Jensen's inequality here, but I'm thinking that maybe it is necessary to prove that $f(tx+(1-t)y)=tf(x)+(1-t)f(y)$ for any $t\in (0,1)$, and that the particular case of $t=1/2$, which I have, isn't sufficient.

REPLY [3 votes]: Apparently you have $f(x)$ monotonic over some interval. That is sufficient. Rewrite as $f(x)+f(y)=2f(\frac{x+y}{2})$. Setting $y=0$ gives $2f(\frac{x}{2})=f(x)+f(0)$. Thus $f(x)+f(y)=2f(\frac{x+y}{2})=f(x+y)+f(0)$, so that $g(x)=f(x)-f(0)$ satisfies the Cauchy equation $g(x+y)=g(x)+g(y)$. Thus $g(x)=xg(1) \, \forall x \in \mathbb{Q}$. (I assume you know how to show this?) WLOG take $g(1) \geq 0$, otherwise just use $g'(x)=-g(x)$ in place of $g(x)$ in the following proof.
Since $f(x)$ is monotonic over some interval $I$, $g(x)$ is also monotonic over some interval $I$. Since $g(1) \geq 0$ and $g(x)=xg(1) \, \forall x \in \mathbb{Q}$, $g(x)$ cannot be decreasing, and so must be non-decreasing. Consider $x \in I \subseteq \mathbb{R}$, where $x$ is not an endpoint of $I$. Since the rationals are dense in $\mathbb{R}$, $\forall \epsilon>0, \exists p, q \in \mathbb{Q}$ s.t. $x-\epsilon<p<x<q<x+\epsilon$, then considering $\epsilon$ small enough so that $(x-\epsilon), (x+\epsilon) \in I$ (possible since $x$ is not an end point). Thus $g(1)(x-\epsilon) \leq pg(1)=g(p)\leq g(x) \leq g(q)=qg(1) \leq g(1)(x+\epsilon)$, so $g(x)=xg(1) \, \forall x \in I$, except maybe the end points.
Now for any $x \in \mathbb{R}$, we can write $x=x'+k$, where $k \in \mathbb{Q}$ and $x' \in I$, $x'$ not an endpoint of $I$. Then $g(x)=g(x')+g(k)=x'g(1)+kg(1)=xg(1)$, so $g(x)=xg(1) \, \forall x \in \mathbb{R}$, so $f(x)=g(x)+f(0)=x(f(1)-f(0))+f(0) \, \forall x \in \mathbb{R}$.
{"set_name": "stack_exchange", "score": 4, "question_id": 323387}