# Chain rule for functions of two variables

Summary

2 variables, 1 variable

• If $$z=f\left( x,y \right)$$ and $$x=g(t)$$ and $$y=h\left( t \right)$$ then we can create a composite function

$z=F\left( t \right)=f\left( g\left( t \right),h\left( t \right) \right)$

• Example: $$z=f\left( x,y \right)=xe^y$$ , $$x=t^2$$ , $$y=4t+1$$ then $$z=F\left( t \right)=t^2e^{4t+1}$$
• If all functions are smooth then

$F'\left( t \right)=f'_x\left( x,y \right)x'\left( t \right)+f'_y\left( x,y \right)y'\left( t \right)$

• Example (continued). $$f'_x\left( x,y \right)=e^y=e^{4t+1}$$ , $$x'\left( t \right)=2t$$ , $$f'_y\left( x,y \right)=xe^y=t^2e^{4t+1}$$ and $$y'\left( t \right)=4$$ . We have

$F'\left( t \right)=e^{4t+1}2t+4t^2e^{4t+1}$

• We can confirm that this is correct by differentiating $$F\left( t \right)=t^2e^{4t+1}$$ with respect to $$t$$ .

Slope of a level curve

• $$z=f\left( x,y \right)=c$$ for some constant $$c$$ is a level curve for $$f\left( x,y \right)$$ . It is also an implicit relationship between $$x$$ and $$y$$ and $$y=y\left( x \right)$$ .
• The composite function is $$z=F\left( x \right)=f\left( x,y\left( x \right) \right)=c$$
• Taking the derivative of both sides using the chain rule:

$\frac{d}{dx}F\left( x \right)=f'_x\left( x,y \right)⋅1+f'_y\left( x,y \right)⋅y'=0$

• or (assuming $$f'_y\left( x,y \right)≠0$$ )

$y'=- \frac{f'_x\left( x,y \right)}{f'_y\left( x,y \right)}$

2 variables, 2 variables

• If $$z=f\left( x,y \right)$$ and $$x=g(s,t)$$ and $$y=h\left( s,t \right)$$ then we can create a composite function

$z=F\left( s,t \right)=f\left( g\left( s,t \right),h\left( s,t \right) \right)$

• Example: $$z=f\left( x,y \right)=xy^2$$ , $$x=s^2+t^2$$ , $$y=st$$ then

$z=F\left( s,t \right)=\left( s^2+t^2 \right)s^2t^2=s^4t^2+s^2t^4$

• If all functions are smooth then

$F'_s\left( s,t \right)=f'_x\left( x,y \right)x'_s\left( s,t \right)+f'_y\left( x,y \right)y'_s\left( s,t \right)$

$F'_t\left( s,t \right)=f'_x\left( x,y \right)x'_t\left( s,t \right)+f'_y\left( x,y \right)y'_t\left( s,t \right)$

• Example (continued). $$f'_x\left( x,y \right)=y^2=s^2t^2$$ , $$f'_y\left( x,y \right)=2xy=2\left( s^2+t^2 \right)st$$ , $$x'_s\left( s,t \right)=2s$$ , $$x'_t\left( s,t \right)=2t$$ , $$y'_s\left( s,t \right)=t$$ , $$y'_t\left( s,t \right)=s$$ . We have

$F'_s\left( s,t \right)=s^2t^22s+2\left( s^2+t^2 \right)stt=4s^3t^2+2st^4$

$F'_t\left( s,t \right)=s^2t^22t+2\left( s^2+t^2 \right)sts=4t^3s^2+2s^4t$

• We can confirm that this is correct by differentiating $$F\left( s,t \right)=s^4t^2+s^2t^4$$ with respect to $$s$$ and $$t$$ .