Convex Optimization 1 - Charalampos Salis
Convex Optimization 1 - Charalampos Salis
B USINESS
D EPARTMENT OF I NFORMATICS
Convex Optimization
Assignment 1
Salis Charalampos
1 Exercise 2.1
Pk Pk
We need to show that if x1 , ..., xk ∈ C and i=1 θi = 1, then i=1 θi xi ∈ C for an
arbitrary k. We will use induction:
• For k = 2, we have the trivial case, since if C is convex, then from the definition
of convexity we get:
• Using the induction hypothesis, we will prove that if x1 , ..., xk+1 ∈ C and
Pk+1 Pk+1
i=1 θi = 1, with θi ≥ 0, ∀i, then: i=1 θi xi ∈ C. We will try to "down-
scale" the dimensions. At first, we normalize each coefficient for i ≥ 2 with the
term 1 − θi , i.e. construct the new coefficient θ˜i = 1−θ
θi
1
. Then, we construct the
Pk+1 ˜
new point: i=2 θi xi , which is convex, since x2 , ..., xk+1 ∈ C and
Pk+1
i=2 θi
Pk+1 ˜ 1−θ1
i=2 θi = 1−θ1 = 1−θ1 =1
The convexity is guaranteed by the induction hypothesis. Then, from the defini-
Pk+1 ˜
tion of convexity, since x1 and θi xi ∈ C, we have that the point:
i=2
Pk+1 ˜ Pk+1
θ1 x1 + (1 − θ1 ) i=2 θi xi = i=1 θi xi ∈ C
2 Exercise 2.2
2.1 Convexity
· 1st Part: Assume that the set C is convex and L is an arbitrary line. Then, from
the definition of convexity: ∀x, y ∈ C and θ ∈ [0, 1]: θx + (1 − θ)y ∈ C. However,
θx + (1 − θ)y also belongs to the line segment between x and y, which implies that:
θx + (1 − θ)y ∈ L.
· 2nd Part: Assume that C ∩ L is convex, but C is not convex. Using again the
definition of convexity, we get that there are x, y ∈ C, such that: θx + (1 − θ)y ∈
/ C,
2
θ ∈ [0, 1]. However, the line segment between x and y must be convex (from previous
assumption) and, thus, will not contain the point θx + (1 − θ)y, which contradicts the
assumption. Hence, if C ∩ L is convex, then C must also be convex.
2.2 Affineness
· 1st Part: Assume that the set C is affine and L is an arbitrary line. Then, from
the definition of affineness: ∀x, y ∈ C and θ ∈ R: θx + (1 − θ)y ∈ C. Also, the
point θx + (1 − θ)y belongs to the line segment between x and y, which implies that:
θx + (1 − θ)y ∈ L.
· 2nd Part: Assume that C ∩ L is affine, but C is not affine. Using again the definition
of affineness, we get that there are x, y ∈ C, such that θx + (1 − θ)y ∈ / C, θ ∈ R.
However, any point of the line segment segment between x and y belongs to the
respective line passing through these points, resulting in: θx + (1 − θ)y ∈ C ∩ L, which
is affine (from previous assumption). Hence, if C ∩ L is affine, then C must also be
affine.
3 Exercise 2.3
We want to show that ∀x, t ∈ C and θ ∈ [0, 1], it holds: θx + (1 − θ)y ∈ C. Because
θ ∈ [0, 1], we know that it has a unique binary expansion, i.e. the following representa-
P∞
tion: θ = k=1 ak (θ)2−k , where ak (θ) ∈ {0, 1}. For any finite degree n, by applying
midpoint convexity n times, we get that:
Pn Pn
( k=1 ak (θ))x + (1 − k=1 ak (θ))y ∈ C
From the closeness of C, we can also get the limit to infinity and stay in C, in order
to obtain any real number in [0, 1]:
n
X n
X ∞
X ∞
X
lim [( ak (θ))x + (1 − ak (θ))y] = ( ak (θ))x + (1 − ak (θ))y
n→∞
k=1 k=1 k=1 k=1
= θx + (1 − θ)y ∈ C
3
4 Exercise 2.4
Let C be the intersection of all convex sets that contain S. Then, we have to show
that: conv S = C. We will show that both conv S ⊆ C and conv S ⊇ C hold.
· 2nd Part: conv S ⊇ C: We know that conv S is convex and also the smallest
convex set that contains S, from its definition. Thus, given that C is the intersection of
all convex sets that contain S, it is reduced to conv S. Hence: conv S ⊇ C always
holds.
Thus, conv S = C.
5 Exercise 2.5
1
min ||x − x0 ||
2
s.t. : aT x = b
x∗ = x0 + (b − aT x) ||a||
a
2
a a
x1 = x0 + (b2 − aT x0 ) ||a||2 = x0 + (b2 − b1 ) ||a||2
4
Thus, the distance between the hyperplanes is:
6 Exercise 2.7
We want to show that all points x ∈ Rn that are closer to a than b form a set of the
following form: {x|cT x ≤ d}, where c ̸= 0. We consider any point x ∈ Rn , such that:
q q
||x − a||2 ≤ ||x − b||2 ⇒ (x − a)T (x − a) ≤ (x − b)T (x − b)
⇒ (x − a)T (x − a) ≤ (x − b)T (x − b)
⇒ (x − a)T x − (x − a)T a ≤ (x − b)T x − (x − b)T b
⇒ xT x − 2aT x + aT a ≤ xT x − 2bT x + bT b
⇒ 2(bT − aT )x ≤ bT b − aT a
⇒ 2(b − a)T x ≤ bT b − aT a
Thus, these points have the form: {x|cT x ≤ d}, where c = 2(b − a) and
d = bT b − aT a.
The code to produce the plot is located in the Appendix. Given two points a and b, the
blue line depicts the hyperplane H = {x|2(b − a)T x ≤ bT b − aT a}.
5
The area under the hyperplane to the direction of a denotes the corresponding
halfspace calculated in the exercise.
7 Exercise 2.11
Consider two points of the hyperbolic set H, x and x̃. We want to show that: θx +
(1 − θ)x̃ ∈ H. We have that:
we have:
[θx1 + (1 − θ)x˜1 ] · [θx2 + (1 − θ)x˜2 ] = θ2 x1 x2 + (1 − θ)2 x˜1 x˜2 + θ(1 − θ)x1 x˜2 + θ(1 − θ)x˜1 x2
= θ2 x1 x2 + (1 − θ)2 x˜1 x˜2 + θ(1 − θ)(x1 x˜2 + x˜1 x2 )
θ2 x1 x2 + (1 − θ)2 x˜1 x˜2 + θ(1 − θ)(x1 x˜2 + x˜1 x2 ) ≥ θ2 x1 x2 + (1 − θ)2 x˜1 x˜2
6
because θ ∈ [0, 1] ⇒ (1 − θ) ∈ [0, 1], which implies that: 2θ(1 − θ) ≥ 0.
We now consider again two arbitrary points of H, x and x̃. In the general case, the
convex combination of x and x̃ becomes:
Qn
θx + (1 − θ)x̃ = i=1 [θxi + (1 − θ)x̃i ]
n
Y n
Y n
Y
[θxi + (1 − θ)x̃i ] = θ xi + (1 − θ) x̃i
i=1 i=1 i=1
n
Y n
Y
≥( xi )θ + ( x̃i )1−θ ≥ 1
i=1 i=1
8 Exercise 2.12
(b) Rectangle: Following the same rational with (a), we can think of a rectangle as
the intersection of many halfspaces (thus, convex sets). Hence, it is also convex.
(d) In Exercise 2.7 we showed the Voronoi description of a halfspace. In this case, we
have to consider many points y instead of just one. For any y, the set: {x|||x − x0 || ≤
||x − y||2 } is a halfspace, thus, by calculating this quantity ∀y, we get the intersection
of all these halfspaces, which is convex.
(e) If S and T consist only of one point, then the set is convex (Exercise 2.7). For
the general case, the set is not convex and we will prove it using a counter-example.
7
Consider the 1-dimensional case, with T = {0} and S being the set of two symmetric
points to T : S = {−x0 , x0 }, where x0 ∈ R+ . Then, ∀x ∈ R, we have:
p
dist(x, x0 ) = (x − x0 )2 = |x − x0 |
p
dist(x, −x0 ) = (x + x0 )2 = |x + x0 |
dist(x, 0) = |x|
From theory, we know that the union of two convex sets is not necessarily convex.
The lack of convexity derives from "gaps" in the diagram of the most close points.
{x|x + S2 ⊆ S1 } = {x, x0 ∈ S2 |x + x0 ∈ S1 }
\
= {x|x + x0 ∈ S1 }
x0 ∈S2
\
= (S1 − x0 )
x0 ∈S2
The subtraction of a convex set with any set is not necessarily convex, so the
intersection is, also, not necessarily convex.
8
If θ = 1, this is obviously a halfspace, which is convex. If θ < 1, then:
9 Exercise 2.15
Pn
(a) E[f (x)] = i=1 pi f (ai ). Thus: α ≤ E[f (x)] ≤ β is:
Pn
α≤ i=1 pi f (ai ) ≤ β
9
Pn
(e) E(x2 ) ≥ α ⇒ i=1 pi a2i ≥ 0
where a⃗2 = (a21 , ..., a2n )T and A matrix is the outer product: A = aaT . A must be
positive definite, because for vectors in Rn , it must hold:
(h) Since we want the infimum of β in the quartile function, we just consider the
maximum element of ⃗a, let it be ak . Then:
becomes:
inf{β|prob(x ≤ ak ) ≥ 0.25}
Then:
Pk
prob(x ≤ ak ) ≥ 0.25 = i=1 pi ≥ 0.25
10
(i) Following the same rational with (h), we have:
Then:
Pn
prob(x ≥ ak ) ≥ 0.25 = 1−prob(x ≤ ak ) < 0.75 ⇒ i=k+1 pi < 0.75
10 Exercise 2.16
We consider two points of S: (x, y1 + y2 ), (x, y˜1 , y˜2 ) ∈ S. Then, for θ ∈ [0, 1]:
11
11 Appendix
import numpy as np
import matplotlib.pyplot as plt
a = np.array([0.2, 0.3])
b = np.array([0.9, 0.7])
plt.xlim(0, 1.5)
plt.ylim(0, 1)
plt.scatter(a[0], a[1], color="red", label="a")
plt.scatter(b[0], b[1], color="orange", label = "b")
def euclidean_norm(x):
hyperplane_points = []
epsilon = 0.005
12