# OPMT 5701

Two Variable Optimization

Using Calculus For Maximization Problems

One Variable Case
If we have the following function
y = 10x − x2
we have an example of a dome shaped function. To find the maximum of the dome, we
simply need to find the point where the slope of the dome is zero, or
dy
dx
= 10 − 2x = 0
10 = 2x
x=5
and
y = 25

Two Variable Case
Suppose we want to maximize the following function

z = f (x, y) = 10x + 10y + xy − x2 − y 2
Note that there are two unknowns that must be solved for: x and y. This function is an
example of a three-dimensional dome. (i.e. the roof of BC Place)
To solve this maximization problem we use partial derivatives. We take a partial
derivative for each of the unknown choice variables and set them equal to zero
∂z
∂x
= fx = 10 + y − 2x = 0 The slope in the ”x” direction = 0
∂z
∂y
= fy = 10 + x − 2y = 0 The slope in the ”y” direction = 0

This gives us a set of equations, one equation for each of the unknown variables. When
you have the same number of independent equations as unknowns, you can solve for each of
the unknowns.
rewrite each equation as

y = 2x − 10
x = 2y − 10
substitute one into the other

x = 2(2x − 10) − 10
x = 4x − 30
3x = 30

1

Otherwise. one equation for each of the unknowns. Minimum fxx > 0 fyy > 0 fyy fxx − fxy fyx > 0 3. The partials. above. 2 . fxy . y = 10 REMEMBER: To maximize (minimize) a function of many variables you use the technique of partial diﬀerentiation. fxx = −2 < 0 fyy = −2 < 0 fxy = 1 fyx = 1 and fyy fxx − fxy fyx = (−2)(−2) − (1)(1) = 3 > 0 therefore we have a maximum. the direct eﬀects must outweigh the cross eﬀects Rules for two variable Maximums and Minimums 1. fxy and fyx are the indirect eﬀects. Second order Conditions (second derivative Test) To test for a maximum or minimum we need to check the second partial derivatives.fy ) and two variable in each equation. x = 10 similarly.fxx . You then solve the set of equations simulaneously to derive solutions for each of the unknowns. or the cross eﬀects of one variable on the slope in the other variable’s direction. we will get four second partials ( fxx . we have a Saddle Point From our second order conditions. fyy . and fyy are the direct eﬀects of of a small change in x and y on the respective slopes in in the x and y direction. fyx ) Using our original first order equations and taking the partial derivatives for each of them (a second time) yields: fx = 10 + y − 2x = 0 fy = 10 + x − 2y = 0 fxx = −2 fyy = −2 fxy = 1 fyx = 1 The two partials. For both Maximums and Minimums. This produces a set of equations. Maximum fxx < 0 fyy < 0 fyy fxx − fxy fyx > 0 2. Since we have two first partial derivative equations (fx .

p2 . we can eliminate p1 and p2 leaving us with a two variable maximization problem. q2 ) = p1 q1 + p2 q2 − q12 − 5q1 q2 − q22 which is the function of four variables: p1 . each having the following market demand func- tions q1 = 14 − 14 p1 q2 = 24 − 12 p2 The monopolist’s joint cost function is C(q1 . Example: Profit Maximization A monopolist oﬀers two diﬀerent products. q2 ) = q12 + 5q1 q2 + q22 The monopolist’s profit function can be written as π = p1 q1 + p2 q2 − C(q1 . First. First. Using the market demand func- tions. rewrite in matrix form · ¸· ¸ · ¸ 10 5 q1 56 = 5 6 q2 48 3 . q1 .and q2 . but it is not necessary to use the Hessian. rewrite the demand functions to get the inverse functions p1 = 56 − 4q1 p2 = 48 − 2q2 Substitute the inverse functions into the profit function π = (56 − 4q1 )q1 + (48 − 2q2 )q2 − q12 − 5q1 q2 − q22 The first order conditions for profit maximization are ∂π ∂q1 = 56 − 10q1 − 5q2 = 0 ∂π ∂q2 = 48 − 6q2 − 5q1 = 0 Solve the first order conditions using Cramer’s rule. using a Hession Matrix. The Hessian is written as · ¸ fxx fxy H= fyx fyy where the determinant of the Hessian is ¯ ¯ ¯ f f ¯ |H| = ¯¯ xx xy ¯ = fyy fxx − fxy fyx ¯ fyx fyy which is the measure of the direct versus indirect strengths of the second partials.Hessian Matrix of Second Partials: Sometimes the Second Order Conditions are checked in matrix form. This is a common setup for checking maximums and minimums.

we get p∗1 = 56 − 4(2.75) = 45 p∗2 = 48 − 2(5. The various second derivatives can be set up in a matrix called a Hessian The Hessian for this problem is · ¸ · ¸ π 11 π 12 −10 −5 H= = π 21 π 22 −5 −6 The suﬃcient conditions are |H1 | = π 11 = −10 < 0 (First Principle Minor of Hessian) |H2 | = π 11 π 22 − π 12 π 21 = (−10)(−6) − (−5)2 = 35 > 0 (determinant) Therefore the function is at a maximum.7) = 36.6 From the profit function. check the second order conditions to verify that the profit is at a maximum.7 35 Using the inverse demand functions to find the respective prices. since the signs of |H1 | and |H2 | are invariant to the values of q1 and q2 . the maximum profit is π = 213. L) = L + K 2 2 L = Labour K = Capital Then the profit function for a competitive firm is π = P q − wL − rK P = Market Price or w = Wage Rate 1 1 π = P L 2 + P K 2 − wL − rK r = Rental Rate First order conditions 4 . Example: Profit Max Capital and Labour Suppose we have the following production function q = Output 1 1 q = f (K. Further.75 35 ¯ ¯ ¯ 10 56 ¯ ¯ ¯ ¯ 5 48 ¯ q2∗ = = 5. where |A| = 35 ¯ ¯ ¯ 56 5 ¯ ¯ ¯ ¯ 48 6 ¯ q1∗ = = 2.94 Next. we know that the profit function is strictly concave.

L is labour and K is capital. General Form ∂π P −1 1. is in turn a function of K and L via the production function Q = f (K. L. Find the optimal K. the exogenous variables are P. ∂L = 2 L 2 −w =0 P fL − w = 0 −1 ∂π P 2. However output. and π 2. and r = 10 1. L and Q. ∂k = 2 K 2 −r =0 P fK − r = 0 Solving (1) and (2). K.w and r. Q is output. in matrix form ¯ ¯ ¯ ¯ ¯ π LL πLK ¯ ¯¯ −P L −3 0 ¯ ¯ H = ¯¯ ¯=¯ 4 2 ¯ π KL π KK ¯ ¯ 0 −P −3 K 2 ¯ 4 µ ¶µ ¶ £ ¤ −P −3 −P −3 P fLL fKK − (fLK )2 = L2 K 2 −0>0 4 4 Diﬀerentiate first order of conditions with respect to capital (K) and labour (L) =⇒Therefore profit maximization Example: If P = 1000. Since the firm operates in a competitive market. Check second order conditions Example: Cobb-Douglas production function and a com- petitive firm Consider a competitive firm with the following profit function π = T R − T C = P Q − wL − rK where P is price. There are three endogenous variables. L) 5 . and w and r are the input prices for L and K respectively. Q. we get L∗ = ( 2w P )−2 K ∗ = ( 2r P )−2 Second order conditions (Hessian) −3 π LL = P fLL = −P 4 L2 <0 −3 π KK = P fKK = −P 4 K 2 <0 π LK = π KL = P fLK = P fKL = 0 or. w = 20.

But first. Rewriting the first equation in Equation 5 to isolate K ¡ ¢ 3 1 P 14 L− 4 K 4 = w 3 K = ( 4w p L 4 )4 Substituting into the second equation of Equation 5 ·³ ´4 ¸− 34 P 14 3 ¡P ¢ 1 4w 34 4 L K− 4 = 4 L 4 p L =r ¡ 1 ¢4 = P4 4 w−3 L−2 = r Re-arranging to get L by itself gives us P 3 1 L∗ = ( w− 4 r− 4 )2 4 Taking advantage of the symmetry of the model. L) = P L 4 K 4 − wL − rK The first order conditions are ∂π ¡ ¢ 3 1 = P 14 L− 4 K 4 − w = 0 ∂L ∂π ¡ ¢ 1 3 ∂K = P 14 L 4 K − 4 − r = 0 This system of equations define the optimal L and K for profit maximization. we need to check the second order conditions to verify that we have a maximum. For simplicity. Therefore. The Hessian for this problem is · ¸ " 3 7 1 ¡ ¢2 3 3 # π LL π LK P (− 16 )L− 4 K 4 P 14 L− 4 K − 4 H= = ¡ ¢2 3 3 ¡ 3¢ 1 7 πKL π KK P 14 L− 4 K − 4 P − 16 L4 K 4 The suﬃcient conditions for a maximum are that |H1 | < 0 and |H| > 0. then a + b < 1. We can now return to the first order conditions to solve for the optimal K and L. is the Cobb-Douglas function Q = La K b where a and b are positive parameters. let’s consider the symmetric case where a = b = 14 1 1 Q = L4 K 4 Substituting Equation 3 into Equation 1 gives us 1 1 π(K. 6 . we can quickly find the optimal K P 3 1 K ∗ = ( r− 4 w− 4 )2 4 L∗ and K ∗ are the firm’s factor demand equations. which in this case. If we further assume decreasing returns to scale. the second order conditions are satisfied.

2) Each firm’s profit function is π i = P qi − cqi − K Firm 1 π 1 = P q1 − cq1 − K π 1 = (a − bq1 − bq2 )q1 − cq1 − K Max π 1. 2 Each firm faces the same cost function T C = K + cqi (i = 1. For Firm 2 π 2 = (a − bq1 − bq2 )q2 − cq2 − K Max π2 Treating q1 as constant q1 q2 = a−c 2b − 2 Firm 2’s ”Best Response Function” The two ”Best Response Functions” a−c q2 Firm 1 q1 = 2b − 2 a−c q1 Firm 2 q2 = 2b − 2 gives us two equations and two unknowns. The solution to this system of equations is the equilibrium to the ”Cournot Duopoly Game. treating q2 as constant ∂π ∂q1 = a − bq2 − 2bq1 − c = 0 2bq1 = a − c − bq2 q1 = a−c 2b − q22 ⇒ ”Best Response Function” Best Response Function tells Firm 1 the profit maximizing q1 for any level of q2 . q1∗ = a−c 3b 2.Cournot Doupoly (Game Theory) .” Using Cramers Rule 1. Assumption: Each firm takes the other firms output as exogenous and chooses output to maximize its own profits. q2∗ = a−c 3b 2(a−c) Market Output q1∗ + q2∗ = 3b 7 . Market Demand: P = a − bq or P = a − b(q1 + q2 ) (q1 + q2 = q) Where qi is firm i’s output i = 1.

Partial Derivative Rules: U = xy ∂U/∂x = y ∂U/∂y =x U = xa y b ∂U/∂x = axa−1 y b ∂U/∂y = bxa y b−1 a U = xa y −b = xyb ∂U/∂x = axa−1 y −b ∂U/∂y = −bxa y −b−1 U = ax + by ∂U/∂x = a ¡ ¢ ∂U/∂y = b¡ ¢ U = ax1/2 + by 1/2 ∂U/∂x = a 12 x−1/2 ∂U/∂y = b 12 y −1/2 2. Logarithm (Natural log) ln x (a) Rules of natural log If T hen y = AB ln y = ln(AB) = ln A + ln B y = A/B ln y = ln A − ln B y = Ab ln y = ln(Ab ) = b ln A NOTE: ln(A + B) 6= ln A + ln B (b) derivatives IF T HEN dy y = ln x dx = x1 dy 1 y = ln (f (x)) dx = f (x) · f 0 (x) (c) Examples If T hen 1 y = ln(x2 − 2x) dy/dx = (x2 −2x) (2x − 2) ¡1¢ ¡1¢ y = ln(x1/2 ) = 12 ln x dy/dx = 2 x = 2x 1 3. The Number e dy if y = ex then = ex dx dy if y = ef (x) then = ef (x) · f 0 (x) dx (a) Examples dy y = e3x dx = e3x (3) 3 dy 3 y = e7x dx = e7x (21x2 ) dy y = ert dt = rert Finding the MRS from Utility functions EXAMPLE: Find the total diﬀerential for the following utility functions 8 .Review of Some Derivative Rules 1.

1. U(x1 . x2 ) = α ln c1 + β ln c2 where (α. x2 ) = x21 + x32 + x1 x2 3. U(x1 . x2 ) = xa1 xb2 where (a. U(x1 . ∂x 1 = U1 = a ∂x2 = U2 = b and dU = U1 dx1 + U2 dx2 = adx1 + bdx2 = 0 If we rearrange to get dx2 /dx1 ∂U dx2 U1 a = − ∂x ∂U 1 =− =− dx1 ∂x2 U2 b dx2 The MRS is the Absolute value of dx1 : a MRS = b ∂U ∂U 2. β > 0) Answers: ∂U ∂U 1. b > 0) 4. ∂x 1 = U1 = 2x1 + x2 ∂x 2 = U2 = 3x22 + x1 and dU = U1 dx1 + U2 dx2 = (2x1 + x2 )dx1 + (3x22 + x1 )dx2 = 0 Find dx2 /dx1 dx2 U1 (2x1 + x2 ) =− =− dx1 U2 (3x22 + x1 ) dx2 The MRS is the Absolute value of dx1 : (2x1 + x2 ) MRS = (3x22 + x1 ) ∂U iii) ∂x1 = U1 = axa−1 1 x2 b ∂U ∂x2 = U2 = bxa1 xb−1 2 and ¡ ¢ ¡ a b−1 ¢ dU = axa−1 1 xb 2 dx1 + bx1 x2 dx2 = 0 Rearrange to get dx2 U1 axa−1 xb ax2 =− = − a1 b−12 = − dx1 U2 bx1 x2 bx1 dx2 The MRS is the Absolute value of dx1 : ax2 MRS = bx1 9 . x2 ) = ax1 + bx2 where (a. b > 0) 2. U(x1 .

³ ´ ³ ´ ³ ´ ³ ´ ∂U 1 α ∂U 1 β iv) ∂c1 = U1 = α c1 dc1 = c1 dc1 ∂x2 = U2 = β c2 dc2 = c2 dc2 and µ ¶ µ ¶ α β dU = dc1 + dc2 = 0 c1 c2 Rearrange to get ³ ´ α dc2 U1 c1 αc2 =− = ³ ´ =− dc1 U2 β βc1 c2 dc2 The MRS is the Absolute value of dc1 : αc2 MRS = βc1 10 .