23
Convex Functions Prof. Daniel P. Palomar ELEC5470/IEDA6100A - Convex Optimization The Hong Kong University of Science and Technology (HKUST) Fall 2019-20

Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Convex Functions

Prof. Daniel P. Palomar

ELEC5470/IEDA6100A - Convex Optimization

The Hong Kong University of Science and Technology (HKUST)

Fall 2019-20

Page 2: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Outline of Lecture

• Definition convex function

• Examples on R, Rn, and Rn×n

• Restriction of a convex function to a line

• First- and second-order conditions

• Operations that preserve convexity

• Quasi-convexity, log-convexity, and convexity w.r.t. generalized

inequalities

(Acknowledgement to Stephen Boyd for material for this lecture.)

Daniel P. Palomar 1

Page 3: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Definition of Convex Function

• A function f : Rn −→ R is said to be convex if the domain, dom f ,

is convex and for any x, y ∈ dom f and 0 ≤ θ ≤ 1,

f (θx+ (1− θ) y) ≤ θf (x) + (1− θ) f (y) .

• f is strictly convex if the inequality is strict for 0 < θ < 1.

• f is concave if −f is convex.

Daniel P. Palomar 2

Page 4: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Examples on RConvex functions:

• affine: ax+ b on R

• powers of absolute value: |x|p on R, for p ≥ 1 (e.g., |x|)

• powers: xp on R++, for p ≥ 1 or p ≤ 0 (e.g., x2)

• exponential: eax on R

• negative entropy: x log x on R++

Concave functions:

• affine: ax+ b on R

• powers: xp on R++, for 0 ≤ p ≤ 1

• logarithm: log x on R++

Daniel P. Palomar 3

Page 5: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Examples on Rn

• Affine functions f (x) = aTx+ b are convex and concave on Rn.

• Norms ‖x‖ are convex on Rn (e.g., ‖x‖∞, ‖x‖1, ‖x‖2).

• Quadratic functions f (x) = xTPx + 2qTx + r are convex Rn if

and only if P � 0.

• The geometric mean f (x) = (∏ni=1 xi)

1/nis concave on Rn

++.

• The log-sum-exp f (x) = log∑i exi is convex on Rn (it can be

used to approximate maxi=1,...,n

xi).

• Quadratic over linear: f (x, y) = x2/y is convex on Rn ×R++.

Daniel P. Palomar 4

Page 6: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Examples on Rn×n

• Affine functions: (prove it!)

f (X) = Tr (AX) + b

are convex and concave on Rn×n.

• Logarithmic determinant function: (prove it!)

f (X) = logdet (X)

is concave on Sn = {X ∈ Rn×n | X � 0}.

• Maximum eigenvalue function: (prove it!)

f (X) = λmax (X) = supy 6=0

yTXy

yTy

is convex on Sn.

Daniel P. Palomar 5

Page 7: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Epigraph

• The epigraph of f if the set

epi f ={(x, t) ∈ Rn+1 | x ∈ dom f, f (x) ≤ t

}.

• Relation between convexity in sets and convexity in functions:

f is convex⇐⇒ epi f is convex

Daniel P. Palomar 6

Page 8: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Restriction of a Convex Function to a Line

• f : Rn −→ R is convex if and only if the function g : R −→ R

g (t) = f (x+ tv) , dom g = {t | x+ tv ∈ dom f}

is convex for any x ∈ dom f, v ∈ Rn.

• In words: a function is convex if and only if it is convex when

restricted to an arbitrary line.

• Implication: we can check convexity of f by checking convexity of

functions of one variable!

• Example: concavity of logdet (X) follows from concavity of log (x).

Daniel P. Palomar 7

Page 9: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Example: concavity of logdet (X) :

g (t) = logdet (X + tV ) = logdet (X) + logdet(I + tX−1/2V X−1/2

)= logdet (X) +

n∑i=1

log (1 + tλi)

where λi’s are the eigenvalues of X−1/2V X−1/2.

The function g is concave in t for any choice of X � 0 and V ;

therefore, f is concave.

Daniel P. Palomar 8

Page 10: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

First and Second Order Condition

• Gradient (for differentiable f):

∇f (x) =[∂f(x)∂x1

· · · ∂f(x)∂xn

]T∈ Rn.

• Hessian (for twice differentiable f):

∇2f (x) =

(∂2f (x)

∂xi∂xj

)ij

∈ Rn×n.

• Taylor series:

f (x+ δ) = f (x) +∇f (x)T δ + 1

2δT∇2f (x) δ + o

(‖δ‖2

).

Daniel P. Palomar 9

Page 11: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

• First-order condition: a differentiable f with convex domain is

convex if and only if

f (y) ≥ f (x) +∇f (x)T (y − x) ∀x, y ∈ dom f

• Interpretation: first-order approximation if a global underestimator.

• Second-order condition: a twice differentiable f with convex

domain is convex if and only if

∇2f (x) � 0 ∀x ∈ dom f

Daniel P. Palomar 10

Page 12: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Examples

• Quadratic function: f (x) = (1/2)xTPx+ qTx+ r (with P ∈ Sn)

∇f (x) = Px+ q, ∇2f (x) = P

is convex if P � 0.

• Least-squares objective: f (x) = ‖Ax− b‖22

∇f (x) = 2AT (Ax− b) , ∇2f (x) = 2ATA

is convex.

Daniel P. Palomar 11

Page 13: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

• Quadratic-over-linear: f (x, y) = x2/y

∇2f (x, y) =2

y3

[y

−x

] [y −x

]� 0

is convex for y > 0.

Daniel P. Palomar 12

Page 14: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Operations that Preserve ConvexityHow do we establish the convexity of a given function?

1. Applying the definition.

2. With first- or second-order conditions.

3. By restricting to a line.

4. Showing that the functions can be obtained from simple functions

by operations that preserve convexity:

• nonnegative weighted sum

• composition with affine function (and other compositions)

• pointwise maximum and supremum, minimization

• perspective

Daniel P. Palomar 13

Page 15: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

• Nonnegative weighted sum: if f1, f2 are convex, then α1f1+α2f2is convex, with α1, α2 ≥ 0.

• Composition with affine functions: if f is convex, then f (Ax+ b)

is convex (e.g., ‖y −Ax‖ is convex, logdet(I +HXHT

)is con-

cave).

• Pointwise maximum: if f1, . . . , fm are convex, then f (x) =

max {f1, . . . , fm} is convex.

Example: sum of r largest components of x ∈ Rn: f (x) = x[1] +

x[2] + · · ·+ x[r] where x[i] is the ith largest component of x.

Proof: f (x) = max {xi1 + xi2 + · · ·+ xir | 1 ≤ i1 < i2 < · · · < ir ≤ n}.

Daniel P. Palomar 14

Page 16: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

• Pointwise supremum: if f (x, y) is convex in x for each y ∈ A,

then

g (x) = supy∈A

f (x, y)

is convex.

Example: distance to farthest point in a set C:

f (x) = supy∈C‖x− y‖ .

Example: maximum eigenvalue of symmetric matrix: for X ∈ Sn,

λmax (X) = supy 6=0

yTXy

yTy.

Daniel P. Palomar 15

Page 17: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

• Composition with scalar functions: let g : Rn −→ R and

h : R −→ R, then the function f (x) = h (g (x)) satisfies:

f (x) is convex ifg convex, h convex nondecreasing

g concave, h convex nonincreasing

• Minimization: if f (x, y) is convex in (x, y) and C is a convex set,

theng (x) = inf

y∈Cf (x, y)

is convex (e.g., distance to a convex set).

Example: distance to a set C:

f (x) = infy∈C‖x− y‖

is convex if C is convex.

Daniel P. Palomar 16

Page 18: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

• Perspective: if f (x) is convex, then its perspective

g (x, t) = tf (x/t) , dom g ={(x, t) ∈ Rn+1 | x/t ∈ dom f, t > 0

}is convex.

Example: f (x) = xTx is convex; hence g (x, t) = xTx/t is convex for

t > 0.

Example: the negative logarithm f (x) = − log x is convex; hence the

relative entropy function g (x, t) = t log t− t log x is convex on R2++.

Daniel P. Palomar 17

Page 19: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Quasi-Convexity Functions

• A function f : Rn −→ R is quasi-convex if dom f is convex and the

sublevel sets

Sα = {x ∈ dom f | f (x) ≤ α}are convex for all α.

• f is quasiconcave if −f is quasiconvex.

Daniel P. Palomar 18

Page 20: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Examples:

•√|x| is quasiconvex on R

• ceil (x) = inf {z ∈ Z | z ≥ x} is quasilinear

• log x is quasilinear on R++

• f (x1, x2) = x1x2 is quasiconcave on R2++

• the linear-fractional function

f (x) =aTx+ b

cTx+ d, dom f =

{x | cTx+ d > 0

}is quasilinear

Daniel P. Palomar 19

Page 21: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Log-Convexity

• A positive function f is log-concave is log f is concave:

f (θx+ (1− θ) y) ≥ f (x)θ f (y)1−θ for 0 ≤ θ ≤ 1.

• f is log-convex if log f is convex.

• Example: xa on R++ is log-convex for a ≤ 0 and log-concave for

a ≥ 0

• Example: many common probability densities are log-concave

Daniel P. Palomar 20

Page 22: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

Convexity w.r.t. Generalized Inequalities

• f : Rn −→ Rm is K-convex if dom f is convex and for any

x, y ∈ dom f and 0 ≤ θ ≤ 1,

f (θx+ (1− θ) y) �K θf (x) + (1− θ) f (y) .

• Example: f : Sm −→ Sm, f (X) = X2 is Sm+ -convex.

Daniel P. Palomar 21

Page 23: Convex Functions - Hong Kong University of Science and … · 2019-12-03 · De nition of Convex Function A function f: Rn!R is said to be convex if the domain, domf, is convex and

References

Chapter 3 of

• Stephen Boyd and Lieven Vandenberghe, Convex Optimization.

Cambridge, U.K.: Cambridge University Press, 2004.

https://web.stanford.edu/˜boyd/cvxbook/bv cvxbook.pdf

Daniel P. Palomar 22