QF101: Quantitative Finance September 5, 2017 Week 3: Derivatives Facilitator: Christopher Ting AY 2017/2018 I recoil with ismay an horror at this lamentable plague of functions which o not have erivatives. Charles Hermite 3.1 What is a erivative? 1. The first erivative of a function is the limit: Here is a very small quantity. f ( x + ) = lim, x 0 If the limit exists, the function is sai to be ifferentiable. 2. The first erivative at x is the graient or slope of the curve ( x, ) in a plane. 3. Derivative of a constant function The erivative of = c, where c R, is 0. 4. Derivative of a power function If is a power function, namely, = x n, then its first erivative is where n R is a constant. 5. Derivative of a logarithm function x = nxn 1, If f (x) is the natural logarithm of x, i.e., = ln(x), then its first erivative is x = 1 x. If f (x) is the logarithm to base b of x, i.e., = log b (x), then its first erivative is x = 1 x ln(b). 3-1
Week 3: Derivatives 3-2 6. Derivative of an exponential function If f (x) is the exponential function, i.e., = exp(x) = e x, then its first erivative is = exp(x). x If the exponential function f (x) oes not have the natural base e, but another positive base b, i.e., = b x, then its first erivative is 7. Derivative of a linear combination of functions x = ln(b) bx. If f 1 (x) an f 2 (x) are two functions an c 1, c 2 R are two constants, then ( c1 f 1 (x) + c 2 f 2 (x) ) = c 1 x x f 1(x) + c 2 x f 2(x). In other wors, the erivative of a linear combination is equal to the linear combinations of the erivatives. This property is calle linearity of the erivative. Two special cases of this rule are: Multiplication by a constant ( c1 f 1 (x) ) = c 1 x x f 1(x). Aition ( f1 (x) + f 2 (x) ) = x x f 1(x) + x f 2(x). 8. Derivative of a prouct of functions If f 1 (x) an f 2 (x) are two functions, then the erivative of their prouct is: ( f1 (x) f 2 (x) ) ( ) ( ) = x x f 1(x) f 2 (x) + f 1 (x) x f 2(x). 9. Derivative of a composition of functions (chain rule) If f (x) an g (y) are two functions, then the erivative of their composition is: ( g ( )) ( ) = x y g(y) x. y= This formula suggest that the first step is to compute the erivative of g (y) y g(y).
Week 3: Derivatives 3-3 Then, substitute y with f (x) y g(y) y= Finally, multiply it by the erivative of f (x), x. Example: Suppose h(x) = 4x + 1/x. It is a composite of g(y) = y an = 4x + 1/x. Step 1: 1 y = y 2 1. y Step 2: Step 3: ( y) = y y= 1 1. 2 4x + 1/x x h(x) = 1 ( 1 4 1 ). 2 4x + 1/x x 2 10. Derivative of an inverse function If y = is a function with erivative x, then its inverse x = f 1 (y) has erivative: y f 1 (y) = 11. Derivatives of trigonometric functions ( 1 x. x=f (y)) 1 sin(x) = cos(x) x cos(x) = sin(x) x x tan(x) = 1 cos 2 (x) The inverse trigonometric functions have the following erivatives: 12. Notation x arcsin(x) = 1 1 x 2 x arccos(x) = 1 1 x 2 x arctan(x) = 1 1 + x 2 Very often, the first erivative of is enote more succinctly by f (x) = x.
Week 3: Derivatives 3-4 3.2 Rolle s theorem 1. Rolle s theorem essentially states that a ifferentiable function which attains equal values at two istinct points must have a point somewhere between them where the first erivative is zero. 2. If a real-value function f is continuous on a close interval [a, b], ifferentiable on the open interval (a, b), an f(a) = f(b), then there exists a c in the open interval (a, b) such that f (c) = 0. proof of Rolle s theorem: The iea of the proof is to argue that if f(a) = f(b), then f must attain either a maximum or a minimum somewhere between a an b, say at c, an the function must change from increasing to ecreasing (or the other way aroun) at c. In particular, if the erivative exists, it must be zero at c. By assumption, f is continuous on [a, b], an by the extreme value theorem, f attains both its maximum an its minimum in [a, b]. If these are both attaine at the enpoints of [a, b], then f is constant on [a, b] an so the erivative of f is zero at every point in (a, b). Suppose then that the maximum is obtaine at an interior point c of (a, b). We shall examine the above right- an left-han limits separately. For a real h such that c + h is in [a, b], the value f(c + h) is smaller or equal to f(c) because f attains its maximum at c. Therefore, for every h > 0, f(c + h) f(c) h 0, hence where the limit exists by assumption. f f(c + h) f(c) (c+) := lim 0, h 0 + h Similarly, for every h < 0, the inequality turns aroun because the enominator is now negative an we get hence f(c + h) f(c) h 0, f f(c + h) f(c) (c ) = lim 0. h 0 h Finally, when the above right- an left-han limits agree (in particular when f is ifferentiable), then the erivative of f at c must be zero. The logic for the minimum is similar an the proof is complete.
Week 3: Derivatives 3-5 3.3 Mean value theorem 1. The mean value theorem states that if a function is continuous on the close interval [a, b], where a < b, an ifferentiable on the open interval (a, b), then there exists a point c in (a, b) such that f (c) = f(b) f(a) b a. 2. The expression (f(b) f(a))/(b a) gives the slope of the line joining the points (a, f(a)) an (b, f(b)), which is a chor of the graph of f, while f (x) gives the slope of the tangent to the curve at the point (x, ). Thus the mean value theorem says that given any chor of a smooth curve, we can fin a point lying between the en-points of the curve such that the tangent at that point is parallel to the chor. The following proof illustrates this iea. Proof: Define g(x) = rx, where r is a constant. Since f is continuous on [a, b] an ifferentiable on (a, b), the same is true for g. We now want to choose r so that g satisfies the conitions. Namely g(a) = g(b) f(a) ra = f(b) rb r(b a) = f(b) f(a) r = f(b) f(a) b a By Rolle s theorem, since g is continuous an g(a) = g(b), there is some c in (a, b) for which g (c) = 0, an it follows from the equality g(x) = rx that, f (c) = g (c) + r = 0 + r = f(b) f(a) b a as require. 3.4 L Hôpital s rule 1. L Hôpital s rule is an interesting result to eal with the ratios 0/0 an ± / when a certain limit is reache. 2. L Hôpital s rule states that for two functions an g(x), where x R, an a value c R, if either lim = lim g(x) = 0, x c x c
Week 3: Derivatives 3-6 or lim = lim g(x) =, x c x c then there exists a limit to the ratio when x approaches c. Namely, if L is a finite value. lim x c g(x) = lim f (x) x c g (x) = L Proof: Let f an g be functions satisfying the hypotheses. Let I be the open interval in the hypothesis with enpoint c. Consiering that g (x) 0 on this interval an g is continuous, I can be chosen smaller so that g is nonzero on I. For each x in the interval, efine m(x) = inf f (ξ) g (ξ) an M(x) = sup f (ξ) g (ξ), as ξ ranges over all values between x an c. From the ifferentiability of f an g on I, the mean value theorem ensures that for any two istinct points x an y in I there exists a ξ between x an y such that Consequently f(y) g(x) g(y) = f (ξ) g (ξ). m(x) for all choices of istinct x an y in the interval. f(y) g(x) g(y) M(x) Note that the value g(x) g(y) is always nonzero for istinct x an y in the interval, for if it was not, the mean value theorem woul imply the existence of a p between x an y such that g (p) = 0. Case 1: lim x c = lim x c g(x) = 0 For any x in the interval I, an point y between x an c, m(x) f(y) g(x) g(y) = g(x) f(y) g(x) 1 g(y) g(x) M(x), an therefore as y approaches c, f(y) g(y) an become zero, an so g(x) g(x) m(x) g(x) M(x).
Week 3: Derivatives 3-7 Case 2: lim x c g(x) = For any x in the interval I, efine S x = { y y is between x an c }. For any point y between x an c, we have m(x) As y approaches c, both g(y) m(x) lim inf y S x f(y) g(y) g(x) = f(y) g(y) g(y) 1 g(x) g(y) M(x). g(x) an become zero, an therefore g(y) f(y) g(y) lim sup y S x f(y) g(y) M(x). The limit superior an limit inferior are necessary since the existence of the limit of f/g has not yet been establishe. We nee the facts that an an f (x) lim m(x) = lim M(x) = lim x c x c x c g (x) = L ; ( lim lim inf x c y S x lim x c ( lim sup y S x ) f(y) = lim inf g(y) x c g(x) ; ) f(y) = lim sup g(y) x c g(x). In Case 1, the squeeze theorem, establishes that lim exists an is equal to L. x c g(x) In Case 2, the squeeze theorem again asserts that lim inf x c g(x) = lim sup x c g(x) limit lim exists an is equal to L. This is the result that was to be proven. x c g(x) = L, an so the 3. In the case when g(x) iverges to infinity as x approaches c an converges to a finite limit at c, then l Hôpital s rule woul be applicable, but not absolutely necessary, since basic limit calculus will show that the limit of /g(x) as x approaches c must be zero. Example: Fin the limit of sin x lim x 0 x. Apply the l Hôpital s rule by first ifferentiate the numerator an enominator with respect to x to obtain Therefore as x 0, the limit is 1. cos x 1.
Week 3: Derivatives 3-8 3.5 Taylor Expansion 1. A Taylor series is a series expansion of a real function about a point x = a. = f(a) + f (a) 1! = n=0 f (n) (a) n! (x a) + f (a) 2! (x a) n. (x a) 2 + f (3) (a) (x a) 3 + 3! Here, f (n) (a) is a symbol for n x n, x=a which is the value of the n-th erivative of compute at the point a. The erivative of orer zero is efine to be itself an (x a) 0 an 0! are both efine to be 1. 2. In the special case that a = 0, the series is calle the Maclaurin series. 3. Taylor s theorem Let k 1 be an integer an let the function f : R R be k times ifferentiable at the point a R. Then there exists a function h k : R R such that an = f(a) + f (a)(x a) + f (a) 2! Proof: (x a) 2 + + f (k) (a) (x a) k + h k (x)(x a) k, k! lim h k(x) = 0. x a Let P (x) = f(a) + f (a)(x a) + f (a) (x a) 2 + + f (k) (a) (x a) k an 2! k! P (x) h k (x) = (x a) k x a 0 x = a It is sufficient to show that lim h k(x) = 0. x a The proof is base on repeate application of L Hôpital s rule. Note that, for each j = 0, 1,..., k 1, f (j) (a) = P (j) (a). Hence each of the first k 1 erivatives of the numera-
Week 3: Derivatives 3-9 tor in h k (x) vanishes at x = a, an the same is true of the enominator. Therefore, P (x) lim x a (x a) k = lim x a ( ) P (x) x = (x a)k x = lim x a = 1 k! lim f (k 1) (x) P (k 1) (x) x a x a k 1 ( ) P (x) x k 1 k 1 (x a)k xk 1 = 1 k!( f (k) (a) f (k) (a) ) = 0. Here, the secon to last equality follows by the efinition of the erivative at x = a. Example: Example: 1 1 x = 1 1 a + x a (x a)2 + (1 a) 2 (1 a) 3 +. e x = e (1 a + (x a) + 1 2! (x a)2 + 1 ) 3! (x a)3 +. Example: The Taylor expansion of the sine function is For x 0, ivie both sies by x to obtain sin(x) = x x3 3! + x5 5! x7 7! +. sin(x) x = 1 x2 3! + x4 5! x6 7! +. Now, the solutions of sin(x)/x = 0 occur precisely at x = n π where n = ±1, ±2, ±3,.... Let us assume we can express this infinite series as a (normalize) prouct of linear factors given by these solutions, sin(x) x ( = 1 x ) ( 1 + x ) ( 1 x π ) π 2π = (1 (1 x2 π 2 x2 4π 2 ) ( 1 + x 2π ) (1 x2 9π 2 ). ) ( 1 x ) ( 1 + x ) 3π 3π Multiply out this prouct an collect all the x 2 terms, we see that the x 2 coefficient of sin(x)/x is ( 1 π 2 + 1 4π 2 + 1 ) 9π 2 + = 1 1 π 2 n 2. n=1 This must equal 1/3! associate to x 2 in the Taylor expansion of sin(x)/x. 1 6 = 1 π 2 n=1 1 n 2.
Week 3: Derivatives 3-10 Therefore, we obtain n=1 This metho was first publishe by Euler. 1 n 2 = π2 6. 4. The route taken to arrive at the Taylor expansion is Bolzano-Weierstrass Theorem Each boune sequence has a convergent subsequence. Bouneness Theorem A continuous function on a close interval is boune. Extreme value theorem A continuous function on a close interval must attain its maximum an minimum values. Rolle s theorem f (c) = 0 Mean value theorem f f(b) f(a) (c) = b a L Hôpital s rule Taylor s expansion Squeeze theorem 3.6 Extremum 1. Consier a function on an interval. An extremum point c is a point in the omain for which at least f (c) = 0. 2. We also say that x = c is a critical point of the function if f(c) exists an f (c) = 0. 3. We say that has an absolute or global maximum at x = c if f(c) for every x in the omain. 4. We say that has an absolute or global minimum at x = c if f(c) for every x in the omain. 5. We say that has an relative or local maximum at x = c if f(c) for every x in some open interval aroun c.
Week 3: Derivatives 3-11 6. We say that has an relative or local minimum at x = c if f(c) for every x in some open interval aroun c. 7. The maximum an minimum in the extrem value theorem are global. 8. Fermat s theorem If has a relative extremum (maximum or minimum) at x = c an f (c) exists, then x = c is a critical point of. More precisely, let f : (a, b) R be a function an suppose that c (a, b) is a local extremum of f. If f is ifferentiable at c then f (c) = 0. Conversely, if f is ifferentiable at c (a, b), an f (c) 0, then c is not an extremum of f. Proof: Suppose that c is a local maximum (a similar proof applies if c is a local minimum). Then there exists δ > 0 such that ( c δ, c + δ ) (a, b) an such that we have f(c) x with x c < δ. Hence for any h (0, δ), f(c + h) f(c) h 0. Since the limit of this ratio as h gets close to 0 from above exists an is equal to f (c) we conclue that f (c) 0. On the other han for h ( δ, 0) we notice that f(c + h) f(c) h 0 ; but again the limit as h gets close to 0 from below exists an is equal to f (c) so we also have f (c) 0. Hence we conclue that f (c) = 0. 3.7 First-orer conition 1. At the maximum an minimum of, the graient is zero, i.e., f (x) = 0. By Rolle s theorem an Fermat s theorem, solving f (x) = 0, which is the so-calle first-orer conition, results in an x at which f ( x ) is the maximum or minimum value. 2. As an application, consier the utility function where λ is a constant such that λ < 2. U(w) = wλ 1 λ,
Week 3: Derivatives 3-12 3. Intuitively, a utility function inicates the amount of satisfaction erive from the wealth w. 4. An investor has a current wealth of $100 an may choose to invest any part of it in a risky asset. Let α be the amount investe in the risky asset. The left over amount of 100 α is kept at cash. 5. If the investment goes well an assuming 20% return, the wealth will become w = 1.2α + (100 α) = 100 + 0.2α. 6. If the investment oes not go well, an assuming 10% loss, the wealth will become w = 0.9α + (100 α). 7. Suppose the goo an ba outcomes are equally likely to happen, then we can efine a function f(α) as follows: f(α) = 1 2 U( 100 + 0.2α ) + 1 2 U( 100 0.1α ) It is an equal combination of the utility from goo outcome, an the utility from ba outcome. 8. Using the explicit functional form of the utility function, we have f(α) = 1 ( ) λ 100 + 0.2α 1 + 1 ( ) λ 100 0.1α 1. 2 λ 2 λ 9. What shoul α be in orer to maximize f(α)? Applying the above theorems, we fin the first-orer conition f (α) = 1 ( 0.2λ(100 + 0.2α) λ 1 0.1λ(100 0.1α) λ 1) = 0. 2λ 10. To solve this equation, we rearrange the terms to obtain 0.2 ( 100 + 0.2α ) λ 1 = 0.1 ( 100 0.1α ) λ 1. 11. With λ < 1, we rewrite the equation further as ( ) 100 + 0.2α 1 λ = 2. 100 01α 12. Working through a few steps leas to an optimal amount that maximizes the equally weighte utility of wealth as follows: α = 100( 2 1/(1 λ) 1 ) 0.2 + 0.1 2 1/(1 λ). 13. How can we tell f ( α ) is a maximum an not a minimum?
Week 3: Derivatives 3-13 3.8 Secon erivative test 1. Suppose that x = c is a critical point of f (c) such that f (c) = 0 an the secon erivative f (x) is continuous an in a region aroun x = c. Then (a) If f (c) < 0, then x = c is a local maximum. (b) If f (c) > 0, then x = c is a local minimum. Proof of (a): Since f (x) is continuous in a region aroun c, we can further assume that f (c) < 0 is some open region, say (a, b) aroun x = c, i.e., a < c < b. Let x be any number such that a < x < c. Apply the mean value theorem on f (x) taking value in the interval [x, c], which shows that there is a number x < < c such that f (c) f (x) = f ()(c x). In a < x < < c, given that f (x) < 0 an c x > 0 we have f (c) f (x) < 0. With f (c) = 0, it follows that f (x) > 0. In other wors, to the left of x = c, the function is increasing. Next, we consier x to the right of c, namely, c < x < b. From the mean value theorem on [c, x] an the first erivative, there is a number c < < x such that f (x) f (c) = f ()(x c). Now c < < x < b. Since f () < 0 an x c > 0, we gather that f (x) f (c) < 0. In conjunction with f (c) = 0, we conclue that f (x) < 0. Therefore, to the right of x = c, the function is ecreasing. Combing these two finings, we have an increasing from the left of c an a ecreasing to the right of c. This can only mean that x = c is a relative maximum.
Week 3: Derivatives 3-14 2. The secon erivative in the previous example is f (α) = 0.1(λ 1) (0.2 ( 100 + 0.2α ) λ 2 ( ) ) λ 2 + 0.05 100 0.1α. 3. At α = α, f (α) < 0. This is because with λ 3, we have α < 100 an the term 0.2 ( 100 + 0.2α ) λ 2 ( ) λ 2 + 0.05 100 0.1α > 0. Since λ 1 is negative, it follows that f ( α) is negative. Therefore, f( α) is a maximum. 4. When f (x) 0 for all x in the omain, then is a concave function. Conversely, when f (x) 0, then is a convex function. 3.9 Exercises A. Fin the respective first erivative of (a) = ln(x 2 ) (b) = (x + 1) exp(x) ( ) (c) = exp x2 + x 2 () = x1 n 1, where n is a non-negative constant. 1 n (e) = cos(x) sin(x) (f) = tan(1 + x) (g) = exp(x) arccos(x) (h) = arctan 2 (x) (i) = exp(x) sin ( exp(x) ) (j) = 2 1 + 4x 2 B. Fin the respective limit of 1 cos x (a) lim x 0 x c 1 x 1 (b) lim, where c is a constant. x 1 1 x C. Obtain the Taylor expansion of the following function f : R R with respect to a point a R. (a) = ln(1 x) (b) exp (µx + 12 ) σ2 x 2 D. Prove the secon statement (b) in the secon erivative test.