We defined the convexity of an $f: \mathbb{R} \to \mathbb{R}$ function like this:
$f$ is convex on the interval $I$ if $\forall a,b\in I$, $a<b$, $\forall x \in I$ $$f(x)\leqslant f(a)+\frac{f(b)-f(a)}{b-a}(x-a)$$
And then we had the following theorem:
The following statements are equivalent:
(i) $f$ is convex on $I$
(ii) $\forall a \in I$, $m_a(x)=\frac{f(x)-f(a)}{x-a}$ is monotone increasing on $I\setminus\{a\}$
I tried to prove (i)$\implies$(ii) like this: Let $a,x,y \in I$. If $a<x<y$, then $$f(x) \leqslant f(a) + \frac{f(y)-f(a)}{y-a}(x-a)$$ $$\frac{f(x)-f(a)}{x-a} \leqslant \frac{f(y)-f(a)}{y-a}$$ $$m_a(x) \leqslant m_a(y)$$ Which is fine, but when $x<a<y$, we have that $x-a \leqslant 0$, so $$\frac{f(x)-f(a)}{x-a} \geqslant \frac{f(y)-f(a)}{y-a}$$ $$m_a(x) \geqslant m_a(y)$$ And it's not good. Did I miss something or is the theorem false as it is stated?