The problem it solves
Before you start: this builds on maxima and minima of two variables.
Often you want the largest or smallest value of a function \(f(x, y, z)\) when the variables are tied together by a constraint \(\phi(x, y, z) = 0\). For example: the largest box volume for a fixed amount of cardboard, or the point on a plane closest to the origin.
Sometimes you can use the constraint to eliminate a variable (as in the box example on the maxima and minima page). Lagrange's method avoids that algebra, keeps the variables symmetric, and works even when elimination is messy.
To find the extreme values of \(f(x, y, z)\) subject to \(\phi(x, y, z) = 0\):
1. Form the auxiliary function
\[F = f + \lambda\,\phi\]
2. Set its partial derivatives to zero
\[F_x = 0, \quad F_y = 0, \quad F_z = 0\]
3. Solve together with the constraint
Solve these with \(\phi = 0\) for \(x, y, z\) (and \(\lambda\)). The solutions are the candidate points.
The unknown number \(\lambda\) is the Lagrange multiplier. You usually don't need its value; it's a tool for eliminating variables.
The idea in one picture
In symbols, “the contour of \(f\) touches the constraint curve” means their normal vectors point the same way: \(\nabla f = -\lambda\,\nabla\phi\). Written out component by component, that is exactly \(F_x = F_y = F_z = 0\).
Solving the equations
The algebra is the hard part. Two tricks solve most exam problems:
- Make \(\lambda\) the subject in each equation, then set the expressions equal to each other.
- Multiply each equation by its variable (\(x F_x\), \(y F_y\), \(z F_z\)) when \(f\) is a product like \(xyz\). The terms often become identical, which quickly gives \(x = y = z\).
Lagrange's method finds candidate points but doesn't classify them. In word problems the nature is usually clear from the context (a box has a largest volume but no smallest). Otherwise, compare the values at the candidate points.
Solved examples
Example 1: The picture above
EasyFind the maximum of \(f = xy\) subject to \(x + y = 2\).
- \(F = xy + \lambda(x + y - 2)\). \(F_x = y + \lambda = 0\) and \(F_y = x + \lambda = 0\).
- So \(x = y = -\lambda\). Then the constraint gives \(2x = 2\), so \(x = y = 1\).
AnswerMaximum value \(1\), at \((1, 1)\).
Example 2: Maximum product with a fixed sum
MediumFind the maximum value of \(xyz\) subject to \(x + y + z = a\) (\(x, y, z > 0\)).
- \(F = xyz + \lambda(x + y + z - a)\). \(F_x = yz + \lambda = 0\), \(F_y = xz + \lambda = 0\), \(F_z = xy + \lambda = 0\).
- So \(yz = xz = xy\). Since \(z \ne 0\), \(yz = xz\) gives \(x = y\); similarly \(y = z\).
- The constraint gives \(3x = a\), so \(x = y = z = \dfrac{a}{3}\).
AnswerMaximum value \(\dfrac{a^3}{27}\).
Example 3: Minimum with a fixed sum
MediumFind the minimum of \(x^2 + y^2 + z^2\) subject to \(x + y + z = 3a\).
- \(F = x^2 + y^2 + z^2 + \lambda(x + y + z - 3a)\). \(F_x = 2x + \lambda = 0\), and similarly for \(y\) and \(z\).
- So \(x = y = z = -\dfrac{\lambda}{2}\), and the constraint gives \(x = y = z = a\).
AnswerMinimum value \(3a^2\), at \((a, a, a)\).
Example 4: Nearest point on a plane
Exam levelFind the shortest distance from the origin to the plane \(ax + by + cz = p\).
- Minimise the square of the distance, \(f = x^2 + y^2 + z^2\). \(F = f + \lambda(ax + by + cz - p)\).
- \(2x + \lambda a = 0\), so \(x = -\dfrac{\lambda a}{2}\); similarly \(y = -\dfrac{\lambda b}{2}\), \(z = -\dfrac{\lambda c}{2}\).
- Substitute in the plane: \(-\dfrac{\lambda}{2}(a^2 + b^2 + c^2) = p\), so the point is \(\dfrac{p\,(a, b, c)}{a^2 + b^2 + c^2}\).
- Its distance from the origin is \(\dfrac{|p|\sqrt{a^2 + b^2 + c^2}}{a^2 + b^2 + c^2}\).
AnswerShortest distance \(= \dfrac{|p|}{\sqrt{a^2 + b^2 + c^2}}\)
Example 5: The open box, solved again
Exam levelAn open-top box must hold 32 cm³. Use Lagrange's method to find the dimensions that minimise its surface area.
- Minimise \(S = xy + 2xz + 2yz\) subject to \(xyz = 32\). \(F = S + \lambda(xyz - 32)\).
- \(F_x = y + 2z + \lambda yz = 0\), \(F_y = x + 2z + \lambda xz = 0\), \(F_z = 2x + 2y + \lambda xy = 0\).
- Multiply them by \(x\), \(y\), \(z\) respectively. Each then contains \(\lambda xyz\), so \(xy + 2xz = xy + 2yz = 2xz + 2yz\).
- The first equality gives \(x = y\); the second gives \(xy = 2xz\), so \(y = 2z\). Then \(xyz = 4z^3 = 32\), so \(z = 2\).
AnswerBase 4 cm × 4 cm, height 2 cm, the same as by elimination.
Never divide by \(x\), \(y\) or \(z\) without saying why it is non-zero. In word problems it's usually obvious (a length can't be 0), but writing “since \(z \ne 0\)” earns the mark.
Common mistakes
1. Forgetting the constraint equation
\(F_x = F_y = F_z = 0\) gives three equations, but there are four unknowns (\(x, y, z, \lambda\)). You need \(\phi = 0\) as the fourth.
2. Dividing by something that could be zero
Dividing by a variable can throw away valid solutions or create false ones. Factorise, or state why it is non-zero.
3. Expecting the method to say maximum or minimum
It only finds candidate points. Use the context or compare values to decide.
4. Minimising distance instead of distance squared
Minimising \(\sqrt{x^2 + y^2 + z^2}\) gives the same point but much messier derivatives. Square it first.
How it's asked in exams
- Extreme values with a constraint, for example \(xyz\) given \(x + y + z = a\).
- Geometry: the shortest distance from a point to a plane or surface, or the largest rectangle or box inside a shape.
- Word problems: boxes, tanks and costs, sometimes asking you to compare with the elimination method.
Practice questions
Try each one on paper before you open the answer.
Q1Find the maximum of \(x^2 y\) subject to \(x + y = 3\) (\(x, y > 0\)).
\(2xy + \lambda = 0\) and \(x^2 + \lambda = 0\), so \(2xy = x^2\), giving \(x = 2y\) (as \(x \ne 0\)). Then \(3y = 3\): \(y = 1\), \(x = 2\). Maximum value \(4\).
Q2Find the maximum of \(x + y\) subject to \(x^2 + y^2 = 1\).
\(1 + 2\lambda x = 0\) and \(1 + 2\lambda y = 0\), so \(x = y\). Then \(2x^2 = 1\), \(x = \pm\dfrac{1}{\sqrt 2}\). The maximum is \(\sqrt 2\), at \(\left(\tfrac{1}{\sqrt 2}, \tfrac{1}{\sqrt 2}\right)\).
Q3Find the shortest distance from the origin to the plane \(2x + 3y + 6z = 14\).
By Example 4: \(\dfrac{14}{\sqrt{4 + 9 + 36}} = \dfrac{14}{7} = 2\). The nearest point is \(\dfrac{14}{49}(2, 3, 6) = \left(\tfrac{4}{7}, \tfrac{6}{7}, \tfrac{12}{7}\right)\).
Q4A closed rectangular box has surface area 108 cm². Find its largest possible volume.
Maximise \(xyz\) subject to \(2(xy + yz + zx) = 108\). By symmetry of the equations, \(x = y = z\), so \(6x^2 = 108\) and \(x = 3\sqrt 2\).
Largest volume \(= (3\sqrt 2)^3 = 54\sqrt 2 \approx 76.4\) cm³: a cube.
Q5Find the minimum of \(x^2 + y^2\) subject to \(xy = 1\).
\(2x + \lambda y = 0\) and \(2y + \lambda x = 0\). Multiply by \(x\) and \(y\) and subtract: \(x^2 = y^2\). With \(xy = 1\): \((1, 1)\) or \((-1, -1)\). Minimum value \(2\).
Bring it to a free demo class and work through it with Vipul Sir. Book on WhatsApp.
Frequently asked questions
What is a Lagrange multiplier?
The extra unknown \(\lambda\) introduced in \(F = f + \lambda\phi\). It lets you treat a constrained problem as if it were unconstrained.
When should I use Lagrange's method instead of substitution?
When eliminating a variable using the constraint is awkward, or when the problem is symmetric in the variables. Lagrange's method keeps the symmetry, which often gives \(x = y = z\) quickly.
Does Lagrange's method tell me whether the point is a maximum or minimum?
No. It finds candidate points. Decide from the context of the problem, or by comparing the function's values at the candidates.
Why is it called the method of undetermined multipliers?
Because \(\lambda\) starts as an unknown (undetermined) number, and you often never need to find its value.