The Chain Rule

Finding derivatives of compositions of functions.
June 23, 2017—Dan Uhlman

Basic Compositions of Functions

You have already worked with derivative rules for many functions.
Find the derivatives for
sin(x)
,
5
x
,
ln(x)
and
x
e
:
In[]:=
D[Sin[x],x]
Out[]=
cos(x)
In[]:=
D[
5
x
,x]
Out[]=
5
4
x
In[]:=
D[Log[x],x](*notethatln(x)isinputasLog[x]inWL*)
Out[]=
1
x
In[]:=
D[
x

,x]
Out[]=
x

A composition of functions is one function put inside another, such as
sin(2x)
.
The
2x
function is put inside the
sin(x)
function. Our first guess at the derivative of
sin(2x)
would probably be
cos(2x)
.
What does the Wolfram Language say is the derivative of
sin(2x)
?
In[]:=
D[Sin[2x],x]
Out[]=
2cos(2x)
Our guess was partly correct; the answer does contain
cos(2x)
, but also has an extra factor of
2
. Let’s try another example.
Find the derivative of
sin(
3
x
)
:
In[]:=
D[Sin[
3
x
],x]
Out[]=
3
2
x
cos(
3
x
)
Again, we expected to see
cos(
3
x
)
, but there is another “extra” factor of
3
2
x
.
Can we predict where this extra factor is coming from?
Here are three more examples to help us with our prediction:
In[]:=
D[Sin[
14
x
],x]
Out[]=
14
13
x
cos(
14
x
)
In[]:=
D[Sin[Log[x]],x]
Out[]=
cos(log(x))
x
A note about logarithms in the Wolfram Language: In the Wolfram Language,
log(x)
is the same as
ln(x)
, the natural logarithm. The Wolfram Language uses
Log10[x]
for
log
10
(x).
In[]:=
D[
7x

,x]
Out[]=
7
7x

Notice that the argument of the “outside” function remains unchanged (the
7x
part in the last example).
Predict each derivative, then calculate the answer:
In[]:=
D[Sin[
x
],x]
In[]:=
D[Sin[Tan[x]],x]
In[]:=
D[
5x

,x]
In[]:=
D[
Sin[x]

,x]
In[]:=
D[
4
(Sin[x])
,x]
You might describe this rule to a friend as: Take the derivative of the outside function, then multiply by the derivative of the inside function.
Find the derivative of
g(
2
x
)
:
In[]:=
D[g[
2
x
],x]
Out[]=
2x
′
g
(
2
x
)
Using function notation, a composition of functions can be written as
f(g(x))
.
Predict the derivative of
f(g(x))
and then calculate the answer:
In[]:=
D[f[g[x]],x]
Out[]=
′
g
(x)
′
f
(g(x))
Notice that this answer is the derivative of
f
(with the same argument) multiplied by the derivative of g. This is called the chain rule:

x
f(g(x))=
′
g
(x)
′
f
(g(x))

Intermediate Examples

Multiple Applications of the Chain Rule

Challenge Yourself

FURTHER EXPLORATIONS
Using the Chain Rule with the Product Rule
Using the Chain Rule with the Quotient Rule
AUTHORSHIP INFORMATION
Dan Uhlman
6/23/17