next up previous contents
Next: GradientsNormals, Level Curves Up: Computational Labs in Mathematica Previous: Partial DerivativesDifferentials, and

Chain Rule for Partial Derivatives

Objectives

In this lab we will get more comfortable using some of the symbolic power of Mathematica. In the process we will explore the Chain Rule applied to functions of many variables.

Derivatives Along Paths

A function is a rule that assigns a single value to every point in space, e.g. w=f(x,y) assigns the value w to each point (x,y) in two dimensional space. If we define a parametric path x=g(t), y=h(t), then the function w(t) = f(g(t),h(t)) is univariate along the path. The derivative can be found by either substitution and differentiation,

displaymath272

or by the Chain Rule,

displaymath273

Let's pick a reasonably grotesque function,

displaymath274

First, define the function for later usage:

       f[x_,y_] := Cos[
                        x^2 y - Log[ (y^2 +2)/(x^2+1) ]	
                      ]
Now, let's find the derivative of f along the elliptical path tex2html_wrap_inline292 , tex2html_wrap_inline294 . First, by direct substitution. Find w(t);
       woft = f[ 4 Cos[t], 9 Sin[t] ]
The derivative can then be found using
       dwdt1 = D[ woft, t]
How would you have liked to do that by hand?

Now let's try using the Chain Rule. First, define the path variables:

       xx = 4 Cos[t]; yy = 9 Sin[t];
and now let's do the Chain Rule:
       crule = D[f[x,y],x] D[xx,t] + D[f[x,y],y] D[yy,t]
Notice that this has variables x,y and t. That is because we have not substituted the path in for x and y. To do this, we will use the substitution operation in Mathematica, `/. ->'. Try this to find the final form of tex2html_wrap_inline306 :
       dwdt2 = crule/.{x->4 Cos[t], y->9 Sin[t]}
To see that the two methods yield the same answer, try subtracting them and simplifying:
       Simplify[dwdt1 - dwdt2]
If you did everything correctly, the result should be `0.'

Multi-Variable Chain Rule

Essentially the same procedures work for the multi-variate version of the Chain Rule. Try finding tex2html_wrap_inline310 and tex2html_wrap_inline312 where r and tex2html_wrap_inline316 are polar coordinates, that is tex2html_wrap_inline318 and tex2html_wrap_inline320 . First, take derivatives after direct substitution for tex2html_wrap_inline322 ,

       wrtheta = f[ r Cos[theta], r Sin[theta] ]
Then try using the Chain Rule directly,

displaymath308

and then substituting, which in Mathematica can be accomplished using the substitution

       /.{x -> r Cos[theta], y -> r Sin[theta]}

Finally

Try a couple of homework problems. In particular, you may want to give some of the implicit differentiation problems a whirl.


next up previous contents
Next: GradientsNormals, Level Curves Up: Computational Labs in Mathematica Previous: Partial DerivativesDifferentials, and

James Powell
Fri Feb 14 12:47:33 MST 1997