# setting of Lagrangian function

Consider a simple consumer's problem:

Max $$u(X)$$ s.t. $$\sum_i^l p_i x_i\leq \sum_i^l p_i w_i$$

$$w$$ is initial endowment.

We can set the Lagrangian function to solve this problem.

$$L=u(X)+\lambda ( \sum_i^l p_i w_i +\sum_i^l p_i x_i)$$

But some may set the Lagrangian function as differenct way.

$$L=u(X)+\lambda ( \sum_i^l p_i x_i -\sum_i^l p_i w_i)$$

The result of calculation is same except the sign of Lagrangian multiplier $$\lambda$$

For the consumer's problem, which way is correct?

Edit after comment: There is a typo at the first equation in this question. $$\sum_i^l p_i w_i +\sum_i^l p_i x_i$$ should be changed as $$\sum_i^l p_i w_i -\sum_i^l p_i x_i$$

It's a matter of choice how one writes the Lagrangian in the context of Lagrange/KKT. Depending on how it's written, the gradients of the objective and constraint functions are either parallel or anti-parallel at a (suitable) optimum, and the Lagrange multiplier is neither negative or positive. At the end of the day, it is the same (subset of) optima that are covered by the Lagrangian FOC.

However, there is a standard choice---sometimes called the standard form in optimization literature---that ensures the Lagrange multipliers $$\lambda$$'s are non-negative. (See, for example, Convex Optimization by Boyd and Vandenberghe.)

In the standard form, the Lagranian is always written in such a way that it improves the objective function.

This convention is not always pointed out/followed in economics texts. When it is followed in economic contexts, then the Lagrange multipliers admit the usual interpretation as marginal values of the corresponding constraints---a kind of "indirect marginal utility". E.g. the standard-form Lagrange multiplier is the derivative of the indirect utility function with respect to wealth---which must be non-negative.

For example, consider the maximization problem $$\max_{g(x) \geq 0} u(x)$$ where $$u : \mathbb{R}^n \rightarrow \mathbb{R}$$ and $$g : \mathbb{R}^n \rightarrow \mathbb{R}^p$$. E.g. in a consumer's problem, $$u$$ is utility function, $$p = 1$$, and $$g(x) = p^T(w-x)$$.

Then the standard form Lagrangian is $$L(x, \lambda) = u(x) + \lambda^T g(x).$$ It improves the objective function $$u$$ when $$\lambda \geq 0$$. This means that, for maximization problems, $$L(x, \lambda) \geq u(x)$$ for all $$x$$ and all $$\lambda \geq 0$$. Since you're trying to maximize $$u$$, improving on $$u$$ means being larger than $$u$$.

1. In the standard form, the Lagrange multiplers must be non-negative., i.e. at an (suitable) optimum $$x^*$$, we must have $$D u(x^*) + \lambda^T D g(x^*) = 0$$ for some $$\lambda$$ with non-negative entries. This is easy to see, especially in the case of single constraint $$p = 1$$. If constraint $$g$$ is slack, then $$\lambda = 0$$. If $$g$$ binds, then the gradient $$D g(x^*)$$ must point toward the interior $$\{ g > 0 \}$$. On the other hand, $$D u(x^*)$$ cannot point toward the interior---otherwise there would be an optimum in the interior. So $$D u(x^*)$$ and $$D g(x^*)$$ are anti-parallel and $$\lambda > 0$$.

2. If the maximization problem is formulated as $$\max_{g(x) \leq 0} u(x)$$ then the standard form Lagrangian is $$L(x, \lambda) = u(x) - \lambda^T g(x)$$. Again, $$L$$ is written in such a way that, when $$\lambda$$ is non-negative, $$L$$ improves $$u$$. Similar for a minimization problem.

3. "Suitability" of an optimum means that $$D g(x^*)$$ must be full-rank. This type of condition is called constraint qualification. The general KKT theorem says that the Lagrangian FOC is a necessary condition for local optima where constraint qualification holds. When the objective function is concave or quasi-concave (convex or quasi-conconvex, for minimization), then constraint qualification is not needed and Lagrangian FOC is sufficient for global optima.

• '+1' brilliant explanation and notation. I like the phrase "written in such a way that it improves the objective function." So just to be perfectly clear the standard form has two requirements : 1) $\lambda \geq 0$ for critical points and 2) $L(x,\lambda)$ improves is written so as to improve obejctive function implying that $(+-)\lambda g(x) \geq 0$ for maximization and $(+-)\lambda g(x) \leq 0$ for minimization? – Jesper Hybel Dec 22 '20 at 0:28
• @JesperHybel Yes re your comment 2), in particular the $+/-$ in front of $\lambda g(x)$, which points out the choice of $\geq/\leq$ in the inequality constraint. 1) is a consequence, rather than a requirement. If 2) is followed, then $\lambda^*$ must be non-negative at a suitable optimum. – Michael Dec 22 '20 at 1:00

The two ways of properly setting up Lagrangian are completely equivalent (although you have mistakes above) so it does not matter which way you set it up.

You actually have mistake there resulting in the two ways being different:

In the first equation you forgot minus sign since: $$\sum_i^l p_i w_i = \sum_i^l p_i x_i \implies 0 = \sum_i^l p_i w_i - \sum_i^l p_i x_i \neq 0 = \sum_i^l p_i w_i + \sum_i^l p_i x_i$$

Thus the first lagrangian set up properly will look like

$$L_1=u(X)+\lambda ( \sum_i^l p_i w_i - \sum_i^l p_i x_i) = u(X)+\lambda ( \sum_i^l p_i w_i) - \lambda (\sum_i^l p_i x_i))$$

In the second equation you make mistake of forgetting that in the second way of setting up lagrangian the multiplier has negative sign $$-\lambda$$ (see Hammond et al Essential Mathematics for Economic Analysis pp 499 for full explanation why)

$$L_2=u(X)-\lambda ( \sum_i^l p_i x_i -\sum_i^l p_i w_i) = u(X)+\lambda ( \sum_i^l p_i w_i) - \lambda (\sum_i^l p_i x_i))$$

Hence clearly both $$L_1$$ and $$L_2$$ are completely equivalent you just have to set them up without making typos/mistakes.

• Hi, @imuflon1, I made a typo. At first equation, pw+px should be changed at pw-px. Now, two equation is different (different sing of lambda). You are saying first equation is correct (in modified version) and second equation is wrong. Right? Why second equation is wrong? – martian03 Dec 20 '20 at 16:56
• @martian03 because depending on how you solve the constraint for zero you need to change sign of lambda - lambda cant just be positive no matter what - the sign of lambda is dictated by constraint i.e. $g(x,y)=c$ can be solved for zero as $0=c-g(x,y)$ and in that case lambda has to be positive $\lambda$ or as $g(x,y)-c=0$ in which case it has to be $-\lambda$. – 1muflon1 Dec 20 '20 at 17:01