24142
24142
24142
Solution.
1. To prove that the given system of linear equations Ax = b has infinitely many solutions,
we analyze the matrix A and use its rank
Compute the rank of A
Performing row-reduction, we aim to find the rank
1 1
R2 ← R2 + R1 , R3 ← R3 + R1
2 2
2 −4 2 −14
0 0 −1 4 .
0 0 0 0
The rank of A is the number of non-zero rows, which is Rank(A) = 2. We can clearly
see that there are 4 columns, but the rank of matrix A is only 2, meaning there are
2 free variables in this problem. Hence this system of Linear equations has infinite
solutions.
To further verify this claim, we can find the general solution. Reduce the matrix further
by applying the following transformations R1 ← R1 /2, R2 ← −R2
1 −2 1 −7 | 5
0 0 1 −4 | 1 .
0 0 0 0 | 0
From the row-reduced matrix, we can simplify and rewrite the system as
1
Thus, the general solution is
x1 2x2 + 3x4 + 4
x2 x2
x=
x3 = 4x4 + 1 .
x4 x4
0 0 1
Since x2 and x4 are free, the system has infinitely many solutions.
2. If the objective is to find the least norm solution (ConvProb) we can restate the problem
as follows.
1
min4 ||x||2
x∈R 2
2
3. Now let’s solve this convex optimization problem using KKT conditions. To begin with
the Lagrangian for this problem is
1
L(x, λ) = ||x||2 − λT (Ax − b)
2
The KKT conditions are as follows,
(a) ∇x L(x, λ) = 0.
(b) Ax = b
To solve the KKT, lets start with first condition, the gradient of 12 ||x||2 = 12 xT x is x,
and the gradient of λT (Ax − b) with respect to x is AT λ. Thus
∇x L(x, λ) = x − AT λ.
(AAT )λ = b.
λ = (AAT )−1 b.
x = AT (AAT )−1 b.
This gives the least-norm solution to the problem, which concludes the solution using
the KKT conditions. A small piece of code was written and the value of x∗ was found
to be,
T
x∗ = 0.5957, −1.1915, −0.3617, −0.3404 .
4. Now we want to find projection of any point z on the constraint set of convProb
Ax = b. This can be derived by solving the following constrained optimization problem.
1
min4 ||x − z||2
x∈R 2
subjected to the constraint that Ax = b. This problem can be solved using KKT
conditions like before, So let’s state the Lagrangian and the KKT for this problem.
1
L(x, λ) = ||x − z||2 − λT (Ax − b)
2
(a) ∇x L(x, λ) = 0.
(b) Ax = b
3
To solve we start with the gradient with respect to x
∇x L(x, λ) = x − z − AT λ.
A(z + AT λ) = b.
Az + AAT λ = b.
Solving for λ we get
λ = (AAT )−1 (b − Az).
Thus, we have derived the projection of any point z onto the constraint set Ax = b.
4
Problem 2. Support Vector Machines
1. Value of the Primal objective Function.
2. Dual conversion of the primal.
3. show that X X
λi = λi = γ
i:yi =1 i:yi =−1
5
N N
∂L X X
=− λi y i = 0 ⇒ λi y i = 0
∂b i=1 i=1
Substituting w back into the Lagrangian:
!⊤ N ! !⊤
N N N N
1 X X X X X
L= λi yi xi λj yj xj − λi yi λj yj xj x i + b + λi
2 i=1 j=1 i=1 j=1 i=1
3. we have from the constraints of the dual, y T Λ = 0. If all the yi s are equal to 1 we have,
X X
λi = y i λi = y T Λ = 0
6
4. Implemented the following objective and constraints that are equivalent to the result
from part 2
1
minimize g(Λ) = −Λ⊤ 1 + Λ⊤ AΛ
2
T
subject to Λ ≥ 0, y Λ = 0
The objective value for the dual problem came out to 2.66 which is same as the primal,
it shows that the original dual formulation and the dual implementation are equivalent
to the primal. the Lambda values is non zero for points 0,1,6,9. We will see in the
later part that this also matches the constraints that are active in the primal.
5. We can check which constraints of the primal are active by checking the i’s where
labeli (wT datai + b) = 1. A function was written to verify all the indices and it is found
that points where we are actively constrained are 0,1,6,9.
6. We can see clearly from the scatter plot above the line wT x + b separates y = 1 and
y = −1 optimally and we can clearly see the Active constraints near the margin of the
line.