Theorem. Let f:Ω→Rf:\Omega\to\mathbb{R} be twice continuously differentiable on a nonempty open Ω⊂Rn\Omega\subset\mathbb{R}^n. Then ff is convex on Ω\Omega if and only if for every x∈Ωx\in\Omega its ∇2f(x)\nabla^2 f(x) is positive semidefinite (in the sense of ), i.e.,

⟨v,∇2f(x) v⟩≥0for all v∈Rn.\langle v,\nabla^2 f(x)\,v\rangle \ge 0 \quad \text{for all } v\in\mathbb{R}^n.

Context. This is the standard multivariable calculus criterion for convexity and underlies many second-order methods in optimization.

Proof sketch. Convexity of ff is equivalent to convexity of every restriction to a line: for fixed x∈Ωx\in\Omega and direction d∈Rnd\in\mathbb{R}^n, consider φ(t)=f(x+td)\varphi(t)=f(x+td) on the maximal interval where x+td∈Ωx+td\in\Omega. Apply the one-dimensional criterion to φ\varphi, noting that φ′′(t)=⟨d,∇2f(x+td)d⟩\varphi''(t)=\langle d,\nabla^2 f(x+td)d\rangle.