Lagrange Multiplier Examples

from Section 13.6 of College Algebra and Calculus an Applied Approach by Larson and Hodgkins. For each example below, for practice, you may want to copy the portion, following the colon, from each line labeled “Wolfram Alpha input:” into Wolfram Alpha. This should reproduce the Wolfram Alpha output.

Example 1, p. 958, Section 13.6

The problem is to maximize V = xyz subject to the constraint that 6x + 4y + 3z = 24. Implicit in the problem is an additional constraint that since V is the volume of a box and the box must have sides with non-negative length.

We will use w for the Lagrange multiplier variable rather than the Greek letter . This will make it easier to type input into Wolfram alpha. We first form the Lagrange function:

F(x,y,z,w) = xyz - w (6x + 4y + 3z - 24) = xyz – 6wx – 4wy – 3wz +24w .

The Lagrange equations (setting all partial derivatives of F to 0) are

Fx = yz - 6w = 0

Fy = xz - 4w = 0

Fz = xy - 3w = 0

Fw = - ( 6x+4y+3z - 24 ) = -6x-4y-3z + 24 = 0

We will solve the problem three ways in Wolfram alpha. It is recommend that you use the first technique on the homework assignments. On tests and quizzes, you will be required to write out the Lagrange equations. (It will not be required that you solve these equations. ) The first approach give you practice forming these equations.

(1)Solve the Lagrange equations. The Wolfram Alpha input / output is:

Wolfram Alpha Input: solve yz - 6w = 0, xz-4w = 0, xy - 3w = 0, -6x - 4y - 3z + 24 = 0

Wolfram Alpha Output:

The correct answer to the maximization problem is the last solution since this solution, with x = 4/3, y = 2 and z = 8/3, has V = 64/9 which is larger than V values (= 0) for the other solutions.

(2) Find a stationary point of the Lagrange function F. A stationary point is a point where all the partial derivative of a function are zero. The Wolfram Alpha input / output is:

Wolfram Alpha Input: stationary points of xyz - w (6x + 4y + 3z - 24)

Wolfram Alpha Output:

In each of these four solutions the value the Lagrange function F is first listed at the values of (w, x, y, z) indicated on the second line. The (saddle point) indication is not important for us. Again the correct solution to the maximization problem is the last solution listed with x = 4/3, y = 2, and z = 8/3.

(3) Solve a constrained optimization problem. In the problem we want to maximize xyz subject to the constraints that . The Wolfram Alpha input / output is:

Wolfram Alpha input: maximize xyz subject to 6x + 4y + 3z - 24 = 0, x >= 0, y >= 0, z >= 0

Wolfram Alpha output:

Here the is Wolfram Alpha’s symbol for “and.”

Example 2, p. 959, Section 13.6

In this example the problem is to maximize f(x,y) = 100 x3/4 y1/4 subject to the constraint that 150x + 250 y = 50000. Implicit in the problem is the additional constraints that since in the Cobb-Douglas model the units of labor and units of capital are assumed to be non-negative.

For this problem the Lagrange function is

.

The corresponding Lagrange equations are:

We attempt to solve this problem using Wolfram Alpha with the same three approaches for the first example.

(1)Solve the Lagrange equations. The Wolfram Alpha input / output is:

Wolfram Alpha input:

solve 75 x^(-1/4) y^(1/4) - 150 w = 0, 25x^(3/4) y^(-3/4) - 250 w = 0, -150 x - 250 y + 50000 = 0

Wolfram Alpha output:

The solution to the maximization problem has x = 250, y = 50 and f(x,y) = 100 (250)3/4(50)1/4 = 16719 units.

(2) Find a stationary point of the Lagrange function F.The Wolfram Alpha input / output is:

Wolfram Alpha Input: stationary points of 100 x^(3/4) y^(1/4) - w (150x + 250 y - 50000 )

Wolfram Alpha Output:

Wolfram Alpha fails to find a solution with this approach.

(3) Solve a constrained optimization problem. In the problem we want to maximize f(x,y) = 100 x3/4 y1/4 subject to the constraint that 150x + 250 y = 50000 and .

Wolfram Alpha input: maximize 100 x^(3/4) y^(1/4) subject to 150x + 250 y - 50000 = 0, x >= 0, y>=0

Wolfram Alpha output:

So the maximum productivity is 5000 x 53/4 = 16719 when x = 250 and y = 50.

Example 3, p. 959, Section 13.6

This is the same problem as Example 2 except that the constraint is 150x + 250 y = 70000. The purpose of the problem is to determine the new productivity by using the Lagrange multiplier (w for us and in the text). The value of the Lagrange multiplier is the rate of change of the objective function (the function being optimized) as the constraint is relaxed. Terms such as “ marginal productivity,” “marginal utility,” and, in some applications, “shadow price” are used to interpret the Lagrange multiplier. For this problem the value of the Lagrange multiplier from Example 2, Solution (1) was w = 0.33437 and this rate of change happens to be a constant as the constraint is increases from 50000 to 70000. Therefore the new value of this objective function is

new value of f(x,y)

= old value of f(x,y) + (rate of change of f(x,y) with respect to changes in the constraint) (the increase in the constraint)

= 16719 + (the value of the Lagrange multiplier) (70000-50000) = 16719 + 0.33437 x 20000 = 23406

We can confirm this result using Wolfram Alpha to solve the optimization problem with the new constraint, 150x + 250 y = 70000.

Wolfram Alpha input: maximize 100 x^(3/4) y^(1/4) subject to 150x + 250 y - 70000 = 0, x >= 0, y>=0

Wolfram Alpha output:

The new maximum value of f(x,y) is 7000 x 53/4 is 23406. This is consistent with the solution obtained when we interpreted the Lagrange multiplier as a marginal productivity.

Example 4, p. 961, Section 13.6

For this problem, in order to simplify the input to Wolfram Alpha, we will use p and q, rather than p1 and p2, for the prices of the two items. Then the problem is to maximize subject to the constraint that or .

The Lagrange function is

The Lagrange equations are

We will solve this problem with our first and third approach (the second approach fails).

(1)Solve the Lagrange equations. The Wolfram Alpha input / output is:

Wolfram Alpha input:

solve -400 p + 300 q + 25+ 100 w = 0, 300 p - 360 q + 535 - 20 w = 0, 100 p - 20 q - 300 = 0

Wolfram Alpha output:

Therefore (to the nearest cent) of p= $3.94, q = $4.69 and the value of P is $712.21.

(3) Solve a constrained optimization problem. We want to

maximize subject to and (since prices should be non-negative).

Wolfram Alpha input:

maximize -200 p^2 - 180 q^2 + 300 p q + 25 p +535 q - 375 subject to -100 p + 20 q + 300 =0, p>=0, q>=0

Wolfram Alpha output:

The value of P here is $ 1425/2 = $712.50. This is more precise than the solution calculated in (1) since the prices p = 63/16 and q = 75/16 are not rounded off to the nearest penny.