From an Optimization Problem to a System
A constrained optimization problem asks us to find extrema of an objective function while restricting its inputs to points that satisfy a condition. For one equality constraint, the condition has the form \(g=c\), where \(g\) is a function of the variables and \(c\) is a fixed number.
At a regular constrained extremum, the Lagrange condition relates the gradient of the objective to the gradient of the constraint. The practical task in this tutorial is to translate that condition accurately into equations: identify the unknowns, calculate the gradients, introduce the multiplier, and include the constraint itself.
Identify the Ingredients First
Suppose \(f:\mathbb{R}^n\to\mathbb{R}\) is the objective and \(g:\mathbb{R}^n\to\mathbb{R}\) is the constraint function. The feasible points are precisely the points \(\mathbf{x}\) satisfying \(g(\mathbf{x})=c\). In coordinates, write the variables as \(x_1,\ldots,x_n\), and regard the multiplier \(\lambda\) as an additional unknown.
The gradient of a differentiable scalar-valued function is the vector of its first partial derivatives. Thus, for \(n\) variables,
Compute \(\nabla f\) and \(\nabla g\) separately before writing the system. Then set corresponding components equal in \(\nabla f=\lambda\nabla g\), and append the original constraint equation \(g=c\). Do not replace the constraint equation with the gradient equation: both are required.
Why the Vector Equation Becomes Coordinate Equations
The gradient equation is a vector equality. Two vectors are equal exactly when their corresponding components are equal. Multiplying \(\nabla g\) by the scalar \(\lambda\) multiplies every component by that same scalar. Therefore, the vector condition is equivalent to one scalar equation for each variable.
Including \(g=c\) then gives \(n+1\) equations in \(n+1\) unknowns. This count describes the usual setup; it does not guarantee that the system has a solution, that its solutions are easy to find, or that each solution is an extremum.
The method is motivated by the geometry of a regular constraint. At a point where \(\nabla g\ne\mathbf{0}\), that gradient is normal to the level set \(g=c\). At a constrained extremum covered by the Lagrange theorem, the objective gradient is parallel to this normal, so it is a scalar multiple of \(\nabla g\). The scalar is \(\lambda\), and the feasible point must also satisfy \(g=c\).
Worked Example: A Quadratic Objective on a Line
Worked Example: A Quadratic Objective on a Line
Set up the Lagrange system for \(f(x,y)=x^2+y^2\) subject to \(g(x,y)=x+y=1\).
Step 1: Identify the functions and unknowns. The objective is \(f(x,y)=x^2+y^2\), and the constraint function is \(g(x,y)=x+y\), with constraint value \(c=1\). The unknowns in the system will be \(x,y,\lambda\).
Step 2: Compute the gradients.
Step 3: Write the gradient equation in components. From \(\nabla f=\lambda\nabla g\), the first components give \(2x=\lambda\), and the second components give \(2y=\lambda\).
Step 4: Append the constraint. The complete candidate system is
Check: The point \(x=\tfrac12,\ y=\tfrac12\) with \(\lambda=1\) satisfies the system: \(2x=1=\lambda\), \(2y=1=\lambda\), and \(x+y=\tfrac12+\tfrac12=1\). This verifies that it is a solution of the candidate equations. The setup alone does not classify the point as a maximum or minimum.
Worked Example: A Product on a Circle
Worked Example: A Product on a Circle
Set up the system for \(f(x,y)=xy\) subject to \(g(x,y)=x^2+y^2=4\).
Step 1: Identify the ingredients. Here \(f(x,y)=xy\), \(g(x,y)=x^2+y^2\), and \(c=4\). The unknowns are \(x,y,\lambda\).
Step 2: Compute each gradient.
Step 3: Match components in the gradient equation. The first component gives \(y=2\lambda x\), and the second gives \(x=2\lambda y\).
Step 4: Include feasibility. The candidate system is
Check: Consider \(x=\sqrt{2},\ y=\sqrt{2},\ \lambda=\tfrac12\). The first equation has left side \(\sqrt{2}\) and right side \(2(\tfrac12)\sqrt{2}=\sqrt{2}\). The second has the same two sides. The constraint gives \((\sqrt{2})^2+(\sqrt{2})^2=2+2=4\). Thus this point and multiplier satisfy all three equations. This check verifies a candidate, not whether it is an extremum.
Worked Example: A Constraint with a Negative Derivative
Worked Example: A Constraint with a Negative Derivative
Set up the system for \(f(x,y)=x^2+2y^2\) subject to \(g(x,y)=x-y=3\).
Step 1: Identify the functions and unknowns. The objective is \(x^2+2y^2\); the constraint function is \(x-y\), with \(c=3\). Use \(x,y,\lambda\) as the unknowns.
Step 2: Compute the gradients carefully. In particular, the derivative of \(-y\) with respect to \(y\) is \(-1\).
Step 3: Write both component equations. The gradient equation gives \(2x=\lambda\) and \(4y=-\lambda\). The negative sign in the second equation comes from the second component of \(\nabla g\).
Step 4: Add the constraint. The full system is
Check: At \(x=2,\ y=-1,\ \lambda=4\), the first equation reads \(4=4\); the second reads \(-4=-4\); and the constraint reads \(2-(-1)=3\). The proposed values satisfy every equation.
What the System Does—and Does Not—Say
A solution \((x_1,\ldots,x_n,\lambda)\) of the system gives a feasible point whose gradients satisfy the Lagrange condition. It is therefore a candidate for a constrained extremum when the regularity condition applies. The multiplier is part of the algebraic system, not an additional coordinate of the original domain.
Conversely, a constrained extremum at a regular feasible point must satisfy the condition supplied by the Lagrange theorem. This makes the system useful for generating candidates. However, a candidate need not be an extremum: it could be a saddle-type point on the constraint, or its objective value might not be the greatest or least among all feasible candidates. Those conclusions require further analysis.
The regularity qualification matters. If \(\nabla g=\mathbf{0}\) at a feasible point, the stated regular-point condition does not guarantee that the point appears among solutions of the Lagrange system. A careful application checks whether the constraint gradient vanishes at relevant feasible points rather than treating the system as a universal test.
Common Setup Errors
Errors in the setup can change the candidate set, even before any equations are solved. The most common is to omit the constraint equation. The gradient equations alone do not impose feasibility, so they may include points that do not satisfy \(g=c\).
Another frequent error is to use the gradient of the objective on both sides, or to forget a component of the constraint gradient. The correct right-hand side is \(\lambda\nabla g\), using the same scalar multiplier in every component. Also, preserve signs when differentiating the constraint.
Finally, do not confuse the fixed number \(c\) with the unknown multiplier \(\lambda\). The equation \(g=c\) expresses feasibility; \(\lambda\) appears only in the gradient relation. Keeping these roles separate makes the setup easier to check.
A Reliable Setup Routine
Record the objective \(f\), the constraint function \(g\), and the fixed constraint value \(c\).
Calculate \(\nabla f\) and \(\nabla g\), checking every component and sign.
Write \(\nabla f=\lambda\nabla g\), using the same \(\lambda\) in each coordinate equation.
Add \(g=c\), then check that the unknowns are the original variables together with \(\lambda\).
They are candidates under the regularity condition, not automatic proofs of extrema.
Check Your Understanding
For each question, focus on how the problem is translated into equations.
- For \(f(x,y)=x^2+y^2\) subject to \(x-y=2\), what are \(\nabla f\), \(\nabla g\), and the full Lagrange candidate system?
- For an objective in three variables and one equality constraint, how many coordinate gradient equations are there, and what additional equation must be included?
- Why must the same multiplier \(\lambda\) appear in every component equation?
- What regularity condition is required for the Lagrange theorem’s necessary condition at a feasible point?
- Does a solution of the candidate system by itself prove that the point is a constrained maximum or minimum? Explain briefly.