Solution (source code)

= Solution

Here $L$-smooth means that $f$ is differentiable on the entire Euclidean space and has an $L$-<Lipschitz gradient>, with $L>0$. Together with <convexity>, this implies \b[$1/L$-<cocoercivity>]:
$$
\boxed{\langle\nabla f(u)-\nabla f(v),u-v\rangle\geq\frac1L\|\nabla f(u)-\nabla f(v)\|_2^2}.
$$
First, integration of the <Lipschitz gradient> along a line segment proves the <descent lemma>:
$$
f(w)\leq f(v)+\langle\nabla f(v),w-v\rangle+\frac L2\|w-v\|_2^2.
$$
Indeed, subtract the linear term and integrate $\langle\nabla f(v+t(w-v))-\nabla f(v),w-v\rangle$ for $0\leq t\leq1$; its absolute value is at most $Lt\|w-v\|_2^2$.

Fix $u$ and define $q(w)=f(w)-\langle\nabla f(u),w\rangle$. This is a <convex function>, has the same <Lipschitz gradient> constant, and $\nabla q(u)=0$, so $u$ is a global minimizer. Put $d=\nabla f(v)-\nabla f(u)=\nabla q(v)$. The <descent lemma> at $v$ with $w=v-d/L$ gives
$$
q(u)\leq q(v-d/L)\leq q(v)-\frac1{2L}\|d\|_2^2.
$$
Therefore
$$
f(v)-f(u)-\langle\nabla f(u),v-u\rangle\geq\frac1{2L}\|\nabla f(v)-\nabla f(u)\|_2^2.
$$
Interchange $u,v$ and add the inequalities. The function values cancel, leaving the asserted <cocoercivity>. This is a proof of the <Baillon–Haddad theorem> without assuming a second derivative. <Convexity> is essential: $f(u)=-\|u\|_2^2/2$ has a $1$-<Lipschitz gradient> but its gradient is not <cocoercive>.