A constraint that implies convexity 
Let $f:\mathbb{R} \to \mathbb{R} $ be a function such that $\forall x<y, \exists z\in(x, y) $ with $(y-x) f(z) \le (y-z) f(x) +(z-x) f(y) $.
a) Give an example of a non-convex function $f$ which has this property.
b) Prove that a continuous function $f$ which has this property is convex.

For a) it is obvious that we must search for a discontinuous $f$ with this property, but I can't find one. For b), I tried to assume that $f$ is not convex, which means that $\exists u<v$ and $a \in [0,1]$ such that $f(au+(1-a)v)>af(u)+(1-a)f(v)$,but here I am stuck.
 A: Try $f(0)=1$, $f(x) = 0$ otherwise. 
A: Intuitively, what's happening with (b) is that the equation
$$
   g(z) = \frac{y-z}{y-x} f(x) + \frac{z-x}{y-x} f(y)
$$
is the equation of the secant line through $(x,f(x))$ and $(y,f(y))$. Call this line the $x,y$-secant for short. So the property we're assuming is that for all $x<y$ there is a $z \in (x,y)$ such that $f(z)$ lies below the $x,y$-secant. We want to prove that for all $x<y$, all $z \in (x,y)$ have this property.
Suppose for the sake of contradiction $w \in [x,y]$ is such that $f(w) > g(w)$. Then let $S_1 = \{z \in [x,w] : f(z) \le g(z)\}$ and $S_2 = \{z \in [w,y] : f(z) \le g(z)\}$. We know that $\sup S_1$ has to exist ($S_1$ is bounded and $x \in S_1$). We know that $f(\sup S_1) \le g(\sup S_1)$ because $S_1$ is closed (here we use continuity of $f$). We know that $\sup S_1 < w$ because $f(w) > g(w)$. The corresponding things hold for $\inf S_2$ as well. Also, $\sup S_1 < w < \inf S_2$, so $\sup S_1 < \inf S_2$.
But now there is a contradiction. Strictly between $z_1 = \sup S_1$ and $z_2 = \inf S_2$ there is a point $z$ that lies below the $z_1,z_2$-secant. But then it lies below the $x,y$-secant as well. So $\sup S_1 < z < \inf S_2$ and yet $z$ should be in either $S_1$ or $S_2$, contradiction. 
So $w$ cannot exist, and therefore $f$ is convex.
