Proving that the tangent to a convex function is always below the function [duplicate]

Consider a real-valued convex function $f$ defined on an open interval $(a,b) \subset \mathbb{R}$. Let $x,y \in (a,b)$. I want to prove that \begin{equation} f((1-\lambda)x + \lambda y) \leq (1-\lambda)f(x) + \lambda f(y) , \lambda \in [0,1]\implies f(y) + f'(y)(x-y) \leq f(x) \end{equation} No other assumptions (regarding the second derivatives) is allowed. While both facts are really obvious and clear, I am unable to prove this without making additional assumptions.


Presumably you're allowed to assume that $f$ is differentiable.

The Idea: If you draw a picture you convince yourself that if, say, $y<z<x$ then $$\frac{f(y)-f(z)}{y-z}\le\frac{f(y)-f(x)}{y-x}.$$Now let $z\to y$, the left side of the inequality tends to $f'(y)$ and you're done.

Now to make that idea into an actual proof from what we're given we write $z=(1-\lambda)x+\lambda y$.

The Proof: Say $a<y<x<b$ (the proof for $a<x<y<b$ is the same). For $0<\lambda<1$ you have $$f((1-\lambda)x+\lambda y)\le(1-\lambda)f(x)+\lambda f(y).$$Subtract $f(y)$ from both sides and rearrange slightly: $$f((1-\lambda)x+\lambda y)-f(y)\le(1-\lambda)(f(x)-f(y)).$$

Note that $$[(1-\lambda)x+\lambda y]-y=(1-\lambda)(x-y)>0.$$

Since $(1-\lambda)(x-y)>0$ you can divide both sides of the second-last inequality by it and you get

$$\frac{f((1-\lambda)x+\lambda y)-f(y)}{[(1-\lambda)x+\lambda y]-y} \le\frac{f(x)-f(y)}{x-y}.$$Now if $\lambda\to 1$ then $(1-\lambda)x+\lambda y\to y$, so the left side approaches $f'(y)$, and you get $$f'(y)\le\frac{f(x)-f(y)}{x-y}.$$Since $x-y>0$ you can multiply both sides by $x-y$, and you get $$f'(y)(x-y)\le f(x)-f(y).$$

(If $a<x<y<b$ the proof would be the same, except that $(1-\lambda)(x-y)<0$, so above when you divided by $(1-\lambda)(x-y)$ the inequality would change from $\le$ to $\ge$. Then at the end when you multiplied by $x-y$ it would change back to $\le$.)