Post · 14 min read· pp. 1073–1082

Hessian Matrix of Convex Functions

Introduction

Hessian matrix is useful for determining whether a function is convex or not. Specifically, a twice differentiable function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is convex if and only if its Hessian matrix ∇2f(x)\nabla^2 f(x) is positive semi-definite for all x∈Rnx \in \mathbb{R}^n. Conversely, if we could find an x∈Rnx \in \mathbb{R}^n such that ∇2f(x)\nabla^2 f(x) is not positive semi-definite, ff is not convex.

In this blog post, I would like show a self-contained discussion and proof for this property.

Convex Function Definitions

Here are the definitions of function being convex, strictly convex, and strongly convex. Strongly convex implies strictly convex, and strictly convex implies convex.

Convex Function

A function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is convex if its domain XX is a convex set and for any x1,x2∈Xx_1, x_2 \in X, for all λ∈[0,1]\lambda \in [0, 1], we have

f(λx1+(1−λ)x2)≤λf(x1)+(1−λ)f(x2)f(\lambda x_1 + (1-\lambda) x_2) \leq \lambda f(x_1) + (1-\lambda) f(x_2)

The local minimum of ff is the global minimum of ff.

Strictly Convex Function

A function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is strictly convex if its domain XX is a convex set and for any x1,x2∈Xx_1, x_2 \in X and x1≠x2x_1 \neq x_2, for all λ∈(0,1)\lambda \in (0, 1), we have

f(λx1+(1−λ)x2)<λf(x1)+(1−λ)f(x2)f(\lambda x_1 + (1-\lambda) x_2) < \lambda f(x_1) + (1-\lambda) f(x_2)

The local minimum of ff is the global minimum of ff and there is only one local minimum.

Strongly Convex Function

A function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is strongly convex if there exists α>0\alpha > 0 such that f(x)−α∥x∥2f(x) - \alpha \lVert x \lVert^2 is convex.

Prerequisites

Directional Derivative

Given the function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R}, the directional derivative at point xx in direction hh is defined as

∇hf(x)=lim⁡t→0f(x+th)−f(x)t\nabla_{h} f(x) = \lim_{t \rightarrow 0} \frac{f(x + th) - f(x)}{t}

In addition, if the function is differentiable at xx, we will also define the gradient at xx, ∇f(x)\nabla f(x), such that

∇hf(x)=∇f(x)⊤h\begin{align} \nabla_{h} f(x) &= \nabla f(x)^{\top} h\\ \end{align}

There are multiple different definitions for directional derivative. For example, some people defined the directional derivative to be with respect to an arbitrary nonzero vector v after normalization, thus being independent of its magnitude and depending only on its direction.

∇hf(x)=lim⁡t→0f(x+th)−f(x)t∣h∣\nabla_{h} f(x) = \lim_{t \rightarrow 0} \frac{f(x + th) - f(x)}{t \lvert h \rvert}

In this case, the gradient at xx is different for this directional derivative definition and is defined as follows.

∇hf(x)=∇f(x)⊤h∣h∣\begin{align} \nabla_{h} f(x) &= \nabla f(x)^{\top} \frac{h}{\lvert h \rvert} \\ \end{align}

The value of the directional derivatives at the same point using the two directional derivative definitions are, obviously, different and they are off by a scale of the norm of hh. But we could also see that, even though the value of the directional derivatives at the same point using the two directional derivative definitions are different, the value of gradients at the same point using the two gradient definitions are the same.

In this article, we will use the first set of definitions for directional derivative and gradient.

Convex Function Additions

If functions f,g:Rn→Rf, g: \mathbb{R}^n \rightarrow \mathbb{R} are both convex, then f+gf+g is also convex.

This could be easily proved using the definition of convex functions.

Proof

Because ff and gg are both convex functions, we have

(f+g)(λx1+(1−λ)x2)=f(λx1+(1−λ)x2)+g(λx1+(1−λ)x2)≤λf(x1)+(1−λ)f(x2)+λg(x1)+(1−λ)g(x2)=λ(f+g)(x1)+(1−λ)(f+g)(x2)\begin{align} (f+g)(\lambda x_1 + (1-\lambda) x_2) &= f(\lambda x_1 + (1-\lambda) x_2) + g(\lambda x_1 + (1-\lambda) x_2) \\ &\leq \lambda f(x_1) + (1-\lambda) f(x_2) + \lambda g(x_1) + (1-\lambda) g(x_2) \\ &= \lambda (f+g)(x_1) + (1-\lambda) (f+g)(x_2) \\ \end{align}

Therefore,

(f+g)(λx1+(1−λ)x2)≤λ(f+g)(x1)+(1−λ)(f+g)(x2)(f+g)(\lambda x_1 + (1-\lambda) x_2) \leq \lambda (f+g)(x_1) + (1-\lambda) (f+g)(x_2)

f+gf+g must be convex.

This concludes the proof.

Linear Functions are Convex

If function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is linear, then ff is convex.

Proof

Suppose f(x)=a⊤x+bf(x) = a^{\top} x + b for some a∈Rna \in \mathbb{R}^n and b∈Rb \in \mathbb{R}.

f(λx1+(1−λ)x2)=a⊤(λx1+(1−λ)x2)+b=a⊤λx1+λb+a⊤(1−λ)x2+b−λb=λ(a⊤x1+b)+(1−λ)(a⊤x2+b)=λf(x1)+(1−λ)f(x2)\begin{align} f(\lambda x_1 + (1-\lambda) x_2) &= a^{\top} (\lambda x_1 + (1-\lambda) x_2) + b \\ &= a^{\top} \lambda x_1 + \lambda b + a^{\top} (1-\lambda) x_2 + b -\lambda b\\ &= \lambda (a^{\top} x_1 + b) + (1-\lambda) (a^{\top} x_2 + b) \\ &= \lambda f(x_1) + (1-\lambda) f(x_2) \\ \end{align}

Therefore,

f(λx1+(1−λ)x2)=λf(x1)+(1−λ)f(x2)f(\lambda x_1 + (1-\lambda) x_2) = \lambda f(x_1) + (1-\lambda) f(x_2)

ff must be convex.

This concludes the proof.

Convex Function Sufficient and Necessary Condition

Assume that function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is differentiable, then ff is convex if and only if for every x,y∈Rnx, y \in \mathbb{R}^n, the inequality

f(y)≥f(x)+∇f(x)⊤(y−x)f(y) \geq f(x) + \nabla f(x)^{\top} (y - x)

is satisfied.

This can be proved using the definition of convex functions.

Proof

Assume ff is convex and we have x,y∈Rnx, y \in \mathbb{R}^n and x≠yx \neq y. By the definition of convex functions, we have

f(12x+12y)≤12f(x)+12f(y)f\Big( \frac{1}{2}x + \frac{1}{2}y \Big) \leq \frac{1}{2} f(x) + \frac{1}{2} f(y)

We denote h=y−xh = y - x. Then the inequality becomes

f(x+12h)≤12f(x)+12f(x+h)f\Big( x + \frac{1}{2}h \Big) \leq \frac{1}{2} f(x) + \frac{1}{2} f(x + h)

We could subtract f(x)f(x) from both side of the inequality without breaking it.

f(x+12h)−f(x)≤12f(x+h)−12f(x)f\Big( x + \frac{1}{2}h \Big) - f(x) \leq \frac{1}{2} f(x + h) - \frac{1}{2} f(x)

and thus

f(x+h)−f(x)≥f(x+2−1h)−f(x)2−1f(x + h) - f(x) \geq \frac{f(x + 2^{-1}h) - f(x)}{2^{-1}}

With this, we could equivalently have

f(x+21−kh)−f(x)≥f(x+2−kh)−f(x)2−1f(x + 2^{1-k}h) - f(x) \geq \frac{f(x + 2^{-k}h) - f(x)}{2^{-1}}

Therefore,

f(x+h)−f(x)≥f(x+2−1h)−f(x)2−1≥f(x+2−2h)−f(x)2−2⋮≥f(x+2−kh)−f(x)2−k\begin{align} f(x + h) - f(x) &\geq \frac{f(x + 2^{-1}h) - f(x)}{2^{-1}} \\ &\geq \frac{f(x + 2^{-2}h) - f(x)}{2^{-2}} \\ &\vdots \\ &\geq \frac{f(x + 2^{-k}h) - f(x)}{2^{-k}} \\ \end{align}

Note that according to the definition of directional derivative,

lim⁡k→∞f(x+2−kh)−f(x)2−k=∇hf(x)=∇f(x)⊤h\lim_{k \rightarrow \infty} \frac{f(x + 2^{-k}h) - f(x)}{2^{-k}} = \nabla_{h} f(x) = \nabla f(x)^{\top} h

Therefore,

f(x+h)−f(x)≥∇f(x)⊤h\begin{align} f(x + h) - f(x) &\geq \nabla f(x)^{\top} h \end{align}

We replace hh by y−xy - x and got

f(y)−f(x)≥∇f(x)⊤(y−x)\begin{align} f(y) - f(x) &\geq \nabla f(x)^{\top} (y-x) \end{align}

Therefore,

f(y)≥f(x)+∇f(x)⊤(y−x)\begin{align} f(y) &\geq f(x) + \nabla f(x)^{\top} (y-x) \end{align}

Now assume for every x,y∈Rnx, y \in \mathbb{R}^n, we have

f(y)≥f(x)+∇f(x)⊤(y−x)f(y) \geq f(x) + \nabla f(x)^{\top} (y - x)

For any arbitrary w,v∈Rnw, v \in \mathbb{R}^n, and $0 \leq \lambda \leq 1$, we denote

x=λw+(1−λ)vx = \lambda w + (1 - \lambda) v

Then according to the inequality assumption, we have

f(w)≥f(x)+∇f(x)⊤(w−x)f(v)≥f(x)+∇f(x)⊤(v−x)\begin{align} f(w) &\geq f(x) + \nabla f(x)^{\top} (w - x) \\ f(v) &\geq f(x) + \nabla f(x)^{\top} (v - x) \\ \end{align}

Note that

v−x=λ(v−w)w−x=(1−λ)(w−v)\begin{gather} v - x = \lambda(v - w) \\ w - x = (1 - \lambda) (w - v) \\ \end{gather}

So we could have the following inequality,

λf(w)+(1−λ)f(v)≥λ(f(x)+∇f(x)⊤(w−x))+(1−λ)(f(x)+∇f(x)⊤(v−x))=f(x)+∇f(x)⊤(λ(w−x)+(1−λ)(v−x))=f(x)+∇f(x)⊤(λ(1−λ)(w−v)+(1−λ)λ(v−w))=f(x)=f(λw+(1−λ)v)\begin{align} \lambda f(w) + (1 - \lambda) f(v) &\geq \lambda \Big( f(x) + \nabla f(x)^{\top} (w - x) \Big) + (1 - \lambda) \Big( f(x) + \nabla f(x)^{\top} (v - x) \Big) \\ &= f(x) + \nabla f(x)^{\top} \Big( \lambda (w - x) + (1 - \lambda)(v - x) \Big) \\ &= f(x) + \nabla f(x)^{\top} \Big( \lambda (1 - \lambda) (w - v) + (1 - \lambda)\lambda(v - w) \Big) \\ &= f(x) \\ &= f(\lambda w + (1 - \lambda) v) \\ \end{align}

Because ww and vv are arbitrary, therefore, by definition, ff is a convex function.

This concludes the proof.

Similarly, for strictly convex function, the inequality becomes

f(y)>f(x)+∇f(x)⊤(y−x)f(y) > f(x) + \nabla f(x)^{\top} (y - x)

and we could prove it using the similar fashion as we did for convex function.

Taylor Theorem

The univariate and multivariate Taylor theorem has been discussed and proved in detail in my previous blog post “Taylor Theorem”.

For quadratic multivariate Taylor theorem, let f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} be a $2$-times differentiable function at the point a∈Rna \in \mathbb{R}^n. Using the Lagrange form of the remainder, there exists t∈(0,1)t \in (0, 1) such that

f(x)=f(a)+∇f(a)⊤(x−a)+12(x−a)⊤H(a+t(x−a))(x−a)\begin{align} f(x) &= f(a) + \nabla f(a)^{\top} (x-a) + \frac{1}{2} (x-a)^{\top} H(a + t(x - a)) (x-a) \\ \end{align}

First-Order Necessary Conditions for Local Minimizer

If function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is continuously differentiable, suppose x∗x^{\ast} is a local minimizer of ff, then ∇f(x∗)=0\nabla f(x^{\ast}) = 0.

Proof

Given an arbitrary constant s∈Rns \in \mathbb{R}^n, we construct a new univariate function g:R→Rg: \mathbb{R} \rightarrow \mathbb{R}

g(α)=f(x∗+αs)g(\alpha) = f(x^{\ast} + \alpha s)

Because x∗x^{\ast} is a local minimizer of ff, it is easy to see that $0$ is a local minimizer of gg.

According to Taylor theorem,

g(α)=g(0)+g′(0)(α−0)+h(α)(α−0)=g(0)+g′(0)α+h(α)α\begin{align} g(\alpha) &= g(0) + g^{\prime}(0) (\alpha - 0) + h(\alpha) (\alpha - 0) \\ &= g(0) + g^{\prime}(0) \alpha + h(\alpha) \alpha \\ \end{align}

where

lim⁡α→0h(α)=0\lim_{\alpha \rightarrow 0} h(\alpha) = 0

Suppose g′(0)≠0g^{\prime}(0) \neq 0, because

lim⁡α→0h(α)=0\lim_{\alpha \rightarrow 0} h(\alpha) = 0

There must exists an ε>0\varepsilon > 0 such that for all $0 < \lvert \alpha \rvert < \varepsilon$

g(α)>g(0)g(\alpha) > g(0)

∣h(α)∣<∣g′(0)∣\lvert h(\alpha) \rvert < \big\lvert g^{\prime}(0) \big\rvert

Because for all $0 < \lvert \alpha \rvert < \varepsilon$

g(α)−g(0)=g′(0)α+h(α)α=(g′(0)+h(α))α>0\begin{align} g(\alpha) - g(0) &= g^{\prime}(0) \alpha + h(\alpha) \alpha \\ &= \big( g^{\prime}(0) + h(\alpha) \big) \alpha \\ &> 0 \end{align}

If g′(0)<0g^{\prime}(0) < 0, then g′(0)+h(α)<0g^{\prime}(0) + h(\alpha) < 0, and (g′(0)+h(α))α<0\big( g^{\prime}(0) + h(\alpha) \big) \alpha < 0 when $0 < \alpha < \varepsilon$. This raises a contradiction.

If g′(0)>0g^{\prime}(0) > 0, then g′(0)+h(α)>0g^{\prime}(0) + h(\alpha) > 0, and (g′(0)+h(α))α<0\big( g^{\prime}(0) + h(\alpha) \big) \alpha < 0 when −ε<α<0-\varepsilon < \alpha < 0. This raises a contradiction.

Therefore,

g′(0)=0g^{\prime}(0) = 0

Let’s derive what g′(α)g^{\prime}(\alpha) is.

g′(α)=dg(α)dα=df(x∗+αd)dα\begin{align} g^{\prime}(\alpha) &= \frac{d g(\alpha)}{ d \alpha } \\ &= \frac{d f(x^{\ast} + \alpha d)}{ d \alpha } \\ \end{align}

By applying the higher-order differentials, we define u=x∗+αsu = x^{\ast} + \alpha s, we have

g′(α)=df(x∗+αs)dα=df(u)dα=∇f(u)⊤dudα=∇f(u)⊤sdαdα=∇f(u)⊤s=∇f(x∗+αs)⊤s\begin{align} g^{\prime}(\alpha) &= \frac{d f(x^{\ast} + \alpha s)}{ d \alpha } \\ &= \frac{d f(u)}{ d \alpha } \\ &= \frac{\nabla f(u)^{\top} d u}{ d \alpha } \\ &= \frac{\nabla f(u)^{\top} s d \alpha}{ d \alpha } \\ &= \nabla f(u)^{\top} s \\ &= \nabla f(x^{\ast} + \alpha s)^{\top} s \\ \end{align}

where ∇f⊤\nabla f^{\top} is a row vector and ss is a column vector. Specifically,

∇f⊤=[∂f∂u1,∂f∂u2,⋯ ,∂f∂un]\nabla f^{\top} = \bigg[ \frac{\partial f}{\partial u_1}, \frac{\partial f}{\partial u_2}, \cdots, \frac{\partial f}{\partial u_n} \bigg]

Therefore,

g′(0)=∇f(x∗)⊤s=0\begin{align} g^{\prime}(0) &= \nabla f(x^{\ast})^{\top} s \\ &= 0 \\ \end{align}

Because ss is arbitrary, therefore,

∇f(x∗)=0\nabla f(x^{\ast}) = 0

This concludes the proof.

Global Minimizer

If function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is convex and differentiable, then x∗x^{\ast} is a global minimizer of ff if and only if ∇f(x∗)=0\nabla f(x^{\ast}) = 0.

Proof

Assume x∗x^{\ast} is a global minimizer, then x∗x^{\ast} is also a local minimizer. According to the first-order necessary conditions for local minimizer, ∇f(x∗)=0\nabla f(x^{\ast}) = 0.

Now assume ∇f(x∗)=0\nabla f(x^{\ast}) = 0, according to the sufficient and necessary condition for convex functions, we must have

f(y)≥f(x∗)+∇f(x∗)⊤(y−x∗)≥f(x∗)\begin{align} f(y) &\geq f(x^{\ast}) + \nabla f(x^{\ast})^{\top} (y - x^{\ast}) \\ &\geq f(x^{\ast}) \\ \end{align}

Because yy is arbitrary, therefore x∗x^{\ast} is a global minimizer.

This concludes the proof.

Second-Order Necessary Conditions for Local Minimizer

If function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is $2$ times continuously differentiable, suppose x∗x^{\ast} is a local minimizer of ff, then the Hessian matrix H(x∗)H(x^{\ast}), i.e., ∇2f(x∗)\nabla^2 f(x^{\ast}), must be positive semi-definite.

Proof

Given an arbitrary constant s∈Rns \in \mathbb{R}^n, we construct a new univariate function g:R→Rg: \mathbb{R} \rightarrow \mathbb{R}

g(α)=f(x∗+αs)g(\alpha) = f(x^{\ast} + \alpha s)

According to Taylor theorem,

g(α)=g(0)+g′(0)(α−0)+12g′′(0)(α−0)2+h(α)(α−0)2=g(0)+g′(0)α+12g′′(0)α2+h(α)α2\begin{align} g(\alpha) &= g(0) + g^{\prime}(0) (\alpha - 0) + \frac{1}{2} g^{\prime\prime}(0) (\alpha - 0)^2 + h(\alpha) (\alpha - 0)^2 \\ &= g(0) + g^{\prime}(0) \alpha + \frac{1}{2} g^{\prime\prime}(0) \alpha^2 + h(\alpha) \alpha^2 \\ \end{align}

where

lim⁡α→0h(α)=0\lim_{\alpha \rightarrow 0} h(\alpha) = 0

Because x∗x^{\ast} is a local minimizer of ff, it is easy to see that $0$ is a local minimizer of gg. By the first-order necessary condition for local minimum, we must have

g′(0)=0g^{\prime}(0) = 0

We further claim that

g′′(0)≥0g^{\prime\prime}(0) \geq 0

and we will prove it by contradiction.

Because

lim⁡α→0h(α)=0\lim_{\alpha \rightarrow 0} h(\alpha) = 0

there must exists an ε>0\varepsilon > 0 such that for all $0 < \lvert \alpha \rvert < \varepsilon$

g(α)>g(0)g(\alpha) > g(0)

h(α)<∣12g′′(0)∣h(\alpha) < \bigg\lvert \frac{1}{2} g^{\prime\prime}(0) \bigg\rvert

We further multiply the non-negative α2\alpha^2 on both sides of the inequality.

h(α)α2<∣12g′′(0)∣α2h(\alpha) \alpha^2 < \bigg\lvert \frac{1}{2} g^{\prime\prime}(0) \bigg\rvert \alpha^2

Because for all $0 < \lvert \alpha \rvert < \varepsilon$

g(α)−g(0)=g′(0)α+12g′′(0)α2+h(α)α2=12g′′(0)α2+h(α)α2>0\begin{align} g(\alpha) - g(0) &= g^{\prime}(0) \alpha + \frac{1}{2} g^{\prime\prime}(0) \alpha^2 + h(\alpha) \alpha^2 \\ &= \frac{1}{2} g^{\prime\prime}(0) \alpha^2 + h(\alpha) \alpha^2 \\ &> 0 \end{align}

Suppose g′′(0)<0g^{\prime\prime}(0) < 0, then 12g′′(0)α2+h(α)α2<0\frac{1}{2} g^{\prime\prime}(0) \alpha^2 + h(\alpha) \alpha^2 < 0. This raises a contradiction.

Therefore,

g′′(0)≥0g^{\prime\prime}(0) \geq 0

We have shown that

g′(α)=∇f(u)⊤s\begin{align} g^{\prime}(\alpha) &= \nabla f(u)^{\top} s \\ \end{align}

where u=x∗+αsu = x^{\ast} + \alpha s, ∇f⊤\nabla f^{\top} is a row vector and ss is a column vector. Specifically,

∇f⊤=[∂f∂u1,∂f∂u2,⋯ ,∂f∂un]\nabla f^{\top} = \bigg[ \frac{\partial f}{\partial u_1}, \frac{\partial f}{\partial u_2}, \cdots, \frac{\partial f}{\partial u_n} \bigg]

If we expand the dot product, we have

g′(α)=∑i=1n∂f(u)∂uisi\begin{align} g^{\prime}(\alpha) &= \sum_{i=1}^{n} \frac{\partial f(u)}{\partial u_i} s_i \\ \end{align}

Similarly,

g′′(α)=∑i=1nd∂f(u)∂uidαsi=∑i=1n∇∂f(u)∂ui⊤dudαsi=∑i=1n∇∂f(u)∂ui⊤dudαsi=∑i=1n∇∂f(u)∂ui⊤ssi\begin{align} g^{\prime\prime}(\alpha) &= \sum_{i=1}^{n} \frac{d \frac{\partial f(u)}{\partial u_i}}{d \alpha} s_i \\ &= \sum_{i=1}^{n} \frac{ \nabla \frac{\partial f(u)}{\partial u_i}^{\top} du}{d \alpha} s_i \\ &= \sum_{i=1}^{n} \nabla \frac{\partial f(u)}{\partial u_i}^{\top} \frac{ du}{d \alpha} s_i \\ &= \sum_{i=1}^{n} \nabla \frac{\partial f(u)}{\partial u_i}^{\top} s s_i \\ \end{align}

where

∇∂f∂ui⊤=[∂2f∂ui∂u1,∂2f∂ui∂u2,⋯ ,∂2f∂ui∂un]\nabla \frac{\partial f}{\partial u_i}^{\top} = \bigg[ \frac{\partial^2 f}{\partial u_i \partial u_1}, \frac{\partial^2 f}{\partial u_i \partial u_2}, \cdots, \frac{\partial^2 f}{\partial u_i \partial u_n} \bigg]

If we expand the dot product, we have

g′′(α)=∑i=1n∇∂f(u)∂ui⊤ssi=∑i=1n(∑j=1n∂2f(u)∂ui∂ujsj)si=∑i=1n∑j=1n∂2f(u)∂ui∂ujsisj=∑i=1n∑j=1n∂2f(x∗+αs)∂ui∂ujsisj=s⊤∇2f(u)s=s⊤∇2f(x∗+αs)s\begin{align} g^{\prime\prime}(\alpha) &= \sum_{i=1}^{n} \nabla \frac{\partial f(u)}{\partial u_i}^{\top} s s_i \\ &= \sum_{i=1}^{n} \bigg( \sum_{j=1}^{n} \frac{\partial^2 f(u)}{\partial u_i \partial u_j} s_j \bigg) s_i \\ &= \sum_{i=1}^{n} \sum_{j=1}^{n} \frac{\partial^2 f(u)}{\partial u_i \partial u_j} s_i s_j \\ &= \sum_{i=1}^{n} \sum_{j=1}^{n} \frac{\partial^2 f(x^{\ast} + \alpha s)}{\partial u_i \partial u_j} s_i s_j \\ &= s^{\top} \nabla^2 f(u) s \\ &= s^{\top} \nabla^2 f(x^{\ast} + \alpha s) s \\ \end{align}

Therefore,

g′′(0)=s⊤∇2f(x∗)s≥0\begin{align} g^{\prime\prime}(0) &= s^{\top} \nabla^2 f(x^{\ast}) s \\ &\geq 0 \\ \end{align}

Because ss is arbitrary, therefore, ∇2f(x∗)\nabla^2 f(x^{\ast}) is positive semi-definite.

This concludes the proof.

Hessian Matrix

A twice differentiable function f:Rn→Rf: \mathbb{R}^n \rightarrow \mathbb{R} is convex if and only if its Hessian matrix ∇2f(x)\nabla^2 f(x) is positive semi-definite for all x∈Rnx \in \mathbb{R}^n.

Proof

Assume ff is convex and we have an arbitrary value a∈Rna \in \mathbb{R}^n. We define a new function g:Rn→Rg: \mathbb{R}^n \rightarrow \mathbb{R}.

g(y)=f(y)−∇f(a)⊤(y−a)g(y) = f(y) - \nabla f(a)^{\top} (y - a)

Because −∇f(a)⊤(y−a)- \nabla f(a)^{\top} (y - a) is a linear function, thus it is convex. Because g(y)g(y) is the summation of two convex functions, f(y)f(y) and −∇f(a)⊤(y−a)- \nabla f(a)^{\top} (y - a), thus it is convex.

The first-order and second-order partial derivatives of gg are

∇g(y)=∇f(y)−∇f(a)\nabla g(y) = \nabla f(y) - \nabla f(a)

∇2g(y)=∇2f(y)\nabla^2 g(y) = \nabla^2 f(y)

for all y∈Rny \in \mathbb{R}^n.

We also note that

∇g(a)=∇f(a)−∇f(a)=0\begin{align} \nabla g(a) = \nabla f(a) - \nabla f(a) = 0 \end{align}

From the property of the global minimizer of a convex and differentiable function, we know that aa is a global minimizer of gg. Based on the second-order necessary condition for a local minimizer (global minimizer is also a local minimizer), ∇2g(a)\nabla^2 g(a) is positive semi-definite. Because ∇2g(a)=∇2f(a)\nabla^2 g(a) = \nabla^2 f(a), ∇2f(a)\nabla^2 f(a) is also positive semi-definite. Because a∈Rna \in \mathbb{R}^n is arbitrary, the Hessian matrix ∇2f(x)\nabla^2 f(x) is positive semi-definite for all x∈Rnx \in \mathbb{R}^n.

Assume the Hessian matrix ∇2f(x)\nabla^2 f(x) is positive semi-definite for all x∈Rnx \in \mathbb{R}^n, according to Taylor’s theorem,

f(y)=f(x)+∇f(x)⊤(y−x)+12(y−x)⊤∇2f(x+t(y−x))(y−x)f(y) = f(x) + \nabla f(x)^{\top} (y-x) + \frac{1}{2} (y-x)^{\top} \nabla^2 f(x + t(y-x)) (y-x)

for some $0 \leq t \leq 1$.

Because ∇2f(x)\nabla^2 f(x) is positive semi-definite for all x∈Rnx \in \mathbb{R}^n, (y−x)⊤∇2f(x+t(y−x))(y−x)≥0(y-x)^{\top} \nabla^2 f(x + t(y-x)) (y-x) \geq 0. Therefore,

f(y)≥f(x)+∇f(x)⊤(y−x)f(y) \geq f(x) + \nabla f(x)^{\top} (y-x)

This proves tha ff is convex.

This concludes the proof.

References