Basics
Lagrange Multiplier Method
2023-12-13
The Lagrange multiplier method is used to solve constrained maximization and minimization problems. It is useful for understanding support vector machines, support vector regression, soft-margin SVMs, and manifold learning methods. Here, we use a simple example and compare the results with those obtained using Excel Solver.
The problem is to find the location and value that minimizes the objective function for all x, y satisfying the following two constraints:
Object function:
\(min \dfrac {(x^2+y^2)}{2}\)
subject to:
\(-x-y+2<0\)
\(x-y+2 < 0\)
If you solve it using Excel Solver, you can formulate the constraints and find the result as (x=0, y=2).

The Lagrange multiplier method transforms optimization problems into single minimization problems by introducing Lagrange multipliers. Here, the Lagrange multipliers, λ and μ, are restricted to the positive domain to simplify the problem space.
Object function:
\(\min _{x,y,\lambda ,\mu }^{ } \begin{Bmatrix} \dfrac {x^2+y^2}{2}+\lambda(-x-y+2)+\mu(x-y+2) \end{Bmatrix}\)
The key point here is that x and y are functions of λ and μ.
To find the values of x and y that satisfy the objective function, take the derivative and set it equal to zero. Solving the equation will give you the values of x and y that satisfy the objective function.
\(x=\lambda-\mu\)
\(y=\lambda+\mu\)
From the above two equations, we can find λ and μ as a function of x and y,
\(\lambda =\dfrac {(x+y)}{2}\)
\(\mu =\dfrac {(-x+y)}{2}\)
Now, substituting the objective function with the given constraints into the problem, the dual problem (which maximizes) with respect to unconstrained variables x and y can be derived.
Unconstrained Object Function:
\(max \left(2y-\dfrac {x^2+y^2}{2}\right)\)
The position at which the derivative values for x and y become zero is given by
\(\partial L/\partial x = 0, -x=0 \Rightarrow x=0\)
\(\partial L/\partial y = 0, -y+2=0 \Rightarrow y=2\)
and
The maximum value of the object function becomes
\(2y-(x^2+y^2)/2 = 2\)
If you use Excel to find the solution to the problem, you need to resolve the maximum value problem as shown below. It is important to note that the maximum value is obtained when the Lagrange multipliers λ and μ, which are positive, are equal to 1. In this case, the maximum value is 2, which is the same result as mentioned above.
