Refresher course: Maths in Economics (Peerapat Jatukannyaprateep) ***For simplicity, any function in this note is assumed to be continuous and twice differentiable unless stated otherwise.*** Let π¦ be a function of π₯, π = π(π) We call it “π is a function of π”. π¦ is called a dependent variable (output) and π₯ is called an independent/explanatory variable (input). Input Function Output (x) f(x) (y) Example: π¦ = π(π₯) = (2π₯ + 3)2 x y -3 9 -2 1 -1 1 Slope: is given by a change in y over a change in x, 0 9 βπ¦ βπ₯ 1 25 2 49 3 81 . Differentiation: a method to compute the slope of a function (the rate at which a dependent variable y changes with respect to the change in the independent variable x). Derivative: a measure of how a function changes as its input changes. The derivative is the ratio of the infinitesimal change of the dependent variable over the infinitesimal change of the independent variable. “Infinitesimal”: smaller than any number but is not equal to zero (approaching zero). “The derivative of y with respect to x” can be found by 3 following methods: Forward Difference ππ¦ ππ(π₯) π(π₯ + β) − π(π₯) = = lim β→0 ππ₯ ππ₯ β Backward Difference ππ¦ ππ(π₯) π(π₯) − π(π₯ − β) = = lim β→0 ππ₯ ππ₯ β Central Difference β β π (π₯ + ) − π(π₯ − ) ππ¦ ππ(π₯) 2 2 ≡ lim π(π₯ + β) − π(π₯ − β) = = lim β→0 β→0 ππ₯ ππ₯ β 2β All of the 3 methods give the same result when h approaches zero. Linear function y is a linear function of x if it can be written in the following form: π¦ = ππ₯ + π where b and c are constants. The characteristic of a linear function is that the slope (derivative) is constant. (The slope is the same no matter what the value of x is.) Example: x y y = 3x + 2 -3 -7 -2 -4 -1 -1 0 2 1 5 2 8 3 11 (3(π₯ + β) + 2) − (3(π₯) + 2) π π π(π₯ + β) − π(π₯) = lim = lim =π β→0 π π β→0 β β ππ¦ ππ₯ does not depend on the independent variable x. (It is not a function of x.) x dy/dx (Slope) -2 3 -1 3 0 3 1 3 2 3 Non-linear function Any function that is not linear, including logarithmic and exponential function, is called a non-linear function. The slope of a non-linear function is not a constant. It depends on its independent variable (input). (It is a function of x.) Example: x y π = ππ + π -3 12 -2 7 -1 4 0 3 1 4 2 7 3 12 ((π₯ + β)2 + 3) − (π₯ 2 + 3) (π₯ 2 + 2π₯β + β2 + 3) − (π₯ 2 + 3) π π π(π₯ + β) − π(π₯) = lim = lim = lim = ππ β→0 β→0 π π β→0 β β β The result above shows that the slope of the function is twice the value of the independent variable i.e. it is not constant x Slope -2 -4 -1 -2 0 0 1 2 2 4 Derivatives of elementary functions Note that we also use a notation π ′ (π₯) for a derivative of π(π₯). Let c be a constant. π π(π) π(π) = π π = Constant rule: c 0 ππ₯ π πππ₯ π−1 π ππ₯ ππ ππ₯ ln(π₯) 1 π₯ Sum rule: π′ (π₯) + β′ (π₯) π(π₯) + β(π₯) Product rule: Quotient rule: Chain rule: π(π₯)β′ (π₯) + π′ (π₯)β(π₯) π(π₯)β(π₯) β(π₯)π′(π₯) − π(π₯)β′ (π₯) β(π₯)2 πβ(π₯) ππ(π₯) × ππ(π₯) ππ₯ π(π₯) β(π₯) β(π(π₯)) Examples: 1) Constant rule π¦ = π(π₯) = 3 ππ¦ = 0 (π΅π¦ π‘βπ ππππ π‘πππ‘ ππ’ππ) ππ₯ Similar to a linear function with slope (b) = 0. 2) π (πππ ) π = ππππ−π π¦ = π(π₯) = 3π₯ 2 Here c = 3 and r = 2 ππ¦ = 3 × 2 × π₯ 2−1 = 6π₯ ππ₯ 3) Sum rule π¦ = π(π₯) = 2π₯ 2 + 4π₯ − 7 ππ¦ π(2π₯ 2 ) π(4π₯) π(−7) = + + = 4π₯ + 4 + 0 = 4π₯ + 4 ππ₯ ππ₯ ππ₯ ππ₯ The value of the constant does not affect the slope of the function. (brown line: c = 7, red line: c = 0, blue line: c = -7) Let π(π) = ππ , π(π) = πππ 4. Product Rule Let π(π₯) = π(π₯)β(π₯) ππ(π₯) = π′ (π₯)β(π₯) + π(π₯)β′ (π₯) = 2π₯π 3π₯ + π₯ 2 (3π 3π₯ ) = (2π₯ + 3π₯ 2 )π 3π₯ ππ₯ 5. Quotient Rule Let π(π₯) = π(π₯) β(π₯) ππ(π₯) β(π₯)π′(π₯) − π(π₯)β′ (π₯) 2π₯π 3π₯ − 3π₯ 2 π 3π₯ 2π₯ − 3π₯ 2 = = = ππ₯ β(π₯)2 π 6π₯ π 3π₯ 6. Chain Rule Let π(π₯) = β(π(π₯)) = π 3π₯ 2 ππ(π₯) πβ(π(π₯)) ππ(π₯) 2 = × = (3π 3π(π₯) )(2π₯) = 6π₯π 3π₯ ππ₯ ππ(π₯) ππ₯ Concavity and Convexity of a function It is a must-know mathematical concept. I recommend that you take a look at this great lecture note by Martin J. Osborne (https://www.economics.utoronto.ca/osborne/MathTutorial/CCVF.HTM) Optimisation problems with univariate functions The maximum and the minimum (plural: maxima and minima) of a function, known collectively as extrema (singular: extremum) are the largest and smallest value that the function takes a point, either within a given neighbourhood (local/relative extremum) or on the function domain in its entirety (global/absolute extremum). Examples: 1) The function π₯ 2 has no maximum and one local minimum which is also a unique global minimum at x = 0. At the point, the function takes the value of π(0) = 02 = 0. 2) The function π₯ 3 − 3π₯ 2 has no global extremum (because when π₯ → −∞, π(π₯) = −∞, and when π₯ → ∞, π(π₯) = ∞), but has a local maximum at x = 0 (y = 0) and a local minimum at x = 2 (y = -4) 3) The function π₯ 3 has no maximum and minimum, but has a saddle point at x=0. (A saddle point is a point that is a stationary point but not a local extremum. At this point, the function switches from being concave to convex, or from convex to concave.) Local Extrema A point is said to be a local maximum/minimum if it satisfies the following 2 conditions: 1. First Order Condition (F.O.C.) It is a stationary (critical) point. A stationary point is a point where the derivative of a function is equal to zero. (the point where the function stops increasing or decreasing.) π. πΆ. πͺ. βΆ π′ (π∗ ) = π The slope (derivative) at a maximum and a minimum is always zero. 2. Second Order Condition (S.O.C.) The First Order Condition is not sufficient in determining whether a point is a local minimum or a local maximum. To be able to fully determine, the second derivative (the derivative of the derivative of the function, by π′′(π₯)) needs to be checked. ππ ′(π₯) ππ₯ , denoted πΊ. πΆ. πͺ. βΆ π′′ (π∗ ) > π (πΉππ π ππππππ’π) π′′ (π∗ ) < π (πΉππ π πππ₯πππ’π) π′′ (π∗ ) = π (ππππ π ππ’ππ‘βππ πππ£ππ π‘ππππ‘πππ π€βππ‘βππ ππ‘ ππ π πππππ πππ₯πππ’π, π πππππ ππππππ’π, ππ π π πππππ πππππ‘. ) If the second derivatives of both the left and the right neighbourhood of the stationary point are positive, the point is a local minimum. lim π ′′ (π₯ − β) > 0 πππ lim π ′′ (π₯ + β) > 0 β→∞ β→∞ On the other hand, if the second derivatives of both the left and the right neighbourhood of the stationary point are negative, the point is a local maximum. lim π ′′ (π₯ − β) < 0 πππ lim π ′′ (π₯ + β) < 0 β→∞ β→∞ If the stationary point is to be a saddle point, the sign of the second derivatives of its left and right neighbourhood must not be the same. lim π ′′ (π₯ − β) > 0 πππ lim π ′′ (π₯ + β) < 0 ππ lim π ′′ (π₯ − β) < 0 πππ lim π ′′ (π₯ + β) > 0 β→∞ β→∞ β→∞ β→∞ The idea behind this condition is that, a positive second derivative implies that the slope (the first derivative) at the stationary point is starting to increase which implies that the function is also starting to increase from the stationary point, thus, the point is a minimum. On the other hand, a negative second derivative implies that the slope at the stationary point is starting to decrease implying that the function is also starting to decrease, hence, the point is a maximum. Graph A: π(π) = ππ + π The red line in the graphs are the first derivative line, Graph A: Graph B: π(π) = −ππ + π dy dx = 2x, Graph B: dy dx = −2x. As can be seen above, the functions reach their local extremum when its first derivative line crosses the x-axis (the derivative function is equal to zero) (F.O.C.). The extremum is the minimum if the slope of the first derivative line is positive (Graph A), and is the maximum if the slope of the first dervative line is negative (Graph B) (S.O.C.). Examples: 1) π = ππ + ππ + π π. πΆ. πͺ.: ππ¦ = 2π₯ + 2 (πππ’ππ π‘π 0 ππ‘ π₯ ∗ = −1) ππ₯ πΊ. πΆ. πͺ. : π2π¦ = 2 > 0 (πΌπ‘ ππ π ππππππ’π. ) ππ₯ 2 Blue line: the function π¦ = π₯ 2 + 2π₯ + 5, Green line: the first derivative of the function, ππ¦ ππ₯ = 2π₯ + 2 From the graph, the function y reaches its minimum at the point where the value of the first derivative function is zero (at π₯ ∗ = −1) and the value of the minimum is equal to: π₯ ∗ 2 + 2π₯ ∗ + 5 = (−1)2 + 2(−1) + 5 = 4 2) π = ππ − πππ + π π. πΆ. πͺ.: ππ¦ = 3π₯ 2 − 6π₯ = 3π₯(π₯ − 2) (πππ’ππ π‘π 0 ππ‘ π₯ ∗ = 0 πππ 2) ππ₯ πΊ. πΆ. πͺ. : π2π¦ = 6π₯ − 6 ππ₯ 2 At π₯ ∗ = 0 πΊ. πΆ. πͺ. : π2π¦ = 6π₯ − 6 = 6(0) − 6 = −6 < 0 (πΌπ‘ ππ π πππ₯πππ’π. ) ππ₯ 2 At π₯ ∗ = 2 πΊ. πΆ. πͺ. : π2π¦ = 6π₯ − 6 = 6(2) − 6 = 6 > 0 (πΌπ‘ ππ π ππππππ’π. ) ππ₯ 2 Blue line: the function π¦ = π₯ 3 − 3π₯ 2 + 6, Green line: the first derivative of the function, ππ¦ ππ₯ = 3π₯ 2 − 6π₯ (From the graph, the function y reaches an extremum whenever the first derivative function crosses the x-axis.) The function has no global extremum, but has a local maximum at π₯ ∗ = 0 (π¦ = 6) and a local minimum at π₯ ∗ = 2 (π¦ = 2). 3) π = ππ π. πΆ. πͺ. : ππ¦ = 3π₯ 2 (πππ’ππ π‘π π§πππ ππ‘ π₯ ∗ = 0) ππ₯ πΊ. πΆ. πͺ. : π2π¦ = 6π₯ ππ₯ 2 At π₯ ∗ = 0, 6π₯ ∗ = 0, thus the point is a saddle point and the function π¦ = π₯ 3 have no maximum and minimum. Global Extrema A Global maximum(minimum) is a point where the value of the function is the largest(smallest) in its entire domain. Consider the function π¦ = π(π₯) = π. πΆ. πͺ. : π₯4 4 + π₯3 3 9 − π₯ 2 − 9π₯ + 5 2 ππ¦ = π₯ 3 + π₯ 2 − 9π₯ − 9 = (π₯ + 3)(π₯ + 1)(π₯ − 3) = 0 ππ₯ There are 3 stationary points, at π₯ ∗ = −3, −1, πππ 3 πΊ. πΆ. πͺ. : π2π¦ = 3π₯ 2 + 2π₯ − 9 ππ₯ 2 At π∗ = −π, π2π¦ = 3(−3)2 + 2(−3) − 9 = 27 − 6 − 9 = 12 > 0 (πβππ πππππ‘ ππ π πππππ ππππππ’π. ) ππ₯ 2 π(−3) = 2.75 At π∗ = −π, π2π¦ = 3(−1)2 + 2(−1) − 9 = 3 − 2 − 9 = −8 < 0 (πβππ πππππ‘ ππ π πππππ πππ₯πππ’π. ) ππ₯ 2 π(−1) = 9.42 At π∗ = π, π2π¦ = 3(3)2 + 2(3) − 9 = 27 + 6 − 9 = 24 > 0 (πβππ πππππ‘ ππ π πππππ ππππππ’π. ) ππ₯ 2 π(3) = −33.25 From the graph, the function has 2 local minima, at x = -3 and x = 3. The local minimum at x = 3 is also the global minimum as it gives the function the smallest value. There is 1 local maximum at x = -1, but it is not a global maximum. For this function, there is no global maximum since the value of the function goes to infinity and minus infinity as π₯ → ∞ and π₯ → −∞, respectively. Suppose, the domain of the function is [−5 , 5] instead of (−∞, ∞), then the function would have 3 local maxima at -5, -1, and 5 giving the value of the function 52.08, 9.42, and 45.42, respectively. Thus, the global maximum is at x = -5. To find the global extrema of a function on an interval [a, b] 1. Find the critical/stationary points of the function. (First Order Condition) 2. Classify the critical/stationary points whether they are local maxima, local minima, or saddle points. (Second Order Condition) 3. Compare the values of the function at these points together with the values evaluated at each end point. The point with the largest value is the global maximum, and the point with the smallest value is the global minimum. Partial derivative Suppose we have a function of two variables π§ = π(π₯, π¦) (z is a function of x and y) For example π§ = π₯π¦ 2 You can see that the value of z depends on the value of y, and the marginal change in the value of z when x change also depends on y. Partial derivative of z with respect to x π§ = π₯π¦ 2 The partial derivative of z with respect to x is the change in z associated with the change in x holding other variables constant. (We use π symbol to distinguish between derivative and partial derivative.) ππ§ = π¦2 ππ₯ Which means that when x changes by 1 unit, z changes by π¦ 2 unit implying that the change in z with respect to x also depends on the value of y y 1 2 3 4 5 ππ§ = π¦2 ππ₯ 1 4 9 16 25 The rules of partial derivative are the same with derivative’s except that the other variables are treated as constants. Example 1: π§ =π₯+π¦ Then ππ§ ππ₯ ππ¦ = + =1+0 ππ₯ ππ₯ ππ₯ ππ§ ππ₯ ππ¦ = + =0+1 ππ¦ ππ¦ ππ¦ Example 2: π§ = (π₯ − π¦)2 By chain rule ππ§ = 2(π₯ − π¦) ππ₯ ππ§ = −2(π₯ − π¦) ππ¦ Example in economics: Cournot competition equilibrium Optimisation problems with multivariate functions Similar to the optimisation of a function of 1 variable. 1. First Order Condition (The maximum/minimum is a stationary point) A multivariate function is stationary if the partial derivative of the function with respect to each variable is equal to zero π§ = π(π₯, π¦) ππ§ ππ§ = 0 πππ =0 ππ₯ ππ¦ Hence, we often have to deal with a system of equations to find a pair of x and y that satisfy both of the equations. 2. Second Order Condition (Second derivative test) Again we have to check the second order partial derivative which includes the cross partial derivative. To sum up, we have to check the determinant (det) of the Hessian Matrix of the function π2π§ ππ₯ 2 π» = π2π§ [ππ¦ππ₯ Note that π2 π§ ππ₯ππ¦ = π2π§ ππ₯ππ¦ π2π§ ππ¦ 2 ] π2 π§ ππ¦ππ₯ 1. If det(H) > 0, and π2 π§ ππ₯ 2 > 0 πππ π2 π§ ππ¦ 2 > 0 then the point is a local minimum. (the Hessian is positive definite i.e. all eigenvalues are positive.) 2. If det(H) > 0, and π2 π§ ππ₯ 2 < 0 πππ π2 π§ ππ¦ 2 < 0, the point is a local maximum. (the Hessian is negative definite i.e. all eigenvalues are negative.) 3. If the determinant of the Hessian Matrix is negative, then the point is a saddle point. (i.e. the Hessian is indefinite. It has both negative and positive eigenvalues.) *If the Hessian is positive/negative semi-definite, the result is inconclusive and require further investigation. Very small note: Determinant of a π × π matrix Let π΄ = [ π π π ] π det(A) = ad – bc You must also know how to compute the determinant of a matrix with higher dimension too! Recommended detailed note on definiteness (by Eivind Eriksen): http://home.bi.no/a0710194/Teaching/BI-Mathematics/GRA-6035/2010/lecture5.pdf Constraint Optimisation Suppose we would like to solve the optimisation problem of a function, however, there is a constraint on the values of the independent variables. Examples in economics 1. Cost minimisation Suppose, a firm needs 2 inputs for its production; K(Capital) and L (Labour). Therefore the production function of the firm is going to be a function of K and L π = π(πΎ, πΏ) Now, let w denotes wage (cost of labour) and r denote cost of capital, then our cost function would be πΆ(πΎ, πΏ) = ππΎ + π€πΏ Suppose we would like to produce Q units of output with the minimum cost, then our cost minimisation problem become min πΆ(πΎ, πΏ) πΎ,πΏ π π’πππππ‘ π‘π π(πΎ, πΏ) = π 2. Utility maximisation Suppose, an individual’s utility depends on 2 kind of goods, A and B, then his utility function can be written as π(π΄, π΅) e.g. π(π΄, π΅) = √π΄ + √2π΅ let ππ΄ πππ ππ be the price of A and B respectively. The non-satiation property (more is preferred to less) of utility function implies the individual prefer more to less. Therefore, the solution to the utility maximisation is π΄ = ∞ πππ π΅ = ∞ However, in real life, there is always a budget constraint (You have a limited amount of money). Let the individual’s budget equals to m, then the utility maximisation problem becomes max π(π΄, π΅) π΄,π΅ π π’πππππ‘ π‘π ππ΄ π΄ + ππ΅ π΅ = π Lagrange multiplier method To solve the optimisation problem under constraint, the method of Lagrange multiplier is commonly used. Let π(π₯, π¦) be the objective function (the function you would like to maximise or minimise e.g. Cost function, Utility function) and let π(π₯, π¦) = π be the constraint. (e.g. the quantity of output needed to be produced, budget constraint). Next, set up the Lagrangian max Λ(π₯, π¦, π) = π(π₯, π¦) + π(π − π(π₯, π¦)) π₯,π¦,π Where Λ(π₯, π¦, π) is a Lagrange function (or Lagrangian) and π is called a Lagrange multiplier. Then find the stationary point(s) (First Order Condition) πΛ πΛ πΛ = 0, = 0, =0 ππ₯ ππ¦ ππ or ππ(π₯, π¦) ππ(π₯, π¦) −π =0 ππ₯ ππ₯ ππ(π₯, π¦) ππ(π₯, π¦) −π =0 ππ¦ ππ¦ π − π(π₯, π¦) = 0 Second Order Condition We have to check the bordered Hessian which is given by: (2 variable case) 0 π»π΅ = [π1 π2 π1 Λ11 Λ21 π2 Λ12 ] Λ22 The sufficient condition for a local max is that the bordered Hessian is negative definite: |π»1π΅ | < 0, |π»2π΅ | > 0, |π»3π΅ | < 0, |π»4π΅ | > 0, … 0 where π»1π΅ = [ π1 0 π1 ] , π»2π΅ = [π1 Λ11 π2 π1 Λ11 Λ21 π2 Λ12 ] and so on. Λ22 On the otherhand, the sufficient condition for a local min is that the bordered Hessian is positive definite: |π»1π΅ | < 0, |π»2π΅ | < 0, |π»3π΅ | < 0, |π»4π΅ | < 0, …