# Worksheet 12-1: Duality

Download: [CMSE382-WS12_1.pdf](CMSE382-WS12_1.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-1: Q1

Consider the problem

$$
\begin{aligned}
f^* = \min &\quad x_1^2 - x_2\\
\text{s.t.} &\quad x_1-x_2^2 = 0,
\end{aligned}
$$

1. Find the optimal solution by replacing $x_1$ with $x_2^2$ and making the objective a single variable function. What is the optimal value $f^*$? (Note $f^*$ is the minimimal value of the objection function $f(x_1,x_2) = x_1^2-x_2$, not the point $x_1,x_2$ that achieves the minimum.)

2. Now solve the problem using duality:

   a. Write down the Lagrangian.

   b. What is $\nabla_{x_1,x_2} L(x_1,x_2,\mu)$? When is $\nabla_{x_1,x_2} L(x_1,x_2,\mu) = 0$?

   c. Write a formula for $q(\mu) = \min_{x_1,x_2} L(x_1,x_2,\mu)$ in terms of $\mu$.

   d. What value of $\mu$ maximizes $q(\mu)$?

   e. What is the optimal dual value $q^* = \max_\mu q(\mu)$?

3. We know from the weak duality theorem that $q^* \leq f^*$. Is the bound tight for this problem? That is, do we have $q^* = f^*$ in this problem?

---

## Worksheet 12-1: Q2

Consider the problem

$$
\begin{aligned}
\min &\quad x_1^2 - x_2\\
\text{s.t.} &\quad x_2^2 \leq 0,
\end{aligned}
$$

1. Find the optimal solution by reducing the problem to a single variable unconstrained optimization problem without using duality.

2. Write down the Lagrangian.

3. Obtain the dual objective function $q(\lambda)=\min_{x_1,x_2} L(x_1,x_2,\lambda)$.
   Note that you will need to consider the two cases: $\lambda=0$ and $\lambda>0$. This means your objective function will be a piece-wise function.

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

5. Is the bound from the weak duality theorem tight for this problem? That is, do we have $q^* = f^*$ in this problem?

---

## Worksheet 12-1: Q3

$$
\begin{aligned}
\text{(P)}\quad \min_{(x,y)} \; & x^2+y^2 \\
\text{s.t.} \; & 1 - x^4 \le 0
\end{aligned}
$$

1. Using the [desmos plot](https://www.desmos.com/3d/bbh7v1ykwn), what do you think the optimal solution $f^*$ is?

2. Now solve the problem using duality:

   a. Write down the Lagrangian.

   b. In a different Desmos plot from above, plot the Lagrangian as a function of $x$ and $y$ using a slider bar for different values of $\lambda \geq 0$. What do you observe? What does this suggest about the dual function $q(\lambda) = \min_{x,y} L(x,y,\lambda)$? What is $q^* = \max_\lambda q(\lambda)$?

      *For an additional challenge, can you justify your observation without using Desmos?*

3. Based on what you found above, is the bound from the weak duality theorem tight for this problem? That is, do we have $q^* = f^*$ in this problem?
