WEBVTT 1 00:00:00.000 --> 00:00:06.640 Well hello everyone and welcome to our first class on partial differentiation. 2 00:00:06.640 --> 00:00:13.200 We'll have two classes and the first class will include the following topics. 3 00:00:13.200 --> 00:00:19.840 First of all we'll start off with a brief review, brief reminder of differentiation of a function 4 00:00:19.840 --> 00:00:29.120 of one variable. We'll then look at defining a function of two variables and look at partial 5 00:00:29.120 --> 00:00:34.160 derivatives of a function of two variables. We'll look at the geometrical interpretation 6 00:00:34.160 --> 00:00:40.240 and the notation that's used. We'll then work on some examples to calculate the partial derivatives 7 00:00:40.240 --> 00:00:47.440 of standard functions and after that we'll introduce the chain rule for a function of two variables 8 00:00:48.160 --> 00:00:54.960 and finally we'll move on and look at the extended chain rule which looks at slightly more complicated 9 00:00:54.960 --> 00:01:02.320 functions of two variables. So first of all we'll have a look at some motivation for partial 10 00:01:02.320 --> 00:01:07.600 differentiation. Now we've all seen functions of a single variable before, that's functions of one 11 00:01:07.600 --> 00:01:16.160 variable for example y equals f of x and they are useful in representing certain physical phenomena. 12 00:01:16.160 --> 00:01:23.680 For example the area of a circle of radius r we know the formula for the area is given by a equals pi 13 00:01:23.680 --> 00:01:30.880 r squared and here's a diagram showing the circle of radius r and we calculate its area 14 00:01:30.880 --> 00:01:38.720 by calculating pi r squared. So the area therefore depends on one quantity and that quantity is r 15 00:01:38.720 --> 00:01:46.480 and if r was to vary then the area a would vary just as in this diagram here we've got a blue 16 00:01:46.480 --> 00:01:52.080 circle of radius r we calculated its area and we obtain a value. Now if we take this other circle 17 00:01:53.040 --> 00:02:01.200 and we calculate its area because we varied r, we made r smaller then the area of the circle 18 00:02:01.200 --> 00:02:08.080 will be smaller. So the variable a is called the dependent variable because it depends on r which 19 00:02:08.080 --> 00:02:16.800 we call the independent variable and the mathematical notation for this area is a is equal to f of r so 20 00:02:16.880 --> 00:02:27.360 area is a function of r and as I said if r was to vary then the area would vary. In real world 21 00:02:27.360 --> 00:02:34.160 situations though quantities generally depend on more than one variable and that gives rise to 22 00:02:34.160 --> 00:02:39.520 functions of several variables and I'm going to give you now a couple of examples of functions 23 00:02:39.520 --> 00:02:45.680 of two variables. In this course we won't look at any more than two variables we'll look at function 24 00:02:45.680 --> 00:02:51.520 of two variables but the whole idea generalizes to functions of many variables three four five 25 00:02:52.400 --> 00:02:58.080 as many variables as you want but we'll stick with looking at functions of two variables. 26 00:02:58.080 --> 00:03:05.440 So here's an example the volume of a cylinder v because the cylinder has radius r and height h 27 00:03:06.320 --> 00:03:12.640 is given by the formula v is equal to pi r squared h and that makes sense if you think about it. 28 00:03:12.640 --> 00:03:19.600 The cylinder has a circular base and a circular top and the area of that is pi r squared and if we 29 00:03:19.600 --> 00:03:26.160 multiply by the height h that will give us the volume so the formula is v is equal to pi r squared 30 00:03:26.160 --> 00:03:32.800 h so the volume therefore depends on the two quantities r and h and if either one of these 31 00:03:32.800 --> 00:03:40.640 or both of them vary then clearly the volume will vary so in this case the volume v is the dependent 32 00:03:40.640 --> 00:03:48.240 variable and it's a function of the two independent variables r and h and the mathematical notation 33 00:03:48.240 --> 00:03:58.000 for this is v is equal to f of r comma h so in this example here I've kept the radius fixed but I've 34 00:03:58.000 --> 00:04:06.320 increased the height of the cylinder and clearly you can see as h increases then so too does the 35 00:04:06.320 --> 00:04:14.640 volume. Another example comes from a combined gas law and the combined gas law gives the relationship 36 00:04:14.640 --> 00:04:21.840 between pressure, volume and the absolute temperature of a fixed amount of gas. This combined gas law 37 00:04:21.840 --> 00:04:27.600 comes from a combination of Boyle's law, Charles's law and Gay-Lusick's law for those of you who've 38 00:04:27.600 --> 00:04:36.640 done physics so it says the combined last gas law states that pv is equal to k times t where p is the 39 00:04:36.640 --> 00:04:44.080 pressure v is the volume and t is the absolute temperature of the gas and k is some constant so 40 00:04:44.080 --> 00:04:52.240 we can rearrange this equation in terms of pressure to write p is equal to kt over v so that pressure 41 00:04:52.240 --> 00:04:59.600 in this case is a function of the two variables v and t. The v and t can vary k of course is a constant 42 00:04:59.600 --> 00:05:06.400 so we write it as p is equal to f of v comma t and the pressure therefore depends on the two 43 00:05:06.400 --> 00:05:14.240 quantities volume and temperature v and t and if either one of both of these varies then p will vary. 44 00:05:14.240 --> 00:05:20.160 Okay so let's have a look we're going to eventually look at the geometrical interpretation of partial 45 00:05:20.160 --> 00:05:25.920 derivatives but let's remind ourselves of the partial of a functional one variable and the 46 00:05:25.920 --> 00:05:31.760 geometrical interpretation of a derivative. So a functional one variable can be written as y is 47 00:05:31.760 --> 00:05:41.360 equal to f of x and we can plot it as a curve in the xy coordinate system so it's a curve in 2d in 48 00:05:41.360 --> 00:05:50.800 2 dimensions so we've got the x axis going along the horizontal and the y axis going along the vertical 49 00:05:51.920 --> 00:05:59.440 so and motion is only possible in the horizontal direction or the vertical direction you can go 50 00:05:59.440 --> 00:06:06.720 horizontally left or right and vertically up and down and the height y above or even below the 51 00:06:06.800 --> 00:06:14.240 horizontal axis varies with the position of x on the horizontal axis so for example an x here would 52 00:06:14.240 --> 00:06:24.000 produce a y value up here and if we move along to here say the x value produces a y value here so the 53 00:06:24.000 --> 00:06:31.200 x the y value will generally vary with your x value and in this diagram I've just plotted it for 54 00:06:31.200 --> 00:06:37.760 positive y just for simplicity reason but this graph could easily dip down below the horizontal axis 55 00:06:37.760 --> 00:06:44.800 and you would get a negative value for y so in this diagram the guy walking along the top of the 56 00:06:44.800 --> 00:06:54.560 curve is free to move horizontally and vertically as he follows the curve up and down so the curve 57 00:06:54.560 --> 00:07:01.920 the slope is constantly changing it's here we've got a positive slope here we'll have a zero slope 58 00:07:01.920 --> 00:07:07.600 where we reach the turning point and then the slope will become negative it will become zero again 59 00:07:07.600 --> 00:07:15.920 and it starts going positive again and so on now the geometric interpretation of a derivative so 60 00:07:15.920 --> 00:07:22.240 you can essentially think of a derivative as a function that allows us to measure the gradient 61 00:07:22.240 --> 00:07:30.400 or slope of a function and when we substitute a value of x into the derivative we obtain the slope 62 00:07:30.400 --> 00:07:39.040 of the tangent line at that point and we also obtain the slope of the curve at the point so for 63 00:07:39.040 --> 00:07:44.640 example if y is equal to f of x of some function of x then the derivative you can either write it as 64 00:07:44.640 --> 00:07:53.600 df by dx or dy by dx gives a rate of change of f of x with respect to x you know essentially it's 65 00:07:53.600 --> 00:08:00.320 telling us how y is changing with respect to x so evaluating as I've just said evaluating the 66 00:08:00.320 --> 00:08:06.960 derivative at a point at some point we'll call x zero gives the gradient of the tangent line 67 00:08:07.680 --> 00:08:14.160 and hence the slope of the curve at that point so in this diagram we've got a red curve y equals 68 00:08:14.160 --> 00:08:20.960 f of x if we were to differentiate the formula for this function we would get an expression that 69 00:08:20.960 --> 00:08:26.640 would allow us to calculate the gradient at any point and if we plug in the point x zero that'll 70 00:08:26.640 --> 00:08:36.080 give us the slope of the curve at that point and it's a positive slope in this case so let's do an 71 00:08:36.080 --> 00:08:49.520 example so here is a curve y is equal to f of x is equal to x squared plus 3x so I want to calculate 72 00:08:49.520 --> 00:08:56.480 the slope of the curve at the point x equals four so remember to do that I've got to differentiate my 73 00:08:56.480 --> 00:09:05.440 function and the derivative that results will give me a formula for calculating the slope of the curve 74 00:09:06.080 --> 00:09:13.280 at any value of x and I've been given a specific value of x that I want to plug in to the expression 75 00:09:13.280 --> 00:09:17.840 for the derivative so let's differentiate the function first of all so it's just the power 76 00:09:17.840 --> 00:09:23.040 rule that applies x squared when you differentiate down comes the power subtract one of ways you get 77 00:09:23.040 --> 00:09:31.120 2x and 3x when you differentiate gives us 3 so we now want to find the slope at the point x equals 78 00:09:31.120 --> 00:09:38.000 four so this expression will allow us to do that so we plug in x equals four and we find 79 00:09:38.000 --> 00:09:47.360 that the slope at the point x equals four is 11 it's positive so the curve is increasing at x equals 80 00:09:48.000 --> 00:09:58.000 four so that is an example of differentiation of a function of a single variable and evaluating 81 00:09:58.000 --> 00:10:06.640 the slope of the curve at a given point you'll be familiar with these these are just this just a 82 00:10:06.640 --> 00:10:12.400 table of standard derivatives of a function of a single variable as you can see sine differentiates 83 00:10:12.400 --> 00:10:18.240 to give cos cos becomes minus sine when you differentiate it tan differentiates becomes 84 00:10:18.240 --> 00:10:26.320 sec squared x remember sec x is one over cos x e to the x is unique in that zone derivative it 85 00:10:26.320 --> 00:10:33.280 doesn't change when you differentiate it and log x when you differentiate it becomes one over x so 86 00:10:33.280 --> 00:10:38.800 this is a table of standard derivatives when we come to look at partial differentiation you'll find 87 00:10:39.360 --> 00:10:45.440 that there are no new rules for differentiation everything you've come across before will hold 88 00:10:45.440 --> 00:10:52.080 the only thing that gets a little bit tricky is you've got more variables to work with but we'll 89 00:10:52.080 --> 00:10:58.960 see that in due course so first of all let's have a look at a function of two variables so in this 90 00:10:58.960 --> 00:11:09.200 diagram here I've plotted the function z is equal to f of x y and that's cos x times cos y so it's a 91 00:11:09.200 --> 00:11:19.680 function of the variable x and it's a function of the variable y so a function of two variables 92 00:11:20.640 --> 00:11:28.640 two independent variables x and y so z is a function of x and y that represents a 3d surface in the 93 00:11:28.640 --> 00:11:34.640 x y coordinate system so if I just go back for a minute let's have a look at a function of a single 94 00:11:34.640 --> 00:11:41.520 variable so for a function of a single variable y equals f of x look at one independent variable and 95 00:11:41.520 --> 00:11:47.520 for every value of x you plug into the formula you know it could be something x squared plus three 96 00:11:48.240 --> 00:11:54.480 like in the example that we had yeah x squared plus three x for every value of x we plug into the 97 00:11:54.480 --> 00:12:01.040 formula we get a value of y and the value of y if it's positive it would be above the x axis and if 98 00:12:01.040 --> 00:12:07.440 it's negative it'll be below the x axis so every value of x will generate a value of y and hence 99 00:12:07.440 --> 00:12:15.040 the resulting curve well in in three dimensions where you get a function of two variables the idea 100 00:12:15.440 --> 00:12:22.000 similar really except that you know now you've got a z axis we've got our x y plane here so what 101 00:12:22.000 --> 00:12:30.320 happens is that for every x y coordinate pair you plug them into the formula and out comes a value 102 00:12:30.320 --> 00:12:38.080 of z if z is positive then you're above the x y plane and if x is negative you're down below the 103 00:12:38.080 --> 00:12:44.320 x y plane you can think the x y plane has been the floor a positive value will go up towards the 104 00:12:44.320 --> 00:12:52.880 ceiling and a negative value will be down below the floor so the height as I've just said above 105 00:12:52.880 --> 00:13:00.000 or below the horizontal axis varies with the x y position in the plane so in general for every x y 106 00:13:00.000 --> 00:13:08.000 coordinate pair when you plug it in you'll get a different z value and in this case that's what our 107 00:13:08.720 --> 00:13:15.280 function looks like it's a three-dimensional surface function of the two variables x and y 108 00:13:16.400 --> 00:13:24.640 okay so that leads us to the idea of partial derivatives we saw in a function of one variable 109 00:13:24.640 --> 00:13:30.480 the curve where the guy was walking along the slope was changing as he moved from left to right or 110 00:13:30.480 --> 00:13:39.040 equally well from from right to left and the slope of the curve was changing things are slightly 111 00:13:39.040 --> 00:13:46.800 different slightly more complicated when we go up to three dimensions because in two dimensions as we 112 00:13:46.800 --> 00:13:55.680 saw this fellow could only walk to the left or right and he would go up and down along the curve 113 00:13:55.680 --> 00:14:02.160 depending on what the slope of the function was okay so he could only go left or right and he would 114 00:14:02.160 --> 00:14:10.320 move up and down along the curve now in three dimensions in 3d of course he can walk off in any 115 00:14:10.320 --> 00:14:16.400 direction he likes you know he doesn't have to walk parallel with any axis he can walk off in 116 00:14:16.400 --> 00:14:21.360 n direction and explain that a bit more in a minute so a partial derivative it's a function 117 00:14:22.240 --> 00:14:29.120 it's a derivative of a function of more than one variable and to calculate a partial derivative 118 00:14:30.080 --> 00:14:35.280 all variables apart from the variable we are differentiating with respect to our held constant 119 00:14:35.280 --> 00:14:41.120 i'll explain that shortly and we differentiate as i've said before using the standard rules 120 00:14:41.760 --> 00:14:48.880 for differentiating a function of a single variable so in this case here in this module 121 00:14:48.880 --> 00:14:55.520 here as i've said we're only going to look at functions of two variables we don't look at 122 00:14:56.080 --> 00:15:01.600 but we could look at functions of three variables four variables five variables and so on the ideas 123 00:15:01.600 --> 00:15:06.160 all carry across but we restrict ourselves to functions of two variables 124 00:15:08.720 --> 00:15:15.840 now as i mentioned earlier the two dimensional diagram we saw with the guy walking along the 125 00:15:15.840 --> 00:15:22.560 curve he could only move along in the positive x and positive y direction he would move up and down 126 00:15:22.560 --> 00:15:28.000 along the curve depending on the slope when we up things to three dimensions so 127 00:15:29.280 --> 00:15:36.080 a guy standing here he could actually walk off in any direction he wants because he could spin 128 00:15:36.080 --> 00:15:42.560 around through 360 degrees he could walk off parallel to the y-axis he could walk parallel to the x 129 00:15:42.560 --> 00:15:48.480 axis but he could also walk out at an angle he could come directly out like this or he could walk 130 00:15:48.480 --> 00:15:56.800 out like so he could so he's got freedom to walk off in any direction 360 degrees 131 00:15:59.040 --> 00:16:06.240 so that's an awful lot of different derivatives but we're going to restrict ourselves to only 132 00:16:06.800 --> 00:16:14.960 consider moving off parallel to the y-axis and parallel to the x-axis so in other words 133 00:16:14.960 --> 00:16:20.800 we're only going to look at the slope of the surface in the direction of the x-axis and the 134 00:16:21.440 --> 00:16:32.160 slope in the direction of the y-axis so let's just have a look at a brief geometrical interpretation 135 00:16:32.160 --> 00:16:38.720 of the partial derivatives with respect to x and with respect to y let's have a look at the partial 136 00:16:38.720 --> 00:16:45.840 derivative with respect to y first the partial derivative with respect to y requires us to 137 00:16:45.840 --> 00:16:54.880 keep x fixed and to move in the y direction parallel to the y-axis so that's what i'm going to do here 138 00:16:54.880 --> 00:17:06.160 so so this surface here in blue we take a slice through it at a fixed value of x at x equals x0 139 00:17:06.160 --> 00:17:13.440 and if you do that you'll obtain this orange plane here on this orange plane x0 x is constant 140 00:17:13.440 --> 00:17:18.880 it's got the value x0 all the way along you can think the plane could actually stretch all the way 141 00:17:18.880 --> 00:17:24.800 along to the left and all the way along to the right but i've only just taken a segment of it just 142 00:17:24.800 --> 00:17:31.760 to show you what's going on so when we slice through the surface at a fixed value of x when x is equal 143 00:17:31.760 --> 00:17:39.840 to x0 we obtain this plane here and the plane would have equation x equals x0 and it'll intersect 144 00:17:39.840 --> 00:17:49.120 our surface here in this yellow line so what you what we need to think about if we're looking at 145 00:17:49.120 --> 00:17:57.920 the slope in the y direction we're going to keep x fixed and we can walk along this yellow line just 146 00:17:57.920 --> 00:18:06.320 in a similar way to the guy in 2d was walking along the curve this guy can walk along the yellow line 147 00:18:06.320 --> 00:18:12.160 and of course depending on the surface the contours of the surface he'll go up and down and up and 148 00:18:12.160 --> 00:18:25.120 down just following the contours of the surface along the yellow line keeping x fixed at the value 149 00:18:25.120 --> 00:18:33.120 x0 so x is fixed the only thing that's varying is y and that will lead us to the definition 150 00:18:33.120 --> 00:18:39.680 of a partial derivative with respect to y so just at the foot of the slide here i say if x is kept 151 00:18:39.680 --> 00:18:48.960 constant at x equals x0 and y is increased by moving along the yellow curve parallel to the y axis 152 00:18:48.960 --> 00:18:55.440 the slope of the surface changes and that leads us to the idea of the partial derivative of the 153 00:18:55.440 --> 00:19:03.840 function with respect to y now the notation the partial derivative of function z equals f of xy 154 00:19:04.560 --> 00:19:14.000 partial derivative with respect to y is written like this you use a curly d so it's partial dz by dy 155 00:19:14.000 --> 00:19:19.360 and you use curly d's because it's a function of more than one variable we use curly d's in the work 156 00:19:19.360 --> 00:19:26.720 you'll have done up to now where we only had functions of a single variable we use a straight 157 00:19:26.720 --> 00:19:33.600 back d like that we would have a dy by dx so that relates to functions of a single variable 158 00:19:33.600 --> 00:19:41.760 whereas the curly d notation corresponds to functions of more than one variable and partial 159 00:19:41.760 --> 00:19:52.320 derivatives okay so to calculate the partial with respect to y that's dz by dy with differentiator 160 00:19:52.320 --> 00:20:00.400 function z of xy with respect to y while we treat x as a constant and the reason for that is fairly 161 00:20:00.400 --> 00:20:05.520 obvious because as we said we take the slice through the surface at a constant value of x 162 00:20:06.080 --> 00:20:13.360 the value of x doesn't change it's it's an x is equal to x0 all the way along the line and all the 163 00:20:13.360 --> 00:20:20.640 way along that curve so all the way along that curve x is constant the thing that's changing is y 164 00:20:21.600 --> 00:20:27.840 so that gives us a partial derivative with respect to y and we can do a similar thing for 165 00:20:27.840 --> 00:20:32.720 calculate the partial derivative with respect to x and here what it looks like geometrically 166 00:20:32.720 --> 00:20:41.360 so in this case we take a cross section of our surface z equals f of xy at y equals y0 167 00:20:41.920 --> 00:20:52.080 it's parallel with the x axis so we keep y fixed at y equals y0 and the red curve on the top of 168 00:20:52.080 --> 00:21:00.080 the surface will correspond to our cross section that's defined by the plane y equals y0 this 169 00:21:00.080 --> 00:21:08.640 orange plane is the slice through the surface in this direction where we keep y fixed and we intersect 170 00:21:08.640 --> 00:21:17.360 the surface in this red line and again we can along this line here y is fixed y is kept constant 171 00:21:17.360 --> 00:21:25.280 at y equals y0 and so along the red line y is constant at y equals y0 the thing that's changing 172 00:21:25.280 --> 00:21:31.840 is x as the guy would walk out along the red line he would go up and down and up and down depending 173 00:21:31.840 --> 00:21:38.480 on the contusion of the surface and the slope would be changing as he went along the red line 174 00:21:39.120 --> 00:21:45.920 so that leads us to the partial derivative with respect to x so if we keep y constant at y equals 175 00:21:45.920 --> 00:21:53.600 y0 and we increase x or equally well decrease it if we increase it though by moving along the red 176 00:21:53.600 --> 00:22:00.960 curve in this direction parallel to the x axis the slope of the surface changes and that would give us 177 00:22:00.960 --> 00:22:07.040 the partial derivative with respect to x and similarly to an earlier definition for partial 178 00:22:07.040 --> 00:22:12.880 derivative z by dy we can do the same thing with respect to x so the partial derivative of a function 179 00:22:12.880 --> 00:22:20.160 z with respect to x is written like this with the curly d's curly dz by dx and so rate of change 180 00:22:20.720 --> 00:22:28.560 the rate at which the function changes as x changes and y is kept constant so y is kept 181 00:22:28.560 --> 00:22:36.240 constant in this case at the value y0 so this this curve has the value y0 all the way along with the 182 00:22:36.240 --> 00:22:43.840 thing that's changing though is x and to calculate the partial derivative with respect to x that's 183 00:22:43.840 --> 00:22:54.000 partial dz by dx we differentiate z equals f of x y with respect to x and keep while keeping y constant 184 00:22:55.760 --> 00:23:03.040 so just to summarize that i've just finished saying this to differentiate to obtain partial 185 00:23:03.040 --> 00:23:09.840 dz by dx we differentiate z with respect to x treating y as a constant and the notation we have 186 00:23:09.840 --> 00:23:17.600 we've seen the curly dz by dx we've seen that alternative notation short more short hand notation 187 00:23:17.600 --> 00:23:24.720 the z with x as a subscript that means exactly the same as this notation here and because z is 188 00:23:24.720 --> 00:23:31.200 equal to f you can just replace the z by f if you prefer so any one of these they all mean exactly 189 00:23:31.200 --> 00:23:37.040 the same thing the partial derivative with respect to x similarly we can do the same thing for y 190 00:23:37.040 --> 00:23:40.720 where we've got the partial derivative with respect to y which we've seen before in this 191 00:23:40.720 --> 00:23:47.360 notation here this notation is called Leibniz after the mathematician Leibniz this Leibniz 192 00:23:47.360 --> 00:23:52.960 notation we can also write it in short hand notation and we're doing it with respect to y with y as a 193 00:23:52.960 --> 00:24:00.160 subscript and again we can replace z with f and all of these mean exactly the same that the partial 194 00:24:00.160 --> 00:24:07.120 derivative with respect to y so now we've got the background of the motivation of the 195 00:24:07.120 --> 00:24:16.080 geometrical interpretation out of the way let's have a look at some examples so suppose we've got 196 00:24:16.080 --> 00:24:23.600 a function z is equal to x squared minus 2x squared y cubed plus 4 y plus 5 well that function 197 00:24:24.160 --> 00:24:33.360 represents a surface in three dimensions it's a function of x and a function of y so z is equal 198 00:24:33.360 --> 00:24:39.680 you could write it like this if you want it you know you could write z is equal to f of x y if 199 00:24:39.680 --> 00:24:49.600 you like so this is also equal to f of x y so there we are so we want to calculate the partial 200 00:24:49.600 --> 00:24:54.960 derivative with respect to x and the partial derivative with respect to y so the question 201 00:24:54.960 --> 00:25:01.920 has to do that first and then we have to calculate the slope in both the x direction and the y 202 00:25:01.920 --> 00:25:13.520 direction at this point p okay so let's have a look at doing that so 203 00:25:13.520 --> 00:25:22.800 okay so let's do the partial derivative with respect to x first of all so we've got partial dz 204 00:25:22.800 --> 00:25:28.640 by dx so all I do here is I replace z by the function given in the question there you go 205 00:25:28.640 --> 00:25:34.880 that's what we've done now when we used to differentiate functions of a single variable 206 00:25:35.760 --> 00:25:42.960 as you know you just do term by term if you've got x squared plus 3x you would differentiate the x 207 00:25:42.960 --> 00:25:47.440 squared and you would differentiate the x and you would add them together so you can just do 208 00:25:47.440 --> 00:25:52.800 term by term differentiation well you can do exactly the same when you've got a function 209 00:25:52.800 --> 00:25:58.400 of two or more variables you just differentiate your function term by term so let's have a look 210 00:25:58.400 --> 00:26:05.040 at doing that so I've got four terms here one two three four so I'm going to just take the derivative 211 00:26:05.760 --> 00:26:11.600 with respect to x of each of the four terms and that's all I'm doing here remember of course these 212 00:26:11.600 --> 00:26:16.960 are partial derivatives I use the currently denotation because I've got a function of two variables 213 00:26:18.240 --> 00:26:25.600 so the partial with respect to x of x squared minus the partial respect to x of 2x squared y 214 00:26:25.600 --> 00:26:35.120 cubed plus the partial with respect to x of 4y plus the partial with respect to x of the constant 215 00:26:35.840 --> 00:26:42.880 five so this is actually very easy this one because this is just a function of a single 216 00:26:42.880 --> 00:26:48.480 variable so there's nothing new here this is just the same differentiation you've seen before 217 00:26:48.480 --> 00:26:57.280 you differentiate an x squared with respect to x so you would get 2x what about this one here now this 218 00:26:57.280 --> 00:27:08.160 involves an x and a y and they're at a constant they're all it's a product 2x squared y cubed the 219 00:27:08.160 --> 00:27:14.960 derivative is with respect to x so in this example just starting out I'm going to take 220 00:27:14.960 --> 00:27:21.520 everything that does involve x outside the derivative operator and the reason for that is 221 00:27:21.520 --> 00:27:29.280 remember that when we differentiate with respect to x we treat y and any function of y as a constant 222 00:27:29.280 --> 00:27:38.960 so if we treat y as a constant then y cubed is a constant and so 2 is 2y cubed so we can take the 223 00:27:38.960 --> 00:27:45.040 2y cubed outside and that just leaves me x squared to differentiate with respect to x 224 00:27:45.760 --> 00:27:53.200 now this term here doesn't involve x so I'm just going to leave it as it is it's again it's a function 225 00:27:53.200 --> 00:27:57.360 of a single variable and the variable being y I'm just going to leave that as it is I'll deal 226 00:27:57.360 --> 00:28:04.000 with that shortly just leave it as it is and again leave the constant as it is so I've got d by dx 227 00:28:04.000 --> 00:28:10.000 of the constant five so going through these I've already done this one but let's just say it again 228 00:28:10.000 --> 00:28:16.960 differentiate x squared with respect to x I get 2x I've got to do the same thing here differentiate 229 00:28:16.960 --> 00:28:22.080 x squared with respect to x so I get 2x don't forget the 2y cubed you're multiplying by and 230 00:28:22.080 --> 00:28:30.160 there's a minus there plus now I've got to differentiate 4y with respect to x it's an x 231 00:28:30.160 --> 00:28:37.360 derivative I'm calculating so as we talked about earlier we treat y as a constant and we also treat 232 00:28:37.360 --> 00:28:45.040 any function of y as a constant so 4y will be a constant will be thought of as a constant 233 00:28:45.040 --> 00:28:50.320 and if you differentiate a constant with respect to x you get zero so that's why the zero comes in 234 00:28:50.320 --> 00:28:58.080 here and again this is purely just a constant five and when you differentiate a constant with respect 235 00:28:58.080 --> 00:29:04.000 to x you get zero so that's where that zero comes from and I can tidy this a little up a little bit 236 00:29:04.000 --> 00:29:11.040 multiply them together to get 4xy cubed and here's my answer 2x minus 4xy cubed so that's the 237 00:29:11.040 --> 00:29:16.960 partial derivative with respect to x and that expression will allow us to calculate the slope 238 00:29:16.960 --> 00:29:25.440 of the curve at any point in the x direction we're now doing the same thing for y again I'll 239 00:29:25.440 --> 00:29:31.760 replace my z with a function that's given in the question I'm going to differentiate this term by 240 00:29:31.760 --> 00:29:38.720 term so it's the derivative with respect to y of each of these four terms this is just a function 241 00:29:38.720 --> 00:29:43.840 of a single variable so I'll leave it as it is that's the way I'm doing these is whenever I've got a 242 00:29:43.840 --> 00:29:49.680 function of a single variable I'm just leaving it as it is so that one stays as it is four y's 243 00:29:49.680 --> 00:29:55.120 significant that'll stay as it is and the five is a constant so that'll just stay as it is this 244 00:29:55.120 --> 00:30:02.880 one I've got a product of x is in y's so what I'm going to do is like I did in the previous one 245 00:30:02.880 --> 00:30:10.560 with respect to x I'm going to I'm differentiating here with respect to y so x and any function of x 246 00:30:10.560 --> 00:30:16.400 is treated as a constant so x squared will be treated as a constant and 2x squared will be 247 00:30:16.400 --> 00:30:22.080 treated as a constant you can lump all of this together and to all intents and purposes it's 248 00:30:22.080 --> 00:30:27.840 just a constant term because we'll differentiate with respect to y so the 2x squared I can take 249 00:30:27.840 --> 00:30:35.040 outside the operator so out it comes and that just leaves me y cubed to differentiate with respect 250 00:30:35.040 --> 00:30:42.240 to y so I can go through each of these term by term so differentiate x squared with respect to y 251 00:30:43.040 --> 00:30:50.000 so x and any function of x and therefore x squared is treated as a constant so its derivative is zero 252 00:30:50.240 --> 00:30:58.960 the derivative of three y of y cubed with respect to y is three y squared so that comes there 253 00:31:00.080 --> 00:31:06.800 the derivative of four y with respect to y is just four and the derivative of the constant five 254 00:31:06.800 --> 00:31:14.560 with respect to y is just zero and again I can combine all of this so I'll have four minus six 255 00:31:15.040 --> 00:31:23.040 x squared y squared so that expression there is for the partial derivative with respect to y 256 00:31:23.040 --> 00:31:29.680 and it'll allow us to calculate the slope of the surface at any point in the y direction 257 00:31:30.960 --> 00:31:41.120 okay so let's have a look at calculating the slope in the x and y direction so as we saw in part one 258 00:31:41.120 --> 00:31:45.520 we found the partial derivative with respect to x and we also found the partial derivative with respect 259 00:31:45.520 --> 00:31:53.920 to y and we'll ask to calculate the slope of the x direction at a point p three minus 128 260 00:31:54.720 --> 00:32:01.280 so to do that I use my expression for the partial derivative with respect to x 261 00:32:02.080 --> 00:32:06.800 and this notation with this notation here means take your partial derivative with respect to x 262 00:32:06.800 --> 00:32:14.560 the expression that you found and substitute in these values of course it's just the x and y value 263 00:32:14.560 --> 00:32:21.680 you sub in we just included the z value just to show where you would be standing on the surface 264 00:32:21.680 --> 00:32:28.880 that's the coordinates of the point on top of the surface so we sub in the x value and the y value 265 00:32:28.880 --> 00:32:39.600 into the partial d z by dx we found earlier and we find that the value is 18 so the partial 266 00:32:39.600 --> 00:32:47.520 derivative with respect to x is positive and if we keep y fixed or we keep y constant and very 267 00:32:48.480 --> 00:33:00.000 x the function would be increasing at the point p so if you look along the surface in the direction 268 00:33:00.640 --> 00:33:11.520 of x you're you're varying x moving parallel with the x axis and in that case the surface is 269 00:33:11.520 --> 00:33:18.000 increasing you'd be climbing your pole so we do the same thing now for the slope in the y direction 270 00:33:18.000 --> 00:33:24.560 so we use these partial dz by dy and we plug in the x and y coordinates into this expression here 271 00:33:24.560 --> 00:33:29.680 and we find we get a negative value so the partial derivative with respect to y is negative 272 00:33:29.680 --> 00:33:36.960 so the function is decreasing at the point p as we vary as we vary 273 00:33:39.200 --> 00:33:49.200 as we vary y and keep x constant okay so we're so we're keeping x constant in this case 274 00:33:50.720 --> 00:33:59.200 okay so let's have a look at an example of doing that so here's our diagram I've taken 275 00:34:00.320 --> 00:34:07.120 from this website you can see this was called a saddle point because it does look like a saddle 276 00:34:07.120 --> 00:34:18.720 so we can see suppose this is our point p here well if we move off parallel with the x axis 277 00:34:18.880 --> 00:34:30.800 we can see the slope is increasing so at the point p if we move off parallel with the x axis 278 00:34:31.440 --> 00:34:39.760 we can see that the slope is increasing on the other hand if we move off parallel with the y axis 279 00:34:39.760 --> 00:34:46.320 you can see the slope is decreasing so it is perfectly possible to stand at a point p on a surface 280 00:34:46.720 --> 00:34:54.640 and for you to be increasing in one direction and decreasing in another direction at standing at 281 00:34:54.640 --> 00:35:02.720 that point okay so let's have a look now at another example 282 00:35:05.840 --> 00:35:12.320 so here's a function of two variables again we're surfacing three dimensions and we want to 283 00:35:12.880 --> 00:35:22.000 find the partial dz by dx so I replace z by the given function there it is inside the bracket 284 00:35:22.640 --> 00:35:28.640 I can do term by term differentiation so I'll differentiate the first term plus the derivative 285 00:35:28.640 --> 00:35:33.040 of the second term and these derivatives are partial derivatives calculate respect to x 286 00:35:34.080 --> 00:35:41.760 so in this one I'm going to take out anything that doesn't involve x so the 27 over 5 y can come 287 00:35:41.760 --> 00:35:48.160 outside and that just needs me x to differentiate with respect to x and this is just a function of 288 00:35:48.160 --> 00:35:56.000 a single variable function of x so I'll just leave it as it is so I differentiate x with respect to 289 00:35:56.000 --> 00:36:04.960 x I get 1 and if I differentiate this term 1 3 1 over 4 x with respect to x all that survives 290 00:36:04.960 --> 00:36:12.080 as a constant 1 3 1 over 4 so putting all of this together I get the answer in the blue box at the 291 00:36:12.080 --> 00:36:19.440 foot of the slide so that's the partial derivative with respect to x of this function so we treat y 292 00:36:19.440 --> 00:36:27.840 as a constant now in this one we've been asked to find the partial respect to y and that requires us 293 00:36:27.840 --> 00:36:37.600 to treat x as a constant so again partial dz by dy I replace z with a given function there it is 294 00:36:38.240 --> 00:36:46.240 I'll do term by term differentiation with respect to y so my first term is here plus the derivative 295 00:36:46.240 --> 00:36:52.800 of my second term here it's a y derivative so I can take out anything that doesn't involve y I'm 296 00:36:52.800 --> 00:37:02.720 treating x as a constant so we treat 27 over 5 times x as a constant so out it comes and that just 297 00:37:02.720 --> 00:37:08.160 leaves me y to differentiate with respect to y this is a function of a single variable so I'll 298 00:37:08.160 --> 00:37:15.120 just leave it as it is because that'll be easy to handle so I differentiate y with respect to y 299 00:37:15.200 --> 00:37:24.320 that'll give me 1 so I'll obtain this expression here which is 27 over 5 x plus the derivative of 300 00:37:24.320 --> 00:37:32.560 this expression with respect to y well this only involves x well it's a constant times x a function 301 00:37:32.560 --> 00:37:38.080 of x and we know that x is treats are constant how we differentiate with respect to y and any 302 00:37:38.080 --> 00:37:44.320 function of x treats are constant so how we differentiate this term here will get 0 and 303 00:37:44.320 --> 00:37:52.800 my answer is as given in the blue box at the foot of the slide okay so let's have a look at another 304 00:37:52.800 --> 00:38:02.000 example so in this case we've been asked to differentiate the function z is equal to sine x 305 00:38:02.000 --> 00:38:07.520 times sine 2y we want to do partial derivative with respect to x and the partial derivative with 306 00:38:07.520 --> 00:38:17.200 respect to y now one thing I'll say here just it's sometimes tempting to use the product rule here 307 00:38:19.920 --> 00:38:24.160 you could use the product rule perfectly fine that would be perfectly okay and you would get 308 00:38:24.160 --> 00:38:29.040 the correct answer but you don't actually need the product rule here because if you look at it 309 00:38:29.280 --> 00:38:34.320 remember the product rule comes into play when you get two functions 310 00:38:36.800 --> 00:38:44.720 involving the same variables multiplied together but this one your first function only involves x 311 00:38:44.720 --> 00:38:50.720 and your second function only involves y so you don't actually need the product rule the product 312 00:38:50.720 --> 00:38:58.480 rule if you had if this first function had been something like sine of x y sine 2y if you wanted 313 00:38:58.480 --> 00:39:03.760 to calculate the partial derivative with respect to y you would need the product rule because this 314 00:39:03.760 --> 00:39:10.000 is a function of x and y and this is a function of y so you could two functions of y multiply 315 00:39:10.000 --> 00:39:16.000 together so you would need the product rule but we'll see examples of the product rule in the next 316 00:39:16.000 --> 00:39:22.160 lecture in partial differentiation so we'll just leave that for now here we don't need the product 317 00:39:22.160 --> 00:39:27.520 rule because we've just got a function of x times a function of y so let's just go straight into it 318 00:39:27.520 --> 00:39:34.000 and calculate the partial derivative so the partial derivative of z with respect to x we replace z 319 00:39:34.000 --> 00:39:39.920 by the given function there it is now it's a partial derivative with respect to x or y and any 320 00:39:39.920 --> 00:39:46.960 function of y is treated as a constant so the sine 2y can come outside the operator and that just 321 00:39:46.960 --> 00:39:55.360 leaves us sine x to differentiate with respect to x and that's easy we know that it's just cos x 322 00:39:55.360 --> 00:40:03.520 so my final answer is that the partial derivative with respect to x is sine y cos sine 2y cos x 323 00:40:04.720 --> 00:40:10.960 we're then asked to find the partial derivative with respect to y and again we replace z with a 324 00:40:10.960 --> 00:40:18.160 given function it's a y derivative so x and any function of x this treat as a constant so sine x 325 00:40:18.160 --> 00:40:26.400 can be taken outside and that just leaves us sine of 2y to differentiate with respect to y 326 00:40:26.400 --> 00:40:34.080 now I'll just say something about this one here we've got sine of 2y now the derivative of that 327 00:40:34.080 --> 00:40:43.520 is not cos of 2y because you've got a function of a function so we need the chain rule some of you 328 00:40:43.520 --> 00:40:48.080 might know this is the composite rule because you've got a function composed of more than one 329 00:40:48.080 --> 00:40:53.600 function it's also called the composite rule we call it the chain rule so we need the chain rule 330 00:40:53.600 --> 00:40:59.600 here and the chain rule if I'm going to just use this notation for differentiation with respect to 331 00:40:59.600 --> 00:41:05.680 y d with a subscript y so I want to differentiate this function with respect to y so I differentiate 332 00:41:05.680 --> 00:41:13.680 the outside function cos I leave the bracket as it is 2y and I've got to multiply by the 333 00:41:13.680 --> 00:41:20.240 derivative of the term inside the brackets so that's the chain rule for a function of one variable 334 00:41:20.240 --> 00:41:25.760 I'll I'll actually be doing an example of that shortly before we look at the chain rule for a 335 00:41:25.760 --> 00:41:32.480 function of two variables but that's just a quick reminder of how you differentiate a function of 336 00:41:32.480 --> 00:41:39.840 a function differentiate the outside function sine becomes cos leave the bracket as it is 337 00:41:39.840 --> 00:41:47.760 and then multiply by the derivative of the term inside the brackets so I would I would get 2 cos 338 00:41:47.760 --> 00:41:53.200 2y and I've got to multiply that by sine x which I took outside because that was just 339 00:41:53.200 --> 00:42:02.800 been treated as a constant so I get 2 sine x cos 2y okay so there we are so we've got another 340 00:42:02.800 --> 00:42:08.880 example here similar cases to the last one we've got a function of y multiplying a function of x 341 00:42:08.880 --> 00:42:16.160 so we don't need the product rule so let's do the partial with respect to x first of all so I 342 00:42:16.160 --> 00:42:22.800 replace said by the given function it's an x derivative so y and any function of y can get 343 00:42:22.800 --> 00:42:31.200 taken outside and treated as a constant so e to the 3 y comes out and that just leaves me log 4x 344 00:42:31.200 --> 00:42:39.040 squared to differentiate now a common mistake here when people differentiate log of 4x squared 345 00:42:39.040 --> 00:42:43.440 is a function of a single variable so it's just the same differentiation as we've been 346 00:42:44.240 --> 00:42:50.320 you know come across up to now the common mistake here is that people think the derivative of log 347 00:42:50.320 --> 00:42:58.000 of 4x squared is 1 over 4x squared it's not that's wrong that's incorrect you need the chain rule 348 00:42:58.000 --> 00:43:05.440 because you've got a function log applied to another function 4x squared so you get a function 349 00:43:05.440 --> 00:43:12.800 of a function so that means you need to use the chain rule and the chain rule first of all 350 00:43:12.800 --> 00:43:18.720 differentiate the outside function when you differentiate log it's going to be 1 over whatever's 351 00:43:18.720 --> 00:43:25.680 inside the bracket so it's going to be 1 over 4x squared so anyone who did this would be partly 352 00:43:25.680 --> 00:43:32.320 correct but because it's a chain rule you must multiply by the derivative of the term inside 353 00:43:32.320 --> 00:43:38.720 the bracket and that would be 8x when you differentiate 4x squared with respect to x you get 354 00:43:39.680 --> 00:43:47.200 now you can simplify this 4 goes into that once goes in there twice x goes to that once x goes 355 00:43:47.200 --> 00:43:54.080 into x squared once it leaves you x so you'd be left with 2 over x and that's what I've shown 356 00:43:54.080 --> 00:44:00.320 in the green box here I've just shown the differentiation been done in in more detail there 357 00:44:00.320 --> 00:44:09.200 there it is so when we put all of this together I'll have e to the 3y times the derivative of 358 00:44:09.200 --> 00:44:18.720 this term which was 2x so I'll just get 2e to the 3y over x okay so that's the partial derivative 359 00:44:18.720 --> 00:44:24.880 of this function with respect to x so let's do the partial derivative with respect to y and once 360 00:44:24.880 --> 00:44:32.000 again we don't need the product rule because we've got a function of y multiply a function of x 361 00:44:32.000 --> 00:44:39.280 it's a y derivative so we treat anything that involves x as a constant so log of 4x squared 362 00:44:39.280 --> 00:44:47.200 will be treated as a constant so let's set up a differentiation we'll replace said by the given 363 00:44:47.200 --> 00:44:55.040 function y derivative so x and any function of x therefore log of 4x squared is treated as a constant 364 00:44:55.040 --> 00:45:04.880 so out it comes so we've got to differentiate e to the 3y with respect to y okay so this again 365 00:45:06.000 --> 00:45:12.000 is a function of a function it's an exponential function applied to the function 3y so we need 366 00:45:12.080 --> 00:45:19.040 the chain rule so e to the 3y it's a chain rule for a function of a single variable of course 367 00:45:19.040 --> 00:45:24.400 e to the 3y is our function we can write it like this some people find it a bit easier to see the 368 00:45:24.400 --> 00:45:30.640 chain rule been applied if we write you know if we've got brackets present and x is a common 369 00:45:30.640 --> 00:45:38.400 notation for for the exponential function like saying computer programs we can write as x 3y so 370 00:45:39.360 --> 00:45:44.080 let's do the chain rule the chain rule says differentiate the outside function well we know 371 00:45:44.800 --> 00:45:50.640 that the exponential function is its own derivative so the exponential just becomes the exponential 372 00:45:50.640 --> 00:45:57.520 when you differentiate leave the bracket as it is so you get 3y times the derivative of the term 373 00:45:57.520 --> 00:46:08.320 inside the bracket which is 3 so you get 3e cubed y when we write it in this notation here 3x3y 374 00:46:08.400 --> 00:46:15.360 and it's given like so so this is what we've got then we've got our log 4 of x squared on the outside 375 00:46:15.360 --> 00:46:20.240 multiplying the derivative term we've just calculated the derivative term as 3e to the 3y 376 00:46:20.240 --> 00:46:26.400 and I can rearrange them if I want I don't have to but I find it neater to write it like this so I 377 00:46:26.400 --> 00:46:37.280 get 3e to the 3y log 4x squared so that is the partial derivative with respect to y okay so 378 00:46:37.280 --> 00:46:42.480 now we've just finished talking about the chain rule and we saw how it is essentially a shortcut 379 00:46:42.480 --> 00:46:51.200 approach you know to the chain rule in this example you know like differentiate the outside function 380 00:46:51.200 --> 00:46:56.400 the exponential leave the bracket as it is and multiply by the term inside the brackets but 381 00:46:56.400 --> 00:47:04.320 sometimes it's useful to see the more formal definition of the chain rule and it'll help us 382 00:47:04.400 --> 00:47:12.960 when we come to calculating partial derivatives using the chain rule so the chain rule is for 383 00:47:12.960 --> 00:47:19.440 calculating derivatives of what are called composite functions that's a function of a function 384 00:47:20.720 --> 00:47:27.360 and that's when we were working with one variable we saw examples of that just a few minutes ago 385 00:47:27.360 --> 00:47:34.080 but I'm going to give you the full definition here so suppose we've got a function y is equal to f of u 386 00:47:34.480 --> 00:47:42.960 where u is equal to some function g of x so for our example we could have you know if I just jump 387 00:47:44.320 --> 00:47:51.120 you know the example I'm going to do let's just look at this we could have y is equal to sign u 388 00:47:52.320 --> 00:48:03.840 where u is equal to what was it x squared plus 3x x squared plus 3x so that's what we've got 389 00:48:04.720 --> 00:48:12.480 so how do we differentiate this well let's look at our diagram here and hopefully this will 390 00:48:12.480 --> 00:48:22.800 will help so we've got at the at the root node we've got y and at the terminal node we've got x 391 00:48:24.080 --> 00:48:31.440 so we want to calculate dy by dx but y is written as a function of u which is in turn 392 00:48:31.440 --> 00:48:36.960 a function of x and that's what we're showing here y is a function of u which in turn is a 393 00:48:36.960 --> 00:48:44.160 function of x now to calculate dy by dx start at the root node go to the terminal node multiply 394 00:48:44.160 --> 00:48:50.640 derivatives on your way so you would calculate y is a function of u so you could calculate dy by du 395 00:48:51.360 --> 00:48:58.320 u is a function of x so you could calculate du by dx and to get dy by dx you just multiply 396 00:48:58.320 --> 00:49:05.440 these two derivatives together so let's have a look at an example so again I've copied my diagram over 397 00:49:05.440 --> 00:49:15.520 here um there it is there's my tree diagram here I've got y this equal to sign of x squared plus 398 00:49:15.520 --> 00:49:24.480 3x now I could do that using the the method the the short method that I used earlier it's fine 399 00:49:24.560 --> 00:49:28.400 when we're working with simple functions but sometimes as functions become more complicated 400 00:49:29.120 --> 00:49:35.120 it's much better to use this approach so we'll for illustration purposes we'll use this full 401 00:49:35.120 --> 00:49:40.240 approach and that'll help us when we come to using the chain rule for a function of two variables 402 00:49:40.240 --> 00:49:46.000 so I'm going to call the thing in brackets u that's a standard approach called set the dummy 403 00:49:46.000 --> 00:49:52.800 variable u equal to the expression in brackets so u is equal to x squared plus 3x so y is equal to 404 00:49:52.800 --> 00:50:01.520 sign u there you are I've got to differentiate uh y with respect to u so dy by du is just 405 00:50:01.520 --> 00:50:07.600 cause u differentiate sign you get cause and use a function of x so I differentiate u with respect 406 00:50:07.600 --> 00:50:18.480 to x to get 2x plus 3 my formula tells me that dy by dx is just the product of dy by du and du by 407 00:50:18.480 --> 00:50:25.840 dx now my three diagrams over here I've got my my variable y at the root node and I've got the 408 00:50:25.840 --> 00:50:35.600 variable x at the terminal node and I want to find dy by dx so dy so y is at the root x at the terminal 409 00:50:35.600 --> 00:50:44.880 node so I go from y all the way down to x and I multiply derivatives together on my way so y is 410 00:50:44.960 --> 00:50:52.000 a function of u so I get dy by du use a function of x I've got du by dx I've already calculated 411 00:50:52.000 --> 00:50:59.360 them I know what they are dy by du is cause u du by dx is 2x plus 3 so I obtained this expression 412 00:50:59.360 --> 00:51:07.440 here now the original question that was asked was to determine dy by dx so really I can't leave 413 00:51:07.440 --> 00:51:13.120 u in here but that's not a problem because I know what u is I'm the one who defined it I set it equal 414 00:51:13.120 --> 00:51:19.840 to the expression inside the bracket which is x squared plus 3x sorry sorry which was yes x squared 415 00:51:19.840 --> 00:51:28.480 plus 3x so I do cause of u becomes cause of x squared plus 3x times 2x plus 3 so I've written it 416 00:51:28.480 --> 00:51:38.720 in this form here so that's an example of the the chain rule applied to a function of one variable 417 00:51:38.720 --> 00:51:46.320 and you will have seen that before so now we're going to extend that definition of the chain rule 418 00:51:46.880 --> 00:51:53.680 to the case where we've got a function of more than one variable now in that last example 419 00:51:54.800 --> 00:52:01.760 we set u equal to the term inside the bracket so u is a function of the single variable x 420 00:52:02.720 --> 00:52:10.960 y was a function of u and u was a function of x only x both functions of single variables 421 00:52:10.960 --> 00:52:19.040 now when we in this example this chain rule we're going to look at the case when u is a function 422 00:52:19.040 --> 00:52:28.640 of two variables x and y so if I just if I can just take my diagram over to the slide 423 00:52:29.040 --> 00:52:35.600 just bear with me while I copy it there we are so this was the case of a function of a single 424 00:52:35.600 --> 00:52:44.400 variable of one variable y was a function of u which in turn was a function of x in this case now 425 00:52:45.440 --> 00:52:52.160 z is a function of u that's fine it's a function of a single variable but u is now a function of x 426 00:52:52.240 --> 00:53:01.040 and y that means we can calculate as before we can calculate the derivative of the variable at the 427 00:53:01.040 --> 00:53:08.080 root node with respect to u in other words dz by du similar to our single variable case there 428 00:53:08.720 --> 00:53:17.440 we just do z by du but now use a function of two variables so we must calculate the partial derivative 429 00:53:17.440 --> 00:53:23.360 with respect to each variable so we've got partial respect to u and the partial partial respect to x 430 00:53:23.360 --> 00:53:31.120 sorry and the partial with respect to y and then if we want the derivative of our function z with 431 00:53:31.120 --> 00:53:38.800 respect to x that's a partial derivative we simply start at the root node and travel down to the 432 00:53:38.800 --> 00:53:47.680 terminal node multiplying the derivatives on our way so the partial with respect to x becomes the 433 00:53:47.680 --> 00:53:57.840 derivative of z with respect to u times the partial derivative of u with respect to x now I think 434 00:53:57.840 --> 00:54:03.280 I've mentioned this before but why have I got a straight back d there and a curly d there well it's 435 00:54:03.280 --> 00:54:12.480 because z is a function of one variable so we just use the standard notation that we've always 436 00:54:12.480 --> 00:54:17.760 used for a derivative because we only dealt with derivatives of functions of single variables up 437 00:54:17.760 --> 00:54:23.520 to now and this is the notation we'd have seen a straight back d representing the derivative 438 00:54:23.520 --> 00:54:28.960 when we have functions of more than one variable functions like in this case a function of two 439 00:54:28.960 --> 00:54:34.560 variables we've got to introduce the curly d to show that it's a partial derivative that's all it is so 440 00:54:35.680 --> 00:54:42.560 we've covered this one the partial respect to x is the product of the derivatives down this branch 441 00:54:42.560 --> 00:54:50.320 now similarly we can get the partial of z with respect to y by starting at the root node z and 442 00:54:50.320 --> 00:54:58.800 traveling down the right hand branch of the tree to the terminal node y and we multiplied derivatives 443 00:54:58.800 --> 00:55:07.120 as we go along that journey so we'll have the derivative of z with respect to u times the 444 00:55:07.120 --> 00:55:17.760 partial derivative of u with respect to y and that's the formula given down here okay so we can now 445 00:55:17.760 --> 00:55:22.240 go ahead and look at an example 446 00:55:25.760 --> 00:55:31.760 so what do we have here so we've got a function z is equal to f of x y if you like 447 00:55:31.760 --> 00:55:39.040 this equal to 2x cubed plus x y plus y to the four all to the power six now 448 00:55:41.600 --> 00:55:46.400 the question here is do we need the chain rule for this and the answer is yes we do 449 00:55:46.480 --> 00:55:53.920 because we've got a function that's the power six function applied to another function the 450 00:55:53.920 --> 00:56:01.600 function inside the brackets it's probably more obvious to see if you had a sign out there rather 451 00:56:01.600 --> 00:56:06.320 than the power six that you know a function of a function but this is a function of a function 452 00:56:06.320 --> 00:56:11.360 you've got the power six function applied to the function inside the bracket so we're going to use 453 00:56:11.360 --> 00:56:18.080 the chain rule to calculate the partial derivatives with respect to x and with respect to y so we'll 454 00:56:18.080 --> 00:56:23.760 do we'll start off by doing what we normally do we've got function of a function or a composite 455 00:56:23.760 --> 00:56:31.760 function you prefer to call it that so z is going to be equal to u to the power six where u 456 00:56:32.560 --> 00:56:39.920 is set equal to the term inside the brackets which is standard practice you set the w variable u 457 00:56:39.920 --> 00:56:46.800 equal to whatever's inside the brackets in general that's the approach that we take we'll set u equal 458 00:56:46.800 --> 00:56:54.480 to 2x cubed plus x y plus y to the four and if that is u then z is equal to u to the six okay 459 00:56:55.760 --> 00:57:02.480 so uh i've copied that over to the slide here i've copied over my diagram my three diagram that i'm 460 00:57:02.480 --> 00:57:09.840 going to use so i need the full derivative that's a derivative with the straight back d of the single 461 00:57:10.560 --> 00:57:14.960 of z which is function of the single v able u i need that derivative and i need the two 462 00:57:14.960 --> 00:57:22.240 partials that's u with respect to x and u with respect to y and my formula first of all i'm 463 00:57:22.240 --> 00:57:27.600 going to calculate the partial derivative with respect to x so there's my formula there which 464 00:57:27.600 --> 00:57:34.320 i obtained by starting at the root node traveling down to the terminal node at x and multiplying 465 00:57:34.320 --> 00:57:41.680 the derivatives together as i go so first of all the derivative of z with respect to u well that's 466 00:57:41.680 --> 00:57:49.120 easy single variable to be the power power low it'll be six u to the five when i differentiate that 467 00:57:49.120 --> 00:57:55.040 there we are and i've got to multiply that with a partial derivative with respect to x so i want 468 00:57:55.200 --> 00:58:01.520 partial derivative of this term with respect to x now i could break it up and you know till 469 00:58:01.520 --> 00:58:07.440 become more confident with these type of things it's probably a good idea to break it up into the 470 00:58:07.440 --> 00:58:14.560 separate three derivatives and differentiate with respect to x so but let's see if we can do this 471 00:58:14.560 --> 00:58:20.800 without doing that just uh we've got to differentiate two x cubed with respect to x well that's easy 472 00:58:20.800 --> 00:58:26.400 because you know it's just a function of a single variable it's going to be six x squared 473 00:58:28.240 --> 00:58:34.240 leave the middle term for now differentiate y to the four with respect to x now it's an x derivative 474 00:58:34.240 --> 00:58:41.440 i'm calculating so y and any function of y will be treated as a constant and that includes y to the 475 00:58:41.440 --> 00:58:47.600 power four so y to the power four has been treats a constant differentiate that with respect to x 476 00:58:47.600 --> 00:58:54.400 that'll be zero so that just leaves me the middle term to differentiate with respect to x 477 00:58:55.120 --> 00:59:01.440 so here it is i've just isolated it here there you go it's an x derivative so y 478 00:59:01.440 --> 00:59:07.200 treats the constant so out it comes i've then just going to differentiate x with respect to x so 479 00:59:07.200 --> 00:59:15.680 that's just one and y times one is y so that will just be y when we differentiate so this 480 00:59:16.240 --> 00:59:24.000 term when i differentiate this term with respect to x i get six x plus six x squared sorry plus y 481 00:59:24.000 --> 00:59:32.160 there it is there and i've got to multiply that by six u to the five u was defined up here so i 482 00:59:32.160 --> 00:59:39.120 just plug that in there so i get six times this expression all to the power five don't forget it's 483 00:59:39.120 --> 00:59:44.720 raised to the power five when you differentiate so that's the answer there so i've now got to do 484 00:59:45.440 --> 00:59:56.560 the derivative with respect to y same approach really i look at my diagram and i've got to travel 485 00:59:56.560 --> 01:00:02.800 down from the root node to the terminal node that includes y multiplying derivatives on my way so 486 01:00:02.800 --> 01:00:10.160 i'll go down here z is a functional single variable u so i've got the full derivative dz by du and i've 487 01:00:10.160 --> 01:00:17.680 got to multiply that by the partial derivative du by dy so let's calculate these so i've got um 488 01:00:18.960 --> 01:00:26.880 dz partially z by dy is the full derivative z by u times the partial du by dy okay full derivative 489 01:00:26.880 --> 01:00:35.680 of dz by du z is equal to u to the six so that's we six u to the five there we are now this one i need 490 01:00:35.680 --> 01:00:41.680 a partial derivative with respect to y of this this term inside the bracket which involves 491 01:00:41.680 --> 01:00:50.080 three separate terms so i'll differentiate them one by one so the first term is a function of x only 492 01:00:51.520 --> 01:00:56.800 and it's a y derivative i want so we treat x and any function of x is a constant so you differentiate 493 01:00:56.880 --> 01:01:02.560 two x cubed with respect to y you'll get zero so that won't contribute let's do the last one first 494 01:01:02.560 --> 01:01:09.440 of all differentiate y to the four with respect to y you get four y cubed okay so that's fine 495 01:01:10.080 --> 01:01:15.680 four y cubed what about the middle term well let's have a look at it over here this is very 496 01:01:15.680 --> 01:01:21.680 similar to the last one except now we differentiate with respect to y so it's a y derivative so x gets 497 01:01:21.680 --> 01:01:28.000 three to the constant so we can take the x outside the operator there it goes differentiate y with 498 01:01:28.000 --> 01:01:36.880 respect to y i'll get one x times one is x so that's where that x comes from so i'll have six u to the 499 01:01:36.880 --> 01:01:46.880 five times x plus four y cubed i need my answer in terms of x so that requires me to substitute for 500 01:01:46.880 --> 01:01:52.880 u in here but u is just as given up here to the term that's inside the brackets there you go so i'll 501 01:01:52.880 --> 01:02:01.200 get six times this expression to the power five times x plus four y cubed so that's uh 502 01:02:04.000 --> 01:02:10.560 that's the derivative with respect to y of my function my original 503 01:02:11.120 --> 01:02:22.080 composite function my function of a function okay so let's have a look at another of these 504 01:02:22.080 --> 01:02:29.280 so here's a function z equals f of x y is sine of three x to the five y squared minus two x to the 505 01:02:29.280 --> 01:02:36.720 four y and i want to find the partial derivative with respect to x of that function so we'll do 506 01:02:36.800 --> 01:02:44.080 the same thing as we did before we'll use our diagram here we've got z will be a function of 507 01:02:44.080 --> 01:02:53.200 u which in turn will be a function of x and y so we set u equal to the expression inside the 508 01:02:53.200 --> 01:03:02.800 bracket so u will be as given here so then z will be equal to sine u okay i've set u equal to this 509 01:03:03.440 --> 01:03:12.320 bracket term so clearly z will just be sine u i want to get the partial respect to x so i start at 510 01:03:12.320 --> 01:03:18.880 the root node with z and i travel down to the terminal node with x and i multiply derivatives 511 01:03:18.880 --> 01:03:27.360 as i go along so let's do that so first of all i need dz by du well that's pretty easy 512 01:03:27.360 --> 01:03:38.160 um i need the derivative of sine u which is just cos u just a function of a single variable so sine 513 01:03:38.160 --> 01:03:44.160 differentiates to cos so it could cause you i've then got to do the derivative of this term here 514 01:03:44.160 --> 01:03:51.840 with respect to x so um you can do it term by term so let's have a look at that so i'm going to do 515 01:03:52.480 --> 01:04:09.360 d by dx of 3x to the 5 y squared minus partial d by dx of 2x to the 4 y like that 516 01:04:10.640 --> 01:04:19.840 no it's an x derivative so anything involved in y can come outside so i can actually take the 517 01:04:19.840 --> 01:04:23.120 3 y outside and that just leaves me 518 01:04:25.920 --> 01:04:35.680 x to the 5 to differentiate minus it's an x derivative so i can take out anything that 519 01:04:35.680 --> 01:04:41.920 does involve x so the 2 y can come outside and it leaves me x to the power 4 to differentiate 520 01:04:42.000 --> 01:04:50.000 so if i do this i've got 3 y squared times differentiate x to 5 i get 5x to the 4 minus 521 01:04:50.000 --> 01:05:02.240 2y times 4x cubed and if i work these out i get 15x to the 15x to the 4 y squared you know when i 522 01:05:02.240 --> 01:05:12.640 multiply that out 15x to the 4 y squared minus it'll become 8x cubed y and that's exactly what 523 01:05:12.640 --> 01:05:24.320 i've got on the at that line there okay so uh i'm almost done i'm almost done all i have to do now 524 01:05:24.320 --> 01:05:31.840 is replace u with the bracketed term the thing that i set equal to u at the very start so if i do 525 01:05:31.840 --> 01:05:41.440 that that will give me my partial derivative of this function with respect to x okay so that's 526 01:05:41.440 --> 01:05:49.520 fine so now we can do the same thing with respect to y so i set up my problem in a similar way i 527 01:05:49.520 --> 01:05:55.040 look at my diagram i've got the partial derivative with respect to y the root node is z the terminal 528 01:05:55.040 --> 01:06:00.960 node is y so i travel down the right hand branch and i multiply derivatives as i go along 529 01:06:01.680 --> 01:06:07.360 so i'll need the full derivative d set by d u because u is a function of a single variable 530 01:06:07.360 --> 01:06:14.240 and i'll need the partial derivative of u with respect to y partial derivative because u is a 531 01:06:14.240 --> 01:06:21.600 function of two variables x and y so let's set all of that up so i'm i'm i'm multiplying the 532 01:06:21.600 --> 01:06:28.560 derivatives on my way so i get this expression here this formula here for the partial derivative 533 01:06:28.560 --> 01:06:40.160 with respect to y so i need d by d u of sine u which is just cos u and i need partial d by dy 534 01:06:40.160 --> 01:06:47.120 of the bracketed expression there we are so i can do that just as on the previous slide with 535 01:06:47.120 --> 01:06:52.320 respect to x i can do this term by term and differentiate with respect to y so i've got d 536 01:06:52.960 --> 01:07:03.200 by dy of the first term which is 3x to the 5y squared from that i do minus the partial with 537 01:07:03.200 --> 01:07:13.280 respect to y of 2x to the 4y like that so that is just the next line after this one 538 01:07:14.240 --> 01:07:23.440 so i can do that you know i can it's a y derivative so x and any function of x can get pulled outside 539 01:07:23.440 --> 01:07:30.320 the operator so that just leaves me i can take the 3x to the 5 out so it'll just leave me partial 540 01:07:30.880 --> 01:07:39.840 d by dy of y squared minus well i want to it's a y derivative so x and any function of x can get 541 01:07:39.840 --> 01:07:47.920 taken outside so the 2x the 4 gets taken outside and that just leaves me y to differentiate so if i 542 01:07:47.920 --> 01:07:58.000 do this i will get 3x to the 5 times y squared minus 2x to the 4 the derivative of y with respect to 543 01:07:58.000 --> 01:08:06.480 y is just 1 so i can simplify this to give me 3 well it's it's it's it's fine as it is it's it's 544 01:08:06.480 --> 01:08:19.360 done really so that will give me oh sorry of course i didn't actually do the y derivative 545 01:08:20.160 --> 01:08:30.240 dear dear so i had to of course one thing i didn't do was differentiate the y squared to give me 2y 546 01:08:30.240 --> 01:08:39.840 so i can put all of this together to get 6x to the 5 y minus 2x to the 4 sorry about that so 547 01:08:40.800 --> 01:08:46.160 yeah don't forget of course to differentiate the term inside the bracket so i get obtained this 548 01:08:46.160 --> 01:08:51.840 expression here that just leaves me to replace the u by the bracket term and that would give me 549 01:08:51.840 --> 01:09:04.240 my answer for the partial derivative of z with respect to y okay so that's one example of the 550 01:09:04.240 --> 01:09:14.480 chain rule being applied to a function of two variables here's another slightly more complicated 551 01:09:14.480 --> 01:09:26.720 example in that last example we said u equal to the term in the bracket and that was a function 552 01:09:26.720 --> 01:09:39.520 of x and y in this case what do we have we've got a function that said that is a function of x and y 553 01:09:39.760 --> 01:09:50.160 but x and y are themselves the term a function of t so you know that could happen if you just think 554 01:09:50.160 --> 01:09:59.760 about you know you think about say a particle moving about you could have its x y you'd have 555 01:09:59.760 --> 01:10:08.320 its x y z coordinates but you could have that x and y dependent time for example so if you 556 01:10:08.320 --> 01:10:14.480 calculated the x y coordinates at a given time you would get certain values if you calculated let's 557 01:10:14.480 --> 01:10:21.600 say a second later you would get a different value so the x and y coordinates can vary with time for 558 01:10:21.600 --> 01:10:31.440 example so let's have a look at what goes on there then so here's my diagram at my root node i've got 559 01:10:31.520 --> 01:10:40.000 my z function which i've just said is a function of x and y it's a function of the two variables 560 01:10:40.000 --> 01:10:48.240 x and y set to c equal to f of x y x and y in turn are functions of the single variable t 561 01:10:49.600 --> 01:10:56.000 so that's what we've got now what derivatives do we need well set is a function of x and y so we 562 01:10:56.000 --> 01:11:00.720 need partial derivatives so we need the partial respect to x coming down the left branch and we 563 01:11:00.720 --> 01:11:09.120 need the partial respect to y coming down the right branch then x is a function of t only so we'll 564 01:11:09.120 --> 01:11:18.080 need the full derivative that's a straight back d dx by dt also y is a function of t only so we'll 565 01:11:18.080 --> 01:11:25.520 need the full derivative dy by dt so that's our diagram and that's going to allow us to calculate 566 01:11:25.520 --> 01:11:35.280 the derivative of our function z with respect to t and the way we do that is very similar to what 567 01:11:35.280 --> 01:11:45.040 we're doing earlier we we start at the root node and we travel to the nodes the terminal nodes that 568 01:11:45.040 --> 01:11:53.520 involve t and we add the left branch expressions to the right branch expressions in other words 569 01:11:53.520 --> 01:11:59.760 you go down the left branch first let's go down the left branch first you get partial dz by dx 570 01:12:00.640 --> 01:12:12.080 times dx by dt that's it there plus you must do this plus similar journey down the right branch 571 01:12:12.080 --> 01:12:22.080 partial dz by dy times dy by dt and that will give you the derivative of the original function 572 01:12:22.080 --> 01:12:30.240 z with respect to t so that's what we're going to do and it's always easier to illustrate this with 573 01:12:30.240 --> 01:12:38.800 an example so suppose we've got a function z is equal to f of x y and that's given by x squared 574 01:12:38.800 --> 01:12:47.520 plus y squared i've copied my diagram over z at the root node function of two variables x and y 575 01:12:47.520 --> 01:12:53.680 so i can differentiate with respect to x down the left branch and i can differentiate z with 576 01:12:53.680 --> 01:13:02.320 respect to y down the right branch and these are of course partial derivatives now x is a function 577 01:13:02.320 --> 01:13:09.120 of t only and it's given by t to the power four so i can differentiate x with respect to t 578 01:13:10.000 --> 01:13:16.560 similarly y is a function of t only and it's given by y is equal to sine t so i can differentiate y 579 01:13:17.280 --> 01:13:24.000 with respect to t and that would be a full derivative just like dx by dt with a full derivative 580 01:13:24.000 --> 01:13:29.040 because it's a function of a single variable there they are x is t to the four y sine t 581 01:13:29.040 --> 01:13:35.120 only one variable they're t but z on the other hand is a function of x and y so you need partial 582 01:13:35.120 --> 01:13:42.000 derivatives for that one so let's calculate the four derivatives that we need so we need the partial 583 01:13:42.000 --> 01:13:49.680 dz by dx well that's easy we treat y and any function of y is a constant so this is really 584 01:13:49.680 --> 01:13:56.400 just x squared plus a constant differentiate that with respect to x you get 2x plus 0 when you 585 01:13:56.400 --> 01:14:03.440 differentiate the constant so you get 2x similarly when you differentiate z with respect to y we treat 586 01:14:03.440 --> 01:14:09.600 x and therefore x squared is a constant so when you differentiate a constant you get 0 differentiate 587 01:14:09.600 --> 01:14:15.120 y squared with respect to y you get 2y so there's the partial with respect to y so we've got the 588 01:14:15.120 --> 01:14:21.440 partial respect to x which is 2x and we've got the partial respect to y which is 2y all that's left 589 01:14:21.440 --> 01:14:27.520 for us now to do is to calculate the partial respect to the partial sorry the full derivative of 590 01:14:28.320 --> 01:14:35.280 x with respect to t and the full derivative of y with respect to t x is for t to the fourth so 591 01:14:35.280 --> 01:14:42.960 differentiate that you get 4t cubed y is sine t differentiate that you get cos t so let's put 592 01:14:42.960 --> 01:14:53.120 all of this together we want the full derivative of z with respect to t okay so there it is dz by dt 593 01:14:53.120 --> 01:15:01.440 and the formula tells us it's the derivative stone the left branch plus the product of the 594 01:15:01.440 --> 01:15:06.640 derivative stone the right branch so that's what we've got there's my formula and I've got all the 595 01:15:06.640 --> 01:15:16.400 expressions I need up above so it's going to be 2x times 4t cubed plus 2y times cos t okay I know 596 01:15:16.400 --> 01:15:23.840 what x and y are so they're given to me in the question so I can substitute for x and y so what 597 01:15:23.840 --> 01:15:31.920 I'm going to get I'm going to get x was t to the fourth so sub that in so I'll get 8t to the four 598 01:15:32.560 --> 01:15:41.040 times t cubed and here I've got 2y cos t but I know that y is sine t so I'll get substitute 599 01:15:41.600 --> 01:15:50.800 y sine t in for y I'll get 2 sine t cos t multiply this out or simplify it if you prefer I get 600 01:15:50.800 --> 01:15:56.640 8t to the seven just the law of indices there multiplying t to four times t cubed you just add 601 01:15:56.640 --> 01:16:06.880 the powers to give you t to the seven and you've got plus two sine t cos t so that's how you do that 602 01:16:08.080 --> 01:16:14.720 this one actually since the functions we've been given are relatively simple we could actually 603 01:16:15.600 --> 01:16:21.680 have just substituted for x and y in here and we would just get said to be a function of 604 01:16:21.680 --> 01:16:27.760 the single variable t let's have a look at that so I'm saying we know what x is it's t to the fourth 605 01:16:27.760 --> 01:16:34.160 so sub it in there y is sine t so sub it in there so we get a function z that only involves t and 606 01:16:34.160 --> 01:16:40.720 then it's just differentiation of a function of a single variable in this case we're lucky because 607 01:16:40.720 --> 01:16:48.000 the functions are relatively simple and they allow us to do that without too much trouble but quite 608 01:16:48.000 --> 01:16:53.760 often the functions can be fairly complicated and doing this substitution approach will just 609 01:16:53.760 --> 01:16:59.120 make things quite difficult and you should really use the chain rule but let's just see it for this 610 01:16:59.120 --> 01:17:05.680 particular example and it'll check your answer at the same time so that's what I said so there's the 611 01:17:05.760 --> 01:17:13.120 function z we know what x is it's t to the fourth so sub it in and we know what y is it's sine t so 612 01:17:13.120 --> 01:17:20.800 sub that in so that's our line here simplify that we get t to the eight plus sine of t all squared 613 01:17:22.720 --> 01:17:29.360 differentiate that you get eight t to the seven we need the chain rule here so it's a function of 614 01:17:29.440 --> 01:17:36.880 a function so we're applying the square function to sine t so first of all let's see how do we 615 01:17:36.880 --> 01:17:42.000 differentiate the power we use the power law bring the two down take one away from so you get two 616 01:17:42.000 --> 01:17:49.360 sine t times the derivative of the thing in brackets so the derivative of sine t is cos t so that is 617 01:17:49.360 --> 01:17:54.800 my answer and if you look back to the previous slide you'll see that that is exactly what I had 618 01:17:54.800 --> 01:18:05.280 so we have verified our answer okay so um that's fine so that was an example 619 01:18:07.760 --> 01:18:15.280 if I just take over my diagram if I can take this over yeah and I'm just going to paste it down the 620 01:18:15.280 --> 01:18:22.880 corner here because I'm going to compare it with the next case going back to that example we've 621 01:18:22.880 --> 01:18:30.480 just completed we saw that z was a function of x and y where x and y themselves were in turn a function 622 01:18:31.280 --> 01:18:38.880 of a single variable t now there's no need that x and y have to be function of a single variable 623 01:18:38.880 --> 01:18:43.680 they could be a function of two variables three variables whatever we're going to look at the 624 01:18:43.680 --> 01:18:52.560 case when x and y are a function of two variables called u and v okay the idea is exactly the same 625 01:18:52.640 --> 01:19:03.120 as before so this is just slightly more complicated than the example we just did we've now got that 626 01:19:03.120 --> 01:19:10.240 x and y are a function of two variables rather than just the single variable t so let's see how we do 627 01:19:10.240 --> 01:19:19.360 that so I'm just saying up here let z equals f of x y b a differentiable function of x and y where 628 01:19:19.360 --> 01:19:28.960 x is a function of u and v and y is a function of u and v and u and x and y are both differentiable 629 01:19:28.960 --> 01:19:37.760 as well so if we have that we want the partial respect to u so let's say we're going to look at 630 01:19:37.760 --> 01:19:44.960 our root node and we're going to travel down the left branch until we reach u the terminal 631 01:19:44.960 --> 01:19:54.320 node with u and we're going to add to that the product derivatives as we travel in the right 632 01:19:54.320 --> 01:20:01.920 branch from the root node z to the terminal node with u same ideas in the previous example 633 01:20:04.160 --> 01:20:09.840 okay and we add the left branch to the right branch so what do we got so we want to go from 634 01:20:09.840 --> 01:20:16.480 root node to terminal node terminal node has to be u so and multiply derivatives on our way so we get 635 01:20:16.480 --> 01:20:23.600 the partial of z with respect to x multiplied by the partial of x with respect to u so there we are 636 01:20:23.600 --> 01:20:31.120 so that's that but there it is there plus similar journey here the partial of z with respect to y 637 01:20:31.760 --> 01:20:38.240 times the partial of y with respect to u so you're going from root node with z terminal node with u 638 01:20:38.240 --> 01:20:44.240 multiplying derivatives on your journey so that gives us the partial of z with respect to u 639 01:20:44.880 --> 01:20:52.480 we can do a similar thing for the partial of z with respect to v we're going to do the left branch 640 01:20:52.480 --> 01:20:59.520 we'll do the left branch first and we'll add to that the result from the right branch so let's do it so 641 01:20:59.520 --> 01:21:07.440 the partial of z with respect to x brings us to here times the partial of x with respect to v 642 01:21:08.400 --> 01:21:16.160 so that gives us that expression there plus similar journey in the right branch partial of z with respect 643 01:21:16.160 --> 01:21:22.480 to y times the partial of y with respect to v and that gives us that tip so these are the 644 01:21:22.480 --> 01:21:28.480 expressions that we use to calculate the partial of z with respect to u and the partial of z with 645 01:21:28.480 --> 01:21:36.400 respect to v when z is a function of the two variables x and y which themselves are both functions 646 01:21:36.480 --> 01:21:46.720 the two variables u and v right so let's have a look at an example so z is equal to f of x y 647 01:21:46.720 --> 01:21:55.120 and it's given by this function here x cubed times y squared where x is a function of uv given by 648 01:21:55.120 --> 01:22:01.360 two uv squared and y is also a function of the two variables u and v given by three u squared v 649 01:22:02.080 --> 01:22:08.400 and we're going to ask to find partial dz by du so we just take our formula that's our given formula 650 01:22:09.040 --> 01:22:16.400 and we'll take we'll start at the root node with z and we'll travel to the terminal node 651 01:22:17.520 --> 01:22:23.520 with u multiplying derivatives as we go we'll do that in the left branch and we'll do that in the 652 01:22:23.520 --> 01:22:30.080 right branch and we'll add the left branch result to the right branch result and that gives us our 653 01:22:30.080 --> 01:22:36.720 formula okay so we just follow the green path from root to terminal node in both the left branch 654 01:22:37.520 --> 01:22:50.800 and in the right branch so in this example I need to find the partial with respect of z with respect 655 01:22:50.880 --> 01:23:03.040 to x so I've got d by dx of x cubed y squared so I can take the y squared outside because it's an x 656 01:23:03.040 --> 01:23:09.680 derivative I'm calculating like it x cubed so if I differentiate that get y squared times 657 01:23:09.680 --> 01:23:18.960 three x squared so it becomes three x squared y squared and that's the result there now I can also 658 01:23:20.080 --> 01:23:32.640 calculate the partial derivative of z with respect to y so I've got d by dy of x cubed y squared so 659 01:23:32.720 --> 01:23:40.720 that means I treat x and any function of x as a constant so I get x cubed d by dy of y squared 660 01:23:40.720 --> 01:23:51.600 and that is just x cubed times two y so I get two x cubed y okay so now I also have to 661 01:23:52.400 --> 01:24:02.560 calculate the partials of x and y with respect to u so I do d by du of x which is 662 01:24:03.600 --> 01:24:10.960 two u v squared so anything that does involve u can come outside so about two v squared comes out 663 01:24:10.960 --> 01:24:20.240 du by d d by du partial derivative of u because I've taken the two v two v squared outside so it's 664 01:24:20.240 --> 01:24:28.160 just two v squared times one so that's just two v squared so that's that expression obtained okay so 665 01:24:28.240 --> 01:24:38.960 the next one that I need to calculate is the partial of y with respect to u so I get d by du of 666 01:24:39.680 --> 01:24:48.400 y which is three u squared v cubed and it's a u derivative so I can take anything that involves 667 01:24:48.400 --> 01:24:59.680 v outside so we get three v cubed d by du of u squared that's a u in there so it becomes three v cubed 668 01:25:01.120 --> 01:25:09.120 times two u when you differentiate that and that becomes six u v cubed and there we go that's 669 01:25:09.120 --> 01:25:16.000 that expression so we obtained the four expressions that we need and now we can use them to calculate 670 01:25:18.560 --> 01:25:27.840 the derivative partial d z by du okay so that's the formula remember we travel down from the root node 671 01:25:28.480 --> 01:25:33.600 to the terminal node in the left branch and we do the same thing in the right branch and we 672 01:25:33.600 --> 01:25:37.040 multiply the derivatives as we go and we add them together so that's what we're going to do now we've 673 01:25:37.040 --> 01:25:44.240 got all the information we need up above partial d z by dx is three x squared y squared times partial 674 01:25:44.240 --> 01:25:54.880 d x by du is two v squared plus partial d z by dy is two x cubed times partial dy by du which is six 675 01:25:54.880 --> 01:26:01.360 u v cubed I can multiply all this out and I get this expression here now question asked us for the 676 01:26:01.360 --> 01:26:08.000 partial d z by du and I've got x's and y's still mixed up here but I know what x is and I know what 677 01:26:08.000 --> 01:26:15.920 y is so I can substitute in for x and y so I'll have an x squared there so there's my x term up here 678 01:26:15.920 --> 01:26:22.720 so that goes in here and it's squared because x squared y squared so I take this term here 679 01:26:22.720 --> 01:26:30.640 and I square it there you go that's it there times v squared plus 12 x cubed sub in for x and cube it 680 01:26:31.440 --> 01:26:42.480 times y there's y there times u times v cubed there and if you simplify that you're to simplify 681 01:26:42.480 --> 01:26:47.840 that you can check this yourselves you would get this answer at the foot of the slide here 504 682 01:26:47.840 --> 01:26:56.640 du to the 6 v to the power 12 okay so we can do a similar calculation to calculate the partial 683 01:26:57.520 --> 01:27:05.760 derivative of z with respect to v so let's let's have a go at that we want the partial derivative 684 01:27:05.760 --> 01:27:14.000 of z with respect to v I'll actually leave that one as an exercise for yourselves um okay but one 685 01:27:14.000 --> 01:27:22.080 thing I want to show you before we finish is that suppose now in this example we would look at this 686 01:27:22.080 --> 01:27:27.920 and we say well our functions are reasonably straightforward we could actually just substitute 687 01:27:27.920 --> 01:27:36.720 x in here and y in here and calculate the partial derivatives directly with respect to u and v 688 01:27:38.080 --> 01:27:47.520 so if I do that said it's equal to x cubed y squared x is equal to this two u v squared so 689 01:27:47.600 --> 01:27:54.240 substitute in there and cube it times y squared so I'll have to square that term and if I do all 690 01:27:54.240 --> 01:28:00.720 that I obtain this expression here and I can easily differentiate this with respect to you 691 01:28:00.720 --> 01:28:08.320 because I treat v as a constant and any function of these so v to the power 12 gets treated as a 692 01:28:08.320 --> 01:28:17.120 constant and all I have to differentiate is the u to the 7 so I get 72 times 7 u to the 6 times v 693 01:28:17.120 --> 01:28:23.120 to the 12 and I simplified out I get this expression here which is exactly the same answer that I got 694 01:28:23.120 --> 01:28:28.960 using the full chain rule um in this case the functions were relatively straightforward that I 695 01:28:28.960 --> 01:28:36.160 could directly substitute them if I wanted to but in general they won't be and you should know how to 696 01:28:36.160 --> 01:28:44.320 use the full chain rule so as I said earlier there's an exercise for you find the partial derivative 697 01:28:44.320 --> 01:28:50.480 with respect of z with respect to v the answer is given you can do it both ways using the full 698 01:28:50.480 --> 01:28:58.400 chain rule and you can do it by substituting to check your answer so that's um the end of this 699 01:28:58.400 --> 01:29:06.320 lecture now you should be able to attempt the Mobius questions one and two and from the lecture 700 01:29:06.320 --> 01:29:12.480 notes you should be able to attempt tutorial questions one and two so these are the questions 701 01:29:12.480 --> 01:29:18.960 you should be able to attempt in the second class in the second lecture on partial differentiation 702 01:29:18.960 --> 01:29:23.360 we're going to look at the product rule for a function two variables we'll also look at the 703 01:29:23.360 --> 01:29:29.280 quotient rule for a function of two variables and we'll also look at higher order partial derivatives 704 01:29:29.280 --> 01:29:35.280 you know you'll remember that if you had a function for talking about functions of single variables if 705 01:29:35.280 --> 01:29:43.840 you had uh I don't know 3x to the 4 you could calculate the first derivative as 12x cubed 706 01:29:43.840 --> 01:29:50.560 then you could calculate a second derivative just by simply differentiating again 36x squared 707 01:29:50.560 --> 01:29:55.680 and so on if you wanted you can do the same thing for partial derivatives slightly more 708 01:29:55.680 --> 01:30:02.400 complicated of course but we're not going to look at derivatives higher than second order so 709 01:30:02.400 --> 01:30:08.720 that's what we'll be doing in the next class so I'll just stop the recording at that