4. Calculus I: Differentiation If the tangent is unique then the gradient of the curve at A is defined to be the gradient of the tangent to the curve at A. 4.1 The derivative of a function Suppose we are given a curve with a point A lying on it. If the curve is ‘smooth’ at A then we can find a unique tangent to the curve at A: a b c Consider the chord AB. As B gets closer to A, the gradient of the chord gets closer to the gradient of the tangent at A. A A The process of finding the general gradient function for a curve is called differentiation. A B A Here the curve in (a) is smooth at A, but the curves in (b) and (c) are not. Autumn 2007 MA1601 Week 4 Anton Cox (City University) 1 / 37 δy (x,y) 2 / 37 Example 4.1.1: Take f (x) = c, a constant function. (x+δx,y+δy) For y = f (x), the gradient function is defined by δy f (x + δx) − f (x) lim = lim . δx δx→0 δx δx→0 Autumn 2007 MA1601 Week 4 Anton Cox (City University) δx At every x the gradient is 0, so f 0 (x) = 0 for all x. Or f (x + δx) − f (x) c−c = = 0. δx δx Example 4.1.2: Take f (x) = ax. 0 We denote the gradient function by dy dx or f (x), and call it the derivative of f . This is not the formal definition of the derivative, as we have not explained exactly what we mean by the limit as δx → 0. But this intuitive definition will be sufficient for the basic functions which we consider. Anton Cox (City University) MA1601 Week 4 Autumn 2007 3 / 37 Example 4.1.3: Take f (x) = x 2 . At every x the gradient is a, so f 0 (x) = a for all x. Or f (x + δx) − f (x) a(x + δx) − ax aδx = = = a. δx δx δx Anton Cox (City University) δx)2 − δx x 2 + 2xδx + (δx)2 − x 2 = δx δx(2x + δx) = = 2x + δx. δx = (x + = The limit as δx tends to 0 is − x12 , so f 0 (x) = − x12 . MA1601 Week 4 Autumn 2007 5 / 37 Example 4.1.5: Take f (x) = x n with n ∈ N and n > 1. Anton Cox (City University) MA1601 Week 4 Autumn 2007 6 / 37 Autumn 2007 8 / 37 Example 4.1.6: f (x) = sin x. Recall that n 4 / 37 1 1 1 − δx x + δx x x − (x + δx) = (δx)(x + δx)x −δx −1 = = . (δx)(x + δx)x (x + δx)x f (x + δx) − f (x) δx x2 The limit as δx tends to 0 is 2x, so f 0 (x) = 2x. Anton Cox (City University) Autumn 2007 Example 4.1.4: Take f (x) = x1 . Now we need to consider the second formulation, as we cannot simply read the gradient off from the graph. f (x + δx) − f (x) δx MA1601 Week 4 We use the identity for sin A + sin B. n a − b = (a − b)(a n−1 +a n−2 b+a n−3 2 b + ··· + b n−1 ) f (x + δx) − f (x) = 2 sin and so an − b n = an−1 + an−2 b + an−3 b2 + · · · + bn−1 a−b where the sum has n terms. As a → b we have n a − bn = lim (an−1 + an−2 b + an−3 b2 + · · · + bn−1 ) = nbn−1 . lim a−b a→b a→b and so θ→0 and so f 0 (x) = lim Hence f 0 (x) = nx n−1 . MA1601 Week 4 Autumn 2007 7 / 37 δx cos x + 2 We need the following fact (which we will not prove here): δx→0 Anton Cox (City University) sin δx f (x + δx) − f (x) δx 2 = cos x + . δx δx 2 2 lim If a = x + δx and b = x then n f (x + δx) − f (x) a − bn lim = lim = nbn−1 = nx n−1 . δx a−b δx→0 a→b δx 2 Anton Cox (City University) sin δx 2 δx 2 sin θ =1 θ δx cos x + = cos(x). 2 MA1601 Week 4 4.2 Differentiation of compound functions Some standard derivatives, which must be memorised: Once we know a few basic derivatives, we can determine many others using the following rules: Let u(x) and v (x) be functions of x, and a and b be constants. f 0 (x) —— kx k −1 ex f (x) —— xk ex ln x sin x cos x tan x cosec x sec x cot x Function ———— au ± bv uv 1 x cos x − sin x sec2 x − cosec x cot x sec x tan x − cosec2 x Sum and difference Product Autumn 2007 MA1601 Week 4 Anton Cox (City University) v du −u dv dx dx v2 du dz . dz dx u v Quotient Composite Some of these results can be derived from the results in the following sections, or from first principles. However it is much more efficient to know them. Derivative ————— dv a du dx ± b dx dv v du + u dx dx u(v (x)) where z = v (x). The final rule above is known as the chain rule and has the following special case u(ax + b) a du dx (ax + b) For example, the derivative of sin(ax + b) is a cos(ax + b). 9 / 37 MA1601 Week 4 Anton Cox (City University) Autumn 2007 10 / 37 Autumn 2007 12 / 37 Example 4.2.1: Differentiate y = 2x 5 − 3x 3 + Example 4.2.3: Differentiate 4 . x2 y = x 2 ln(x + 3). dy 8 = 10x 4 − 9x 2 − 3 . dx x dy x2 = 2x ln(x + 3) + . dx x +3 Example 4.2.2: Differentiate Example 4.2.4: Differentiate y = e5x . x2 − 1 y= 2 . x +1 Set z = 5x, then dy dy dz = = ez 5 = 5e5x . dx dz dx dy (x 2 + 1)2x − (x 2 − 1)2x 4x = = 2 . dx (x 2 + 1)2 (x + 1)2 Anton Cox (City University) MA1601 Week 4 Autumn 2007 11 / 37 Anton Cox (City University) Example 4.2.7: y = cosec x = Example 4.2.5: Differentiate y = 4 sin(2x + 3). dy dy dz = = 4 cos(z)2 = 8 cos(2x + 3). dx dz dx Example√4.2.8: y = ln(x + u = x + x 2 + 1. As we have already noted, some of the standard derivatives can be deduced from the others. x 2 + 1), i.e. y = ln u where du (x 2 + 1)− 2 =1+ .2x dx 2 and so sin x . cos x dy cos x cos x − sin x(− sin x) cos2 x + sin2 x 1 = = = = sec2 x. dx cos2 x cos2 x cos2 x MA1601 Week 4 √ 1 dy 1 du = dx u dx Example 4.2.6: Differentiate Anton Cox (City University) 1 sin x . dy sin x.(0) − 1. cos x − cos x = = = − cosec x cot x. dx sin2 x sin2 x Set z = 2x + 3, then y = tan x = MA1601 Week 4 Autumn 2007 13 / 37 dy 1 √ = dx x + x2 + 1 1+ √ = Anton Cox (City University) x x2 +1 1 √ x + x2 + 1 √ x2 + 1 + x √ x2 + 1 MA1601 Week 4 ! =√ 1 x2 + 1 Autumn 2007 . 14 / 37 Example 4.3.1: y = ln(1 + x 2 ). Let z = Example 4.2.9: y = x x . dy dx = 2x . 1+x 2 d2 y dz (1 + x 2 ).2 − 2x(2x) 2(1 − x 2 ) = = = . dx dx 2 (1 + x 2 )2 (1 + x 2 )2 We have y = (eln x )x = e(x ln x) , i.e. y = eu where u = x ln x. du dy = eu = ex ln x (ln(x) + 1) = x x (ln(x) + 1). dx dx Example 4.3.2: Show that y = e−x sin(2x) satisfies 4.3 Higher derivatives d2 y dy +2 + 5y = 0. dx dx 2 The derivative dy dx is itself a function, so we can consider its derivative. If y = f (x) then we denote the second derivative, i.e. the derivative of dy d2 y 00 dx with respect to x, by dx 2 or f (x). We can also calculate the higher dy = −e−x sin 2x + 2e−x cos 2x = e−x (2 cos 2x − sin 2x) dx derivatives dn y dx n or f (n) (x). Anton Cox (City University) d2 y = −e−x (2 cos 2x − sin 2x) + e−x (−4 sin 2x − 2 cos 2x) dx 2 = e−x (−3 sin 2x − 4 cos 2x). MA1601 Week 4 Autumn 2007 15 / 37 Anton Cox (City University) MA1601 Week 4 Autumn 2007 16 / 37 Writing s for sin 2x and c for cos 2x we have Now y 00 + 2y 0 + 5y = e−x (−3s − 4c − 2s + 4c + 5s) = 0. 4 9 dy = − dx (1 + x)3 (1 + 3x)2 d2 y −12 54 = + dx 2 (1 + x)4 (1 + 3x)3 Example 4.3.3: Evaluate d3 dx 3 3x 2 1+ (1 + x)2 (1 + 3x) 54 × 9 d3 y 48 − = (1 + x)5 (1 + 3x)4 dx 3 at x = 0. and substituting x = 0 we obtain that We could use the quotient rule, but this will get complicated. Instead we use partial fractions. y= d3 y (0) = 48 − 486 = −438. dx 3 1 + 3x 2 A B C = + + . 1+x (1 + x)2 (1 + 3x) (1 + x)2 1 + 3x We obtain (check!) A = 0, B = −2, and C = 3. MA1601 Week 4 Anton Cox (City University) Autumn 2007 17 / 37 Generally it is hard to give a simple formula for the nth derivative of a function. However, in some cases it is possible. The following can be proved by induction. and y 0 = a cos(ax) y 00 = −a2 sin(ax) y 000 = −a3 cos(ax) y (iv ) = a4 sin(ax) d2 y = a2 eax . dx 2 We can show that We can show that MA1601 Week 4 Autumn 2007 19 / 37 18 / 37 Autumn 2007 20 / 37 = a sin(ax + π2 ) = a2 sin(ax + π) = a3 sin(ax + 3π 2 ) = a4 sin(ax + 2π). dn y nπ = an sin(ax + ). dx n 2 dn y = an eax . dx n Anton Cox (City University) Autumn 2007 Example 4.3.5: y = sin(ax). Example 4.3.4: y = eax . dy = aeax dx MA1601 Week 4 Anton Cox (City University) Anton Cox (City University) MA1601 Week 4 Sometimes it is useful to use the Leibnitz rule, which gives a formula for the nth derivative of a product of functions. 4.4 Differentiating implicit functions dn dn n−2 n−1 d d2 n d n d (f ) (g)+ (f ) (g)+· · · (fg) = n (f )g + n n−1 dx dx 1 dx dx 2 dx n−2 dx 2 n−1 n dn d d ··· + (f ) n−1 (g) + f n (g). dx n − 1 dx dx Sometimes we cannot rearrange a function into the form y = f (x), or we may wish to consider the original form anyway (for example, because it is simpler). However, we may still wish to differentiate with respect to x. Given a function g(y ) we have from the chain rule So for example d d dy (g(y )) = (g(y )) . dx dy dx d3 d3 d2 d d d2 d3 (fg) = 3 (f )g + 3 2 (f ) (g) + 3 (f ) 2 (g) + f 3 (g). dx dx dx 3 dx dx dx dx As can be seen, this is very similar to the binomial theorem, and can also be proved by induction (using the product rule). Anton Cox (City University) MA1601 Week 4 Autumn 2007 21 / 37 Example 4.4.1: x 2 + 3xy 2 − y 4 = 2. Anton Cox (City University) Example 4.4.2: d d 2 (x + 3xy 2 − y 4 ) = (2) = 0. dx dx 2 x2 MA1601 Week 4 + 3 y2 Autumn 2007 24 / 37 = 12 . Therefore we have d 4 d (3xy 2 ) − (y ) = 0 dx dx d dy 2x + 3y 2 + 3x (y 2 ) − 4y 3 =0 dx dx dy 2 3 dy 2x + 3y + 6xy − 4y = 0. dx dx 2x + MA1601 Week 4 22 / 37 d 2 3 d 1 ( + )= ( ) = 0. dx x 2 y 2 dx 2 Therefore we have Anton Cox (City University) Autumn 2007 − Autumn 2007 23 / 37 Anton Cox (City University) d 4 3 + =0 x 3 dx y 2 4 6 dy − 3− 3 = 0. x y dx MA1601 Week 4 4.5 Differentiating parametric equations To differentiate a parametric equation in the variable t we use Sometimes there is no easy way to express the relationship between x and y directly in a single equation. In such cases it may be possible to express the relationship between them by writing each in terms of a third variable. We call such equations parametric equations as both x and y depend on a common parameter. Example 4.5.1: x = t 3 dy dt dy = dx dt dx dy = 2t − 4 dt Although we can write this in the form and so 1 y = x 3 − 4x 3 + 2 Autumn 2007 MA1601 Week 4 25 / 37 dx = 3t 2 dt dy 2t − 4 = . dx 3t 2 the parametric version is easier to work with. Anton Cox (City University) dt 1 = dx . dx dt Example 4.5.1: (Continued.) y = t 2 − 4t + 2. 2 and Anton Cox (City University) MA1601 Week 4 Autumn 2007 26 / 37 Example 4.5.2: Find the second derivative with respect to x of x = sin θ We have y = cos 2θ. dx = cos θ dθ Therefore Note: The rules so far may suggest that derivatives can be treated just like fractions. However d2 y d2 y d2 t 6= 2 2 dx 2 dt dx in general. Moreover 2 −1 d2 y d x 6= . 2 dx dy 2 dy = −2 sin 2θ. dθ dy −2 sin 2θ = = −4 sin θ. dx cos θ Now d2 y d = dx dx 2 dy dx = d d dθ −4 cos θ (−4 sin θ) = (−4 sin θ) = = −4. dx dθ dx cos θ Anton Cox (City University) MA1601 Week 4 Autumn 2007 27 / 37 4.6 Tangents and normals to curves We have already defined the value of the derivative f 0 of a function f at a point x0 to be the gradient of f at x0 . Thus we can easily use the derivative to write down the equation of the tangent to that point. Using the equation for a line passing through (x0 , f (x0 )) we have that the tangent to f at x0 is dy y − f (x0 ) = (x0 )(x − x0 ). dx −1 dy dx (x0 ) MA1601 Week 4 Autumn 2007 28 / 37 Example 4.6.1: Find the equation of the tangent and normal to the curve y = x 2 − 6x + 5 at the point (2, −3). We have and hence dy = 2x − 6 dx dy dx (2) = 4 − 6 = −2. Hence the equation of the tangent is y + 3 = −2(x − 2) i.e. y = −2x + 1. The normal to f at x0 is the line passing through (x0 , f (x0 )) perpendicular to the tangent. This has equation y − f (x0 ) = Anton Cox (City University) 1 The gradient of the normal is −1 −2 = 2 , and hence the equation of the normal is x 1 y + 3 = (x − 2) i.e. y = − 4. 2 2 (x − x0 ) (when this makes sense). Anton Cox (City University) MA1601 Week 4 Autumn 2007 29 / 37 Anton Cox (City University) MA1601 Week 4 Autumn 2007 30 / 37 4.7 Stationary points and points of inflexion If f 0 (x) > 0 for a < x < b then f is increasing on a < x < b We can tell a lot about a function from its derivatives. Example 4.7.1: e.g. arcs PQ, SU, UV. Q V If f 0 (x) < 0 for a < x < b then f is decreasing on a < x < b U P R e.g. arc QS. T S Anton Cox (City University) MA1601 Week 4 Autumn 2007 31 / 37 Anton Cox (City University) MA1601 Week 4 Autumn 2007 32 / 37 A point of inflexion is one where f 00 (x0 ) = 0 and f 00 changes sign at x0 . A stationary point on a curve y = f (x) is a point (x0 , f (x0 )) such that f 0 (x0 ) = 0. These come in various forms: Type e.g. R, T, U. Test f 0 (x) f 00 (x) Changes from + to − Changes from − to + No sign change Local maximum Local minimum Point of inflexion If f 00 (x) > 0 for a < x < b then f is concave up on a < x < b −ve +ve (see below) e.g. arc RST. If f 00 (x) < 0 for a < x < b then f is concave down on a < x < b e.g. Q is a max, S is a min, U is a point of inflexion. e.g. arc PQR. Autumn 2007 MA1601 Week 4 Anton Cox (City University) 33 / 37 Note that the maxima and minima above are only local. This means that in a small region about the given point they are extremal values, but perhaps not over the whole curve. Extremal values for the whole curve are called global maxima or minima. 34 / 37 y = 3x 4 + 8x 3 − 6x 2 − 24x + 2. We have Y C dy = 12x 3 + 24x 2 − 12x − 24 dx and D B Autumn 2007 Example 4.7.3: Find the stationary values and points of inflexion of Example 4.7.2: Consider the function f on the domain X ≤ x ≤ Y given by the graph A MA1601 Week 4 Anton Cox (City University) Stationary points when X d2 y = 36x 2 + 48x − 12. dx 2 dy dx = 0, i.e. (check) x = 1, −1, −2. Both A and C are local maxima, and B and D are local minima. However the global maximum is at Y and the global minimum at X. Anton Cox (City University) MA1601 Week 4 Autumn 2007 35 / 37 y0 y 00 −0+ 72 Min +0− −24 Max −0+ 36 Min √ 1 Points of inflexion at x = 3 (−2 ± 7), i.e. (x, y ) ≈ (0.22, −3.36) and (x, y ) ≈ (−1.55, 12.32). (1, −17) (−1, 15) (−2, 10) −2 Anton Cox (City University) −1 1 MA1601 Week 4 Autumn 2007 37 / 37 Anton Cox (City University) MA1601 Week 4 Autumn 2007 36 / 37