Intermediate Mathematics Introduction to Partial Differentiation R Horan & M Lavelle The aim of this document is to provide a short, self assessment programme for students who wish to acquire a basic understanding of partial differentiation. Copyright c 2004 rhoran@plymouth.ac.uk , mlavelle@plymouth.ac.uk Last Revision Date: May 25, 2005 Version 1.0 Table of Contents 1. 2. 3. 4. Partial Differentiation (Introduction) The Rules of Partial Differentiation Higher Order Partial Derivatives Quiz on Partial Derivatives Solutions to Exercises Solutions to Quizzes The full range of these packages and some instructions, should they be required, can be obtained from our web page Mathematics Support Materials. Section 1: Partial Differentiation (Introduction) 3 1. Partial Differentiation (Introduction) In the package on introductory differentiation, rates of change of functions were shown to be measured by the derivative. Many applications require functions with more than one variable: the ideal gas law, for example, is pV = kT where p is the pressure, V the volume, T the absolute temperature of the gas, and k is a constant. Rearranging this equation as kT p= V shows that p is a function of T and V . If one of the variables, say T , is kept fixed and V changes, then the derivative of p with respect to V measures the rate of change of pressure with respect to volume. In this case, it is called the partial derivative of p with respect to V and written as ∂p . ∂V Section 1: Partial Differentiation (Introduction) kT , find the partial derivatives of p: V (a) with respect to T , (b) with respect to V . Example 1 If p = Solution (a) This part of the example proceeds as follows: kT , V ∂p k ∴ = , ∂T V where V is treated as a constant for this calculation. (b) For this part, T is treated as a constant. Thus 1 p = kT = kT V −1 , V ∂p kT ∴ = −kT V −2 = − 2 . ∂V V p = 4 Section 1: Partial Differentiation (Introduction) 5 The symbol ∂ is used whenever a function with more than one variable is being differentiated but the techniques of partial differentiation are exactly the same as for (ordinary) differentiation. ∂z ∂z Example 2 Find and for the function z = x2 y 3 . ∂x ∂y Solution z = x2 y 3 For the first part y 3 is treated as ∂z a constant and the derivative of ∴ = 2xy 3 , ∂x x2 with respect to x is 2x. ∂z For the second part x2 is treated and = x2 3y 2 , ∂y as a constant and the derivative 2 2 of y 3 with respect to y is 3y 2 . = 3x y . ∂z ∂z and for each of the following functions. ∂x ∂y (Click on the green letters for solutions.) 1 (a) z = x2 y 4 , (b) z = (x4 + x2 )y 3 , (c) z = y 2 sin(x). Exercise 1. Find Section 2: The Rules of Partial Differentiation 6 2. The Rules of Partial Differentiation Since partial differentiation is essentially the same as ordinary differentiation, the product, quotient and chain rules may be applied. ∂z Example 3 Find for each of the following functions. ∂x x−y (a) z = xy cos(xy) , (b) z = , (c) z = (3x + y)2 . x+y Solution (a) Here z = uv, where u = xy and v = cos(xy) so the product rule applies (see the package on the Product and Quotient Rules). u ∂u ∴ ∂x Thus = xy and = y and v ∂v ∂x = cos(xy) = −y sin(xy) . ∂z ∂u ∂v = v+u = y cos(xy) − xy 2 sin(xy) . ∂x ∂x ∂x Section 2: The Rules of Partial Differentiation 7 (b) Here z = u/v, where u = x − y and v = x + y so the quotient rule applies (see the package on the Product and Quotient Rules). u ∂u ∴ ∂x Thus ∂z ∂x = x−y and = 1 and v ∂v ∂x = x+y = 1. ∂u ∂v −u ∂x ∂x v2 (x + y) − (x − y) 2y = . (x + y)2 (x + y)2 v = = (c) In this case z = (3x + y)2 so z = u2 where u = 3x + y, and the chain rule applies (see the package on the Chain Rule). z = u2 and u = 3x + y ∂z ∂u ∴ = 2u and = 3. ∂u ∂x Thus ∂z ∂z ∂u = = 2(3x + y)3 = 6(3x + y) . ∂x ∂u ∂x Section 2: The Rules of Partial Differentiation 8 ∂z ∂z and for each of the following functions. ∂x ∂y (Click on the green letters for solutions.) Exercise 2. Find (a) z = (x2 +3x) sin(y), (d) z = sin(x) cos(xy), (b) z = cos(x) , y5 2 (e) z = e(x +y 2 ) , (c) z = ln(xy), (f) z = sin(x2 + y). Quiz If z = cos(xy), which of the following statements is true? (a) ∂z ∂z = , ∂x ∂y (b) ∂z 1 ∂z = , ∂x x ∂y (c) 1 ∂z ∂z = , y ∂x ∂y (d) 1 ∂z 1 ∂z = . y ∂x x ∂y Section 3: Higher Order Partial Derivatives 9 3. Higher Order Partial Derivatives Derivatives of order two and higher were introduced in the package on Maxima and Minima. Finding higher order derivatives of functions of more than one variable is similar to ordinary differentiation. ∂2z 3 2 Example 4 Find if z = e(x +y ) . ∂x2 Solution First differentiate z with respect to x, keeping y constant, then differentiate this function with respect to x, again keeping y 3 2 constant. z = e(x +y ) 3 2 ∂z ∴ = 3x2 e(x +y ) using the chain rule ∂x (x3 +y 2 ) ∂2z ∂(3x2 ) (x3 +y2 ) ) 2 ∂(e = e + 3x using the product rule ∂x2 ∂x ∂x 2 3 2 3 2 ∂ z = 6xe(x +y ) + 3x2 (3x2 e(x +y ) ) 2 ∂x 3 2 = (9x4 + 6x)e(x +y ) Section 3: Higher Order Partial Derivatives 10 ∂2z ∂2z and , when there are two variables there ∂x2 ∂y 2 is also the possibility of a mixed second order derivative. ∂2z 3 2 Example 5 Find if z = e(x +y ) . ∂x∂y ∂2z ∂ ∂z Solution The symbol is interpreted as ; in words, ∂x∂y ∂x ∂y first differentiate z with respect to y, keeping x constant, then differentiate this function with respect to x, keeping y constant. (It is this differentiation, first with respect to x and then with respect to y, that leads to the name of mixed derivative.) 3 2 ∂z First with x constant = 2ye(x +y ) (using the chain rule.) ∂y ∂2z ∂ (x3 +y2 ) Second with y constant = 2ye ∂x∂y ∂x In addition to both 3 = 3x2 2ye(x 3 = 6x2 ye(x +y 2 ) +y 2 ) . Section 3: Higher Order Partial Derivatives 11 The obvious question now to be answered is: what happens if the order of differentiation is reversed? ∂2z ∂ ∂z 3 2 Example 6 Find = if z = e(x +y ) . ∂y∂x ∂y ∂x Solution 3 2 ∂z First with y constant = 3x2 e(x +y ) (using the chain rule). ∂x ∂2z ∂ 2 (x3 +y2 ) Second with x constant = 3x e ∂y∂x ∂y 3 = 2y3x2 e(x +y 2 ) ∂2z . ∂x∂y As a general rule, when calculating mixed derivatives the order of differentiation may be reversed without affecting the final result. 3 = 6x2 ye(x +y 2 ) = Section 3: Higher Order Partial Derivatives 12 Exercise 3. Confirm the statement on the previous page by finding ∂2z ∂2z both and for each of the following functions, whose first ∂x∂y ∂y∂x order partial derivatives have already been found in exercise 2. (Click on the green letters for solutions.) cos(x) (a) z = (x2 +3x) sin(y), (b) z = , (c) z = ln(xy), y5 2 2 (d) z = sin(x) cos(xy), (e) z = e(x +y ) , (f) z = sin(x2 + y). Notation For first and second order partial derivatives there is a ∂f ∂f compact notation. Thus can be written as fx and as fy . ∂x ∂y ∂2f ∂2f is written fxx while is written fxy . Similarly 2 ∂x ∂x∂y Quiz If z = e−y sin(x), which of the following is zxx + zyy ? (a) e−y sin(x), (b) 0, (c) −e−y sin(x), (d) −e−y cos(x). Section 4: Quiz on Partial Derivatives 13 4. Quiz on Partial Derivatives Choose the correct option for each of the following. Begin Quiz 1. If z = x2 + 3xy + y 3 then (a) 2x + 3y + 3y 2 , (c) 2x + 3x , ∂z is ∂x (b) 2x + 3x + 3y 2 , (d) 2x + 3y . 2. If w = 1/r, where r2 = x2 + y 2 + z 2 , then xwx + ywy + zwz is (a) −1/r , (b) 1/r , r x 3. If u = then uxx is y (c) −1/r2 , (d) 1/r2 . 1 1 1 1 (a) − p , (b) − p , (c) − p , (d) − p . 3 3 3 3 3 4 y x 4 yx 8 y x 8 yx3 End Quiz Score: Correct Solutions to Exercises 14 Solutions to Exercises Exercise 1(a) To calculate the partial derivative ∂z of the function ∂x z = x2 y 4 , the factor y 4 is treated as a constant: ∂z ∂ ∂ = x2 y 4 = x2 × y 4 = 2x(2−1) × y 4 = 2xy 4 . ∂x ∂x ∂x ∂z Similarly, to find the partial derivative , the factor x2 is treated ∂y as a constant: ∂ ∂z ∂ x2 y 4 = x2 × y 4 = x2 × 4y (4−1) = 4x2 y 3 . = ∂y ∂y ∂y Click on the green square to return Solutions to Exercises 15 ∂z for the function z = (x4 + x2 )y 3 , the ∂x factor y 3 is treated as a constant: ∂z ∂ ∂ = (x4 + x2 )y 3 = x4 + x2 × y 3 = (4x3 + 2x)y 3 . ∂x ∂x ∂x ∂z To find the partial derivative the factor (x4 + x2 ) is treated as a ∂y constant: ∂z ∂ ∂ 3 = (x4 + x2 )y 3 = (x4 + x2 ) × y = 3(x4 + x2 )y 2 . ∂y ∂y ∂y Click on the green square to return Exercise 1(b) To calculate Solutions to Exercises 16 ∂z 1 1 Exercise 1(c) If z = y 2 sin(x) then to calculate the y 2 factor is ∂x kept constant: 1 1 ∂ ∂z ∂ 1 y 2 sin(x) = y 2 × = (sin(x)) = y 2 cos(x) . ∂x ∂x ∂x ∂z Similarly, to evaluate the partial derivative the factor sin(x) is ∂y treated as a constant: ∂ 1 1 1 ∂z ∂ 1 y 2 sin(x) = = y 2 × sin(x) = y − 2 sin(x) . ∂y ∂y ∂y 2 Click on the green square to return Solutions to Exercises 17 Exercise 2(a) The function z = (x2 + 3x) sin(y) can be written as z = uv , where u = (x2 + 3x) and v = sin(y) . The partial derivatives of u and v with respect to the variable x are ∂u ∂v = 2x + 3 , = 0, ∂x ∂x while the partial derivatives with respect to y are ∂u ∂v = 0, = cos(y) . ∂y ∂y Applying the product rule ∂z ∂u ∂v = = (2x + 3) sin(y) . v+u ∂x ∂x ∂x ∂v ∂z ∂u = v+u = (x2 + 3x) cos(y) . ∂y ∂y ∂y Click on the green square to return Solutions to Exercises 18 Exercise 2(b) cos(x) can be written as z = cos(x)y −5 . y5 Treating the factor y −5 as a constant and differentiating with respect to x: The function z = ∂z sin(x) = − sin(x)y −5 = − 5 . ∂x y Treating cos(x) as a constant and differentiating with respect to y: ∂v cos(x) . = cos(x)(−5y −6 ) = −5 ∂y y6 Click on the green square to return Solutions to Exercises 19 Exercise 2(c) The function z = ln(xy) can be rewritten as (see the package on logarithms) z = ln(xy) = ln(x) + ln(y) . Thus the partial derivative of z with respect to x is ∂z ∂ ∂ 1 = (ln(x) + ln(y)) = ln(x) = . ∂x ∂x ∂x x Similarly the partial derivative of z with respect to y is ∂z ∂ 1 ∂ = (ln(x) + ln(y)) = ln(y) = . ∂y ∂y ∂y y Click on the green square to return Solutions to Exercises 20 Exercise 2(d) To calculate the partial derivatives of the function z = sin(x) cos(xy) the product rule has to be applied ∂z ∂x ∂z ∂y ∂ ∂ sin(x) + sin(x) cos(xy) , ∂x ∂x ∂ ∂ = cos(xy) sin(x) + sin(x) cos(xy) . ∂y ∂y = cos(xy) Using the chain rule with u = xy for the partial derivatives of cos(xy) ∂ cos(xy) = ∂x ∂ cos(xy) = ∂y ∂ cos(u) ∂u ∂ cos(u) ∂u ∂u = − sin(u)y = −y sin(xy) , ∂x ∂u = − sin(u)x = −x sin(xy) . ∂y Thus the partial derivatives of z = sin(x) cos(xy) are ∂z = cos(xy) cos(x) − y sin(x) sin(xy) , ∂x Click on the green square to return ∂z = −x sin(x) sin(xy) . ∂y Solutions to Exercises 21 2 Exercise 2(e) To calculate the partial derivatives of z = e(x chain rule has to be applied with u = (x2 + y 2 ): ∂z ∂x ∂z ∂y = = ∂ u (e ) ∂u ∂ u (e ) ∂u +y 2 ) the ∂u ∂u = eu , ∂x ∂x ∂u ∂u = eu . ∂y ∂y The partial derivatives of u = (x2 + y 2 ) are ∂u ∂(x2 ) = = 2x , ∂x ∂x ∂u ∂(y 2 ) = = 2y . ∂y ∂y 2 Therefore the partial derivatives of the function z = e(x 2 2 ∂z ∂u = eu = 2x e(x +y ) , ∂x ∂x 2 2 ∂z u ∂u = e = 2y e(x +y ) . ∂x ∂x Click on the green square to return +y 2 ) are Solutions to Exercises 22 Exercise 2(f ) Applying the chain rule with u = x2 + y the partial derivatives of the function z = sin(x2 + y) can be written as ∂z ∂x ∂z ∂y = = ∂ (sin(u)) ∂u ∂ (sin(u)) ∂u ∂u ∂u , = cos(u) ∂x ∂x ∂u ∂u = cos(u) . ∂y ∂y The partial derivatives of u = x2 + y are ∂u ∂x2 = 2x , = ∂x ∂x ∂u ∂y = 1. = ∂y ∂y Thus the partial derivatives of the function z = sin(x2 + y) are ∂z ∂u = 2x cos(x2 + y) , = cos(u) ∂x ∂x ∂z ∂u = cos(u) = cos(x2 + y) . ∂y ∂y Click on the green square to return Solutions to Exercises 23 Exercise 3(a) From exercise 2(a), the first order partial derivatives of z = (x2 + 3x) sin(y) are ∂z ∂z = (2x + 3) sin(y) , = (x2 + 3x) cos(y) . ∂x ∂y The mixed second order derivatives are ∂2z ∂ ∂z ∂ = = (x2 + 3x) cos(y) = (2x + 3) cos(y) , ∂x∂y ∂x ∂y ∂x ∂2z ∂ ∂z ∂ = = ((2x + 3) sin(y)) = (2x + 3) cos(y) . ∂y∂x ∂y ∂x ∂y Click on the green square to return Solutions to Exercises 24 Exercise 3(b) From exercise 2(b), the first order partial derivatives of z = are ∂z sin(x) ∂z cos(x) =− , = −5 , ∂x y5 ∂y y6 so the mixed second order derivatives are ∂ sin(x) ∂2z ∂ ∂z cos(x) = = =5 6 , −5 ∂x∂y ∂x ∂y ∂x y6 y 2 ∂ z ∂ ∂z ∂ sin(x) sin(x) = = − 5 =5 6 . ∂y∂x ∂y ∂x ∂y y y cos(x) y5 Click on the green square to return Solutions to Exercises 25 Exercise 3(c) From exercise 2(c), the first order partial derivatives of z = ln(xy) are ∂z 1 ∂z 1 = , = . ∂x x ∂y y The mixed second order derivatives are ∂ 1 ∂2z ∂ ∂z = = = 0, ∂x∂y ∂x ∂y ∂x y ∂2z ∂ ∂z ∂ 1 = = = 0. ∂y∂x ∂y ∂x ∂y x Click on the green square to return Solutions to Exercises 26 Exercise 3(d) From exercise 2(d), the first order partial derivatives of z = sin(x) cos(xy) are ∂z ∂z = cos(x) cos(xy) − y sin(x) sin(xy) , = − x sin(x) sin(xy) . ∂x ∂y The mixed second order derivatives are ∂ ∂2z ∂ ∂z = = (−x sin(x) sin(xy)) ∂x∂y ∂x ∂y ∂x = − sin(x) sin(xy) − x cos(x) sin(xy) − xy sin(x) cos(xy) , ∂2z ∂ ∂z ∂ = = (cos(x) cos(xy) − y sin(x) sin(xy)) ∂y∂x ∂y ∂x ∂y = −x cos(x) sin(xy) − sin(x) sin(xy) − xy sin(x) cos(xy) . N.B. In the solution above a product of three functions has been differentiated. This can be done by using two applications of the product rule. Click on the green square to return Solutions to Exercises 27 Exercise 3(e) From exercise 2(e), the first order partial derivatives 2 2 of z = e(x +y ) are 2 2 2 2 ∂z ∂z = 2xe(x +y ) , = 2ye(x +y ) . ∂x ∂y The mixed second order derivatives are thus 2 2 ∂2z ∂ ∂z ∂ (x2 +y2 ) = = 2ye = 4xye(x +y ) , ∂x∂y ∂x ∂y ∂x 2 2 2 2 ∂2z ∂ ∂z ∂ 2xe(x +y ) = 4yxe(x +y ) . = = ∂y∂x ∂y ∂x ∂y Click on the green square to return Solutions to Exercises 28 Exercise 3(f ) From exercise 2(f ), the first order partial derivatives of z = sin(x2 + y) are ∂z ∂z = 2x cos(x2 + y) , = cos(x2 + y) . ∂x ∂y The mixed second order derivatives are thus ∂ ∂2z ∂ ∂z = = cos(x2 + y) = −2x sin(x2 + y) , ∂x∂y ∂x ∂y ∂x ∂2z ∂ ∂z ∂ = = 2x cos(x2 + y) = −2x sin(x2 + y) . ∂y∂x ∂y ∂x ∂y Click on the green square to return Solutions to Quizzes 29 Solutions to Quizzes Solution to Quiz: To determine which of the options is correct, the partial derivatives of z = cos(xy) must be calculated. From the calculations of exercise 2(d) the partial derivatives of z = cos(xy) are ∂ ∂ cos(u) ∂u cos(xy) = = − sin(u)y = −y sin(xy) , ∂x ∂u ∂x ∂ ∂ cos(u) ∂u = − sin(u)x = −x sin(xy) . cos(xy) = ∂y ∂u ∂y Therefore 1 ∂ 1 ∂ cos(xy) = − sin(xy) = cos(xy) . y ∂x x ∂y The other choices, if checked, will be found to be false. End Quiz Solutions to Quizzes 30 Solution to Quiz: The first order derivatives of z = e−y sin(x) are zx = e−y cos(x) , zy = − e−y sin(x) , where e−y is kept constant for the first differentiation and sin(x) for the second. Continuing in this way, the second order derivatives zxx and zyy are given by the expressions ∂ ∂ ∂z zxx = = e−y cos(x) = −e−y sin(x) , ∂x ∂x ∂x ∂ ∂ ∂z zyy = = −e−y sin(x) = e−y sin(x) . ∂y ∂y ∂y Adding these two equations together gives zxx + zyy = 0 . End Quiz