14 | PARTIAL DERIVATIVES

This chapter of Single Variable Calculus by Dr JH Klopper is licensed under an Attribution-NonCommercial-NoDerivatives 4.0 International Licence available at http://creativecommons.org/licenses/by-nc-nd/4.0/?ref=chooser-v1 .

14.1 Introduction

In this chapter we start to explore functions with more than a single variable. For functions in two variables we have to consider rates of change in more than a single variable. Here we start to consider techniques of partial derivatives.

14.2 Function of two variables

The function
zf(x,y)
is a map from
2

->
. Figure 14.2.1 shows a graph of the function
f(x,y)
2
x
+
2
y
.
In[]:=
Plot3D[
2
x
+
2
y
,{x,-2,2},{y,-2,2},PlotLabel->"Figure 14.2.1",AxesLabel->{"x","y","z"},ImageSize->Large]
Out[]=
It no longer makes sense to consider the rate of change in the function with respect to a change in a single variable
x
using the techniques of single variable calculus. Instead, we consider the partial derivative.

14.3 Partial derivatives

Note that from the function
f(x,y)
2
x
+
2
y
we can treat one of the variables, say
y
, as a constant. Irrespective of the value of
y
, we will get the same first derivative of
f(x,y)
2
x
+
2
y
with respect to
x
. This is the partial derivative, shown in (), where we use the partial derivative symbol ∂ instead of
d
.
∂
∂x
(
2
x
+
2
y
)=2x
(
1
)
The Wolfram language confirms the results using the D function.
D[
2
x
+
2
y
,x](*Derivativewithrespecttox*)
Out[]=
2x
We can also consider the partial derivative of
f
with respect to
y
and treat
x
as a constant. This is shown in (2).
∂
∂y
(
2
x
+
2
y
)=2y
(
2
)
The Wolfram language confirms the results.
D[
2
x
+
2
y
,y](*Derivativewithrespecttoy*)
Out[]=
2y
​
Problem 14.3.1 Calculate the partial derivative in (3).
∂
∂x
(
2
x
y+2x+3y)
(
3
)
We treat
y
as any constant and calculate the partial derivative in (4).
∂
∂x
(
2
x
y+2x+3y)=2xy+2
(
4
)
The Wolfram Language confirms our solution.
In[]:=
D[
2
x
y+2x+3y,x]
Out[]=
2+2xy
Unlike our explanatory example where the rate of change in
x
was independent of
y
, we have that the rate of change in
x
is dependent on the value of
y
in this problem. Figure 14.3.2 visualizes the problem.
In[]:=
Plot3D[
2
x
y+2x+3y,{x,-3,3},{y,-3,3},PlotLabel->"Figure 14.3.2",AxesLabel->{"x","y","z"},ImageSize->Large]
Out[]=
​

14.4 Application of the partial derivative

In[]:=
age={56.,58.,61.,63.,67.}
Out[]=
{56.,58.,61.,63.,67.}
In[]:=
SeedRandom[1];​​bp=2age+RandomChoice[Range[-5,5,1],5]
Out[]=
{108.,115.,117.,128.,129.}
Figure 14.4.1 visualizes the data as a scatter plot.
In[]:=
ListPlot[Transpose[{age,bp}],PlotLabel->"Figure 14.4.1",AxesLabel->{"Age","Blood pressure"},GridLines->Automatic,ImageSize->Large]
Out[]=
In[]:=
ones={1,1,1,1,1};​​X=Transpose[{ones,age}]
Out[]=
{{1,56.},{1,58.},{1,61.},{1,63.},{1,67.}}
In[]:=
model=LinearModelFit[{X,bp}]
Out[]=
FittedModel
-0.127027#1+1.95946#2


y
=mx+b
(
5
)
ℒ
i
=
y
i
-

y
i
=
y
i
-(
mx
i
+b)
(
6
)
=
2
(108-m(56)-b)
+
2
(115-m(58)-b)
+
2
(117-m(61)-b)
+
2
(128-m(63)-b)
+
2
(129-m(67)-b)
(
7
)
In[]:=
cost=
2
(108-56m-b)
+
2
(115-58m-b)
+
2
(117-61m-b)
+
2
(128-63m-b)
+
2
(129-67m-b)
Out[]=
2
(129-b-67m)
+
2
(128-b-63m)
+
2
(117-b-61m)
+
2
(115-b-58m)
+
2
(108-b-56m)
In[]:=
cost[-0.127,1.959]
Out[]=
37.0823
In[]:=
ListPointPlot3D[{{-0.127,1.969,37}}]
Out[]=