Functions of several variables: Partial derivatives
Chain rules
First, we look at the chain rule for differentiating functions of one variable.
Chain rule for differentiating a function of one variable We consider the function \[y(t)=(3t^2-1)^5\] as being composed of the functions \[y=x^5\quad\text{and}\quad x=3t^2-1\] Then: \[\frac{\dd y}{\dd x}=5x^4\quad\text{and}\quad \frac{\dd x}{\dd t}=6t\] In terms of differentials we have\[\dd y = 5x^4\,\dd x\quad\text{and}\quad \dd x=6t\,\dd t\] Because \[x=3t^2-1\quad\text{and}\quad \dd x=6t\,\dd t\] we have \[\dd y=5(3t^2-1)^4 6t\,\dd t\] and thus\[\frac{\dd y}{\dd t}=\frac{\dd y}{\dd x}\cdot \frac{\dd x}{\dd t}\] where we can write the derivative \(\frac{\dd y}{\dd x}\), which initially is a function of \(x\), via \(x=x(t)\) again in terms of the variable \(t\). This last rule applies more generally, for any function \(y\circ x\), that is, for the composition of the functions \(y\) and \(x\).
We now discuss chain rules for differentiating functions of two variables.
First version of the chain rule If \(z=z(x,y)\) is a differentiable function of two variables, and \(x\) and \(y\) are differentiable functions of \(t\), then \(z\) is a function of \(t\) and \[\frac{\dd z}{\dd t}=\frac{\partial z}{\partial x}\cdot\frac{\dd x}{\dd t}+ \frac{\partial z}{\partial y}\cdot\frac{\dd y}{\dd t}\]
More generally, the following rule also is true.
Second version of the chain rule If \(z=z(x,y)\) is a differentiable function of two variables, and \(x\) and \(y\) are differentiable functions of two variables \(s\) and \(t\), then \(z\) is a function of \(s\) and \(t\), and \[\begin{aligned}\frac{\partial z}{\partial s} &=\frac{\partial z}{\partial x}\cdot\frac{\partial x}{\partial s}+ \frac{\partial z}{\partial y}\cdot\frac{\partial y}{\partial s} \\ \\ \frac{\partial z}{\partial t} &=\frac{\partial z}{\partial x}\cdot\frac{\partial x}{\partial t}+ \frac{\partial z}{\partial y}\cdot\frac{\partial y}{\partial t}\end{aligned}\]
An important application of the second chain rule is the conversion from Cartesian coordinates \(x, y\) to polar coordinates \(r,\varphi\) via the definitions \(x=r\cos\varphi, y=r\sin \varphi\).
Example of polar coordinates Consider the function \[z(x,y)=\frac{2xy}{x^2-y^2}\] where \[x=r\cos(\varphi)\quad\text{and}\quad y=r\sin(\varphi)\]
The definition of the function is simpler in polar coordinates \(r, \varphi\): \[z(r,\varphi) = \frac{2\cdot\bigl(r\cos(\varphi)\bigr)\cdot\bigl(r\sin(\varphi)\bigr)}{(r\cos\bigl(\varphi)\bigr)^2+\bigl(r\sin(\varphi)\bigr)^2}=\frac{2\sin(\varphi)\cos(\varphi)}{\cos^2(\varphi)-\sin^2(\varphi)}=\frac{\sin(2\varphi)}{\cos(2\varphi)}=\tan(2\varphi)\] After this rewriting of the function in polar coordinates you come to the conclusion that \[\frac{\partial z}{\partial r} = 0\quad\text{and}\quad \frac{\partial z}{\partial \varphi}=\frac{2}{\cos^2(2\varphi)}\] But this result also follows from the above chain rule. First, we just calculate the required partial derivatives: \[\begin{aligned} \frac{\partial z}{\partial x} &= \frac{2y\cdot (x^2-y^2)-2xy\cdot 2x}{(x^2-y^2)^2}=\frac{-2y(x^2+y^2)}{(x^2-y^2)^2}\\ \\ \frac{\partial z}{\partial y} &= \frac{2x\cdot (x^2-y^2)-2xy\cdot -2y}{(x^2-y^2)^2}=\frac{2x (x^2+y^2}{(x^2-y^2)^2}\\ \\ \frac{\partial x}{\partial r} &= \cos(\varphi)\qquad\qquad \frac{\partial x}{\partial \varphi}= -r\sin(\varphi)\\ \\ \frac{\partial y}{\partial r}&= \sin(\varphi)\qquad\qquad \frac{\partial y}{\partial \varphi}= r\cos(\varphi)\end{aligned}\] Now we can apply the chain rule: \[\begin{aligned} \frac{\partial z}{\partial r} &=\frac{\partial z}{\partial x}\cdot\frac{\partial x}{\partial r}+ \frac{\partial z}{\partial y}\cdot\frac{\partial y}{\partial r}\\ \\ &= \frac{-2y\,(x^2+y^2)}{(x^2-y^2)^2}\cdot \cos(\varphi)+ \frac{2x\,(x^2+y^2)}{(x^2-y^2)^2}\cdot \sin(\varphi) \\ \\ &= \frac{\bigl(2x\sin(\varphi)-2y\cos(\varphi)\bigr)\cdot\bigl(x^2+y^2\bigr)}{(x^2-y^2)^2} = 0 \\ \\ \frac{\partial z}{\partial \varphi} &=\frac{\partial z}{\partial x}\cdot\frac{\partial x}{\partial \varphi}+ \frac{\partial z}{\partial y}\cdot\frac{\partial y}{\partial \varphi}\\ \\ &=\frac{-2y(x^2+y^2)}{(x^2-y^2)^2}\cdot -r\sin\varphi+\frac{2x(x^2+y^2)}{(x^2-y^2)^2}\cdot r\cos(\varphi)\\ \\ &= \frac{\bigl(2ry\sin(\varphi)+2rx\cos(\varphi)\bigr)\bigl(x^2+y^2\bigr)}{(x^2-y^2)^2} \\ \\ &= \frac{\bigl(2r^2(\sin^2(\varphi)+\cos^2(\varphi)\bigr)r^2 }{(x^2-y^2)^2} = \frac{2r^4}{(x^2-y^2)^2} \\ \\ &= \frac{2r^4}{(r^2\bigl(\cos^2\varphi-\sin^2\varphi\bigr)^2} = \frac{2}{\cos^2(2\varphi)} \end{aligned}\] Much formula manipulation, but the example also shows that some functions are simpler in a another coordinate system than they are defined and that calculations are simpler.
You can formulate the chain rule when you use polar coordinates in the follwoing way:
Chain rule for polar coordinates If \(f(x,y)=f\bigl(r\cos(\varphi), r\sin(\varphi)\bigr)\) then \[\begin{aligned} \frac{\partial f}{\partial r} &= \frac{\partial f}{\partial x}\cdot\frac{\partial x}{\partial r}+ \frac{\partial f}{\partial y}\cdot\frac{\partial y}{\partial r} = \phantom{-}\,\,\frac{\partial f}{\partial x}\cdot\cos(\varphi)\;\,+\frac{\partial f}{\partial y}\cdot\sin(\varphi) \\ \\ \frac{\partial z}{\partial \varphi} &= \frac{\partial f}{\partial x}\cdot\frac{\partial x}{\partial\varphi}+ \frac{\partial f}{\partial y}\cdot\frac{\partial y}{\partial \varphi} = -\frac{\partial f}{\partial x}\cdot r\sin(\varphi)+\frac{\partial f}{\partial y}\cdot r\cos(\varphi) \end{aligned}\]
For functions of more than two variables one can derive similar chain rules for differentiation. For example, the following rule holds for functions of three variables.
Chain rule for functions of three variables If \(w=w(x,y,z)\) is a differentiable function of three variables, and if \(x\), \(y\) and \(z\) are differentiable functions \(t\), then \(w\) is a function of \(t\) and \[\frac{\dd w}{\dd t}=\frac{\partial w}{\partial x}\cdot\frac{\dd x}{\dd t}+ \frac{\partial w}{\partial y}\cdot\frac{\dd y}{\dd t}+\frac{\partial w}{\partial z}\cdot\frac{\dd z}{\dd t}\]