if there exists a discontinuous function f(x) which satisfies $f(\frac{x+y}{2})\leqslant\frac{1}{2}f(x)+\frac{1}{2}f(y)$ but is not convex? [duplicate]

This question comes from Rudin's book "principles of mathematical analysis" chapter 4,exercise 24,on page 101.

The original question is:

Assume that f is a continuous real function defined in $$(a,b)$$ such that $$f(\frac{x+y}{2})\leqslant\frac{1}{2}f(x)+\frac{1}{2}f(y)$$ for all $$x,y\in (a,b)$$.Prove that f is convex.

I have solved this question.But when I am reading the definition of convex function,I find that convex function is not always continuous.So I want to ask if there exists a discontinuous function which satisfies $$f(\frac{x+y}{2})\leqslant\frac{1}{2}f(x)+\frac{1}{2}f(y)$$ but is not convex? Thanks！

marked as duplicate by Brahadeesh, Calvin Khor, Parcly Taxel, Arnaud D., José Carlos SantosOct 26 '18 at 16:22

• All convex functions on $(a,b)$ are continuous. – Kavi Rama Murthy Oct 26 '18 at 12:04
Any additive function, i.e., one with $$\tag1f(x+y)=f(x)+f(y)$$ for all $$x,y$$ will have $$f\left(\frac{x+y}2\right) =f\left(\frac x2\right)+f\left(\frac y2\right)=\frac12\left(f\left(\frac x2\right)+f\left(\frac x2\right)+f\left(\frac y2\right)+f\left(\frac y2\right)\right)=\frac12\left(f(x)+f(y)\right).$$ Once you abandon continuity, there are many solutions to $$(1)$$ - and they are not convex either. In fact, they are so discontinuous that they are unbounded in every open interval.