Spivak's Calculus, "Convexity and Concavity", problem *9b: Proving convexity of a function defined differently in two adjacent intervals. The following is a problem from Spivak's Calculus.

Suppose a function $f$ is convex on $[a,b]$ and a function $g$ is
convex on $[b,c]$, with $f(b)=g(b)$ and $f'_-(b) \leq g'_+(b)$ (as in
the figure below).

If we define $h$ on $[a,c]$ to be $f$ on $[a,b]$ and $g$ on $[b,c]$,
show that $h$ is convex on $[a,c]$. Hint: Given $P$ and $Q$ on
opposite sides of $O=(b,f(b))$, as in the figure below, compare of the
slope of OQ with that of PO.


The solution in the solution manual is:

We have
$$\text{slope PO} < f'_-(b) \leq g'_+(b)< \text{ slope OQ}\tag{1}$$
and this implies that PQ lies above PO and OQ, so PQ lies above the
graph of $h$.

How do we formally show that $(1)$ implies that PQ lies above PO and OQ?
If we let $x_1 \in [a,b]$ and $x_2 \in [b,c]$ we know that
$$\frac{f(b)-f(x_1)}{b-x_1}<f'_-(b)$$
$$\frac{g(x_2)-f(b)}{x_2-b}>g'_+(b)$$
The line segment PQ is
$$h_1(x)=f(x_1)+\frac{g(x_2)-f(x_1)}{x_2-x_1}(x-x_1), x \in [x_1, x_2]$$
The line segment PO is
$$h_2(x)=f(x_1)+\frac{f(b)-f(x_1)}{b-x_1}(x-x_1), x \in [x,b]$$
If we can show that $\frac{g(x_2)-f(x_1)}{x_2-x_1}>\frac{f(b)-f(x_1)}{b-x_1}$, and then show the analogous result for segment OQ, then we will have shown that PQ lies above both PQ and OQ.
 A: Without loss of generality, assume that:
$$
f(b)=g(b)=0
$$
Otherwise, define $f^{*}=f-f(b)$,$g^{*}=g-g(b)$, thus:
$$
\frac{-f(x_{1})}{b-x_{1}}\leq\frac{g(x_{2})}{x_{2}-b}
$$
Let $x_{1}\in[a,b]$, $x_{2}\in[b,c]$ and define:
$$
l(\theta)=(1-\theta)x_{1}+\theta x_{2}=x_{1}+\theta(x_{2}-x_{1})
$$
Let $\theta_{b}=\frac{b-x_{1}}{x_{2}-x_{1}}$ therefore $\theta_{b}\in(0,1)$
and $l(\theta_{b})=b$
We shall show that if $\theta\in[0,\theta_{b}]$
$$
h((1-\theta)x_{1}+\theta x_{2})\leq(1-\theta)h(x_{1})+\theta h(x_{2})
$$
Define $s=\theta\theta_{b}^{-1}$, thus $s\in[0,1]$ and notice that:
\begin{align*}
h((1-\theta)x_{1}+\theta x_{2}) & =h(x_{1}+\theta(x_{2}-x_{1}))\\
 & =h(x_{1}+s(b-x_{1}))\\
 & =f(x_{1}+s(b-x_{1}))
\end{align*}
Since $f(b)=0$ therefore:
$$
h((1-\theta)x_{1}+\theta x_{2})\leq(1-s)f(x_{1})
$$
Thus we only need to prove that:
$$
(1-s)f(x_{1})\leq(1-\theta)f(x_{1})+\theta g(x_{2})
$$
this is equivalent to:
$$
(1-\theta_{b}^{-1})f(x_{1})\leq g(x_{2})
$$
which is equivalent to :
$$
\frac{-f(x_{1})}{b-x_{1}}\leq\frac{g(x_{2})}{x_{2}-b}
$$
That we already know.
The case $\theta\in[\theta_{b},1]$ is analogous.
