RS - Ch 9 - Optimization: One Variable Chapter 9 Optimization: One Choice Variable 1 Léon Walras (1834-1910) 9.1 Vilfredo Federico D. Pareto (1848–1923) Optimum Values and Extreme Values • Goal vs. non-goal equilibrium • In the optimization process, we need to identify the objective function to optimize. • In the objective function the dependent variable represents the object of maximization or minimization Example: - Define profit function: - Objective: Maximize π - Tool: Q π = PQ - C(Q) 2 RS - Ch 9 - Optimization: One Variable 9.2 Relative Maximum and Minimum: First-Derivative Test • Critical Value The critical value of x is the value x0 if f’(x0) = 0 • A stationary value of y is f(x0) • A stationary point is the point with coordinates x0 and f(x0) • A stationary point is coordinate of the extremum • Theorem (Weierstrass) Let f : S→R be a real-valued function defined on a compact (bounded and closed) set S ∈ Rn. If f is continuous on S, then f attains its maximum and minimum values on S. That is, there exists a point c1 and c2 such that 3 f (c1) ≤ f (x) ≤ f (c2) for all x ∈ S. 9.2 First-derivative test ☺ • The first-order condition (f.o.c.) or necessary condition for extrema is that f '(x*) = 0 and the value of f(x*) is: • A relative minimum if f '(x*) changes its sign from negative to positive from the immediate left of x0 to its immediate right. (first derivative test of min.) ☺ y B f '(x*)=0 x x* • A relative maximum if the derivative f '(x) changes its sign from positive to negative from the immediate left of the point x* to its immediate right. (first derivative test for a max.) y A f '(x*) = 0 x* 4 RS - Ch 9 - Optimization: One Variable 9.2 First-derivative test • The first-order condition or necessary condition for extrema is that f '(x*) = 0 and the value of f(x*) is: • Neither a relative maxima nor a relative minima if f '(x) has the same sign on both the immediate left and right of point x0. (first derivative test for point of inflection) y D • f '(x*) = 0 x x* 5 9.2 Example: Average Cost Function AC = Q 2 − 5Q + 8 Objective function f (Q ) = 2Q − 5 1st derivative function f / (Q ) = 2Q − 5 = 0 f.o.c. / * Q = 5 / 2 = 2.5 left extrema ( ) AC = f Q* right f (2.4 ) = 1.76 f (2.5) = 1.75 f (2.6 ) = 1.76 relative min f ' (2.4) = −0.2 f / (2.5) = 0 f ' (2.6) = 0.2 (−,+ ) 6 RS - Ch 9 - Optimization: One Variable 9.2 Example: Average Cost, 1st & 2nd Derivatives 1) AC = Q 2 − 5Q + 8 2) MC = 2Q − 5 MC = 2Q − 5 = 0 Q=5 2 3) MC ′ = 2 7 9.3 Second and Higher Derivatives (Revisited) Derivative of a derivative for y=f (x) • The first derivative f '(x) or dy/dx is itself a function of x, it should be differentiable with respect to x, provided that it is continuous and smooth. • The result of this differentiation is known as the second derivative of the function f and is denoted as f ''(x) or d2y/dx2. • The second derivative can be differentiated with respect to x again to produce a third derivative, f '''(x) and so on to f(n)(x) or dny/dxn • Example: Revenue and Marginal Revenue functions 1) 2) 3) 4) R = f (Q ) = 1200 Q − 2 Q 2 f ′( Q ) = 1200 − 4 Q f ′′(Q ) = − 4 f ′′′(Q ) = 0 primitive function 1st derivative 2 nd derivative 3 rd derivative 8 RS - Ch 9 - Optimization: One Variable 9.3 Example: Revenue, 1st & 2nd Derivatives 1) R = 1200Q − 2Q 2 2) MR = 1200 − 4Q 1200 − 4Q = 0 Q = 300 3) MR′ = −4 9 9.3 Interpretation of the second derivative • f '(x) measures the rate of change of a function – e.g., whether the slope is increasing or decreasing • f ''(x) measures the rate of change in the rate of change of a function – e.g., whether the slope is increasing or decreasing at an increasing or decreasing rate – how the curve tends to bend itself 10 RS - Ch 9 - Optimization: One Variable 9.3 The smile test ☺ • Convexity and Concavity: The smile test for aximum/minimum • If f "(x) < 0 for all x, then strictly concave. => critical points are global maxima • If f "(x) > 0 for all x, then strictly convex. => critical points are global minima ☺ • If a concave utility function (typical for risk aversion) is assumed for a utility maximizing representative agent, there is no need to check for s.o.c. Similar situation for a concave production function 11 9.3 Example: Revenue Function 1) TR = 1200Q − 2Q 2 Revenue function 2) MR = 1200 − 4Q 1st derivative 2' ) MR = 1200 − 4Q* = 0 f.o.c. 3) 4) Q* = 300 MR′ = −4 MR ′ < 0 5) extrema 2nd derivative maximum 12 RS - Ch 9 - Optimization: One Variable 9.3 Inflection Point • Definition A twice differentiable function f(x) has an inflection point at x iff the second derivative of f(.) changes from negative (positive) in some interval (m,x~) to positive (negative) in some interval (x~,m), where x~∈(m,n). • Alternative Definition An inflection point is a point (x, y) on a function, f(x), at which the first derivative, f′(x), is at an extremun, -i.e. a minimum or maximum. (Note: f’’(x)=0 is necessary, but not sufficient condition.) Example: U(w) = w -2 w2 + w3 U’(w)=4w +3 w2 U’’(w)=4+6w => 4+6w~ =0 13 w~=2/3 is an inflection point 9.3 Examples: Optimal Seignorage e M = e − λ (π + r ) +α Y P e M S =π = π e − λ (π + r ) +α Y P F.o.c. (assume π = π e ) : Demand for money Seignorage dS = e − λ (π + r ) +α Y + π ( − λ ) e − λ (π + r ) +α Y dπ = e − λ ( π + r ) + α Y + π ( − λ ) e − λ ( π + r ) + α Y = e − λ ( π + r ) + α Y (1 − πλ ) 1 (1 − π * λ ) = 0 => π * = (Critical point) λ S.o.c. : d 2S = − λ e − λ ( π + r ) + α Y (1 − πλ ) + ( − λ ) e − λ ( π + r ) + α Y = − λ e − λ ( π + r ) + α Y ( 2 − πλ ) dπ 2 * d 2S 1 1 ( π * = ) = − λ e − λ ( π + r ) + α Y < 0 => π * = is a maximum 2 dπ λ λ RS - Ch 9 - Optimization: One Variable 9.3 Examples: Optimal Timing - wine storage A(t ) = Ve − rt V = ke Present va lue t Growth in value 12 A(t) = ke t e − rt = ke t ln A(t ) = lnk + lne t ( = ln k + (t 12 ½ − rt − rt ) − rt ) = lnk + t ½ − rt lne dA 1 dt A F.o.c. : ½ 1 −1 2 t −r 2 dA 1 −1 2 1 −1 2 = A t * − r = 0 => t * − r = 0 dt 2 2 1 1 => =r => t* = 2 4r 2 t* = 9.3 Examples: Optimal Timing - wine storage Optimal time : t * = 1 4r 2 Let ( r ) = 10 % 1 = 25 years 4( 0 .10 )2 Determine optimal values for A(t) and V : t* = A(t) = ke t ½ − rt let ( k ) = $ 1 / bottle A(t) = e 5 −(.1 )(( 25 ) = e 2 .5 = $ 12 .18 / bottle V = Ae rt V = ( $12 .18 /bottle) e (.1 )( 25 ) = $ 148 .38 / bottle V = $ 148 .38 / bottle 16 RS - Ch 9 - Optimization: One Variable 9.3 Examples: Optimal Timing - wine storage Plot of .5(t).5(t)-.5=r, r=.10, t=25 17 9.4 Formal Second-Derivative Test: Necessary and Sufficient Conditions • The zero slope condition is a necessary condition and since it is found with the first derivative, we refer to it as a 1st order condition. • The sign of the second derivative is sufficient to establish the stationary value in question as a relative minimum if f "(x0) >0, the 2nd order condition or relative maximum if f "(x0)<0. 18 RS - Ch 9 - Optimization: One Variable 9.4 Example 1: Profit function Revenue and Cost functions 1) TR = 1200Q − 2Q 2 2) TC = Q 3 − 61.25Q 2 + 1528 .5Q + 2000 Profit function 3) π = TR-TC = − Q 3 + 59.25Q 2 − 328.5Q − 2000 1st derivative of profit function 4) π′ = −3Q 2 + 118.5Q − 328 .5 = 0 5) Q1* = 3 Q2* = 36.5 2 nd derivative of profit function 6) π′′ = −6Q + 118.5 7 ) π′′(3) = 100.5 π′′(36.5) = −100.5 applying the smile test 8) ( ) ( ) π′′ Q1* > 0 → min π′′ Q2* < 0 → max 19 9.4 Example 2: Imperfect Competition Total revenue function 1) ( ) TR ≡ AR * Q = 8000 − 23 Q + 1 . 1Q 2 − 0 . 018 Q 3 Q 20 RS - Ch 9 - Optimization: One Variable 9.4 Example 2: TR and 1st , 2nd & 3rd derivatives Average 1) and total revenue functions AR = f (Q ) = 8000 − 23 Q + 1 . 1Q 2 − 0 . 018 Q 3 2) TR = f (Q )Q Marginal revenue and the product MR = f ( Q ) Q ′ + Q f ′ ( Q ) 3) 4) rule ( ) M R = 8000 − 23 Q + 1 . 1Q 2 − 0 . 018 Q 3 (1 ) ( 2 + Q − 23 + 2 . 2 Q − . 054 Q ) = 8000 − 46 Q + 3 . 3 Q 2 − 0 . 0 . 72 Q 3 2 nd derivative 5) M R ′ = f ′ (MR ) 6) M R ′ = − 46 + 6 . 6 Q − 0 . 216 Q 2 = 0 7) Q 1* = 10 . 76 Q 2* = 19 . 79 3rd derivitive M R ′′ = f ′ (M R ′ ) M R ′′ ( Q ) = 6 . 6 − 0 . 432 Q M R ′′ (10 . 76 ) = 1 . 95 MR " (19 . 79 ) = − 1 . 94 8) 9) 10 ) smile test 11 ) M R ′′ ( Q 1* ) > 0 → min. 21 MR " ( Q 2* ) < 0 → max. 9.5 Taylor Series of a polynomial function: Revisited Taylor series for an arbitrary function : Any function can be approximat ed by the weighted sum of its derivative s. Then the change is given by Where R n +1 / f f ( x ) − f (x0 ) = (x0 ) (x − x )1 0 1! f + // (x0 ) (x − x )2 0 2! +…+ f (n) (x 0 ) (x − x0 )n + R n +1 n! f (n +1 ) ( p ) (x − x0 )n +1 = (n + 1)! If n = 2, then f(x) - f(x 0 ) = f / (x0 ) (x − x )1 0 1! At x 0 , f / (x 0 ) = 0 (x0 ) (x − x )2 + R 0 3 2! - i.e., x 0 is a max., min., or inflection . + f // Then, f(x) - f(x 0 ) ≈ f (x0 ) (x − x )2 0 2! // => the sign of f // (x 0 ) determines what x 0 is. 22 RS - Ch 9 - Optimization: One Variable 9.5 Taylor expansion and relative extremum A function f(x) attains a relative max (min) value at x 0 if f(x) -f(x 0 ) is neg. (pos.) for values of x in the immediate neighborho od of x 0 (the critical value) both to its left and right Taylor series approximat ion for a small change in x : (x0 ) (x − x )2 + ... + R 0 n +1 1! 2! At the max., min., or inflection , f / (x 0 ) = 0 f(x) - f(x 0 ) = f / (x0 ) (x − x )1 0 and if f // (x 0 ) = 0, and if f (3) + f // (x 0 ) = 0, L then f(x) - f(x 0 ) = R n +1 What is the sign of R for the first nonzero derivative ? 23 9.5 Nth-derivative test If the first derivative of a function f(x) at x0 is f / (x0 ) = 0 and if the first nonzero derivative value at x 0 encountered in successive derivation is that of the N th derivative, f (n)(x0 ) ≠ 0, then the stationary value f ( x0 ) will be : a relative max if N is even and f (n)(x0 ) < 0 a relative min if N is even and f (n)(x0 ) > 0 an inflection point if N is odd 24 RS - Ch 9 - Optimization: One Variable 9.5 Nth-derivative test Y = ( 7-x)4 primitive function Y / = -4( 7-x)3 1st deriative Y / = 0 at x * = 7 the critical value Y // (7) = 12( 7-x)2 = 0 2 nd deriviative Y ( 3) (7) = -24( 7-x) = 0 3rd derivative Y ( 4 ) (7) = 24 4 th derivative Because first nonzero derivative Y (n ) is even (4) and Y (4) > 0 (24), critical value is a min. 25 9.5 Nth-derivative test Y = ( 7-x)4 primitive function M Y ( 4) = 24 4 th derivative decision rule : n is even (4) and > 0 therefore a minimum 26