Solving constrained optimization problems using Lagrange multipliers

academics economics Lagrange multipliers microeconomics

Among the most important topics covered in any college-level microeconomics course is that of how to solve constrained optimization problems, which involve maximizing or minimizing the value of some objective function – such as a utility or cost function – subject to one or more constraints – such as a budget or production target. Although these problems can often seem quite abstract, the logic of constrained optimization has applications to an enormous array of real-world situations, including everyday decisions like how much of your income to spend versus save for the future.

The method of Lagrange multipliers is one approach to solving these types of problems.

In this two-part series of posts we will consider how to apply this method to a simple example, while highlighting some practical tips for how to remember the key steps.

As alluded to above, there are three basic elements of any constrained optimization problem:

  1. The objective function, which takes one or more arguments as inputs and returns a numerical value as an output;
  2. Whether the goal is to maximize or minimize the output of the objective function; and
  3. The constraint(s), or limits on which arguments can be validly considered when trying to find the optimal (maximum or minimum) value of the objective function.

 

A solution to one of these problems therefore consists of the argument(s) that, when plugged into the objective function, return(s) the maximum or minimum value that function can attain while also respecting the constraint(s).

To illustrate what this means in practice, let’s take a look at a concrete example.

Suppose that you are faced with the task of buying produce for the coming week, and that you have to decide how to allocate a budget of $18 among two items, avocados and bananas. (Unfortunately you don’t always have a terribly varied diet when you live inside of an economics problem!) 

Your utility function, which describes how much satisfaction you get from a particular combination of avocados and bananas – sometimes called a “bundle” in economic parlance – is given by the expression:

Screen Shot 2023-04-11 at 5.18.04 PM

where A denotes the number of avocados and B the number of bananas purchased. 

Suppose further that the price of one avocado is $1.50 and the price of one banana is $0.50. This means that your budget constraint can be written using the expression

Screen Shot 2023-04-11 at 5.18.35 PM

In other words, the total amount you spend on avocados (the price of an avocado times the quantity of avocados that you buy) plus the total amount you spend on bananas (the price of a banana times the number of bananas that you buy) has to be less than or equal to your budget of $18. (In some optimization problems the constraint will be an equality, but here we assume that it’s an inequality. In other words, you’re allowed to spend less than your full budget if it would make sense to do so.)

The objective function here is the utility function. Your goal is to maximize its value, since you want to get as much satisfaction as possible out of your haul of produce. The constraint is the budget you have available to spend, together with the fact that avocados and bananas are not free. The solution will therefore be the combination (or combinations) of avocados and bananas that maximizes your utility given what you can afford to spend.

The first step in applying the method of Lagrange multipliers is to set up the Lagrangian. This is a function that takes as its arguments the arguments of the objective function as well as another variable known as the Lagrange multiplier, which is usually denoted by the Greek letter λ (lambda).

In our example, the Lagrangian could be written in one of two different ways:

Screen Shot 2023-04-11 at 5.19.21 PM

The underlying problem of choosing values for A and B in order to maximize the objective function is now converted into one of choosing values for A, B, and λ in order to maximize the Lagrangian

This step can admittedly be a bit confusing. It might be tricky to remember how to set up the Lagrangian, how to know whether to add or subtract the term at the end, and/or what to put inside of the parentheses.

Here’s one way of thinking about it that may be helpful. Trying to maximize the Lagrangian effectively means trying to maximize the objective function while also getting extra credit for staying within your budget. If you have a total of $18 to spend, and $(1.5A + 0.5B) is the total amount that it costs to buy A avocados and B bananas, then $(18 – 1.5A – 0.5B) is the amount of money that you have left over. If what’s left over is greater than or equal to zero, you’ve stayed within your budget. 

Congratulations! Staying within your budget is a good thing: it helps get you closer to your goal of maximizing the Lagrangian. This means that we want the term involving λ to make the whole Lagrangian expression larger. If we assume that \lambda is also greater than or equal to zero (more on this in Part Two), then if we put 18 - 1.5A - 0.5B inside the parentheses we want the term involving λ to be added into the Lagrangian.  

Alternatively, we could think not in terms of extra credit for staying within your budget, but rather in terms of losing points for going over your budget. If we adopt this perspective, then the expression 1.5A + 0.5B - 18 tells us by how many dollars you went over your budget. Doing so is a bad thing from the perspective from maximizing the Lagrangian, so if we now put 1.5A + 0.5B - 18 inside the parentheses then we want the term involving λ to be subtracted from the Lagrangian. 

In Part Two of this two-part series, we will consider the remaining steps to arriving at a solution to this example using the method of Lagrange multipliers, as well as how to verify that the solution we obtain is correct. Hope you’re hungry for some (imaginary) fresh produce!

Matt worked as a Research Analyst at the Federal Reserve Bank of New York for two years before going on to earn an MA, MPhil, and PhD in Economics at Columbia University.

Comments

topicTopics
academics study skills MCAT medical school admissions SAT college admissions expository writing English MD/PhD admissions strategy writing LSAT GMAT GRE physics chemistry math biology graduate admissions academic advice ACT interview prep law school admissions test anxiety language learning career advice premed MBA admissions personal statements homework help AP exams creative writing MD study schedules test prep computer science Common Application summer activities history mathematics philosophy organic chemistry secondary applications economics supplements research 1L PSAT admissions coaching grammar law psychology statistics & probability legal studies ESL dental admissions CARS SSAT covid-19 logic games reading comprehension engineering USMLE calculus mentorship PhD admissions Spanish parents Latin biochemistry case coaching verbal reasoning DAT English literature STEM excel medical school political science skills AMCAS French Linguistics MBA coursework Tutoring Approaches academic integrity chinese letters of recommendation mechanical engineering Anki DO Social Advocacy admissions advice algebra art history artificial intelligence astrophysics business careers cell biology classics dental school diversity statement gap year genetics geometry kinematics linear algebra mental health presentations quantitative reasoning study abroad tech industry technical interviews time management work and activities 2L DMD IB exams ISEE MD/PhD programs Sentence Correction adjusting to college algorithms amino acids analysis essay athletics business skills cold emails data science finance first generation student functions graphing information sessions international students internships logic networking poetry resume revising science social sciences software engineering trigonometry writer's block 3L AAMC Academic Interest EMT FlexMed Fourier Series Greek Health Professional Shortage Area Italian Lagrange multipliers London MD vs PhD MMI Montessori National Health Service Corps Pythagorean Theorem Python Shakespeare Step 2 TMDSAS Taylor Series Truss Analysis Zoom acids and bases active learning architecture argumentative writing art art and design schools art portfolios bacteriology bibliographies biomedicine brain teaser campus visits cantonese capacitors capital markets central limit theorem centrifugal force chemical engineering chess chromatography class participation climate change clinical experience community service constitutional law consulting cover letters curriculum dementia demonstrated interest dimensional analysis distance learning econometrics electric engineering electricity and magnetism escape velocity evolution executive function fellowships freewriting genomics harmonics health policy history of medicine history of science hybrid vehicles hydrophobic effect ideal gas law immunology induction infinite institutional actions integrated reasoning intermolecular forces intern investing investment banking lab reports linear maps mandarin chinese matrices mba medical physics meiosis microeconomics mitosis mnemonics music music theory nervous system neurology neuroscience object-oriented programming office hours