# Lagrange multiplier

A Lagrange multiplier is a constant, usually represented by the Greek symbol lambda (λ), which is part of the formula for finding an extreme value of a function f(x,y) subject to a constraint g(x,y). For example, the method of Lagrange multipliers can help determine the maximum area of a rectangle that can be fit inside a given circle represented by g(x,y) = x2 + y2.

The points at which extrema occur for a function f(x,y) subject to the constraint g(x,y) are the common solutions to:

$\nabla f= \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z}\right) = \lambda \nabla g$

and g(x,y) = 0.

## Example

Problem: What is the shape and dimension of the largest rectangle that fits within a circle having a radius equal to the square root of 2?

Solution: g(x,y) = x2 + y2 - 2 = 0. We want to maximize the area of a rectangle. Assuming symmetry about the origin (we could always map a solution to a symmetric one), the area f(x,y) that we want to maximize equals 2x times 2y: f(x,y) = 4xy. From the equation for the Lagrange multiplier above, and setting the x and y coefficients equal to each other, we can generate these two equations:

4y = λ2x
4x = λ2y

Solving each for lambda (λ) demonstrates that x must be equal to y, and plugging that into the equation for g yields:

2x2 = 2
x = 1 = y

Then do not forget to include the maximum area in your answer, which is $f(1,1) = 4 \cdot 1 \cdot 1 = 4$.