# Justifying the multi-variable chain rule to students

Suppose that $f(x,y,z) = x + 2xy^2 - yz$, and that $\gamma(u,v) = \langle uv, u\sin(v), u\cos(v)\rangle$. Use the chain rule to calculate $\partial(f \circ \gamma)/\partial u$.

This is an exercise that typically shows up in a multi-variable calculus course. Sometimes the bit explicitly asking students to use the chain rule isn't there. The chain rule here is the fact that

$$\operatorname{D}(f \circ \gamma) = \operatorname{D}\!f(\gamma) \operatorname{D}\!\gamma\,,$$

so properly responding to this exercise entails calculating the vectors $\operatorname{D}\!f(\gamma)$ and $\operatorname{D}\!\gamma\,,$ multiplying them, and picking out the coordinate corresponding to $\partial u$ (or some semblance of that). But many students tell me that this is dumb: why deal with all those derivative matrices when you can just write the the composite function and take the partial derivative of that?

$$\frac{\partial(f \circ \gamma)}{\partial u} = \frac{\partial}{\partial u} \big( uv + 2u^3\sin^2(v) - u^2\cos(v)\sin(v) \big) = \dotsb$$

How can you respond to these students? How can you explain the utility of using the multi-variable chain rule over just writing out the composite function? And is there a better way to ask this sort of exercise that makes any advantages of using the chain rule clear?

• If you really want them to use the chain rule, why not ask an exercise where one need the full derivative? Change of variable is one example where one needs it; you can also ask for the kernel of a derivative (e.g. to use the implicit function theorem), or ask for the image of a non-coordinate vector, etc. – Benoît Kloeckner Jun 10 '18 at 18:27
• Even if you ask for the full derivative, they can still compute the composite and then the partial derivatives individually. – Mike Pierce Jun 10 '18 at 19:59
• "Even if you ask for the full derivative, they can still compute the composite and then the partial derivatives individually": yes, but then the computation is no longer easier that way. And one needs to understand how to gather and interpret these coefficients (e.g. to compute the determinant). – Benoît Kloeckner Jun 11 '18 at 9:42
• Another remark: the multivariate chain rule looks actually simpler than the univariate one: you simply compose derivatives. Of course, you need to compose derivatives at the right point, but in fact it can enlighten the one-variable formula quite a bit (the product there is a composition, of 1D matrices). – Benoît Kloeckner Jun 11 '18 at 9:45

You can tell them the values of some of the partial derivatives without giving them the entire function. This prevents the students from creating the composite function, since they don't even know one of the pieces of it. For example:

You know from your chemistry class that for a fixed amount of gas, the pressure, volume, and temperature are related by $PV = nRT$ where $n$ and $R$ are constants. Suppose that right now, $P = 10$ kPa, $V = 8$ L, and $T = 300^\circ$. If the temperature is increasing at a rate of $10^\circ$ per second and the pressure is decreasing at $2$ kPa per second, how fast is the volume changing?

You could also mix it up a little bit, and tell them $\frac{dP}{dt} = -2$ kPa per second but then give them a function $T = 10 + 3t - 4t^2$ and tell them that $t = 2$.

And if you want to go further, you can make $T$ and $P$ depend on more than just time; toss in another parameter, again sometimes giving them the values of the partial derivatives and sometimes giving them functions.

• I don't see how any of this requires the multi-variable chain rule though. Don't you just take the implicit derivative of $PV=nRT$ with respect to time and fill in the blanks and solve for $\mathrm{d} V/\mathrm{d} t$? Each of $P$, $V$, and $T$ are $\mathbb{R}^1 \to \mathbb{R}^1$ functions. I think one would have to make $T$ and $P$ depend on more than one parameter (say $t$ and $x$ are your parameters), but then the setup of the question may have to get whacky since you'd have to relate the partials $T_t$, $T_x$, $P_t$, and $P_x$ somehow. – Mike Pierce Jun 12 '18 at 14:02
• My experience is that the students will happily use the multivariable chain rule here, but you are correct that realistically they don't need it. So really this answer isn't very good unless it later gains a second parameter that is reasonable to put into the question. Can I downvote my own answer? :P – Chris Cunningham Jun 12 '18 at 14:45
• That's interesting that you're students are happy to use the multivariable chain rule (to be honest though, I'm not sure myself what functions I would look at the composite of in your example). What level of students do you show this sort of problem? I'm TAing an Intro to Vector Calculus course now, and the students avoid $D(f \circ \gamma) = Df(\gamma) D\gamma$ every time, and will instead write out the composite function and compute the coordinate-wise partial derivatives to fill in the entries of $D(f \circ \gamma)$ one at a time. But my students haven't taken linear algebra yet. – Mike Pierce Jun 12 '18 at 15:38
• I'm even farther away from answering your question than I thought; my students are computing $\frac{\partial V}{\partial t} = <\frac{\partial V}{\partial P}, \frac{\partial V}{\partial T}> \cdot <\frac{\partial P}{\partial t}, \frac{\partial T}{\partial t}>$. Then they would compute similarly, "one entry at a time," as you said, to find $\frac{\partial P}{\partial x}$ if these intermediate functions $P$ and $T$ depended on both $t$ and $x$. I've never presented my students with the matrix multiplication form you are talking about ("Calculus III" students, like sophomores). – Chris Cunningham Jun 12 '18 at 17:21

I think that the thing is to introduce meaning to the intermediate variables. Then each of $f,\gamma$ in $f\circ \gamma$ have meaning themselves. A physics example might have $f$ being the energy of a system and $\gamma$ be the time-evolution of the system. Now the intermediate variables mean things like position and momentum and we care about $Df$ and $D\gamma$ for their own sake.

Further, you can now have these functions "hot-swappable". That is, what if you vary $\gamma$ or the potential energy part of $f$? What happens to the composite?

Otherwise, the students are basically correct; it is easier to not add in a bunch of extra machinery.

• You wouldn't happen to know if/when your physics example naturally comes up in the physics classes that undergraduates take, do you? Or a reference for that so I can become comfortable with it would be cool too, if you have one readily in mind. :) I like the idea of having an exercise where $Df$ and $D\gamma$ are hot-swappable. – Mike Pierce Jun 10 '18 at 16:43
• I don't have anything written up, but I'd probably do something with harmonic oscillators. (or maybe pendulums) The potential energy comes from Hooke's law and kinetic is momentum squared as usual. Conservation of energy says that the derivative of energy should be zero, so you can use that to say things about what $D\gamma$ should be. Things like this show up in classical mechanics. – Adam Jun 11 '18 at 15:03

The underlying issue can be phrased in your terms. The problem is not to compute $\mathrm{D}(f \circ \gamma)$; the problem is to compute

$$\mathrm{D}(f \circ \gamma) \; \widehat{e}_1 = \mathrm{D}f(\gamma)\; \mathrm{D}\gamma \;\widehat{e}_1$$

What's going on is that you are insisting computing this in an inefficient manner. You insist that students compute the covector-matrix product $\mathrm{D}f(\gamma)\; \mathrm{D}\gamma$ first and then right multiply by $\widehat{e}_1$, when its much more efficient to first compute $\mathrm{D} \gamma \; \widehat{e}_1$ product and then left multiply by $\mathrm{D}f(\gamma)$.

This is further exacerbated by the fact that the product $\mathrm{D} \gamma \; \widehat{e}_1$ can itself be computed directly; you can obtain its first column without bothering with the rest of the matrix. You shouldn't be computing the entire matrix $\mathrm{D} \gamma$ when solving this problem.

If you cut out the waste, applying the multi-variable chain rule here is the same thing as computing (in the traditional notation that I hate)

$$\frac{\partial(f \circ \gamma)}{\partial u} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial u} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial u} + \frac{\partial f}{\partial z}\frac{\partial z}{\partial u}$$

which is much more likely to be viewed as an improvement over computing the composite, and students can be encouraged to see the product $\mathrm{D}f(\gamma) \; \mathrm{D} \gamma$ as showing part of the recipe for how to determine what calculation is the correct one.

• I realize it's not a good exercise to ask to compute the whole derivative of the composite function just for one component. In the example I gave, I think the bit about only wanting the component with respect to $u$ was added with the intent to make it easier to grade (???) since it was on an exam. But anyways, even the exercises in their full form, like the exercises at the end of the chapter on the chain rule, don't require the chain rule when you just take partial derivatives of the composite directly, which is really my issue here. – Mike Pierce Jun 13 '18 at 14:03