Lagrange multipliers/dual problem: A simple worked example for max(2-x^2) s.t. x=1

555 Views Asked by At

I'm trying to derive the dual problem of a very simple example of a Lagrange multiplier (note: please correct my terminology if it's off).

This isn't homework, I've just picked the example off some slides somewhere and am trying to solve it to understand the process. I haven't found many simple examples that work through the process from beginning to end. I feel like I'm close to understanding the process, there's just some minor mistakes I'm making where I don't connect what I see in various presentations of the technique to what I'm trying to do here.

$$f_0(x) = \max_x (2-x^2) \,\, \text{ s.t.: } \,\,\, x=1$$

Easy enough, answer must be 1 from visual inspection. So we set up the Lagrange multiplier:

$$g(x) = x-1$$ $$L(x,\lambda) = f_0(x)-\lambda g(x)$$ $$L(x,\lambda) = (2-x^2)-\lambda(x-1)$$ $$L(x,\lambda) = 2-\lambda-x^2-\lambda x$$

Now, if I understand correct, I want to set the terms with x in them to zero to get the dual problem (I think I go off track here). In the lectures I've watched, this is where we factor out x and set the x terms equal to zero, otherwise that part of the equation would go to infinity.

$$g(\lambda) = \min_{\lambda} \left[ 2-\lambda+( -x-\lambda)x\right]$$ $$\begin{cases}2-\lambda & (-x-\lambda)=0 \\ \infty & otherwise \end{cases}$$

Now I try to say $\lambda = -x$, that gives me a dual problem that comes out badly: $$g(\lambda)= \min_{\lambda} (2-\lambda)$$ Given the constraints: $$\lambda > 0$$ $$\lambda = -x$$

This is where it all breaks down for me. I missed something simple there. I know I'm supposed to derive the vectors of partial derivatives at some point, and I haven't yet, I know I'm doing something wrong there. And I don't know what to do to factor out the x properly.

Can someone help me work through this simple example. I'm sure things will click once I get through at least one concrete example beginning to end.

1

There are 1 best solutions below

3
On BEST ANSWER

Your dual function $$g(\lambda) := \min_{\lambda} \left[ 2-\lambda+( -x-\lambda)x\right] $$ is better written $$ h(\lambda) := \max_{x} \left[ 2-\lambda+x( \lambda - x)\right]\tag1 $$ because (a) you've used $g$ already for $g(x)=x-1$, and (b) you should be maximizing over $x$, not minimizing over $\lambda$, and (c) you have a sign wrong in your simplification.

That said, you want to maximize the quantity in square brackets in (1) over $x$, treating $\lambda$ as fixed. The way to maximize over $x$ is to use calculus, or to complete the square. If we do that, we find the max occurs at $x=\lambda/2$. This means that (1) simplifies to $$ h(\lambda) = 2 - \lambda +{\lambda^2\over 4},\tag2 $$ so the dual problem is now: minimize $h(\lambda)$ over all $\lambda$. It's minimized at $\lambda=2$, and the value of $h$ there is $1$.

(I'm not clear on what is meant by 'factoring out $x$' or 'setting the $x$ terms to zero', unless we're talking about simplifying $h$ so that $x$ no longer appears. In the approach that you took, $x$ still appears in your constraint $\lambda=-x$.)