Professional Documents
Culture Documents
P1 Calculus II Partial Differentiation & Multiple Integration
P1 Calculus II Partial Differentiation & Multiple Integration
P1 Calculus II Partial Differentiation & Multiple Integration
P1 Calculus II
Partial Differentiation & Multiple Integration
4 lectures, MT 2014
Rev November 17, 2014
Course Page
David Murray
david.murray@eng.ox.ac.uk
www.robots.ox.ac.uk/dwm/Courses/1PD
Introduction
So far in your explorations of the differential and integral calculus, you have considered
only functions of one variable: y = f (x), and all that.
But you do not have to look too hard to find quantities which depend on more than one
independent variable. The pressure in an oil field will depend on latitude, longitude and
depth, and no doubt will change over time p = p(, , d, t). What is the change
of pressure when these variables change? How might one integrate quanities over the
complete oil field to find, say, the yield?
This set of lectures answers the questions of how our notions of differentiation and
integration can be extended to cover multiple variables.
Grey Book Syllabus (from Weblearn)
Partial differentiation: the chain rule and simple transformations of first-order (not
second-order) partial differential coefficients. Multiple integrals and their evaluation,
with applications to finding areas, volumes, masses, centroids, inertias etc. (excluding
line and surface integrals and using spherical and cylindrical coordinate systems only).
At the end of this course students will:
Be familiar with the basic operations of calculus of functions of several variables.
Understand and perform partial differentiation on a function of multiple variables.
Be able to use the chain rule on partial differentials and simple transformations of
1st order partial differential coefficients.
Understand the concept of a Jacobian and its use
Be able to evaluate multiple integrals and use this to find areas, volumes, masses,
centroids, moments of inertia, etc.
0/2
Lecture Content
1. The partial derivative. First and higher partial derivatives. Total and partial differentials, and their use in estimating errors. Testing for total (or perfect) differentials. Integrating total differentials to recover original function.
2. Relationships involving first order partial derivatives. Function of a function. Composite functions, the Chain Rule and the Chain Rule for Partials. Implicit Functions.
3. Transformations from one set of variables to another. Transformations as old in
terms of new and new in terms of old. Jacobians. Transformations to Plane,
spherical and polar coordinates. What makes a good transformation? Functional
dependence. Shape.
4. Double, triple (and higher) integrals using repeated integration. Transformations,
the use of the Jacobian. Plane, spherical and polar coordinates.
Tutorial Sheets
The tutorial sheet associated with this course is
1P1H Calculus 2: Partial Differentiation and Multiple Integrals
Reading
James, G. (2001) Modern Engineering Mathematics, Prentice-Hall, 3rd Ed.,
ISBN: 0-13-018319-9 (paperback).
Stephenson, G. (1973) Mathematical Methods for Science Students, Longman
Scientific & Technical, 2nd Ed., ISBN: 0-582-44416-0 (paperback).
Stephensons book is a suitable introductory text for your first year. It is divorced
from applications, and is now looking a bit dull. Good for basic problem bashing
though.
Kreyszig, E. (1999) Advanced Engineering Mathematics, John Wiley & Sons,
8th Ed., ISBN: 0-471-15496-2 (paperback).
Course WWW Pages
Pdf copies of these notes (in colour), copies of the lecture slides, the tutorial sheets,
corrections, answers to FAQs etc, will be accessible from
www.robots.ox.ac.uk/dwm/Courses/1PD
Only the notes and the tute sheets get put on weblearn.
Lecture 1
Total and Partial Derivatives and Differentials
1.1
1.1.1
Suppose we want to make a real function f of some real variable x. We certainly need
the function recipe, but we should also specify a range R of admissible values for x for
which x is mapped onto y by y = f (x). We might have y = f (x) = x 2 , with R being
the interval 1 x 1. Note that with this definition it is meaningless to ask what
is f (2)?. Often, however, the range is not specified: the assumption then is that
the range is such as to make y real. For example, if y = (1 + x)1/2 we would assume
that 1 < x. (Those of you experienced in writing functions in a computer language
will know the importance of setting proper ranges for input variables. Without them,
a program may crash.)
1.1.2
in which
(1.1)
(1.2)
xa
1/2
f(x)
f(a)
<
<
a
Figure 1.1: Neighbourhood for continuity for a function of one variable.
1.1.3
Tends to tangent
as x tends to zero
f(x+ x)
f= f(x+ x) f(x)
f(x)
x
x
x+ x
(1.3)
1.2
1/3
The big changes we will encounter take place when going from n = 1 variables to n > 1
variables. So for much of the time we can keep the page uncluttered by dealing with
functions of only n = 2 variables, as in f = f (x, y ).
As illustrated in Fig. 1.3, functions of two variables are conveniently represented graphically using the Cartesian axes Oxy z. The function representation is a surface, as
opposed to a plane curve for a one variable function. It is of course progressively
harder to represent functions of more than two variables.
(a)
(b)
2
f(x,y)
f(x,y)
0.5
0
1
0.5
0
5
1
5
0
y
0
5 4
(c)
2
x
0
5 4
2
x
(d)
Figure 1.3: Surface plots of (a) x 2 + y 2 3, (b) (x + y )(x y ), (c) exp[(x 2 + y 2 )/10] sin(2x) cos(4y ),
and (d) |(x y )|1/2 . (The Matlab code for such plots is given as an Appendix.)
1/4
1.2.1
(1.4)
we have
|f (x, y ) f (a, b)| < .
(1.5)
Or equivalently, as before,
lim
(x,y )(a,b)
(1.6)
Note that for functions of more variables f (x1 , x2 , x3 , ...) the neighbourhood would be
defined by (x1 a)2 + (x2 b)2 + (x3 c)2 + . . . < 2 . The 2-variable case is illustrated
in Figure 1.4.
f(x,y)
f(a,b)
project onto
surface
y
x
circle, radius
at (x,y)=(a,b)
1.3
The extension of the idea of continuity to functions of several variables was direct.
Extending the notion of the derivative is not quite as simple the slope or gradient
of the f (x, y ) surface at (x, y ) depends on which direction you move off in.
The key idea is to consider the gradient in a particular direction and the obvious
directions are those along the xaxis and the y axis.
Now, if one wants to move off from (x, y ) in the x direction, one has to keep y fixed,
and vice versa.
1/5
Figure 1.5 shows the geometrical interpretation of the partial derivatives of a function
of two variables.
f(x,y)
y = constant
plane
Slope is
f
xy
x
x
f(x,y)
x = constant
plane
Slope is
f
yx
y
Figure 1.5: Interpreting partial derivatives as the slopes of slices through the function
1.3.2
Given that the list of variables is known, and the one being varied is explicit, writing
the the held constant subscripts after the derivative is unnecessary. The subscripts
are often omitted, but you may wish to leave them in until you are more familiar with
the subject. Another commonly used shorthand (but one which you, like me, might
find unhelpful when writing by hand) is
f
f
fx =
and
fy =
.
(1.8)
x
y
1/6
1.3.3
If we are dealing with a function of more variables, we keep all but the one variable
constant. Eg for f (x1 , x2 , x3 , ...) we have
The partial derivative again ...
f
f (x1 , x2 , [x3 + x3 ], x4 , . . .) f (x1 , x2 , x3 , x4 , . . .)
f x3 =
= lim
x3 0
x3
x3
1.4
Its definition indicates that actually doing partial differentiation is exactly the same
as normal differentiation with respect to one variable, while all the others are treated
as constants.
Examples.
Q: Find the first partial derivatives of f (x, y ) = x 2 y 3 2y 2 .
A:First assume y is a constant, then x:
fx = 2xy 3
and
fy = 3x 2 y 2 4y
(1.9)
2
+y 2 )
sin(xy 2 )
A:
2
(1.10)
(1.11)
(1.12)
fx = 1/x
(1.13)
and fy = 1/y
fx fy = 1/xy = e f (x,y ) .
1.5
(1.14)
Although you do not need to consider complicated relationships involving 2nd order
derivatives, you do need to know how to find them. It is very obvious! fx and fy are
(well, probably are) perfectly good functions of (x, y ). An example of the notation
used is:
2f
=
fx = fxx
x 2
x
(1.15)
1/7
Example.
f (x, y )
fx
fy
fxx
fy y
=
=
=
=
=
x 2 y 3 2y 2
2xy 3
3x 2 y 2 4y
2y 3
6x 2 y 4 .
(1.16)
(1.17)
(1.18)
(1.19)
(1.20)
2f
fx = fy x =
: in this case, 6xy 2
y
y x
(1.21)
2f
fy = fxy =
: in this case, 6xy 2 .
x
xy
(1.22)
and
f (x, y ) = e (x +y ) sin(xy 2 )
2
2
fx = e (x +y ) [2x sin(xy 2 ) + y 2 cos(xy 2 )]
2
2
fy = e (x +y ) [2y sin(xy 2 ) + 2xy cos(xy 2 )]
fy x = e (x +y ) [4x 2 y cos() + 2y cos() 2y 3 x sin()
2y [2x sin() + y 2 cos()]]
2
2
= e (x +y ) [sin()[2y 3 x + 4xy ] + cos()[4x 2 y + 2y 2y 3 ]]
2
2
and fxy = e (x +y ) [2y 3 cos() + 2y cos() 2xy 3 sin()
2x[2y sin() + 2xy cos()]]
2
2
= e (x +y ) [sin()[2xy 3 + 4xy ] + cos()[2y 3 + 2y 4x 2 y ]]
(1.23)
(1.24)
(1.25)
(1.26)
(1.27)
(1.28)
1/8
Example.
Q: For a general function f show that
3 4
5
f
3f
3f
=0
xy x
2 xy y x 2
(1.29)
(1.30)
(1.31)
1.6
Although total derivatives have fraction-like qualities, this is NOT the case with partial
derivatives.
Example.
Q: Find dy /dx given y = u 1/3 , u = v 3 and v = x 2 .
A:
dy
dy du dv
1
=
(1.32)
(1.33)
1/9
WRONG!
(1.34)
In fact, we will be able to show after studying implicit functions that if we have any
function f (x, y , z) = 0, then
x y z
= 1.
y z x
Partial derivatives, unlike total derivates, do not behave as fractions.
Although we CAN write down expressions like df = . . .
We CANNOT write down f = . . ..
If you ever think that you are dividing partials, THINK AGAIN!
1.7
(1.35)
(1.36)
f
x
y +y
x +
f
y
y .
x
(1.38)
1/10
f y +y
x y
means
f
x y
where
so that
2
y +y
f
f
f
+
y
x y
x y
y x
(1.40)
and
f
x +
f
x
2f
y x
xy +
f
y .
y
(1.41)
f
f
dx +
dy
x
y
(1.42)
f
x dx
and
f
y dy .
Function surface
y
f dy
y
f+df
y+dy
f
f dx
x
y
x
x+dx
Figure 1.6: Total differential as the sum of partial differentials. Remember that dx and dy are infinitesimals.
1.7.1
1/11
Example.
Q: A material with a linear temperature coefficient is made into a block of sides x,
y , z measured at some temperature T . The temperature is raised by a finite T . (a)
Derive the new volume of the block. (b) Then let T dT and find the change using
the total differential.
A: (a) Exactly:
V + V = x(1 + T )y (1 + T )z(1 + T ) = V (1 + T )3 .
(1.43)
A: (b) The volume of the block is V = xy z . Using the expression for the total
differential
dV = y zdx + xz dy + xy dz
= y zx(dT ) + xzy (dT ) + xy z (dT )
= 3V dT
(1.44)
(1.45)
(1.46)
Thus V + dV = V (1 + 3dT ). This answer using the total differential is exact in the
limit as the small T in part (a) tends to zero and becomes dT in part (b).
1.7.2
Note that our expression 1.42 is an exact one for df in the limit as dx and dy tend to
zero. If x and y are just small rather than infinitesimally small then
f
f
f
x +
y .
x
y
(1.47)
Recalling the expression for Taylors expansion in one variable, you may guess that this
is a Taylors expansion to 1st order in two variables. In other words
f (x + x, y + y ) f (x, y ) +
f
f
x +
y .
x
y
(1.48)
As we are already off piste, we might as well see how it continues! To 2nd order
f (x + x, y + y ) f (x, y )
(1.49)
f
f
1st : +
x +
y
x
y
2
2
2
1
f
f
f
2
2
2nd : +
(x) + 2
(x)(y ) +
(y )
2!
x 2
xy
y 2
3rd : + . . . think binomial! . . .
1/12
1.7.3
Suppose we are given some expression p(x, y )dx+q(x, y )dy . Can we determine whether
it is the total differential of some function f (x, y )?
Now, if it is,
df = p(x, y )dx + q(x, y )dy .
(1.50)
f
x
and q(x, y ) =
f
y
(1.51)
q
2f
=
x
xy
(1.52)
(1.53)
Example. Show that there is no function having continous second partial derivatives
whose total differential is (xy dx + 2x 2 dy ).
Set p = xy and q = 2x 2 . Then
p
=x
y
1.7.4
6=
q
= 4x .
x
(1.54)
Suppose we found p(x, y )dx + q(x, y )dy to be total differential using the above test.
Could we recover the function f ? To recover f we must perform the reverse of partial
differentiation.
As f /x = p(x, y ):
Z
f = p(x, y )dx + g(y ) + K1
(1.55)
where g is a function of y alone and K1 is a constant. You can see that we need
the g(y ) because when we differentiate with respect to x it vanishes. As far as x is
concerned, g(y ) is a constant of integration.
1/13
Similarly,
Z
f =
(1.56)
We now need to resolve the two expressions for f , and this is possible, up to a constant
K, as the following example shows.
Example. Let f = xy 3 + sin x sin y + 6y + 10 but pretend we do not know it.
Instead we are asked
Q: Determine whether
(y 3 + cos x sin y )dx + (3xy 2 + sin x cos y + 6)dy
(1.57)
(1.58)
(1.59)
(1.60)
and
(1.61)
So
f = xy 3 + sin x sin y + 6y + K1 .
(1.62)
1/14
10
f(x,y)
8
6
4
2
0
1
0
y
0
1 2
1
x
The following is some simple Matlab code to give a surface plot of a function.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% surface plot script
%
% vectors of grid x and y positions
x
= [ -2:0.1:2];
%
%
%
%
%
%
1/15
y
= [ -1:0.1:1];
turn these in array suitable for surface plotting
[X , Y ] = meshgrid (x , y );
find the function values at each point in mesh
Xsq
= X .* X ;
Ysq
= Y .* Y ;
Z
= 0.6* Xsq .* Xsq + 0.1* Xsq .* Ysq - 2.*( Xsq - Ysq ) +5;
initial graphics
set ( gca , FontSize , 18);
colormap ( default );
brighten (0);
now plot surface
surfc (X ,Y , Z );
label axes
xlabel ( x ); ylabel ( y ); zlabel ( f (x , y ) );
save as postscript ( vector graphics )
print ( - depsc , surfplot . eps );
save as png image
print ( - dpng , surfplot . png );
1/16
A.3 [**] For interest: Finding maxima, minima and saddle points
Stationary points in a function of two variables occur when fx = fy = 0, but further
tests are required to determine whether these points are minima, maxima, or saddle
points.
The required conditions are summarized in the following table.
Tests for stationary points
fx = fy Q = [fxy 2 fxx fy y ] fxx (or fy y )
Type
=0
<0
>0
Minimum
=0
<0
<0
Maximum
=0
>0
Irrelevant
Saddle
Example.
From the surface plot of the earlier function f (x, y ) = 0.6x 4 + 0.1x 2 y 2 2x 2 + 2y 2 + 5
it appears that there is a saddle at (0, 0) and two minima at (1.something, 0). Lets
derive from the table.
fx =
fxx =
fy =
fy y =
fxy =
(1.63)
(1.64)
(1.65)
(1.66)
(1.67)
(1.68)
for arbitrarily small x and y . Geometrically we see that slices through the function
in both x and y directions exhibit maxima.
1/17
Figure 1.8:
(1.69)
for arbitrarily small x and y . Geometrically we see that slices through the function
in both x and y directions exhibit minima.
How do we compute the stationary values. One might guess by looking for points where
f /x and f /y are both zero. Indeed this is the case. For f (x, y ) to be stationary
we require the total differential to be zero, ie:
df =
f
f
dx +
dy = 0.
x
y
(1.70)
Because dx and dy are independent, this gives rise to the condition that f /x = 0
and f /y = 0.
But how to decide whether the point is a maximum or minimum? Again one might guess
that this will have something to do with second derivatives. Using Taylors Theorem
we have
f (a + x, b + y ) = f (a, b) + [(x)fx (a, b) + (y )fy (a, b)]
1
+
[(x)2 fxx + 2(x)(y )fxy + (y )2 fy y ]
2!
+ ...
(1.71)
But the first order derivativens fx , fy are zero, so that, to the second order in small
quantities:
1
f (a + x, b + y ) f (a, b) = [(x)2 fxx + 2(x)(y )fxy + (y )2 fy y ].
2
(1.72)
Now the conditions for maxima and minima above (eqs 1.68 and 1.69) tell us that we
should be interested in the sign of the rhs of equation 1.72 or, equivalently, the sign
1/18
of:
[(x)2 fxx + 2(x)(y )fxy + (y )2 fy y ].
(1.73)
1
fxx
1
fy y
(1.74)
(1.75)
It is clear that in general the sign depends on the actual x and y under consideration,
that is, on how you move off from the point where fx = fy = 0.
But what we can say unequivocally is that if Q = [fxy 2 fxx fy y ] < 0 then the term in
{. . .} is positive. So then the sign depends on fxx , or equivalently fy y . (In fact, we have
just shown that, when Q < 0, SIGN(fxx ) = SIGN(fy y ).)
So,
when Q < 0 and fxx < 0 (or equivalently fy y < 0) the point is a maximum
when Q < 0 and fxx > 0 (or equivalently fy y > 0) the point is a minimum.
What about when Q > 0? Then the sign really does depend on how you move off from
the point where fx = fy = 0. This is a saddle point. The function appears to have a
maximum if you move in one direction and a minimum if you move in another.