If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

### Course: Multivariable calculus>Unit 3

Lesson 5: Lagrange multipliers and constrained optimization

# The Lagrangian

How a special function, called the "Lagrangian", can be used to package together all the steps needed to solve a constrained optimization problem. Created by Grant Sanderson.

## Want to join the conversation?

• The definition of the Lagrangian seems to be linked to that of the Hamiltonian of optimal control theory, i.e. H(x,u, lambda) = f(x,u) + lambda * g(x,u), where u is the control parameter. How does one get from one to the other?
• I had the same question. It seems that Grant has omitted the distinction between the Lagrangian and the Hamiltonian functions. He's essentially written down the Hamiltonian with a minus (-) sign so that you would get the same Lagrange multipliers, only multiplied by -1.
• How can we get the intuition for optimization when inequality constraints are involved. Mainly, how can we visualize KKT conditions?
• What about inequality constraints max f(x), subject to g(x) <= 0 ?
• You can certainly have problems with inequality constraints.
Two things can happen in a problem with an inequality constraint. Either you don't need to go all the way to the constraint (in which case the constraint is known as an inactive constraint) or else we will push up against the constraint (in which case this is equivalent to an equality constraint).
• Here is only problems for maximize. What is with minimizing ? is gradient has to be negative? Thanks
• I guess you could probably minimize by maximizing the negative of the function.
• What if the revenue function peaks within the constraint's area (say at the origin)? The Lagrangian will give us an erroneous result then.
• That’s not on the constraint, so it isn’t a solution. We want the maximum value on the circle.
• Is the Lagrangian equation used in the constrained optimization APIs such as that provided by R? Thanks.
• Is the Lagrangian in anyway connected to the Eigenfunction?
• No, lower-case lambda is used as a symbol for many different things!