# Worksheet 12-2: Duality

Download: [CMSE382-WS12_2.pdf](CMSE382-WS12_2.pdf)

```{warning}
This is an AI-generated transcript of the worksheet and may contain errors or inaccuracies. Please refer to the original course materials for authoritative content.
```

---

## Worksheet 12-2: Q1

Consider the problem

$$
\begin{aligned}
\min &\quad x^2+y^2\\
\text{s.t.} &\quad x+y+1 \leq 0
\end{aligned}
$$

1. Does strong duality hold? You need to check whether the problem is convex, and whether the constraints satisfy the generalized Slater's condition.

2. Now, determine $q^*$ using the following steps:

   a. What is the Lagrangian, $L(x,y,\lambda)$, and the gradient of the Lagrangian $\nabla_{x,y}L(x,y,\lambda)$?

   b. When is the gradient of the Lagrangian zero? Solve for $x$ and $y$ in terms of $\lambda$.

   c. For a fixed $\lambda$, what is the minimum value of $L(x,y,\lambda)$ over $x,y$? Use this to write $q(\lambda) = \inf_{x,y} L(x,y,\lambda)$.

   d. What is $q^*=\max_{\lambda} q(\lambda)$?

3. What do you know about $f^*$, the optimal value of the primal problem?

---

## Worksheet 12-2: Q2

Consider the problem

$$
\begin{aligned}
\min &\quad 2x+y\\
 \text{s.t.} &\quad -3x+3y\leq -1\\
&\quad -3x-2y \leq -4
\end{aligned}
$$

1. Does strong duality hold? You need to check whether the problem is convex, and whether the constraints satisfy the generalized Slater's condition.

2. What are the matrices $A$, $\mathbf{b}$, and $\mathbf{c}$ such that the problem can be written as

$$
\begin{aligned} \min &\quad \mathbf{c}^\top \mathbf{x}\\
 \text{s.t.} &\quad A \mathbf{x}\leq\mathbf{b}
\end{aligned}
$$

3. What is the dual problem?

4. Solve the dual problem to find $q^*$.

5. Use [this desmos](https://www.desmos.com/3d/ubtk3ztody) to visualize the primal problem. What is $f^*$, the optimal value of the primal problem? Is it the same as your $q^*$?

---

## Worksheet 12-2: Q3

Consider the problem

$$
\begin{aligned}
\min &\quad -3x-2y-1z\\
 \text{s.t.} &\quad x+y+z\leq1\\
&\quad x-z \leq -2
\end{aligned}
$$

1. This is a linear programming problem. What are the matrices $A$, $\mathbf{b}$, and $\mathbf{c}$ such that the problem can be written as

$$
\begin{aligned}
\min &\quad \mathbf{c}^\top \mathbf{x}\\
 \text{s.t.} &\quad A \mathbf{x}\leq\mathbf{b}
\end{aligned}
$$

2. What is the dual problem?

3. Solve the dual problem to find $q^*$.

4. What is $f^*$, the optimal value of the primal problem? Justify your answer.
