Mathematics for Computing Introduction to Differentiation Conducted by: Thilini Kulaweera MSc (Colombo) | BSc (Kelaniya) Module details Module Name: Mathematics for Computing Module code: IT1105 Enrollment key:- IT1105 Credit Points: 4 Method of delivery: Lectures (2 hours/week) Tutorials: (1 hour/week) 2 Assessment Criteria • Midterm -30% ( 1 Hour paper) • Final Exam – 70 % (3 hours essay-type questions) 3 Differentiating a linear function A straight line has a constant gradient, or in other words, the rate of change of y with respect to x is a constant. Consider the straight-line y = 3x + 2; Above note that y increases as a rate of 3 units, for every unit increase in x. We say that “the rate of change of y with respect to x is 3”. Observe that the gradient of the straight line is the same as the rate of change of y with respect to x. Key Point For a straight line: “the rate of change of y with respect to x is the same as the gradient of the line.” Differentiation from first principles of some simple curves Consider the curve y = x2 Above for different pairs of points we will get different lines, with very different gradients. For a simple function like y = x2 we see that y is not changing constantly with x. The rate of change of y with respect to x is not a constant. Calculating the rate of change at a point Calculating the rate of change at any point on a curve y = f(x) is defined to be the gradient of the tangent drawn at that point as shown below. The rate of change at a point P is defined to be the gradient of the tangent at P. Key Point The gradient of a curve y = f(x) at a given point is defined to be the gradient of the tangent at that point. Consider the figure below which shows a fixed-point P on a curve y=x2. The lines through P and Q approach the tangent at P when Q is very close to P. Calculate the gradient of one of these lines and let the point Q approach the point P along the curve, then the gradient of the line should approach the gradient of the tangent at P, and hence the gradient of the curve. Consider a general point P which has coordinates (x, y). Choose point Q to be close to P on the curve. Because we are considering the graph of y = x2; y δy (x δx) 2 y δy x 2 2 x(x) (x) 2 y x2 ; δy 2 x(x) (x) So the gradient of PQ is; 2 δy 2 x(x) (x) 2 x x δy x(2 x x) x x δy 2 x x x As we let x become zero, we are left with just 2x, and this is the formula for the gradient of the tangent at P. Gradient of tangent = y lim x lim (2 x x) 2 x x 0 x 0 We can do this calculation in the same way for lots of curves. We have a special symbol for the phrase y lim x x 0 This is again written as “dy/dx” and referred to as “derivative of y with respect to x”. Key Point When n is a positive integer; If y = xn then dy n 1 nx dx The result is true when n is a negative integer and when n is a fraction although we will not prove this here. Linearity rules Also, if y = k f(x) then, where k is a constant dy df k dx dx This means that we can differentiate a constant multiple of a function, simply by differentiating the function and multiplying by the constant. Linearity rules If then, y = f(x) ± g(x) dy df dg dx dx dx This means that we can differentiate sums (and differences) of functions, term by term. The Chain Rule The chain rule, exists for differentiating a function of another function. Consider the expression (x4+x2-9)10. We can call such an expression a ‘function of a function’. Suppose, in general, that we have two functions, f(x) and g(x). Then y = f(g(x)) is a function of a function. g(x) = x4+x2-9 and f(x) = x10 f(g(x)) = f(x4+x2-9) = (x4+x2-9)10 Key Point To differentiate y = f(g(x)), let u = g(x). Then y = f(u) and dy dy du dx du dx Exercise Differentiate y = (2x-5)10 Let u = 2x-5 so that y = u10. It follows that dy dy du dx du dx 9 10u 2 20(2 x 5) 9 du 2 dx dy 10u 9 du The Product Rule The product rule: if y = uv then dy dv du u v dx dx dx Exercise Find the derivative of y = (3x – 2x2) (5 +4x). dy d 2 d (3x 2 x ) [5 4 x] (5 4 x) [3x 2 x 2 ] dx dx dx (3 x 2 x 2 )(4) (5 4 x)(3 4 x) (12 x 8 x ) (15 8 x 16 x ) 2 15 4 x 24 x 2 2 The Quotient Rule The quotient rule: if y = u then v du dv v u dy dx dx 2 dx v Exercise Find the derivative of x 1 y 2x 3 d d (2 x 3) [ x 1] ( x 1) (2 x 3) dy dx dx 2 dx (2 x 3) (2x 3)(1) (x 1)(2) 2 (2x 3) 5 2 (2x 3) Higher- order derivatives The derivative of f’ is the second derivative of f and is denoted by f . d [ f ' ( x)] f " ( x) dx The derivative of f is the third derivative of f and is denoted by f . Example f ( x) 2 x 3 x 4 2 f ' ( x) 8 x 3 6 x f ( x) 24 x 6 " 2 f ' " ( x) 48 x f ( 4) ( x) 48 f (5) ( x) 0 Explicit Vs Implicit Explicit is when the function shows us how to go directly from x to y, such as; y = x3 + 3 (That is the classic y = f(x) style) Implicit is when it is not given directly such as; x2 − 3xy + y3 = 0 27 Implicit differentiation Sometimes functions are given not in the form y = f(x) but in a more complicated form in which it is difficult or impossible to express y explicitly in terms of x. Such functions are called implicit functions. Now we look at how we might differentiate functions of y with respect to x. Consider an expression such as; x2 + y2 − 4x + 5y − 8 = 0 It would be quite difficult to re-arrange this so y was given explicitly as a function of x. Key Point d d dy ( f ( y )) ( f ( y )) dx dy dx Remember, every time we want to differentiate a function of y with respect to x, we differentiate with respect to y and then multiply by (dy/dx). Example We differentiate each term with respect to x: rearrange Suppose we want to differentiate the implicit function with respect to x. y 2 x3 y 3 6 3 y d 2 d 3 d 3 d d ( y ) ( x ) ( y ) (6) (3 y ) dx dx dx dx dx d 2 dy d dy d dy ( y ) 3 x 2 ( y 3 ) 0 (3 y ) dy dx dy dx dy dx dy dy 2 2 dy 2 y 3x 3 y 3 dx dx dx dy dy dy 3x 2 3 y 2 2y 3 dx dx dx dy 3 x 2 (3 y 2 2 y 3) dx dy 3x 2 dx (3 y 2 2 y 3) Relationship of Exponential and Logarithmic “The natural Logarithmic function and the natural exponential function are inverses of each other.” Since the exponential function is the inverse of logarithmic function; Domain of the exponential function = Range of the logarithmic function = Set of all real numbers Range of the exponential function = Domain of the logarithmic function = (0,+∞) Properties of Exponents Let a and b be positive numbers 1. 𝑎0 = 1 2. 𝑎 𝑥 𝑎 𝑦 = 𝑎 𝑥+𝑦 3. 𝑎𝑥 𝑎𝑦 =𝑎 𝑥−𝑦 4. (𝑎 𝑥 )𝑦 = 𝑎 𝑥𝑦 5. (𝑎𝑏)𝑥 = 𝑎 𝑥 𝑏 𝑥 6. 𝑎 𝑥 𝑏 7. 𝑎 −𝑥 = = 𝑎𝑥 𝑏𝑥 1 𝑎𝑥 Properties of Logarithms Let U and V be real positive numbers: 1. ln 1 = 0 2. ln 𝑈𝑉 = ln 𝑈 + ln 𝑉 3. ln 𝑈 𝑉 = ln 𝑈 − ln 𝑉 4. ln 𝑈 𝑥 = 𝑥. 𝑙𝑛 𝑈 5. ln 𝑒 𝑥 = 𝑥 6. 𝑒 ln 𝑥 = 𝑥, 𝑥 > 0 7. ln 𝑈 = ln 𝑉 𝑖𝑠 equivalent 𝑡𝑜 𝑈 = 𝑉 Task 1 Expand the Logarithmic expression given (Assume x > 0 and y> 0): 1. 10 ln 9 2. ln 𝑥 2 + 1 3. 𝑥𝑦 ln 5 4. 𝑥2 ln 3 6𝑦 Task 2 Condense the Logarithmic expressions given: 1. 3 ln 𝑈 − ln(𝑈𝑉)3 +3 ln(𝑈𝑉) 2. ln 𝑈 2 − 𝑉 2 − ln 𝑈 − 𝑉 − ln(𝑈 + 𝑉) Task 3 Solve the following equations for the variable. 1. 𝑒 𝑥 = 5 2. 10 + 3𝑒 0.1𝑡 = 14 3. ln 𝑥 = 5 4. 3 + 2 ln 𝑥 2 = 7 Derivatives of Natural Exponential Functions If 𝑦 = 𝑒 𝑥 , 𝑑(𝑒 𝑥 ) 𝑑𝑥 = 𝑒𝑥 If 𝑦 = 𝑒 𝑓(𝑥) , 𝑑(𝑒 𝑓 𝑥 ) 𝑑𝑥 = 𝑒𝑓 𝑥 .𝑓′(𝑥) These are rules that we need to remember - don't worry about where they come from. Example 1: Find the derivative of 𝑦 = 𝑒 5𝑥 2 . We let f 𝑥 = 5𝑥 2 . Then 𝑓 ′ 𝑥 = 10𝑥, and 2 𝑑(𝑒 5𝑥 ) 𝑑𝑥 = 10𝑥𝑒 5𝑥 2 Now it’s your turn! Differentiate the given exponential functions. 1. 𝑓 𝑥 = 𝑒 3𝑥 2. 𝑓 𝑥 = 𝑒 6−𝑥 3. 𝑓 𝑥 = 𝑒 −𝑥 4. 𝑦 = −3𝑒 −3𝑥 5. 𝑦 = 𝑥𝑒 𝑥 𝑒𝑥 𝑥 6. 𝑓 𝑥 = 7. 𝑓 𝑥 = 𝑥𝑒 𝑥 − 𝑒 𝑥 1 𝑥2 +2𝑥−1 8. 𝑓 𝑥 = −3𝑒 Derivatives of Natural Logarithmic Function If 𝑦 = ln 𝑥, 𝑑 ln 𝑥 𝑑𝑥 = 1 𝑥 = 1 𝑓(𝑥) If 𝑦 = ln 𝑓(𝑥), 𝑑(ln 𝑓(𝑥)) 𝑑𝑥 × 𝑓′(𝑥) Example 2: Find the derivative of the function 𝑦 = ln(6𝑥 + 3). Let 𝑓 𝑥 = 6𝑥 + 3.Then 𝑓 ′ 𝑥 = 6 so that, 𝑑(ln(6𝑥+3)) 6 = 𝑑𝑥 6𝑥+3 Now it’s your turn! Differentiate the given logarithmic functions. 1. 𝑓 𝑥 = ln 2𝑥 2. 𝑓 𝑥 = ln(2𝑥 2 + 4) 3. 𝑦 = 𝑥𝑙𝑛 𝑥 4. 𝑦 = ln 𝑥 + 1 5. 𝑓 𝑥 = ln 𝑥(𝑥 2 +1)2 2𝑥 3 +1 Thank You !!