Hessian criterion for convexity (source code)

= Hessian criterion for convexity
{title2=$g\text{ convex}\iff v^{\mathsf T}H(g)(x)v\ge0$}

On an open <convex set>, a twice-differentiable <real-valued function> is <convex> if and only if its <Hessian matrix> is a <positive semidefinite matrix> at every point. In particular continuous second partial <derivatives> suffice for the differentiability hypothesis. Restrict $g$ to any line segment: $\phi(t)=g(x+tv)$ has $\phi''(t)=v^{\mathsf T}H(g)(x+tv)v$. The <second-derivative criterion for convexity> proves both implications, because <convexity> is equivalent to <convexity> of all such restrictions.