0% found this document useful (0 votes)
48 views93 pages

Slide-2 Convex Functions Updated 926

This document discusses definitions and examples of convex functions. It provides the definition of a convex function as a real continuous function f: Ω → R that satisfies Jensen's inequality for any p1 ∈ [0,1]. Examples of convex functions include exponential, geometric mean, and quadratic functions. The document also discusses proofs of various inequalities using properties of convex/concave functions.

Uploaded by

Lin D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views93 pages

Slide-2 Convex Functions Updated 926

This document discusses definitions and examples of convex functions. It provides the definition of a convex function as a real continuous function f: Ω → R that satisfies Jensen's inequality for any p1 ∈ [0,1]. Examples of convex functions include exponential, geometric mean, and quadratic functions. The document also discusses proofs of various inequalities using properties of convex/concave functions.

Uploaded by

Lin D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 93

Convex Optimization Theory and

Applications
Topic 2 - Convex Functions

Li Li

Department of Automation
Tsinghua University

Fall, 2009-2022.

-1-
2.0. Outline 纲要
2.1. Definition and Examples 定义和例子

2.2. Strong Convexity 强凸

2.3. Operations that Preserve Convexity 保凸运算

2.4. Quasi-Convexity 拟凸

2.5. Log-Concave and Log-Convex 对数凹和对数凸

2.6. Convexity w.r.t. Generalized Inequalities 广义不等式

2.7. Not Exactly Convex but …一些不那么凸的函数

-2-
2.1. Definitions and Examples 定义和例子
布尔巴基学派从集合论观点看数学,认为数学的研究对象
只有集合,除了集合之外,数学不研究任何其他问题,也不
回答任何其他问题。所以,布尔巴基学派把函数定义为三元
组。

In 1954, Bourbaki gave a definition of a function as a triple


( A, F , B) , where F is a functionalgraph, meaning a set of pairs
where no two pairs have the same first member.

此处,三元组 ( A, F , B) 是 Pairs 序偶的集合,此序偶的元


素分别取自集合 A 与 B ,且集合 A 中的元素在三元组中出现
有且仅有一次。函数图像 F 一般简称为函数 Function。

-3-
2.1. Definitions and Examples 定义和例子
凸函数 f is a real continuous function f :   R that is
convex, if and only if, for any p1  0,1 , we have

p1 f ( x1 )  1  p1  f ( x2 )  f  p1x1  1  p1  x2  (2.1)

凹函数 f is concave if  f is convex

-4-
2.1. Definitions and Examples 定义和例子

无论是凸函数,还是凹函数,一定要求定义域为凸集

-5-
2.1. Definitions and Examples 定义和例子
Jensen 不 等 式 Jensen's Inequality : If p1 , ..., pn are
positive numbers which sum to 1 and f is a real continuous
function that is concave up, then

n
 n 

i 1
pi f ( xi )  f   pi xi 
 i 1  (2.2)

How to prove?

-6-
2.1. Definitions and Examples 定义和例子
What are the convex functions to prove these inequalities?

x y
1 x
e 2
 (e  e y )
2 (2.3)

n a1  a2    an
 n a1a2 an 
1 1 1 n
  (2.4)
a1 a2 an

x1  x2    xn x12  x22    xn2



n n (2.5)

-7-
2.1. Definitions and Examples 定义和例子
Consider the concave function in R 

f ( x )  ln x (2.6)

We have

n
1 n 1 n 1 n  1 n 
ln n  xk   ln xk   f ( xk )  f   xk   ln   xk 
k 1 n k 1 n k 1  n k 1   n k 1 
(2.7)

Thus, we prove the right hand side of (2.4).

-8-
2.1. Definitions and Examples 定义和例子
Please prove that for a triangle ABC , we have

3 3
sin A  sin B  sin C 
2 (2.8)

-9-
2.1. Definitions and Examples 定义和例子
Consider the concave function f (x ) in ( 0 ,  )

f ( x)  sin x (2.9)

We have

sinA  sinB  sinC f ( A)  f ( B)  f (C )  A B C   3


  f   sin 
3 3  3  3 2

(2.10)

What is the lower bound of sin A  sin B  sin C ?

- 10 -
2.1. Definitions and Examples 定义和例子
Clearly, we have sin A  0 , sin B  0 , sin C  0 , Thus, we
have

sin A  sin B  sin C


 sin A  sin B  sin(  ( A  B))
 sin A  sin B  sin( A  B)

Can you get the result now?

- 11 -
2.1. Definitions and Examples 定义和例子

证明下图三角形△ABC 是等边三角形。

- 12 -
2.1. Definitions and Examples 定义和例子

设顶点在 A, B, C 处、角度尚末获知的那些角分别为 x, y, z 。
1
sin x sin y sin z 
依角元 Ceva 定理,有 8 , 其中 x  y  z  90 。

再依 Jensen 不等式和均值不等式,又有
3  x yz 3
 3sin    sin x  sin y  sin z  3 sin x sin y sin z 
3
2  3  2

于是
3
sin x  sin y  sin z 
2
这表明前述不等式需两端取等,显然必须要 x  y  z ,即证。
- 13 -
2.1. Definitions and Examples 定义和例子
a b c 3
a, b, c  0   
设 , abc 3 , 请 证 明 1 b 2
1 c 2
1 a 2
2

(Bulgaria TST 2003)

- 14 -
2.1. Definitions and Examples 定义和例子
如果直接平均不等式,不行
a b c a b c 3
     
1 b 1 c
2 2
1 a 2
2b 2c 2a 2

但是注意到
a ab2 ab2 ab
 a   a   a 
1  b2 1  b2 2b 2
3  ab  bc  ca    a  b  c 
2

我们可以得到
a b c ab bc ca 3
   a   b   c  
1 b 1 c
2 2
1 a 2
2 2 2 2

- 15 -
2.1. Definitions and Examples 定义和例子
If a  b  c  d  2 , a  2b  3c  6d  2 , please derive the
2 2 2 2

value of a .

- 16 -
2.1. Definitions and Examples 定义和例子
Since

 1 1 1 2
              4
2 2 2 2
 1 a 2b 3c 6d a b c d
 2 3 6

We have a 2
 4b 2
 9c 2
 36d 2
1

So

a 1

- 17 -
2.1. Definitions and Examples 定义和例子
How to prove

a 2  b2  b2  c 2  c 2  a 2  2  a  b  c 

- 18 -
2.1. Definitions and Examples 定义和例子

- 19 -
2.1. Definitions and Examples 定义和例子
设实数 a, b, c, d 满足 a  b  c  d  0 ,且 a  b  c  d  1。证
明: (a  2b  3c  4d )a abbc c d d  1。(IMO 2020)

- 20 -
2.1. Definitions and Examples 定义和例子
设实数 a, b, c, d 满足 a  b  c  d  0 ,且 a  b  c  d  1。证
明: (a  2b  3c  4d )a abbc c d d  1。(IMO 2020)

证明:由算术平均-几何平均不等式(Jensen's Inequality) ,
我们有
a a bb c c d d  a  a  b  b  c  c  d  d  a 2  b 2  c 2  d 2
故只需证明
3
 
(a  2b  3c  4d )(a  b  c  d )    a 
2 2 2 2
(2.11)
 cyc 
注意到
3
 
      b  6 abc
3 2
a a 3 a
 cyc  cyc sym cyc

- 21 -
2.1. Definitions and Examples 定义和例子

a 3  2ab 2  ad 2  a  a 2
cyc

2a 2b  ab 2  b3  2bc 2  2bd 2  2b a 2


cyc

3a 2c  3b 2c  3ac 2  3cd 2  3c  a 2
cyc

3a 2 d  a 2b  4abd  4acd  4bcd  4d  a 2


cyc
3
 
上述四个不等式相加,其左侧与   a  相比差值为正数,
 cyc 
则(2.11)不等式成立,故原不等式也成立。

- 22 -
2.1. Definitions and Examples 定义和例子
1 4
已知 a  0, b  0, a  b  2 ,则 y  a  b 的最小值为?
错误解:
1 4 4 4
y  2  z
a b ab ab
1 4
上述不等式当 a  b 时,取得等号。
2 8 4
  a  ,b  5
又由于 a b 2 ,得 5 5 ,得到最小值 ab 。

请问错在哪里?

- 23 -
2.1. Definitions and Examples 定义和例子

实际上的最小值不能在上述等号成立时取到
1 4 4
y  
a b ab
1 4 4
只能推出 a  b 时,y 取应该大于 ab ,但这是个变化的值,

并不是全局最小值。因此可能会:
1 4 4
a0  0, b0  0, s.t.  , min y 
a0 b0 a0b0
4 4
 5 2 8
a  ,b 
此时 a0b0 2 8
 ,即取到比 5 5 时更小的 y 。
5 5

- 24 -
2.1. Definitions and Examples 定义和例子
因此,还是运用Jensen's Inequality求解

1 4  1 4
(a  b)      a   b    3
a b  a b

- 25 -
- 26 -
2.1. Definitions and Examples 定义和例子
定理:定义在开的凸集上的凸函数必然是连续函数

Let X be a normed space, x0  X , r  0,   (0, r ) ,


m, M  . Let f : B 0 ( x0 , r )  be a convex function.
(a) [有界则绝对值有界] If f ( x)  m on B 0 ( x0 , r ) , then
| f ( x) || m | 2 | f ( x0 ) | on B 0 ( x0 , r ) .
(b) [Locally Lipschitz 连续] If | f ( x) | M on B 0 ( x0 , r ) , f
is (2M /  ) -Lipschitz on B 0 ( x0 , r   ) .
(c) [连续] f is locally Lipschitz on C  f is continuous
on C .

- 27 -
2.1. Definitions and Examples 定义和例子
Proof. By translation, we can suppose that x0  0 . Denote
B  B 0 (0, r ) and C  B 0 (0, r   ) . 为了简化书写,仅此而已

(a) 要证明第一个命题,我们需要把 f ( x ) 和 f (0) 联系起来,


而手头能用的就是凸函数的基本性质
Since 0  0.5x  0.5(  x ) ( x  B) , according to convexity, we
have f (0)  0.5 f ( x )  0.5 f (  x ) . Consequently, we have

f ( x)  2 f (0)  f ( x)  2 f (0)  m

上下界都有了,绝对值的界也就有了

| f ( x) | max{m, m  2 f (0)} | m | 2 | f (0) | ( x  B)

- 28 -
2.1. Definitions and Examples 定义和例子

(b) Consider two distinct points x, y  C . z  y  ( y  x)
yx
belongs to B and y  ( x, z ) .

An easy calculation shows that


 yx
y x z (convex combination!)
  yx   yx
- 29 -
2.1. Definitions and Examples 定义和例子
Using convexity of f and multiplying by the common
denominator, we get

  y  x  f ( y )   f ( x)  y  x f ( z)

Then   f ( y )  f ( x )   f ( z )  f ( y ) y  x  2 M y  x . So

2M
f ( y)  f ( x)  yx

Interchanging the role of x and y , we obtain that f is


(2M /  ) -Lipschitz on C .

- 30 -
2.1. Definitions and Examples 定义和例子
(c) Let C  d be open and convex, and f : C  a
convex function. Fix x0  C . There exist finitely many points
c1 , , cn  C such that x0 U : int[conv{c1 , ,cn }] (take, e.g.,
the vertices of a small d -dimensional cube centered at x0 ). 这
里用到了凸包的特性

By convexity, f  max{ f (c1 ), , f (cn )} on U .


Then, based on the conclusions of (a) and (b), f is locally
Lipschitz on U .
Finally, by definitions of uniform continuity, we finalize the
proof.

推论:定义在开的凸集上的凸函数必有极小值
- 31 -
2.1. Definitions and Examples 定义和例子
一维凸函数连续性的另外一个证明:函数 f 在一维区间 I 上
是凸函数,当且仅当 ( x1 , x2 )  I 及任何 x  ( x1 , x2 ) 有
f ( x)  f ( x1 ) f ( x2 )  f ( x1 ) f ( x2 )  f ( x)
  (2.12)
x  x1 x2  x1 x2  x
证明:先证必要性。令
x2  x x  x1
1  , 2 
x2  x1 x2  x1
则 1 , 2  0, 1  2  1, x  1 x1  2 x2 , f ( x) 是凸函数,则
f ( x)  f (1 x1  2 x2 )  1 f ( x1 )  2 f ( x2 )
又 f ( x)  1 f ( x)  2 f ( x)  1 f ( x1 )  2 f ( x2 )
整理得 1[ f ( x)  f ( x1 )]  2 [ f ( x2 )  f ( x)],带入 1 , 2 得
x2  x x  x1
[ f ( x)  f ( x1 )]  [ f ( x2 )  f ( x)]
x2  x1 x2  x1
- 32 -
2.1. Definitions and Examples 定义和例子
f ( x)  f ( x1 ) f ( x2 )  f ( x)
即  。根据柯西不等式可知
x  x1 x2  x
f ( x)  f ( x1 )  f ( x)  f ( x1 )    f ( x2 )  f ( x)  f ( x2 )  f ( x)
 
x  x1  x  x1    x2  x  x2  x
f ( x)  f ( x1 ) f ( x2 )  f ( x1 ) f ( x2 )  f ( x)
即   。
x  x1 x2  x1 x2  x
f ( x)  f ( x1 ) f ( x2 )  f ( x)
下证充分性。将  变形得到
x  x1 x2  x
x2  x x  x1
[ f ( x)  f ( x1 )]  [ f ( x2 )  f ( x)] ,根据必要性证明
x2  x1 x2  x1
的反演可得 f (1 x1  2 x2 )  1 f ( x1 )  2 f ( x2 ) ,由凸函数定义
可知函数 f 是凸函数。证毕。
- 33 -
2.1. Definitions and Examples 定义和例子
而根据不等式(2.12)可以很容易的推出满足该条件的一维
函数是连续函数

a c
上面提到的柯西不等式:如果 b  0 , d  0 ,  ,则
b d
a ac c
 
b bd d

How to prove?

- 34 -
2.1. Definitions and Examples 定义和例子
凸函数的一阶条件 First Order Condition for Convexity If a
differentiable function f satisfies
f ( y )  f ( x)  f ( x)T  y  x 
for any x , y in its domain. 凸函数上任一点的切平面永远
在函数下方

等价描述 0  f ( x)  f ( y )  x  y  (Monotone map)


T

- 35 -
2.1. Definitions and Examples 定义和例子
证明:首先证明一阶条件的必要性。

f (tx  (1  t ) y)  tf ( x)  (1  t ) f ( y), t [0,1], x, y  dom( f )

注意到 f (tx  (1  t ) y)  f ( y  t ( x  y )) ,以及


tf ( x)  (1  t ) f ( y)  f ( y)  t ( f ( x)  f ( y)) ,所以可以把上面式
子化简为
f ( y  t ( x  y ))  f ( y )
f ( x)  f ( y ) 
t
令 t  0 ,则不等式右侧恰好为方向导数的定义,也就是说
f ( x)  f ( y)  f ( y)T ( x  y)

- 36 -
2.1. Definitions and Examples 定义和例子
下面证明一阶条件的充分性。注意到两个定义里面均要求
定义域为凸集。

x  y, x, y d o m ,取
(f ) z  tx  (1  t ) y  dom( f ) ,则有
 f ( x)  f ( z )  f ( z )T ( x  z )

 f ( y )  f ( z )  f ( z ) T
( y  z)
第一个式子乘以 t 加上第二个式子乘以 (1  t ) 得到
tf ( x)  (1  t ) f ( y)  f ( z )  f (tx  (1  t ) y)
证毕。

一阶条件的重要推论:如果 f ( x )  0 ,那么无论定义域内
的另外一点 y 是什么,都会有 f ( y )  f ( x) 。所以,对于凸函
数做优化,梯度为0就说明找到了极小值。
- 37 -
2.1. Definitions and Examples 定义和例子

Please prove 
0
e x sin 2 xdx  8

(东京大学1999年高考理科第六题)

- 38 -
2.1. Definitions and Examples 定义和例子
首先注意到
e sin  xdx    e
x 2

x '
sin 2 xdx
 e sin xdx    e
x 2
 cosx  2sinxdx
x '

 e xsin 2 xdx   e xsin2 xdx

下面我们来求  e xsin2 xdx 是多少


e cos 2 x   2e x sin 2 x  e x cos 2 x 1
x '

e sin 2 x   2e x cos 2 x  e x sin 2 x  2 


x '

 2   2  1 :  2e cos2 x  e sin2 x   5e xsin2 x


x x '

- 39 -
2.1. Definitions and Examples 定义和例子

因此,解得
e x
sin2 x  2e x
cos2 x
 e sin2 xdx 
x

5
所以
e xsin2 x  2e x cos2 x
 e sin xdx  e sin xdx 
x 2 x 2

5
带入积分上下界
 
 0  2e   0  2  2e  2
0 xdx   0   0  5   5
x 2
e sin
 5   

一通化简之后,Please prove e  21

- 40 -
2.1. Definitions and Examples 定义和例子
考虑到 e x 是凸函数,做 x  3这个点处 e x 的切线分析:
在本题目中,为了方便计算,我们设 t  3,
那么我们想要求的 x   处的值有如下关系:
e  g    0
函数 g  x  是 e x 在  3,e3  处引出的切线,斜率C为 e3
x   时,可得:
e  e3    3  e3  0
e   e3  2e3
在此处放缩,  3.1,e  2.7
e   3.1  2   2.73  1.1 2.73  21.6513

因此 e  21 成立。
- 41 -
2.1. Definitions and Examples 定义和例子

- 42 -
2.1. Definitions and Examples 定义和例子
凸函数的二阶条件 Second Order Condition for Convexity If
a twice differentiable function f makes the Hessian matrix
2 f ( x ) for any x in its domain a positive semi-definite
matrix.

二阶导数是对于一阶导数变化率的衡量,刻画了曲率特征

例题: f ( X )  ln det X , X  n 是一个凹函数。


证明:直接矩阵求导得到 2 f ( X )   X 2


如果一个函数是严格凸的函数,并不能够推出 f ( x)  0 ,
2

一个反例就是 f ( x )  x 4
,它肯定是严格凸的,但是在原点处,
其二阶导数并不是一个正数。
- 43 -
2.1. Definitions and Examples 定义和例子
证明:首先证明二阶条件的必要性。
Suppose f is convex and let x, d  n , then by first-order
condition we have
f ( x  td )  f ( x)  tf ( x)T d
for all t  .

Relpacing the left hand side of this inequality with its


second-order Taylor expansion yields the inequality
2
t
f ( x)  tf ( x)T d  d T  2 f ( x)d  o(t 2 )  f ( x)  tf ( x)T d
2
or equivalently
1 T 2 o(t 2 )
d  f ( x)d  2  0
2 t
- 44 -
2.1. Definitions and Examples 定义和例子

Letting t  0 yields the inequality d T 2 f ( x)d  0 . Since


d was arbitrary,  2 f ( x) is positive semi-definite at any x .

下面证明二阶条件的充分性。Conversely, if x, y  n
, then
by the mean value theorem there is a   (0,1) such that
1
f ( y )  f ( x)  f ( x) ( y  x)  ( y  x)T  2 f ( x )( y  x)
T

2
where x   y  (1   ) x . Hence
f ( y)  f ( x)  f ( x)T ( y  x)
since  2 f ( x ) is positive semi-definite. Therefore, f is
convex by first-order condition.
- 45 -
2.1. Definitions and Examples 定义和例子
一元凸函数和多元凸函数的重要关系

给任意点 z 和方向向量 v ,如果 g (t )  f ( z  tv) 是一个关于一


维变量 t 的凸函数,那么 f ( x ) 是凸函数。反之亦然。

证明直接用凸函数的定义即可。

这个定义有的时候也称为一维刻画。因为它可以把一个任
意维度的函数 f ( x ) ,通过一个给定的方向 v ,来降维到一个
一维函数 g (t )  f ( z  tv) ,进而通过考虑该一维函数的性质来
解决问题。反之,亦可从一个任意维度的函数 f ( x ) 的一维切
片来分析其的特性,特别是凸性。
- 46 -
2.1. Definitions and Examples 定义和例子
典型的凸函数包括:

 指数函数 ,负对数函数
ax
e
 仿射函数(同时是凸函数和凹函数)
 正定或者半正定二次函数 x T
Ax  bT
xc
 范数(无法利用凸性的一阶条件以及二阶条件进行证明,
因为范数本身可能并不是处处可微的)
 幂函数 x ,绝对值幂函数 x ( p  1 为凸函数,p   0,1 为
p
p

凹函数)

典型的凹函数包括:

 对数函数 log  x 
- 47 -
2.1. Definitions and Examples 定义和例子

- 48 -
2.1. Definitions and Examples 定义和例子

- 49 -
2.2. Strong Convexity 强凸
m 2
若函数 f ( x )  2 x 2 是一个凸函数,那么 f ( x ) 就是一个凸性
量度为 m 的强凸函数。以下性质等价:

1. f 强凸,且凸性量度为 m
2. (f  x   f  y )T
 x  y   m x  y 2
, x, y

3. 2
f  x   mI , x
m
4. f  y   f  x   f ( x)  y  x   2 y  x
T 2

m 2
我们先证明 1  2 。假如 f 强凸,那么有 g  x   f  x   2 x 是
一个凸函数,那么注意到对于凸函数,我们有
- 50 -
2.2. Strong Convexity 强凸

g  x   g  y   x  y   0, x, y


T

注意到 g  x   f  x   mx ,代入可得结论

然后我们证明 2  3 。注意到如果设 x  y  tv ,那么会有

(f  y  tv   f  y )T v  mt v 2

两边除以 t 并且令 t  0,根据方向导数的公式,可以得到

vT 2 f  y  v  m v 2

这个就是 f  y   mI 的意思,因为 v 是任意的。


 2

- 51 -
2.2. Strong Convexity 强凸

接下来证明 3  4 ,这个直接二阶 Taylor 展开就可以了,和


上面证明凸函数的二阶信息等价性是类似的思路。
m
然后就是 4  1 ,这个也只需要证明 g  x   f  x   2 x
2

一个凸函数。而注意到第四个式子想说明的内容是
m m
f  y  y 2 f  x  x 2
(f  x   mx)T  y  x 
2 2
而这个就是凸函数的一阶信息刻画,所以自然也就得到了
结论。
至此我们已经得到了一条完整的闭环,所以这个等价性就
算证明完毕了。
- 52 -
2.2. Strong Convexity 强凸
如果凸函数 f 的一阶和二阶导数都存在,则以下性质等价:
1. f ( x) 是Lipschitz连续的,且常数为 L
2. [f ( x )  f ( y )]T ( x  y )  L y  x , x, y
2

3. 2 f ( x )  LI , x
L
4. f ( y )  f ( x )  f ( x ) ( y  x )  y  x
T 2

2
证明:1→2可由Cauchy不等式得到,即 x, y
[f ( x )  f ( y )] ( x  y )  f ( x )  f ( y )  y  x  L y  x
T 2

2→3证明方法同上,3→4做二阶Taylor展开即可,4→2交
换 x, y 顺序相加即得。最后3→1,对梯度做Taylor展开得
f ( y)  f ( x)   2 f [ x   ( y  x)]( y  x),  [0,1]
注意到 2 f ( x )  LI 恒成立,移项即得证。
到此已完成逻辑闭环,证毕。

- 53 -
2.2. Strong Convexity 强凸
强凸和Lipschitz连续分别对于凸函数 f 的曲率变化(假设一
阶和二阶导数都存在)的上下届进行了刻画,对于证明凸优
化梯度下降算法的收敛性有着重要的作用。我们将在后续课
程中进一步讨论。

- 54 -
2.3. Operations Preserve Convexity 保凸运算
practical methods for establishing convexity of a function

1. verify definition (often simplified by restricting to a line)

2. show that f ( x ) is obtained from simple convex functions


by operations that preserve convexity

 nonnegative weighted sum


 composition with affine function
 pointwise maximum and supremum
 composition
 minimization
 perspective

- 55 -
2.3. Operations Preserve Convexity 保凸运算

- 56 -
2.3. Operations Preserve Convexity 保凸运算

- 57 -
2.3. Operations Preserve Convexity 保凸运算

- 58 -
2.3. Operations Preserve Convexity 保凸运算
Composition with scalar functions复合函数 f ( x)  h( g ( x)) ,
假如它们具有二阶可导的性质,则可以得到
f ( x)  h( g ( x)) g ( x) 2  h( g ( x)) g ( x)

因此可得以下结论:Rules for Composite Convex Functions


设 f , g , h 二阶可导,且 f ( x)  h( g ( x)) ,那么

1. 如果 h 为凸函数且不降, g 为凸函数,那么 f 为凸函数。

2. 如果 h 为凸函数且不增, g 为凹函数,那么 f 为凸函数。

3. 如果 h 为凹函数且不降, g 为凹函数,那么 f 为凹函数。

4. 如果 h 为凹函数且不增, g 为凸函数,那么 f 为凹函数。


- 59 -
2.3. Operations Preserve Convexity 保凸运算
 k 
例题:证明 g ( x)  log   exp  ai x  bi   是一个凸函数。
T

 i 1 

这个函数是 maxi {aiT x  bi }的一个好的近似,所以有时称其


为soft-max,神经网络中的softmax层就来源于此。
可以看出这个函数是一个复杂的复合。指数上的 aiT x  bi 可
以拆分出来作为一个新的函数,所以实际上内层函数是一个
仿射函数,当然是一个凸函数,而外层函数就是
 n xi 
f ( x)  log   e  , xi 为 x 的各个分量
 i 1 

这个函数当然是一个不降的函数。所以根据上面提供的几
条准则,便可通过 f 看出 g 的凸性。
- 60 -
2.3. Operations Preserve Convexity 保凸运算
对其求Hessian矩阵
xi xi xi xj
e e e e
i f ( x)  ,  f ( x) 
2
I (i  j ) 
   
n xl ij n xl 2
n
l 1
e l 1
e e xl
l 1

将其改写为更加紧凑的形式
2 f ( x) diag( z )  zzT
其中 diag( z ) 为对角阵,第i 个对角元素为 zi ,且有
n

z
i 1
i 1

注意到
2
  n n
y  f ( x) y   zi y    zi yi 
T 2 2
i
i 1  i 1 
根据Jensen不等式即可得到其为正定矩阵的结论。
- 61 -
2.3. Operations Preserve Convexity 保凸运算
我们还可以对 h( x ) 做一个拓展,就是在其没有定义的地
方人为规定它们都是正无穷或者负无穷。比方 h( x )  log( x ) 就
是一个定义域不在全空间的函数。但是我们可以通过延拓,
也就是额外设 h( x )   ,x  0 。这样的话就可以得到一个凸
的,又具有单调性的函数 h ( x ) 。如果可以构造出一个这样的
全空间的函数,又不影响原始定义域的值,那就算是一个合
理的拓展。

考察 g ( x )  x 2 ,h( z )  0,dom(h)  [1,2],那么可以得到


f ( x )  h  g ( x )   0 , x  [ 2, 1]  [1, 2] ,很明显这个函数
并不是一个凸函数,因为它的定义域都不是一个凸集。错误
的原因就在于,如果我们考虑 h( x ) 的拓展,会发现无论我们
要求它的函数是凸还是凹,都做不到让 h ( x ) 是单调的。

- 62 -
2.3. Operations Preserve Convexity 保凸运算
Vector composition

- 63 -
2.3. Operations Preserve Convexity 保凸运算

- 64 -
2.3. Operations Preserve Convexity 保凸运算

- 65 -
2.3. Operations Preserve Convexity 保凸运算

The conjugate of a function f is


f *  y   sup  yT x  f  x  
xdom f

f * is convex even if f is not.

- 66 -
2.3. Operations Preserve Convexity 保凸运算
为了解释conjugate function是怎么来的,我们先讨论一下。
对一个严格凸函数,找不到两点的导数相等。为什么?严格
凸函数图像的切线(切面)永远严格位于函数的下方,除了
切点。写成公式就是
f  x   f  x   f  x  , x  x , x

假设对于严格凸函数 f ,存在两个点 x1 , x2 ,它们的梯度相


等。根据刚才说的几何意义,得
f  x1   f  x2   f  x2  x1  x2 
f  x2   f  x1   f  x1  x2  x1 
两式相加,矛盾。

- 67 -
2.3. Operations Preserve Convexity 保凸运算
这说明 x f  x  是单射。这启发我们,能否从梯度的角
度考虑一个凸函数呢?画图可知,一个凸函数的所有切线构
成了一个对原函数的包络。具体来说有如下直观的刻画。
定理(凸函数的直线包络)对于凸函数 f ,有
f  x  max ax  b
a ,b: f  y  ay b ,y

可以说,给定一个凸函数 f ,由它所有切线的(斜率,截
距)信息可以完整地恢复出原来的函数。可以说,给定斜率
y ,我们要找的是 f 的斜率为 y 的切线的负截距 g  y  。但我们
知道,这个切点的横坐标一定是 x   f   y  。于是切线的
1

方程是 z  f  x   f  x  , x  x ,因此负截距是
g  y    z |x0   f  x   f  x  , x   f  x   y, x

f   f  1
 y   y,  f 
1
 y
- 68 -
2.3. Operations Preserve Convexity 保凸运算
对于凸可微函数,我们把  f   x  或者   f   x  称为
1 1

f  x  的Legendre变换。Legendre变换本身很有用,但它仅限
于凸函数和可微函数,如果这两个条件有一个不满足,那么
这个变换就无法完成。考虑 f  x  | x |的情形。函数的梯度在
x  0处时是没有定义的,而其次梯度的范围则为 s   1,1 ,
如下图所示:

- 69 -
2.3. Operations Preserve Convexity 保凸运算
同样,非凸函数在不同的点处其斜率的取值范围与上面的
函数类似,这导致 x 和 s 之间不存在唯一的对应关系。如下图,
同一个斜率 s 对应着两个 b 的值。

怎么解决?选一组与 f ( x ) 相交的直线,然后寻找最小截距
的那条。这使得不可微甚至是非凸函数也可使用这一变换。
- 70 -
2.3. Operations Preserve Convexity 保凸运算
我们注意到负截距有另一种求法。给定斜率 y ,从直线
z  y, x 出发,我们知道所求负截距是将此直线向下平移的
最小量,使得 f 刚好接触到这条直线。写成数学语言就是下
面的优化问题:
g  y   max y, x  f  x 
x
反过来,我们有

定理:若 f 是凸函数, g 定义如上,则


f  x   max y, x  g  y 
y

这个定理其实就是凸函数的直线包络结论的推论。注意到
对任何斜率 a ,最大的 b 就是 g  a  。这个 g 有时又被称为 f * ,
是 f 的Legendre-Fenchel共轭。

- 71 -
2.3. Operations Preserve Convexity 保凸运算

- 72 -
2.3. Operations Preserve Convexity 保凸运算
Boyd老师组开发的Disciplined Convex Programming通过基
本的凸函数原子库(atom library)和凸性演算规则(convexity
calculus rules),来推演一个给定的函数是否是凸函数。具体
来说,凸性演算规则包括10条顶层法则(top-level rules),无
乘积法则(product-free rules),符号法则(sign rules),复合
法则(composition rules)
。无乘积法则是指避免2个凸函数相
乘的表示,符号法则是指避免两个凸函数相减的表示。程序
会尝试可能的函数变形,看是否归结为已知的某个凸优化问
题,以减少漏判误判。

一般来说,判断一个函数是否是凸函数是NP-hard的。例如
判断一个多元四次及以上偶多项式是否是凸的是strongly
NP-hard的。
- 73 -
2.4. Quasi-Convexity 拟凸
下水平集Sublevel Set和上境图Epigraph

- 74 -
2.4. Quasi-Convexity 拟凸

- 75 -
2.4. Quasi-Convexity 拟凸

- 76 -
2.4. Quasi-Convexity 拟凸

- 77 -
2.4. Quasi-Convexity 拟凸

- 78 -
2.4. Quasi-Convexity 拟凸

- 79 -
2.4. Quasi-Convexity 拟凸
拟凸函数的保凸变换

正权重求和
与仿射变换复合
最大值/上确界
单调凸函数与凸函数的复合
下确界
透射变换

- 80 -
2.5. Log-Concave and Log-Convex 对数凹凸

- 81 -
2.5. Log-Concave and Log-Convex 对数凹凸

- 82 -
2.5. Log-Concave and Log-Convex 对数凹凸

- 83 -
2.6. Convexity w.r.t. Generalized Inequalities

- 84 -
2.7. Not Exactly Convex but …不那么凸
第2题 对任意实数 x1 , x2 ,…, xn ,证明下述不等式成立

n n n n


i 1 j 1
xi  x j   xi  x j
i 1 j 1

(IMO 2021)

- 85 -
2.7. Not Exactly Convex but …不那么凸
定义函数
N
f a   xi  x j  a
i , j 1

注意, f  a  的每一项在任意两个相邻的极值点之间都是上
凸函数(画图分析到底是什么函数),所以 f  a  的最小值一
定在某个极值点取到,也就是某个 a    xi  x j  处。

原问题等式右边就是 f  0  ,所以只需要证明
n
f (a)min  
i , j 1
xi  x j

- 86 -
2.7. Not Exactly Convex but …不那么凸
不妨取 x1  1, x2  2 , x1  3,可以画出 f (a )

- 87 -
2.7. Not Exactly Convex but …不那么凸

当 n  0 时,显然。
当 n  1 时,原式即 0  2 x1 ,显然亦成立。
当 n  2 时,由于不等式左侧具有平移不变性,将所有 x 同
时加上  ,等式左边不变。

考察 min xi  x j  0 的情形,当 2   min xi  x j 不等式右


1i , j  n 1i , j  n

侧可视为  的函数:
f      x  2    y  2
xX yY

此处 X 是 xi  x j 中不小于 0 的数构成的可重集,Y 是其中小


于 0 的数所构成的可重集。
- 88 -
2.7. Not Exactly Convex but …不那么凸

于是,
1 1
f     
xX x  2 yY  y  2

当 2   1min
i , j  n
xi  x j 时,该函数关于  单调递减

当 f   0   0 时,对于   0 , 有 f      f   0   0
当 f   0   0 时,对于   0 , 有 f      f   0   0

因此,选取适当的  ,使的所有 x 同时加上  后,不等式右


侧不增加,并且调整过后存在某组  i, j  , 满足 xi  x j  0

- 89 -
2.7. Not Exactly Convex but …不那么凸

若 i  j ,不妨令 i  j  n ,则 xn  0
n n n 1 n 1 n 1


i 1 j 1
xi  x j   xi  x j  2 xi
i 1 j 1 i 1

n n n 1 n 1 n 1


i 1 j 1
xi  x j   xi  x j  2 xi
i 1 j 1 i 1

于是由 n  1 的情况即知不等式成立

- 90 -
2.7. Not Exactly Convex but …不那么凸

若 i  j ,不妨设, j  n ,则

 
n n n2 n2 n2


i 1 j 1
xi  x j   xi  x j  2
i 1 j 1 i 1
xi  xn  xi  xn  2 2 xn

 
n n n2 n2 n2


i 1 j 1
xi  x j   xi  x j  2
i 1 j 1 i 1
xi  xn  xi  xn  2 2 xn

于是由 n  2 的情况可知原不等式成立

综上所述,利用数学归纳法,可证明原不等式成立

- 91 -
2.7. Not Exactly Convex but …不那么凸
有兴趣的同学可以试下下面这道简单一些的题目

对任意实数 x1 , x2 ,…, xn ,证明下述不等式成立

n n n

 x  x
i 1 j 1
i j   xi
i 1

(2006伊朗TST,第二天第一题)

- 92 -
2.8. References
[1] S. Boyd, L. Vandenberghe, Convex Optimization, Cambridge
University Press, 2004. http://www.stanford.edu/~boyd/cvxbook/
http://www.ee.ucla.edu/~vandenbe/cvxbook
[2] J. M. Steele, The Cauchy-Schwarz Master Class: An Introduction to the
Art of Mathematical Inequalities, Cambridge University Press,
Cambridge, U.K., 2004.
[3] 如何理解勒让德变换 https://www.zhihu.com/question/26050948
[4] Legendre-Fenchel 变换的物理意义是什么
https://www.zhihu.com/question/44860559
[5] 勒让德变换 Legendre Transformation
https://zhuanlan.zhihu.com/p/341207902
[6] M. Grant, S. Boyd, Y. Ye, "Disciplined convex programming," Global
Optimization: From Theory to Implementation, L. Liberti, N. Maculan,
eds., pp. 155-210, 2006.

- 93 -

You might also like