Writing Random variable $X$ as a convex combination of $a$ and $b$ When proving the Hoeffding's lemma on Wikipedia, it says

Next, recall that $e^{sX}$ is a convex function on the real line:
$\forall X \in [a,b]: $ $e^{sX} \le \frac{b-x}{b-a}e^{sa} + \frac{x-a}{b-a}e^{sb}$

I'm not familiar with the convexity of a function. Can anyone explain how we were able to write this as a combination of a $a$ and $b$?
 A: This is a general property of convex functions. Here it is plotted for this particular case, with $s = 1$, $a = .5$, $b = 1.5$:

The blue curve is $e^{s x}$ as a function of $x$. The orange line is $\frac{b-x}{b-a} e^{sa} + \frac{x-a}{b-a} e^{sb}$; this is just one form of the equation of a line between the points $(a, e^{sa})$ and $(b, e^{sb})$. (If you plug in $x = a$, the right term is 0, and the left term becomes $e^{sa}$; if you plug in $x = b$, you similarly get $e^{s b}$; also, the expression can be rearranged to be a constant times $x$ plus another constant, so the function is linear.)
Notice that the orange line lies above the blue line for all $x \in [a, b]$. This is actually one definition of a convex function: the epigraph, the set of all points lying on or above the blue line, is a convex set, meaning that if you draw a line segment between any two points, it will be entirely contained within the set.
Now, since $$e^{s x} \le \frac{b-x}{b-a} e^{sa} + \frac{x-a}{b-a} e^{sb}$$ for all fixed $x \in [a, b]$, and we know that $\Pr(X \in [a, b]) = 1$, we can say that the following equation holds for the random variable $X$: $$e^{s X} \le \frac{b-X}{b-a} e^{sa} + \frac{X-a}{b-a} e^{sb}.$$
