about convex function counterexample Proposition) If a function $f : [a, b] \rightarrow \mathbb{R}$ satisfies two conditions that
(1) $f$ is continuous
(2) $f(\frac{x+y}{2}) \le \frac{f(x)+f(y)}{2}$ for every $x$, $y$
then $f$ is convex function.
I already know the proof of above proposition.
My question is how can I find counterexample without condition (1). 
That is, I want to find non-convex function $f$ satisfying condition (2).
Thank you:)
 A: My guess is that you're not going to be able to come up with any nice construction that works as a counterexample.  In particular, I think you need to invoke the axiom of choice to create a suitable counterexample.
For example, any discontinuous solution to Cauchy's functional equation will work here.

In particular, I would say that (2) is just enough to tell you that $f$ acts as a convex function when restricted to any coset of $\Bbb Q$ as a subset of $\Bbb R$.
A: Well this is not a correct counterexample, but I suppose it may provide some ideas...
Consider Dirichlet function
    \begin{eqnarray}
 D(x)=\left\{
 \begin{aligned}
 1\ \ \ \ \ \ \ \ \ \ \ \ \ x\in \mathbb{Q}\\
 0\ \ \ \ \ x\in [0,1]-\mathbb{Q}
 \end{aligned}
 \right.
 \end{eqnarray}
D(x) is defined on [0,1], and is nowhere continuous. Of course it's not a convex function.
When $x_1$, $x_2\in \mathbb{Q}$, we have $f(\dfrac{x_1+x_2}{2})=1$, and $\dfrac{f(x_1)+f(x_2)}{2}=1$. Similarly, for $x_1 \in \mathbb{Q}$, $x_2\in[0,1]-\mathbb{Q}$, we have left$=0$ and right=$\dfrac12$. 
But for $x_1$, $x_2\in [0,1]-\mathbb{Q}$ we have left$=0$ or $1$ and right$=0$.
The third situation does not satisfy (2). That's my problem, and I mistook it yesterday. I tried to improve it but failed.
