Uploaded by andrew.2103

Calculus

advertisement
2205NSC Calculus II
Notes Part 1
Module 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Vector Calculus in 2D and 3D
Integrals in 1, 2 and 3 dimensions ...................................................................................... 3
Vectors – brief revision ..................................................................................................... 14
Curves in 2D and 3D analyzed by vectors ........................................................................ 16
Scalar fields in 2D and 3D – some examples ................................................................... 18
Partial derivatives.............................................................................................................. 21
The gradient vector for a scalar field ................................................................................ 28
Vector fields ...................................................................................................................... 31
Line integrals of vector fields ........................................................................................... 33
Green’s theorem ................................................................................................................ 43
Conservative vector fields................................................................................................. 48
Divergence - measuring the flow of material across a surface ......................................... 50
Gauss’s theorem over a 3D region .................................................................................... 58
Stokes’s theorem - the 3D version of Green’s theorem. ................................................... 62
Combinations of grad, div and curl................................................................................... 68
Module 2
Ordinary Differential Equations
15 Ordinary differential equations (revision) ........................................................................ 71
16 Oscillating systems and 2nd order DE’s ............................................................................ 79
17 Using power series to solve ordinary differential equations............................................. 97
Formula sheet
18 Last year’s Exam formula sheet ...................................................................................... 104
1
Useful references:
O’Neil, P.V., Elements of Advanced Engineering Mathematics, Cengage Learning, 2010.
James, G., Modern Engineering Mathematics, Addison-Wesley, 1992.
Kreyzig, E., Advanced Engineering Mathematics; John Wiley and Sons, 2009.
Ulaby, F.T., and Ravaioli, U., Fundamentals of applied electromagnetics, 7th ed., Pearson,
2015 (Chapter 3).
Tinker, M., and Lambourne, R., Further Mathematics for the Physical Sciences, Open
University/Wiley, 2000.
Zill, D.G., and Wright, W.S., Advanced engineering mathematics, 4th ed., Jones & Bartlett
Pub., 2011 (chapters 1, 2, 3, 9 and 12)
Schey, H.M., Div, grad, curl and all that, W.W. Norton, 2006.
Matlab is available on the computers in the student learning centres. Login to the machine
using your account and run “Matlab”. All Matlab sections in the notes are optional.
2
Module 1 Vector Calculus in 2D and 3D
1 Integrals in 1, 2 and 3 dimensions
This section deals with integrals in two and three dimensions. It also introduces scalar and
vector fields and shows how to set up problems that involve integrals of vector fields.
1.1
A quick revision of 1D integrals
Integrals add things up. The simplest example is an area.
Example 1.
Finding the area under y = x 2 + 1 from x = 0 to x = 3
To estimate the total area under the curve y = x 2 + 1 from x = 0 to x = 3 we can divide the
area into many very thin slices and add up these small areas.
If the slice goes from x to x + dx and has height y
then the slice is very nearly a rectangle.
This is not exact because it does not include the
small triangle at the top.
area of slice ≈ height × width = ydx
So area of slice ≈ height × width = ( x 2 + 1)dx
Here ≈ means very close to when the width dx is small.
Numerical approach
We increase the number of slices. We get values that seem to tend the limiting value of 12
(but the number of slices needed to get high accuracy can be large)
Number of slices used, n
100
1,000
10,000
Total area of all these slices
11.8654
11.9865
11.9987
Calculating precise area: first calculate the area using n rectangles to get an approximate
and then take the limit of n to infinity (in this case dx → 0 ). This approach leads to
integration. Using integral – gives exact result.
In this case we can find the area exactly using the definite integral:
x =3
2
 ( x + 1)dx = [
x=0
x3
+ x]xx == 30 = [ 9 + 3 ] − [0 + 0] = 12
3
3
Example 2 – The mass of a variable density rod
Suppose that we have a metal rod whose density varies as ρ ( x) = 2 + 6 x − 3x 2 , 0 ≤ x ≤ 2 .
That is when x = 0, the density is 2 kg/m, at the centre x = 1 and the density is 5 kg/m. What is
the mass of the rod?
For a very small slice from x to x + dx the mass is very nearly dm = ρ ( x ) dx .
To get the total mass of the rod we need to add all the small masses together.
x=2
x=2
x= 0
x= 0
The total mass is  dm =  ρ ( x) dx =
2
 ( 2 + 6 x − 3 x ) dx = 8 .
That is the mass of the rod is 8 kg.
Calculating an integral symbolically using Matlab (Matlab is available at the Student
Learning Centres)
>> syms x
1.2
>> f = 2 + 6*x – 3*x^2;
 be careful to include *
>> a = int( f, x, 0, 2 )
 gives 8 as an answer.
2D integrals – using mass as an example
If we had a rectangular metal plate a constant density ( kg/metre2 ) then the total mass of the
plate would be given by Total mass = Density × Total area of plate.
If the density varies with position we need a formula for the density in terms of the
coordinates x and y. This is written as ρ ( x, y ) .
The mass of the small shaded rectangle
is very nearly given by
dm = density × area = ρ ( x, y ) dx dy
The total mass of the sheet is written as
a 2D integral  ρ ( x, y ) dxdy .
4
Example 1
The total mass of a rectangle
Suppose that we have a rectangle with width 2 metres and length 1 metre.
The density is given by ρ ( x, y) = 5 − x 2 + y 2 + 2 xy .
The diagram below plots the density as a function of x and y. Plotting surfaces is more
difficult than plotting 1D curves and is done using software such as Matlab.
ρ ( x, y )
The height of the surface gives the density ρ at the point (x, y ).
The Matlab command to plot this surface is:
>>
ezsurf( ‘ 5 - x^2 + y^2 + 2*x*y’, [ 0, 2, 0, 1 ] ); grid; shg
To find the mass of this sheet we need to calculate a double integral.
This can be written in two ways
•
2
M =  (5 − x 2 + y + 2 xy ) dxdy
[limits not shown – symbolic]
• with the actual limits shown M =
2

1
2
2
 (5 − x + y + 2 xy ) dx dy
x=0 y=0
These limits show that x ranges from 0 to 2 and y ranges from 0 to 1.
There are two ways to calculate this integral
5
y =1 x = 2
M =
2
2
 (5 − x + y + 2 xy ) dxdy

[ do x integral first, then y integral]
y=0 x=0
x = 2 y =1
M =
2
2
 (5 − x + y + 2 xy ) dydx

[ do y integral first, then x integral]
x=0 y=0
The two methods will give the same answer.
Method 1
Do the x integral first (for y fixed) and then do the y integral.
y =1
The notation M = 
y =0
x = 2

2
2
  (5 − x + y + 2 xy)dx  dy means
x =0

• Do the integral on the right first – this will give an answer involving y.
Start by getting the indefinite integral of 5 − x 2 + y 2 + 2 xy when we use x as the variable.
Here we treat y as a ‘constant’:
x = 2
1 3
1 2 

2
 (5 − x + y + 2 xy ) dx = 5 x − x + y x + 2 x y 
3
2

x
x=0
x=2
2
This integral is
2
= 0
8
22


2
2
10 − 3 + 2 y + 4 y  − [ 0 + 0 + 0 + 0] = 3 + 2 y + 4 y .
• Finally do the y integral and get the overall answer
y =1
This is
 [
y=0
y =1
22
2
22
2
 22

+ 2 y 2 + 4 y ]dy =  y + y 3 + 2 y 2 
=
+ + 2 = 10 .
3
3
3
3
3
 y =0
So the mass of the rectangle is 10 kg.
6
Method 2
Do the y integral first (for x fixed) and then do y integral.
The notation M =
x = 2y =1

2
2
   (5 − x + y + 2 xy)dy  dx means
x = 0 y = 0

• Do the integral in square brackets first– this will get rid of the y variable and give an
answer involving x:
y = 1
y =1
1
1


Start with  (5 − x 2 + y 2 + 2 xy ) dy = 5 y − x 2 y + y 3 + 2 xy 2 
3
2

y
y=0
Here we treat x as a ‘constant’
The integral is
= 0
1
16


2
2
5 − x + 3 + x  − 0 = 3 − x + x
• Finally do the y integral and get the overall answer
x =2
16
1
1 
32 8
16
This is  [
− x 2 + x ]dx =  x − x 3 + x 2 
=
− + 2 = 10
3
2 x =0
3
3
3
x=0 3
x=2
So the mass of the rectangle is 10 kg.
Conclusion
We calculated this double integral in two different ways (based on the two ways of slicing the
rectangle). Both methods gave the same answer.
In this example both methods were easy but in other cases one method might be much easier
than the other.
7
Doing this integral using Matlab (symbolic algebra)
The first method (do the x integral first)
>> syms x y
>> f = 5 - x^2 + y^2 + 2*x*y
>> temp = int( f, x, 0, 2 )
>> int(temp, y, 0, 1 )




define x & y as symbolic variables
define function f(x, y), include *
do the integral over x with limits
do the final integral over y




define x & y as symbolic variables
define function f(x, y), include *
do the integral over y with limits
do the final integral over y
The second method (do the y integral first)
>> syms x y
>> f = 5 - x^2 + y^2 + 2*x*y
>> temp = int( f, y, 0, 1 )
>> int(temp, x, 0, 2 )
Both methods give the answer of 10.
Example 2
Finding the mass of a triangular region (harder example)
The triangle below is bounded by the x axis, the y axis and the line x + y = 2 . The density at
the point (x, y) is given by ρ ( x, y ) = 3 + 2 xy . The total mass is given by the double integral
 (3 + 2 xy ) dx dy and this will be calculated by slicing the triangle into thin vertical strips
First y goes from 0 to 2-x.
Then x goes from 0 to 2.
So the mass can be written as the
integral
x=2

x=0
y = 2 − x

  (3 + 2 xy ) dy dx
 y=0

Step 1: Calculate the inside integral over the y variable to get
y = 2− x
1 2 y = 2− x
2 y = 2− x
2
 (3 + 2 xy ) dy = [3 y + 2 x y ] y = 0 = [3 y + xy ] y = 0 = 3(2 − x) + x(2 − x)
2
y =0
This expands to 6 − 3x + 4 x − 4 x 2 + x3 = 6 + x − 4 x 2 + x3
Step 2 Do the integral over x from x = 0 to x = 2
x=2
This is
2
3
 [6 + x − 4 x + x ] dx = [6 x +
x=0
Final answer:
1 2 4 3 1 4 2
22
x − x + x ]0 =
2
3
4
3
The total mass of this triangle is 22/3 kg.
8
Doing this using Matlab (symbolic algebra)




>> syms x y
>> f = 3 + 2*x*y
>> temp = int( f, y, 0, 2-x)
>> int(temp, x, 0, 2)
define x & y as symbolic variables
define function f(x, y), include *
do the integral over y with limits
do the final integral over x
This also gives 22/3.
1.3
Integrals over a circular region
If we want to calculate an integral over a circle it is best to use polar coordinates r and θ.
The diagram below shows a small shaded area where r changes by dr and θ changes by dθ.
This area is nearly a rectangle.
The area of this small area is
very nearly rdθ × dr = r dr dθ
rdθ is the ‘width’ and dr is the
height of the small region.
Here θ is measured in radians
and can range from 0 to 2π.
We might need to use
x = r cos(θ ) and y = r sin(θ )
Example: Calculate the integral of f ( x, y ) = x 2 over the inside of the circle with radius 2.
r = 2 θ = 2π
Solution
The integral can be written as I =


r=0
θ =0
f ( x, y ) r dr dθ
2
2
2
Here f ( x, y) = x = r cos (θ ) .
r = 2 θ = 2π
In polar coordinates this is
2
2
 r cos (θ ) r dr dθ .

r=0 θ =0
Now do the θ integral first and the r integral last:
r=2
I =
3
 r dr {
θ = 2π
2
 cos (θ ) dθ }
θ =0
r=0
2π
Using the table of trig integrals in Appendix:  cos 2 (θ )dθ = π .
0
So the integral I is
2
 r4 
I =  r dr { π } = π   = 4π .
r =0
 4 0
r=2
3
9
1.4
Volume integrals ( 3D integrals)
This is the most realistic type of integral because we actually live in a 3D world.
A typical example of a 3D integral would be to find the total mass of an object whose density
varies. Another example is finding the volume of a 3D object.
The easiest example is when the object is a box with perpendicular edges. The most suitable
coordinates are x, y and z.
The volume of this small box is
written as dV = dx dy dz .
If the density of an object is
ρ ( x, y , z ) then the mass of this small
volume is very nearly
dm = ρ ( x , y , z ) dxdydz
The total mass of the object is often
written as  ρ ( x, y , z ) dxdydz .
V
The symbol V under the 3 integrals is the symbol for the volume we are integrating over.
Example 1:
Find the mass of a cube with side 1 whose density is ρ = 1 + xyz
The points in the cube range from x = 0 to x = 1, y = 0 to y = 1 and from z = 0 to z = 1 (this
can also be written as 0 ≤ x ≤ 1 , 0 ≤ y ≤ 1 , 0 ≤ z ≤ 1 ).
z =1 y =1 x =1
Solution:
The total mass is M = 

 (1 + xyz ) dxdydz
z=0 y=0x=0
z2 1
1
] 0 = 1 + xy
2
2
z=0
(remember that we treat x and y as constants here – only z varies).
y =1
1
1 y2
1
• Next we do the y integral  (1 + xy)dy = [ y + x ] 10 = 1 + x
2
2 2
4
y=0
x =1
1
1
9
• Finally we do the x integral  (1 + x ) dx = [ x + x 2 ] 10 =
4
8
8
x=0
z =1
• First we do the z integral to get  (1 + xyz )dz = [ z + xy
Doing this integral with Matlab
>> syms x y z
 define the symbolic variables
>> f = 1 + x*y*z
 define the function to integrate
>> a = int( f, z, 0, 1)
>> b = int( a, y, 0, 1)
>> c = int(b, x, 0, 1)
 do the z integral - answer involves x and y
 do the y integral of a – involves x
 do the x integral of b – gives final answer
10
3D integrals over cylindrical regions
1.5
If we are integrating over a cylindrical region it is better to use 3D cylindrical coordinates –
these coordinates are r, θ and z. r and θ are 2D polar coordinates and z is the distance along
the axis of the cylinder.
The volume of the small shaded box is
very nearly
r dθ drdz = rdr dθ dz
Integrals in cylindrical coordinates are
written as
   ρ (r ,θ , z ) rdrdθ dz
A solid cylinder has a density that changes with r and θ
Example:
The formula for the density is ρ (r ,θ , z ) = (1 + r 2 )(1 + 0.2sin(θ ))
The radius of the cylinder is 1 and the height is 2.
2
1
2π
0
0
0
So the total mass is M =  
2
1
0
0
(
)
2
 (1 + r )(1 + 0.2 sin(θ )) rdrdθ dz
2π
or M =  dz ×  1 + r 2 rdr × 
2π
• Now 
0
•
(1 + 0.2 sin(θ ) ) dθ = [ θ − 0.2 cos(θ ) ]02π
1
 r2 1 4 
3
 (1 + r )rdr =  + r  =
4
0
 2 4 0
1
•
(1 + 0.2 sin(θ ) ) dθ
0
2
2
 dz = 2
0
So the total mass is 2 ×
3
× 2π = 3π .
4
11
= 2π
1.6
3D integrals over spherical regions
Spherical coordinates are a little more complicated. They involve one distance (r) and two
angles (θ and φ).
• r = the distance from the centre of the sphere.
• The angle θ is measured from the North pole . θ can vary from 0 to π radians.
It is similar to latitude in geography except that latitude is measured in degrees and it
ranges from +90 (North pole) and -90 (South pole).
• The angle φ is the angle in the xy plane starting with φ = 0 on the x axis and going up to 2π
radians. φ is similar to longitude except that longitude varies from -180 degrees to + 180
degrees.
We can write x, y and z in terms of r, θ
and φ.
OA is z = r cos(θ )
AP and OB are r sin(θ )
Using the triangle OBC:
x = OB cos(φ ) = r sin(θ ) cos(φ )
y = OB sin(φ ) = r sin(θ ) sin(φ )
Note: Some people reverse θ and φ so that θ is the angle in the xy plane and φ is measured
from the z axis. The symbols used in the diagram are the ones that are most common in
applied maths, physics and engineering.
The small volume in spherical coordinates
is given by:
dV = ( r sin(θ )dφ )( rdθ ) dr = r 2 sin(θ )dθ dφ dr
Here dr is the small change outwards in the r
direction.
r dθ is the length of the edge where θ varies.
r sin(θ ) d φ is the length of the edge where φ
varies.
12
Example:
Find the volume of a sphere of radius a
Solution:
We need to add up the volume elements dV = r 2 sin(θ )dθ dφ dr
Here
r varies from 0 to a,
θ varies from 0 to π (from north pole to south pole),
φ varies from 0 to 2π.
a
So the volume is V =  dV = 
π

2π
a
π
2π
r=0
θ =0
φ =0
2
2
 r sin(θ ) dφ dθ dr =  r dr  sin(θ ) dθ
r = 0θ = 0 φ = 0
 dφ
Thus the integral turns into the product of three separate integrals:
•
2π
 dφ = 2π
φ =0
•
π
π
 sin(θ )dθ = [ − cos(θ )]0 = − [cos(π ) − cos(0)] = − [( −1) − 1] = + 2
θ =0
•
a
2
 r dr =
r =0
1 3
a
3
1
4π 3
So the volume of the sphere is V = a3 × 2 × 2π =
a (which is correct, as you should
3
3
remember).
13
2
Vectors – brief revision
1. 2D and 3D vectors are usually written in terms of the unit vectors pointing in the x, y and z
directions. These are called i, j, k .
z
y
v = 3i + 2j
y
j
k
i
j
i
x
x
Right handed set of axes
A typical 2D vector is written as v = vx i + v y j .
A typical 3D vector is written as v = vx i + v y j + vz k .
3
Adding vectors and multiplying vector by a number
If
a = 3i + 2 j − k and b = 4i + 3j + 5 k
Then
a + b = (3 + 4)i + (2 + 3) j + (−1 + 5) k = 7i + 5 j + 4 k
2a = 2(3i) + 2(2 j) + 2(− k ) = 6i + 4 j − 2 k
4
Lengths of vectors
The length of a 2D vector is
as | v | =
5
|v| =
vx2 + v 2y
and the length of a 3D vector is calculated
vx2 + v 2y + vz2
The dot product combines two vectors a, b to produce a number aib .
This is defined geometrically by
a ib = length of a × length of b × cos(θ )
= | a | | b | cos(θ )
Here θ is the smallest angle between a and b – it is between 0 and π.
a and b are perpendicular if aib = 0 .
6. An easier way to calculate the dot product is by aib = axbx + a yby + az bz .
The dot product is often used to calculate the angle between two vectors.
14
7. Another interpretation of the dot product
The projection of b along the direction of a is
OP. This is OP = | b | cos(θ )
a ib = | a | × OP
= | a | × projection of b along the a direction
If θ is less than 90 then aib is positive but
otherwise aib is negative.
8. The cross product (or vector product)
The cross product of two vectors a and b is another vector a × b .
The length of a × b is | a | | b | sin(θ ) .
Its direction is given by the right hand rule (this means place your right
hand so that your fingers curl from a to b – then your thumb points in
the direction of a × b )
Key property: a × b is perpendicular to both a and b .
9. A much easier way to compute the cross product is to use the determinant formula
+
−
+
i
j
k
a × b = ax
bx
ay
az = + i
by
bz
ay
az
by
bz
−j
ax
bx
ax
az
+k
bz
bx
ay
by
As an example if a = 3i + 2 j − k and b = 4i + 3j + 5 k
+ − +
i
j
k
2 −1
3 −1
3 2
a × b = 3 2 −1 = + i
− j
+ k
3 5
4 5
4 3
4 3 5
Then a × b = + i ( 2 )( 5 ) − ( 3)( −1)  − j ( 3)( 5 ) − ( 4 )( −1)  + k ( 3)( 3) − ( 4 )( 2 ) 
So
a × b = + i [10 + 3] − j[15 + 4] + k [9 − 8] = 13 i − 19 j + k
15
3
Curves in 2D and 3D analyzed by vectors
In 2D curves are often described by a formula like y = f ( x ) . In 3D a curve is described by
formulas involving a single parameter (often called t). This is because a curve is a one
dimensional shape.
Example of parametric equation for curve in 2D
3.1
A circle with radius 2 can be represented as x = 2 cos(t ), y = 2 sin(t ) where t is time.
You can think of this as the equation of the position of a particle that is travelling around the
curve at an angular speed of 1 radian/second.
y
x
The vector from the origin to the point on the circle is
x
r = xi + y j = 2cos(t )i + 2sin(t ) j
The derivative of this vector is
d
d cos(t )
d sin(t )
r=2
i + 2
j = − 2sin(t )i + 2cos(t ) j
dt
dt
dt
The derivative of this vector d r / dt has two interpretations
1.
2.
as a velocity if we think of t as time
as a tangent vector pointing along the curve
y
x
16
3.2
Curves in 3D
In 3D a curve is given by three formulas that give x, y and z in terms of a parameter t.
These equations might be x = f1 (t ), y = f2 (t ), z = f3 (t ) .
This point can also be described by the vector r = f1 (t )i + f 2 (t ) j + f3 (t )k .
As example the diagram below shows a helix in 3D. The points on the curve are calculated
from the formulas x = cos(t ), y = sin(t ), z = t .
As t increases the point P spirals up the helix. The cos and sin terms mean that the x and y
coordinates move in a circle by themselves while z = t moves the point upwards.
So r = cos(t )i + sin(t ) j + t k and
d
r = − sin(t )i + cos(t ) j + k .
dt
17
4 Scalar fields in 2D and 3D – some examples
Remember that scalars are just numbers while vectors have a magnitude (size) and a
direction. A scalar field is a scalar quantity that varies with position over a region of space.
Examples are:
• The temperature T ( x, y, z ) at a point with coordinates ( x, y , z )
• The air pressure P ( x, y , z ) at a point with coordinates ( x, y , z )
• The electric potential V ( x, y , z ) at a point with coordinates ( x, y , z )
[ Quite often these quantities would also depend on time but here we are mostly concentrating
on how they vary over space.]
Mathematically – any function f ( x, y , z ) defines a scalar field. [ Scalar functions can also
be defined using cylindrical coordinates or spherical coordinates.]
4.1
Visualizing scalar fields in 2D using surface plots and contour plots
A scalar field in 2 dimensions is given by a formula f ( x, y ) . There are two ways to plot
f ( x, y ) :
• we can either plot the surface z = f ( x, y ) in 3D or
• we can plot the contour lines where f ( x, y ) is a constant.
It is more difficult to visualize functions f ( x, y , z ) in 3D, even with a good computer package
and colour graphics this is hard.
Example 1.
2
2
Visualizing the function f ( x, y) = 10 + x + y
The diagram plots the height at ( x, y ) up the z axis. It also shows the contours where f is a
constant on the z = 10 plane.
This is like a bowl – the
height increases as x and y
get larger. You can see that
the curves where f is
constant are circles because
Matlab has added them to
the diagram as well.
Note that it is hard to read
the exact value of f(x, y)
from this 3D plot – 3D plots
need practice to interpret
and it is often best to view
them on a computer where
you can rotate them to get
different viewpoints.
18
2
2
Contour lines for f ( x, y) = 10 + x + y :
This shows the circles where f is constant. In this diagram each contour has the value of f
marked on it.
y
x
Example 2.
2
2
Contour lines for the function f ( x, y) = 8 − x + 3xy − 4 y
This is a more complicated function and the contour lines are shaped like ellipses.
2
0
2
1.5
4
2
2
7.5
4
2
0
7.
5
0
2
0
4
6
7.5
-0.5
4
6
-1
6
4
2
2
y
0
6
6
0.5
-1.5
4
0
1
4
0
2
-2
-4
-3
-2
-1
0
x
19
1
2
3
4
Example 3.
2
2
A surface plot for the function f ( x, y) = 3 + x − y
x
This function has a saddle point at (0,0) because
2
• If we move along the x axis (where y = 0) the equation is f ( x, y) = 3 + x and this has a
minimum value at x = 0.
2
• If we move along the y axis (where x = 0) the equation is f ( x, y) = 3 − y and this has a
maximum value at y = 0.
Note about turning points in 2D and 3D:
In 1D calculus turning points for f ( x ) are local minima and local maxima.
But in 2D calculus there are three types of turning points –
• local minima (like example 1),
• local maxima (example 2) and
• ‘saddle points’ (example 3).
In 3D or higher we have the same three options.
20
5
Partial derivatives
For functions of a single variable, such as f (x) = 3+ x 2 , we define the derivative by
considering the slope of the function at a point. We plot the points (x, f (x)) and
(x + h, f (x + h)) , which are neighbouring points on the curve y = f (x) , and evaluate the
slope of the line joining them:
f (x + h) − f (x) f (x + h) − f (x)
=
(x + h) − x
h
We then define the derivative of f (x) at x as this slope, in the limit that h → 0 :
slope of line =
f '(x) = lim
h→0
f (x + h) − f (x)
h
For a function of more than one variable, things are more complicated. Look at Example 1 on
page 18. Imagine f (x,y) was the height of some valley, and you were standing at the point
(1,-1). The slope of the valley at this (and almost any) point depends on the direction you
face. If you look towards the point (0,2), the surface is more or less level (this is the direction
the contour passes through the point, as you can see in contour plot of Example 1). However,
if you look toward the origin, the surface drops quite steeply.
It turns out that we can work out the slope in any direction, if we know the slope in the x- and
y-directions. More generally, we can work out the small change in f (x, y) that arises from
any small changes in x and y , by knowing separately how a small change in x affects
f (x, y) , and how a small change in y affects f (x, y) .
With this in mind, we define the partial derivative of f (x, y) with respect to x , denoted
∂f (x, y)
, as the rate of change of f (x, y) with respect to x , assuming that y is held
∂x
constant:
∂f ∂f (x, y)
f (x + h, y) − f (x, y)
=
= lim
h→0
∂x
∂x
h
Notice how h is only added to the x component in the definition: we want to hold y fixed.
This definition is equivalent to saying “hold the value of y fixed to some value y0, plot the
function f (x, y0 ) as a function of x, for that fixed value y0, and find the slope (derivative) of
f (x, y0 ) .”
This gives us a way of interpreting the partial derivative. Let’s consider the partial derivative
∂f / ∂x of the function f ( x, y) = 10 + x2 + y2 from Example 1, at the point (1,-2). To picture
at this point, we first consider the function f (x,−2) , which is highlighted in blue on the 3D
plot (LHS) and also shown on the 2D plot of x-vs-f(x,y) through the slice y=-2 (RHS). The
tangent of this line at x=1 is shown on the RHS as well: this maps to the tangent on the curve
f (x,−2) in the 3D plot on the LHS. The slope of the line on the 2D plot is ∂f / ∂x
21
2
2
Interpreting the partial derivative ∂f / ∂x at (-2,1) for the function f ( x, y) = 10 + x + y
Similarly, we define the partial derivative of f (x, y) with respect to y as
∂f (x, y)
f (x, y + h) − f (x, y)
= lim
h→0
∂y
h
where now we hold the x component constant, and add h to just y. We interpret this partial
2
2
derivative using the same approach, for the function f ( x, y) = 10 + x + y from Example 1,
at the point (1,-2). To picture ∂f / ∂y at this point, we first consider the function f (1, y) ,
which is highlighted in blue on the 3D plot (LHS) and also shown on the 2D plot of y-vsf(x,y) through the slice x=1 (RHS). The tangent of this line at y=-2 is shown on the RHS as
well: this maps to the tangent on the curve f (1, y) in the 3D plot on the LHS. The slope of
the line on the 2D plot is ∂f / ∂y
2
2
Interpreting the partial derivative ∂f / ∂y at (-2,1) for the function f ( x, y) = 10 + x + y
22
A few notes about the notation:
•
•
•
∂f (x, y)
is called a partial derivative because f has more than one argument: for
∂x
functions with only one argument, such as f (x) , we call f '(x) an ordinary
derivative.
The notation f '(x, y) doesn’t have any meaning: as a function of more than one
variable, f (x, y) can’t have an ordinary derivative. We need to use the standard
notation to specify a derivative with respect to x or y.
We can easily extend these ideas into functions of 3 or more variables. For example,
for the function f (x, y, z) , we can define as ∂f / ∂x
∂f ∂f (x, y, z)
f (x + h, y, z) − f (x, y, z)
=
= lim
h→0
∂x
∂x
h
with analogous definitions for ∂f / ∂y and ∂f / ∂z .
Calculating partial derivatives
Since the definition of the partial derivative is so closely connected to the definition of the
ordinary derivative, it turns out that we use essentially the same rules and techniques to
calculate partial derivatives as we use for ordinary derivatives. We don’t need to use the firstprinciples definition above (although you can if you want to!)
The Golden Rule for calculating partial derivatives:
Find the derivative using the usual rules of differentiation, treating all variables
other than the one you’re taking the derivative with respect to as constants
Let’s look at some examples:
2
2
1) If f ( x, y) = 10 + x + y :
•
∂f (x, y)
, we take the derivative of 10 + x 2 + y 2 with respect to x,
∂x
treating y (and therefore y 2 ) as a constant:
To calculate
∂f (x, y) ∂
= (10 + x 2 + y 2 ) = 0 + 2x + 0 = 2x
∂x
∂x
•
To calculate
∂f (x, y)
, we take the derivative of 10 + x 2 + y 2 with respect to y,
∂y
treating x (and therefore x 2 ) as a constant:
∂f (x, y) ∂
= (10 + x 2 + y 2 ) = 0 + 0 + 2 y = 2 y
∂y
∂y
23
2) If f (x, y) = 2x 2 y :
•
To calculate
∂f (x, y)
, we take the derivative of 2x 2 y with respect to x, treating y as
∂x
a constant:
∂f (x, y) ∂
∂
= (2x 2 y) = 2 y (x 2 ) = 2 y(2x) = 4xy
∂x
∂x
∂x
•
To calculate
∂f (x, y)
, we take the derivative of 2x 2 y with respect to y, treating x
∂y
(and therefore x 2 ) as a constant:
∂f (x, y) ∂
∂
= (2x 2 y) = 2x 2 ( y) = 2x 2 ⋅1= 2x 2
∂y
∂y
∂y
3) If f (x, y) = xsin( y):
•
∂f (x, y)
, we take the derivative of xsin( y) with respect to x, treating y
∂x
(and therefore sin( y) ) as a constant:
To calculate
∂f (x, y) ∂
∂
= (xsin( y)) = sin( y) (x) = sin( y) ⋅1= sin( y)
∂x
∂x
∂x
•
To calculate
∂f (x, y)
, we take the derivative of xsin( y) with respect to y, treating x
∂y
as a constant:
∂f (x, y) ∂
∂
= (xsin( y)) = x (sin( y)) = x ⋅ cos( y) = x cos( y)
∂y
∂y
∂y
4) If f (x, y) = x 2 sin(2 y) − xy :
•
∂f (x, y)
, we take the derivative of x 2 sin(2 y) − xy with respect to x,
∂x
treating y (and therefore sin(2 y) ) as a constant:
To calculate
∂f (x, y) ∂ 2
= (x sin(2 y) − xy)
∂x
∂x
∂
∂
= sin(2 y) (x 2 ) − y (x) = sin(2 y) ⋅ 2x − y ⋅1= 2x sin(2 y) − y
∂x
∂x
•
To calculate
∂f (x, y)
, we take the derivative of x 2 sin(2 y) − xy with respect to y,
∂y
treating x (and therefore x 2 ) as a constant:
24
∂f (x, y) ∂ 2
= (x sin(2 y) − xy)
∂y
∂y
= x2
∂
∂
(sin(2 y)) − x ( y) = x 2 ⋅ 2cos(2 y) − x ⋅1= 2x 2 cos(2 y) − x
∂y
∂y
Notice that the usual differentiation rules, like the chain rule, when calculating
∂
(sin(2 y)) = 2cos(2 y) , still holds here. The key point to remember is to treat all the other
∂y
variables as if they were constant.
Sometimes, it is helpful to (temporarily) substitute a different variable name, like A, for a
complicated expression involving the variables that are being held constant. In the last
example, we might approach it the following way:
∂f (x, y) ∂ 2
= (x sin(2 y) − xy)
∂x
∂x
∂
= (Ax 2 − Bx) where A = sin(2 y), B = y
∂x
= 2Ax − B
= 2sin(2 y) ⋅ x − y = 2x sin(2 y) − y
Here we set terms involving y only to constants A and B, which makes the calculations a little
easier, before substituting them back again at the end.
An important result we will use later in the course involves the product of two functions.
Important Results:
If f (x, y) can be written as the product of two functions, i.e. f (x, y) = g(x)h( y) then
∂f (x, y)
∂f (x, y)
= g(x)h'( y) . This is because
= g '(x)h( y) and
∂y
∂x
∂f (x, y) ∂ 
∂
=  g(x)h( y) = h( y) g(x) = h( y)g '(x) = g '(x)h( y)
∂x
∂x
∂x
∂f (x, y) ∂ 
∂
=  g(x)h( y) = g(x) h( y) = g(x)h'( y)
∂y
∂y
∂y
25
and
Second-order partial derivatives
We can also define second-order partial derivatives, in the same way that we define secondorder ordinary derivatives:
∂2 f (x, y) ∂ æ ∂f (x, y) ö
= ç
÷
∂x è ∂x ø
∂x 2
∂2 f (x, y) ∂ æ ∂f (x, y) ö
= ç
÷
∂y è ∂y ø
∂y 2
That is, we calculate the derivative with respect to x (or y) once, and then we go through the
process again.
As an example, if f (x, y) = 2x 2 y :
•
To calculate
∂2 f (x, y)
,
∂x 2
∂f (x, y)
= 4xy , as we found earlier …
∂x
o … and then we calculate the derivative of 4xy with respect to x, still treating y
o we first calculate
as a constant:
∂2 f (x, y) ∂ æ ∂f (x, y) ö ∂
∂
= ç
÷ = (4xy) = 4 y (x) = 4 y ⋅1= 4 y
2
∂x è ∂x ø ∂x
∂x
∂x
∂2 f (x, y)
• To calculate
,
∂y 2
o we first calculate
∂f (x, y)
= 2x 2 , as we found earlier …
∂y
o … and then we calculate we take the derivative of 2x 2 with respect to y, still
treating x (and therefore x 2 ) as a constant:
∂2 f (x, y) ∂ æ ∂f (x, y) ö ∂
2
2 ∂
= ç
(1) = 2x 2 ⋅ 0 = 0
÷ = (2x ) = 2x
2
∂y
∂y
∂y
∂x
∂y
è
ø
Note that
∂
(2x 2 ) = 0 . This is because there are no terms involving y in this expression. It is
∂y
`constant with respect to y’, and so its partial derivative with respect to y is 0.
There is no reason why we have to take derivatives with respect to the same variables. In
many application (most notably in thermodynamics), we need to take second-order partial
derivatives with respect to different variables. The process is analogous.
26
If f (x, y) = 2x 2 y :
•
To calculate
∂2 f (x, y) ∂ æ ∂f (x, y)
= ç
∂x∂y
∂x è ∂y
o we first calculate
ö
÷,
ø
∂f (x, y)
= 2x 2 , as we found earlier …
∂y
o … and then we calculate the derivative of 2x 2 with respect to x, now treating y
as a constant:
∂2 f (x, y) ∂ æ ∂f (x, y) ö ∂
2
= ç
÷ = (2x ) = 4x
∂x∂y
∂x è ∂y ø ∂x
∂2 f (x, y) ∂ æ ∂f (x, y) ö
= ç
• To calculate
÷,
∂y∂x
∂y è ∂x ø
∂f (x, y)
= 4xy , as we found earlier …
o we first calculate
∂x
o … and then we calculate we take the derivative of 4xy with respect to y, still
treating x (and therefore x 2 ) as a constant:
∂2 f (x, y) ∂ æ ∂f (x, y)
= ç
∂y∂x
∂y è ∂x
Notice that
ö ∂
∂
÷ = (4xy) = 4x ( y) = 4x ⋅1= 4x
∂y
ø ∂y
∂2 f (x, y) ∂2 f (x, y)
=
(!) This is an example of a more general observation:
∂y∂x
∂x∂y
As long as the derivatives exist, the order in which you take partial derivatives
does not matter
27
6 The gradient vector for a scalar field
2
2
To motivate the idea of a gradient we take the example of the scalar field f ( x, y) = x + y .
The curves where f is constant are circles centred at zero. In the diagram below we show the
contours where f = 5, f = 10, f = 15 etc.
In 2D we can move in different directions and how rapidly f changes depends on the direction
that we move in. As an example take the point P, f = 5. On the diagram below the arrow at
P points in the direction that f increases most rapidly
The diagram below shows vectors that point in the steepest increase direction at a few points.
In this example the directions of steepest increase and decrease are perpendicular to the
contour where f is constant. This is true for all functions in 2D or 3D.
6.1
The gradient vector
We can calculate the direction of steepest increase in 2D or 3D using the gradient vector.
The mathematical symbol for this vector is ∇ f
∂f
∂f
• In 2D this is defined by ∇f =
i+
j
∂x
∂y
∂f
∂f
Remember that
is the rate at which f changes in the x direction and
is the rate at
∂x
∂y
which f changes in the y direction ∇ f combines both of these numbers into a vector.
∂f
∂f
∂f
• In 3D it is defined by ∇f =
i +
j+
k
∂x
∂y
∂z
• The symbol ∇ is an upside down triangle.
∇ f is called the gradient of f and it is read as “grad f” (or sometimes “del f”).
28
2
2
If f ( x, y) = x + y , find the gradient of f.
∂ 2
∂ 2
Here ∇f =
( x + y 2 )i +
( x + y 2 ) j = 2 xi + 2 y j
∂x
∂y
This vector points out in the radial direction – this was obvious from the diagram.
Example 1:
2
2
Example 2: If f ( x, y) = 3 + x − 3xy + 4 y , find the gradient of f.
∂f
∂
Here
=
{ 3 + x 2 − 3xy + 4 y 2 } = 0 + 2 x − 3 y + 0 = 2 x − 3 y
∂x
∂x
∂f
∂
=
{ 3 + x 2 − 3 xy + 4 y 2 } = 0 + 0 − 3 x + 8 y = − 3 x + 8 y
∂y
∂y
So ∇f = (2 x − 3 y ) i + ( −3 x + 8 y ) j.
2
2
2
If f ( x, y, z) = x + y − z , find the gradient of f.
∂f
∂f
∂f
Here ∇f =
i+
j +
k = 2 x i + 2 y j − 2 zk
∂x
∂y
∂z
f depends on three variables and its gradient is a 3D vector.
Example 3:
6.2
The small change formula in 2D
In 1D calculus the small change formula (as x changes to x + δx ) is:
df
δ f = f ( x + δ x) − f ( x) =
δ x + extra terms involving (δ x)2 , (δ x)3 ....
dx
df
This formula is often written as δ f ≈
δx
( δx is small)
dx
The symbol “≈” means “approximately equal”, as there are some very small extra terms on
the right.
In 2D calculus (see diagram below) we have a small change formula involving both x and y.
Change in f(x, y ) as we move
from P to Q is
δ f = f (Q ) − f ( P )
Here
P has coordinates
(x,y) and
Q with coordinates
( x + δ x, y + δ y )
x
The small change formula in f
as we move from P to Q is
given by:
∂f
∂f
δx +
δy
∂x
∂y
Here ≈ means that the two sides are very nearly the same when δ x and δ y are small.
δ f = f (Q ) − f ( P ) = f ( x + δ x , y + δ y ) − f ( x , y ) ≈
29
•
•
6.3
∂f
δ x estimates the change in f as x increases to x + δ x while y stays the same.
∂x
∂f
δ y estimates the change in f as y increases to y + δ y while x stays the same.
∂y
Small change formula written in terms of the gradient vector
In this diagram we start at P and
move a small distance to Q. The
small vector PQ is written as
δr = δ x i + δ y j
When we move from P to Q, the
change in f is δ f = f (Q ) − f ( P )
x
∂f
∂f
δx +
δy =
∂x
∂y
∂f
∂f
=(
i +
j ) i( δ x i + δ y j )
∂x
∂y
δf ≈
This can be written as the dot product of the gradient ∇ f and the vector δ r
δ f ≈ ∇f iδ r
We can also write ∇f iδ r = | ∇f | | δ r | cos(θ ) where θ is the angle between the gradient
vector and the small change vector δ r . The formula ∇f iδ r = | ∇f | | δ r | cos(θ ) gives
three main conclusions:
∇f iδ r is largest when the δ r is
parallel to ∇ f . This is when θ = 0,
which gives cos(θ ) = + 1 .
If we move in the ∇ f direction
we get the steepest increase in f.
• Also ∇f iδ r is most negative
when the δ r points in the opposite
direction to ∇ f . This is when
θ = π , which gives cos(θ ) = − 1
.
x
If we move in the −∇ f direction we get the steepest decrease in f.
• The gradient vector ∇ f is perpendicular to the contour line through P.
If δ r is perpendicular to ∇ f then δ f ≈ ∇f iδ r = 0 . So moving perpendicular to ∇ f
makes very little difference to the value of f. This means that we are keeping very close to the
level curve through P.
30
7
Vector fields
A vector field defines a vector at each point in a region of space. Examples are:
• The velocity of a fluid at a point ( x, y, z ) .
• The electric field vector at a point ( x, y, z ) .
• We can also have magnetic fields, gravitational force fields and stress fields in a solid.
In this section we will look at some pictures of 3D vector fields. Later we define two new
types of integrals involving vector fields:
• Line integrals like  Fid r can be used to calculate the amount of work needed to move
C
through a force field.
• Surface integrals  Aid S - these can be used to calculate the amount of water flowing into
S
a volume.
7.1
Pictures of 2D vector fields
Example 1
An outward pointing vector field
x
The formula for this vector field is v( x, y ) =
x2 + y 2
31
i +
y
x2 + y 2
j.
Example 2 - a rotational vector field
If you follow the arrows exactly you will move in a circle around the origin.
−y
The formula for this vector field is v( x, y ) =
x2 + y 2
32
i +
x
x2 + y 2
j.
8
Line integrals of vector fields
Line integrals of vector fields are recorded as  Fid r , where F is a vector field and C is the
C
line along which the integration takes place. This section explains one reason why we might
want to calculate this type of integral and also shows you how to calculate them. Note that a
curve C must be defined in terms of one parameter only. In Sections 7.1 to 7.4 we express C
as a function of x. In Section 7.5 we express C as a function of θ. In Section 7.6 we express C
as a function of t.
8.1
Work and dot products
One application of a dot product is to calculate the work we must do to move an object. Here
are two ways that a small object can move in a constant gravitational force field.
Example 1
Dropping a ball from A to B
Gravity accelerates the ball and its
kinetic energy increases. This increase
in kinetic energy comes from “the work
that the gravitational force does on the
ball”.
In the diagram there are two vectors:
• the gravitational force F which is constant and points down,
•
d = AiB which is the vector measuring the change in position.
The work that gravity does on the ball is given by W = F id .
This gives a positive result because F and d point in the same direction.
Example 2
Throwing a ball upwards from A to B
Now gravity slows the ball down and it loses kinetic energy. The kinetic energy of the ball is
dropping and we say that gravity is doing a negative work on the ball.
Work W = − ( Force F ) ( distance AB )
This matches the formula W = F id because F and d point in opposite directions and
so the dot product is negative.
33
Example 3
Moving the ball sideways from A to B
If we roll the ball horizontally from A to B gravity
does not affect it – its velocity stays the same. So
gravity does no work here.
Here F and d are perpendicular so their dot product is
zero.
This also matches the formula W = F id .
In all cases the formula W = F id gives a sensible answer.
8.2
Interpretation of  Fi d r as work done by a force
C
Imagine that an earth satellite changes from one orbit to another by moving along the path
ABCD. Along the path the force vectors point in different directions.
Because the force changes from place to place on the path we need to add up the small
amounts of work done on each small piece of the path using an integral.
The total amount of work done is the sum of the small terms dW = F i d r .
This is written as a line integral W =
 dW =
ABCD

Fid r .
ABCD
In this diagram the force field does very little work from A to B but from C to D it does a lot
of work and the satellite accelerates as it goes from C to D.
34
8.3
How to calculate a line integral in 2D along a curve C
We convert the integral  F id r into a form that we can deal with.
C
The curve C has the equation y = f ( x ) .
The curve C starts at x = a and ends at x = b.
Step 1:
Calculate d r = d ( xi + y j) = dx i + dy j = dx i +
Step 2
Next get
dy
dx j
dx
Fid r = ( Fx i + Fy j)i(dx i + dy j) = Fx dx + Fy dy
This can be written as Fid r = Fx dx + Fy
dy
dx
dx
Use the equation of the curve to get dy / dx in terms of x.
Step 3
Figure out the limits on x as we go from the start of the curve to the end.
Step 4
Calculate the integral  F i d r =
C
x=b
 [ Fx dx + Fy
x=a
dy
] dx
dx
Conclusion: This shows how a line integral of a vector field can be converted into a 1D
integral of the type that we already know how to do.
35
8.4
Examples of calculating line integrals along curves.
Example 1: Find the line integral  F i d r if F = ( x 2 + 1)i + xy j and C is the straight
C
line y = x from (0,0) to (1,1)
If you look at different places along the line you will see that F makes an acute angle with
the curve and so F i d r is positive everywhere so  F i d r will be positive.
C
Step 1:
Calculate d r
The equation of the curve is y = x stretching from x = 0 to x = 1.
r = xi + y j = x i + x j
So
Then
d r = d ( xi + x j) = dx i + dx j
Calculate F id r
Step 2
Here
F = ( x 2 + 1)i + xy j
and d r = dx i + dx j
So Fid r = ( x 2 + 1)dx + xydx
Then use the equation of the curve y = x to get
Fid r = ( x 2 + 1)dx + x 2dx = (2 x 2 + 1)dx
Calculate the integral  Fi d r
Step 3
C
 Fid r =
C
x=1
2
 (2 x + 1) dx =
x=0
5
3
36
Find the line integral  F i d r if F = ( x 2 + 1)i + xy j and C is the curve
Example 2:
C
2
y = x from (0,0) to (1,1).
Step 1:
Calculate d r
The equation of the curve is y = x 2 stretching from x = 0 to x = 1.
So
r = xi + y j = x i + x 2 j
Also
d r = d ( xi + x 2 j) = dx i + 2 xdx j
Calculate F i d r
Step 2
F = ( x2 + 1) i + xy j
Here
and d r = dx i + 2 xdx j
2
So Fid r = ( x + 1)dx + xy 2 xdx
Then use the equation of the curve y = x 2 to get
Fid r = ( x 2 + 1)dx + 2 x 4 dx = (2 x 4 + x 2 + 1)dx
Calculate the integral  Fi d r
Step 3
C
Then  F id r =
C
x =1
4
2
 (2 x + x + 1)dx =
x=0
2 1
26
+ +1 =
5 3
15
Note: In examples 1 and 2 the two curves go from A = (0,0) to B = (1,1) Changing the
curve between A and B changed the value of the integral.
Examples 3 and 4 use the same vector field F = y i + x j and integrate it over two curves
going from A (0,0) to B (1,1). Here the two integrals take the same value.
37
Example 3
Calculate  Fi d r using F = y i + x j where C is the line y = x starting at
C
(0,0) and finishing at (1,1).
Step 1:
Calculate d r
The equation of the curve is y = x stretching from x = 0 to x = 1.
So r = xi + y j = x i + x j and so d r = d ( xi + x j) = dx i + dx j
Calculate F i d r
Step 2
Here
F = yi + x j
and d r = dx i + dx j
So F i d r = ydx + xdx and then we use the equation of the curve y = x
We get
F i d r = xdx + xdx = 2 xdx
Calculate the integral  F i d r =
Step 3
 2 xdx = 1
x=0
C
Example 4
x =1
Calculate  Fid r again using F = yi + x j where C is the curve y = x 2
C
starting at (0,0) and finishing at (1,1).
Step 1:
Calculate d r
The equation of the curve is y = x 2 stretching from x = 0 to x = 1.
So r = xi + y j = x i + x 2 j and so d r = d ( xi + x 2 j) = dx i + 2 xdx j
Calculate F i d r
Step 2
Here
F = yi + x j
and d r = dx i + 2 xdx j
So Fid r = ydx + 2 x2 dx
Then use the equation of the curve y = x 2 to get
Step 3
Calculate the integral  F i d r =
Fid r = x 2 dx + 2 x 2 dx = 3x 2 dx
x =1
2
 3 x dx = 1
x=0
C
Note: In examples 3 and 4 changing the curve between A and B did not change the
value of the integral.
The vector field here is an example of a ‘conservative vector field’. For this type of vector
field line integrals depends only on the end points of the curve C.
38
Example 5
A situation where the curve involves two separate parts
Calculate  Fi d r with F = y i + 3x j where C is the curve shown below.
C
We do the two integrals separately and add the results together:
•
From O to A:
The equation of OA is y = x and x goes from 0 to 1
Here r = xi + x j so that d r = dxi + dx j
So Fid r = ( y i + 3x j)i(dxi + dx j) = ydx + 3xdx
Because y = x we get F i d r = xdx + 3 xdx = 4 xdx
A
x =1
O
x =0
Then  F i d r =  4 xdx = [2 x 2 ]10 = 2
•
From A to B:
On OB x decreases from 1 to 0 and y is equal to 1.
Here r = x i + 1 j so that d r = dx i
So Fid r = ( yi + 3x j)i(dxi ) = ydx
Because y = 1 we get F i d r = 1dx = dx
B
x=0
A
x =1
Then  F i d r =  dx = [ x ]10 = 0 − 1 = − 1
A
B
O
A
So the total integral  F i d r =  F i d r +  F i d r = 2 − 1 = 1 .
C
39
8.5
Calculating a line integral  Fid r when the curve is given by parametric
C
equations
Take F = y i + x j and integrate it along the semicircle that has radius 2,
Example
going from A = ( 2, 0 ) to B = ( -2, 0 ).
2.5
C(0,2)
2
1.5
y
1
0.5
θ
0
B(-2,0)
-0.5
-2.5
-2
A(2,0)
-1.5
-1
-0.5
0
x
0.5
1
1.5
2
2.5
We could take the equation of the circle as x 2 + y 2 = 4 but then the formula for y is
y = 4 − x 2 which is a bit messy.
A better way is to write x and y in terms of the angle θ. On the semi-circle x = 2 cos(θ ) ,
y = 2 sin(θ ) and θ goes from 0 to π.
Calculate d r in terms of dθ
Step 1:
Start with r = xi + y j = 2cos(θ )i + 2sin(θ ) j
dr
d
dθ =
{2cos(θ )i + 2sin(θ ) j}dθ
dθ
dθ
Doing the derivative gives d r = ( −2sin(θ )i + 2cos(θ ) j) dθ
Then d r =
Calculate F i d r
Step 2
Write F = y i + x j in terms of θ so that F = 2sin(θ ) i + 2cos(θ ) j
Then
F id r = 2sin(θ ) ( −2sin(θ ) ) dθ + 2cos(θ )2cos(θ ) dθ
So
F i d r = {− 4 sin 2 (θ ) + 4 cos 2 (θ )} dθ
Calculate  Fid r as θ goes from 0 to π
Step 3
C
Here
 F id r =
C
θ =π
2
2
 { − 4sin (θ ) + 4 cos (θ ) } dθ .
θ =0
Remember that cos2 (θ ) − sin 2 (θ ) = cos(2θ ) so the integral is
θ =π
 4 cos(2θ ) dθ .
θ =0
40
θ =π
1

= 2sin(2π ) − 2 sin(0) = 0 .
 4 cos(2θ ) dθ = 4  sin(2θ ) 
2

θ =0
θ =0
θ =π
This is
Note:
θ =π
We could also calculate the integral
2
2
 { − 4 sin (θ ) + 4 cos (θ ) }dθ using symbolic
θ =0
Matlab:
>>
>>
>>
syms theta
f = 4*cos(theta)^2 – 4*sin(theta)^2
s = int( f, theta, 0, pi)
This gives s = 0.
8.6
How to calculate a line integral in 3d (optional)
In 3D we must use the parametric form to give formulas for x, y and z in terms of a single
parameter t. If you like you can think of a point moving along the curve and think of t as the
time since it started.
An examples of 3D curve is the spiral ( or helix) shown below - it starts at t = 0 and spirals
upwards around the z axis until t = 4.
The equations for the curve are x = cos(2t ), y = sin(2t ), z = t . The diagram plots the
points from t = 0 to t = 4.
If we want to a line integral along a 3D curve  Fid r the steps involved are:
C
1.
Write the equation of the 3D curve in parametric form – this expresses x, y and z in
terms of the common variable t.
41
2.
Get the starting and final values of t – these will be the limits of the integral.
3.
Write the formula F = Fx ( x, y, z )i + Fy ( x, y, z ) j + Fz ( x, y, z )k
4.
5.
in terms of t.
dr
dx
dy
dz
dt = ( i +
j +
k )dt ,
dt
dt
dt
dt
dx
dy
dz
+ Fy
+ Fz
) dt .
then write Fid r = ( Fx
dt
dt
dt
Write the small step d r =
Do the t integral  F id r =
b
 ( Fx
t=a
dx
dy
dz
+ Fy
+ Fz
) dt
dt
dt
dt
If F = y i + z j + xk and C is the spiral in the diagram above calculate the
Example
line integral  Fid r .
C
Step 1
The parametric equation for c is x = cos(2t ), y = sin(2t ), z = t .
Step 2
The limits on t are t = 0 and t = 4.
Step 3
F = sin(2t )i + t j + cos(2t )k
Step 4
The position vector is r = xi + y j + zk = cos(2t )i + sin(2t ) j + t k and
d r = (−2sin(2t )i + 2cos(2t ) j + 1k )dt .
Fid r = (−2sin 2 (2t ) + 2t cos(2t ) + cos(2t ) ) dt .
Then
The line integral is  F i d r =
C
t=4
2
 ( −2sin (2t ) + 2t cos(2t ) + cos(2t ) ) dt .
t=0
This integral could be calculated by integration by parts or by computer algebra (which does
the same thing). The answer is -0.1926.
If you do this by Matlab, the commands are:
>>
>>
>>
>>
syms t
f = -2*sin(2*t)^2+2*t*cos(2*t) + cos(2*t)
a = int( f, t , 0, 4 )
eval(a)
42
9
Green’s theorem
Suppose that V is a vector field that has continuous partial derivatives inside and on a simple
closed curve C. We can write V ( x, y ) = Vx ( x, y ) i + Vy ( x, y ) j .
Then the line integral
 V id r
around the closed curve C can be written as a double integral
C
over the area R enclosed inside C:
∂Vy
∂V
V
i
d
r
=
{
C
R ∂x − ∂yx } dx dy
This is called Green’s Theorem. Another way to express this theorem is
∂Vy
∂V
{
V
(
x
,
y
)
dx
+
V
(
x
,
y
)
dy
}
=
{
x
y
C
R ∂x − ∂yx } dx dy .
R
Note that the direction of integration of the closed curve is important. If C lies in the xy plane,
then counterclockwise direction is defined as positive. The positive sign in front of the double
integral in Green’s theorem is used when the integration direction is positive. If the direction
of integration of the curve is negative (i.e. clockwise direction in the xy plane), then the
negative sign in front of the double integral in Green’s theorem must be used.
The full proof of this theorem is quite involved so we will just give a proof over a rectangular
region. First we will do some examples to illustrate the theorem. Quite often the double
integral is easier to calculate than the line integral.
9.1
Two examples of Green’s theorem
Example 1
C is the square with side 1 starting at (0,0) and V = 3x 2 i + 2 y j
R
Calculating the line integral:
The line integral involves 4 separate lines OA, AB, BC and CO. We need to calculate each
of these separately and then add them up.
43
• From O to A, x varies from 0 to 1 and y = 0.
Here r = xi + 0 j so d r = dx i and V = 3x 2 i + 2 y j = 3x 2 i
A
x =1
O
x=0
Then V id r = 3x 2dx and so  V i d r =
2
 3 x dx = 1
• From A to B x is 1 and y varies from 0 to 1.
Here r = i + y j so d r = dy j and V = 3x 2 i + 2 y j = 3i + 2 y j
So V i d r
B
y =1
A
y=0
= 2 ydy and the integral  V i d r =
 2 ydy = 1
• From B to C, x varies from 1 to 0 and y = 1.
Then r = xi + j so d r = dx i
So V id r
and V = 3x 2 i + 2 y j = 3x 2 i + 2 j .
C
x=0
B
x =1
= 3x 2dx and the integral  F i d r =
2
 3 x dx = − 1 .
• From C to O, y varies from 1 to 0 and x = 0.
Here r = 0i + y j so d r = dy j . and V = 3x 2 i + 2 y j = 2 y j .
So V i d r
O
y=0
C
y =1
= ydy and the integral  V i d r =
Adding up these 4 parts gives 1 + 1 − 1 − 1
 2 ydy = − 1 .
= 0
Doing the area integral
The integrand is
∂Vy
∂x
−
∂Vx
∂(2 y)
∂(3x 2 )
=
−
= 0 − 0 = 0
∂y
∂x
∂y
The area integral is
 {
R
∂(2 y)
∂(3x2 )
−
} dx dy =  {0 − 0} dx dy = 0 .
∂x
∂y
R
Conclusion:
The line integral and area integral are both zero and so Green’s theorem is true here
2
 (3x i + 2 y j) id r =
C
æ ∂(2 y )
∂ (3x 2 ) ö
−
÷dx dy
R çè ∂x
∂y ø
44
C is the square with side 1 starting at (0,0) and V = xyi + y j .
Example 2
In this example we calculate both sides of Green’s theorem to check that they are the same.
∂Vy
∂Vx
−
} dx dy
They are the line integral  ( xy i + y j) i d r and the area integral  {
∂x
∂y
R
C
Calculating the line integral:
• From O to A, x varies from 0 to 1 and y = 0.
Here r = xi + 0 j so d r = dx i and V = xy i + y j = 0
A
x =1
0
x=0
Then V i d r = 0 and so  V i d r =
 0dx = 0
• From A to B x is 1 and y varies from 0 to 1.
Here r = i + y j so d r = dy j and V = xy i + y j = y i + y j .
So V i d r
B
y =1
A
y=0
= ydy and the integral  V i d r =
 ydy =
1
.
2
• From B to C, x varies from 1 to 0 and y = 1.
Then r = xi + j so d r = dx i and V = xy i + y j = xi + j
So V i d r
C
x=0
B
x =1
= xydx = xdx and the integral  V i d r =
 xdx = −
1
.
2
• From C to O, y varies from 1 to 0 and x = 0.
Here r = 0i + y j so d r = dy j . and V = xy i + y j = y j
So V i d r
O
y=0
C
y =1
= ydy and the integral  V i d r =
Adding up these 4 parts gives: 0 +
 ydy = −
1
1
1
−
−
2
2
2
= −
1
.
2
1
.
2
Calculating the area integral.
This is
 {
R
∂Vy
∂x
−
∂Vx
∂y
∂( xy)
} dx dy =  {
−
} dx dy =  ( − x ) dx dy
∂y
∂x
∂y
R
R
Where R is the square with both x and y range from 0 to 1. Therefore:
y =1
x =1
y =1
y =1
1
1
1
1
−
x
dx
dy
=
−
dy
xdx
=
−
dy
=
−
dy = − × 1 = − .
(
)
R
y = 0 x = 0
y = 0 2

2 y =0
2
2
Conclusion: Both answers are the same so Green’s theorem applies here as well. Notice that
the area integral is by far the easier one to calculate.
45
Proving a simple version of Green’s theorem around the unit square
9.2
 Vid r
Green’s theorem states that
 {V dx + V dy}
=
x
C
y
 {
=
C
∂Vy
R
−
∂x
∂Vx
} dx dy .
∂y
R
Proof
x =1
df
dx =
x = 0 dx
We will use the fundamental theorem of calculus: 
x=0
x =1
 df = f (1) − f (0) .
x=0
x =1
 g ( x) dx = −  g ( x ) dx .
We will also use the formula:
x =1
x=0
The integral around the unit square can be represented as four line integrals over the sides:
 Vid r =
B
C
O
O
A
B
C
 V id r +  V id r +  V id r +  V id r
C
•
A
B
O
A
C
We start with the sum of two line integrals: S1 =  V id r +  V id r .
One integral is up the right hand side (A to B) from y = 0 to y =1. On this side x = 1. The
other integral is down the left hand side (C to O) from y = 0 to y =1. On this side x = 0.
y =1
S1 =

y=0
Vy (1, y ) dy +
y=0

Vy (0, y ) dy
y =1
Now reverse the limits in the 2nd integral
y =1
S1 =

y =1
Vy (1, y ) dy −
y=0
 V (0, y)dy
y
y =1
=
y=0
 { V (1, y) − V (0, y ) }dy
y
y
y =0
x = 1 ∂V
The fundamental theorem gives Vy (1, y) − Vy (0, y) = 
y ( x, y )
∂x
x=0
dx , therefore:
∂V ( x, y )
æ x =1 ∂Vy ( x, y ) ö
S1 =  ç 
dx ÷ dy =  y
dxdy
∂x
∂x
y =0 è x =0
R
ø
y =1
•
Now take the sum of remaining two line integrals S2 =
A
C
O
B
 V id r +  V id r .
One integral is along the bottom side from x = 0 to x =1. On this side y = 0. The other
integral is along the top side from x = 1 to x =0. On this side y = 1.
x =1
S2 =

x=0
x=0
Vx ( x,0) dx +
 V ( x,1)dx
x
x =1
Now reverse the limits in the 2nd integral:
46
x =1
S2 =

x =1
 V ( x,1)dx
Vx ( x,0) dx −
x=0
x
x=0
x =1
This is
S2 = −
 (V ( x,1) − V ( x,0) ) dx .
x
x
x=0
y =1
∂V x ( x , y )
dy .
∂y
y=0
The fundamental theorem gives: Vx ( x,1) − Vx ( x,0) = 
æ y = 1 ∂Vx ( x, y) ö
∂V ( x, y )
x=0 çç y = 0 ∂y dy ÷÷ dx = − R x∂x dxdy .
è
ø
x =1
So
S2 = −
Now combine S1 and S 2 to get:
S1 + S2 =

R
So
∂Vy ( x, y )
∂y
dxdy − 
 Vid r = S1 + S2 =
C
R
∂Vx ( x, y )
dxdy
∂x
æ ∂Vy ( x, y)
∂V ( x, y) ö
R çè ∂y − x∂x ø÷ dxdy .
An extension of this method gives a proof of Green’s theorem around any simple closed
curve.
47
10 Conservative vector fields
Conservation of energy is a really important principle. An example of conservation of energy
is a planet going around a sun in an elliptical orbit. The gravitational force varies from place
to place, at times it accelerates the planet, at other times it slows the planet down. But overall
the total energy of the planet (gravitational plus kinetic) stays the same. This can only happen
if the work done by gravity in one
complete orbit is zero, otherwise
the planet will either gain or lose
total energy and not stay in the
same orbit.
The total work done by gravity on
the planet is W =  F i d r .
C
So the line integral around this closed path  F id r = 0 .
C
Definition of a conservative vector field
A vector field F is a conservative vector field if the integral of F around any closed curve is
zero.
10.1 Key facts about conservative vector fields
• If F is the gradient of a scalar function f then F is a conservative vector field.
∂f
∂f
∂f
This means that F =
(in 3D )
i +
j+
k
∂x
∂y
∂z
• The reverse is also true. A vector field F is conservative only if F is the gradient of a
scalar function f .
The first fact is easy to prove. The second is not so easy.
10.2 Integrating a gradient vector field along a curve
If F is a gradient vector field so F = ∇f .
B
B
A
A
The line integral from A to B is  F id r =  F i d r =  ∇f i d r = f ( B ) − f ( A) .
C
So the value of the integral only depends on the position of the ends of the curve.
Proof (in 2D)
F i d r = ∇f i d r = (
∂f
∂f
∂f
∂f
i +
j )i( dx i + dy j) =
dx +
dy
∂x
∂y
∂x
∂y
48
By the small change formula
B
B
A
A
∂f
∂f
dx +
dy = df .
∂x
∂y
 F id r =  F id r =  df =
So
C
f ( B ) − f ( A) .
Example of this result:
∂f
∂f
i+
j = y i + x j is a gradient vector field. When A (0, 0) and
∂x
∂y
B (1, 1) for any curve from A to B we will always get:
If f ( x, y ) = xy then ∇f =
(1,1)
(1,1)
(0, 0)
(0, 0)
 F id r =  F id r =
C
 df = f (1,1) − f (0,0) = 1 × 1 − 0 × 0 = 1
This matches the calculations on page 34.
10.3 Other properties of conservative vector fields
B
If F is a conservative vector field then the integral  F id r
along a path from A to B is the
A
same for all paths from A to B. In the diagram below C1 and C2 are two paths going from A
to B. So if F is a conservative vector field then  Fid r =  Fid r .
C1
C2
Proof: Both of these integrals have the
B
value
 F id r = f ( B ) − f ( A)
A
If F is a conservative vector field then
the integral around a closed path C is
zero (  F i d r = 0 ).
C
Proof: Think of the closed path as starting at A
and going around to A.
Then
A
 F i d r =  df = f ( A) − f ( A) = 0
C
A
49
11
Divergence - measuring the flow of material across a surface
In this section we will look at the rate at which water (or any other liquid) flows out of a 3D
volume. This is a simple example to understand. The techniques in this section are also used
in electromagnetic problems where similar 3D integration is also used to calculate the electric
field escaping from a closed surface around a charge.
11.1
Describing directions on a 3D surface
The two diagrams below show a cube and a sphere with some vectors pointing out from the
volumes. These are called normal vectors (normal means perpendicular) and they are unit
vectors (their length is always one). Normal vectors are essential for calculating the amount
of water that flows out of a closed volume.
50
11.2
Calculating the amount of water flowing across a small area
In this section we look at ways to calculate the amount of water flowing across a small part of
a surface per second. To explain how to do this we will work through 3 situations.
In these examples we have three bits of information:
• The area of this part of the surface – this is called dS,
•
v is the water velocity vector at this point,
•
n is the ‘normal vector’ to the surface at this point ( it has length one).
1:
Water flows outwards, perpendicular to the surface.
If the velocity vector and the normal vector point in the same direction then water is flowing
out of the volume at this point.
The amount of water that flows
upwards across the surface per
second is:
area (square metres) × size of
velocity vector v (metres/sec)
As a formula this is | v | dS .
The units for the answer are
cubic metres/sec.
2.
When the velocity vector points along the surface
In this case v and n are perpendicular vectors.
Here the water flows along the surface but no water flows in or
out of the volume.
3
The general case when v and n are at an angle θ
The amount of water flowing through the area dS per second is v i n dS
51
Amount of water flowing out of the surface = velocity component perpendicular to the
surface × the area dS.
The angle between the velocity vector v and the perpendicular vector n is θ.
The velocity component perpendicular to the area is | v | cos(θ ) .
The amount of water that flows through this area/second is | v | cos(θ ) dS .
Because n is a unit vector, | n | = 1 , so v in = | v | | n |cos(θ ) = | v | (1) cos(θ ) = | v |cos(θ ) .
Checking that all these results fit together
• If v is parallel to the normal vector n , the angle between v and n is θ = 0
So v in dS = | v | | n |cos(θ ) dS = | v | (1) cos(0) dS = | v | dS
This matches the first example.
• If v is perpendicular to the normal vector n , the angle between v and n is π/2,
π
so vin dS = | v | | n |cos(θ ) dS = | v | (1 ) cos( ) dS =
2
nd
This matches the 2 example.
11.3
| v | ( 0 ) dS = 0 -
Calculating the total amount of water flowing out of a volume
The amount of water that flows out of the shaded patch per second is given by v in dS
The total amount of water that flows out over the whole surface is the sum of all these small
terms – this gives us a surface integral
Total amount of water leaving volume / sec = 
 v in dS
S
52
Often the combination ndS is written as dS , which is a small vector. So the surface integral
can also be written as 
 v in dS = 
 v idS .
S
S
Calculating surface integrals
11.4
The diagram below shows the surface S which is the top face of a cube with side 1. Assuming
the velocity vector at the point (x, y, z) is v = (vx , v y , vz ) = (− x, y, x − y + z ) , calculate the
amount of water flowing out of the top surface.
n
1
0.8
0.6
z
0.4
0.2
0
1
0.8
1
0.6
0.8
0.6
0.4
0.4
0.2
y
0.2
0
0
x
53
The amount flowing out of the top surface is an integral  v indS . Here for the surface S we
S
have z = 1 and x and y vary from 0 to 1. The formula for a small area here is dS = dx dy .
The unit vector that points out of the cube here is n = k .
So we get vin dS = (vx i + v y j + vz k )ik dxdy = + vz dxdy = ( x − y + z ) dxdy
The total amount of water flowing out of the top surface is the integral
x =1
y =1
 v indS =  dx  ( x − y + 1) dy =
x=0
S
y=0
x =1
 dx [ xy −
x=0
1 2
y + y ] yy == 10 =
2
x =1
1
 [ x + ]dx = 1
2
x=0
Amount flowing out of the bottom surface of the cube
Again the velocity vector is v = (vx , v y , vz ) = (− x, y, x − y + z ) . The bottom surface is
when z = 0, so on the bottom surface v = (vx , v y , vz ) = (− x, y, x − y ) .
1
0.8
0.6
z
0.4
0.2
0
1
0.8
1
0.6
0.8
0.6
n
0.4
0.2
0.2
0
y
0.4
0
x
Again dS = dx dy , but the unit vector that points out of the cube here is n = − k , so
v in = (vx i + v y j + vz k )i( −k ) = − vz = − ( x − y ) .
Therefore v indS = − ( x − y ) dxdy . The total amount of water flowing out of the bottom
x =1
y =1
x=0
y=0
surface of the cube is:  v indS = −  dx  ( x − y ) dy .
S
y =1
The inside integral is

( x − y )dy = [ xy −
y=0
x =1
The total integral is −  dx ( x −
x=0
1 2 y =1
1
y ]y = 0 = [ x − ] .
2
2
1
1
1
1 1
) = [ x 2 − x ]xx == 10 = − = 0 .
2
2
2
2 2
54
Amount flowing out along the face of the cube where x = 1 (the right hand face)
Along this face y and z vary from 0 to 1.
1
0.8
n
0.6
z
0.4
0.2
0
1
0.8
1
0.6
0.8
0.6
0.4
0.4
0.2
0.2
0
y
0
x
The unit vector that points out of the cube is n = + i .
Here v = (vx , v y , vz ) = (− x, y, x − y + z ) = (−1, y , 1 − y + z )
(because x = 1 here )
Then dS = dy dz and vin = (vx i + v y j + vz k )ii = + vx = − 1
So the amount of water that flows out through the face x = 1 is
y =1 z =1
 v indS = 
S
y =1
z =1
 −1 dydz = −  dy  dz = − 1
y=0z=0
y=0
z=0
55
11.5
Calculate the amount of water flowing out of a cylinder of radius a.
The diagram shows a cylinder. Its height is h (from z = 0 to z = h) and its radius is a. The
velocity vector at any point is given by v = xi .
On the right hand side of the cylinder the water flows to the right and on the left hand side it
flows to the left. This can only happen if there is a source of water inside the cylinder.
The next diagram shows the small area element on the surface of the cylinder and a more
detailed picture of the normal vector n. Remember that for a cylinder we can use cylindrical
coordinates r, θ and z.
The area of the small shaded part is dS = a dθ dz .
The normal vector points out from the cylinder. It is in the xy plane and it is
n = cos(θ )i + sin(θ ) j .
The velocity vector is v = xi = a cos(θ ) i . The amount of water that flows out through this
small area is vin dS .
vin = a cos(θ )ii{cos(θ )i + sin(θ ) j} = a cos2 (θ )
So
vin dS = a cos 2 (θ ) × a dθ dz = a 2 cos 2 (θ ) dθ dz .
56
The total amount of water that flows out through the curved sides of the cylinder is the
integral of all these small terms where z goes from 0 to h and θ goes from 0 to 2π.

This is
curved side
v in dS =
z=h
θ = 2π
z=0
θ =0
 dz
2
2
 a cos (θ ) dθ
= h π a2
(see table of integrals in the Appendix)
Question:
The amounts of water flowing out of the flat top and bottom sides of the cylinder is easy to
calculate. What are these amounts?
57
12
Gauss’s theorem over a 3D region
Green’s theorem converted a line integral (around a 1D curve) into an integral over the 2D
area inside the curve.
Gauss’s theorem is a way to convert a surface integral into a 3D volume integral.
Gauss’s theorem states that
If V is a closed volume in 3D and S is the surface of V then the surface integral 
 vi dS can be
S
converted into a 3D integral over the volume inside S of the divergence of the vector field v
(expressed as div(v))
∂v y
∂v x
∂v z
+
+
} dV =  div ( v ) dV

 v i dS =  {
∂x
∂y
∂z
S
V
V
Here v = vx i + v y j + vz k .
12.1
The divergence operator
The divergence converts a vector field into a scalar field. There are two common ways of
writing it:
div( v ) =
∂v y
∂v y
∂vx
∂vx
∂v z
∂vz
or as ∇i v =
+
+
+
+
∂x
∂y
∂z
∂x
∂y
∂z
The different terms in the formula are illustrated in the diagram below.
The 2D surface integral involves a vector field v.
The 3D volume integral involves the divergence of v.
Gauss’s theorem is most often used to convert a complicated surface integral into an easier 3D
volume integral. For example with the cube there are six separate surfaces so the surface
integral is messy to do but the volume integral is usually a lot easier.
58
12.2
Examples of calculating the divergence
Example 1
v = x i − y j + 3k
Then ∇i v =
∂v y
∂v x
∂v z
+
+
∂x
∂y
∂z
=
∂x
∂ (− y)
∂ (3)
+
+
= 1−1+ 0 = 0
∂x
∂y
∂z
We started with a vector field and we ended with a scalar field which is zero everywhere.
Example 2
v = x 2 i − xy j + z k
Then ∇i v =
∂v y
∂v x
∂v z
+
+
∂x
∂y
∂z
=
∂( x2 )
∂ ( − xy )
∂( z )
+
+
= 2x − x + 1 = x + 1
∂x
∂y
∂z
We started with a vector field and we ended with a scalar field which is calculated from the
formula x + 1.
12.3
What does the divergence mean?
The divergence measures the rate at which water is leaving a small volume.
If we have a small box whose volume is ∆V then the amount of water that flows (with
velocity v(x,y,z)) out of this box per second is very nearly ∆V div( v ) . In fact the units for
div( v ) is just 1/sec.
To get an intuitive understanding of the divergence people often think of three options
• If div( v ) is positive at a point P then water is actually pouring out of the region near P.
This means there is a source of water at P (e.g. a spring).
• If div( v ) is negative at a point P then water is actually pouring into the region near P.
This means there is a sink of water at P.
• If div( v ) is zero at a point P then the amounts of water leaving the region and the
amount that enters the region are the same. In this case water is conserved.
div( v ) = 0 is the most common situation and so we often have ‘conservation conditions’
that say div( v ) = 0 .
59
There is a similar interpretation for electric fields – electric fields are produced from charges
and there is an important result called Gauss’s law that can be expressed as:
div(E) =
ρ ( x, y , z )
ε0
Here E is the electric field vector and ρ ( x , y , z ) is the charge density at the point (x, y, z) and
ε0 is a constant (the permittivity of free space).
Magnetic fields obey the equation div(B ) = 0 as there are no point sources of magnetic
fields.
12.4
Proving Gauss’s theorem for a cube
Gauss’s theorem states that 
 v i dS =  div ( v ) dV
S
V
Here we will take the volume (V) as a cube with side 1 with one corner at the origin (0,0,0)
and S is the surface of V. The proof is similar to the proof of Green’s theorem over the
square.
Proof
It is easiest to start with the volume integral. There are three terms
We start with 
V
∂v z
dx dy dz =
∂z
1

1

x=0 y=0
∂vz
dzdydx
z = 0 ∂z
1

The z integral is along the vertical line from A to B. A has coordinates ( x, y, 0) and B has
coordinates ( x, y, 1). The z integral gives
∂v z ( x, y , z )
dz = [v z ( x, y , z )] zz == 10
∂z
z =0
1

60
= v z ( x, y ,1) − v z ( x, y , 0)

So
V
∂v z
dx dy dz =
∂z
1

1
 { v z ( x, y ,1) − v z ( x, y , 0) }dydx .
x=0 y=0
The first term on the right matches the surface integral over the top face because there n = k
and z = 1 so that vi dS = vik dxdy = vz ( x, y,1)dxdy .
So
x =1
y =1
x=0
y=0
v i dS = 

z = 1 face
 v z ( x, y ,1) dydx
The 2nd term on the right matches the surface integral over the bottom face because there
n = − k and z = 0 so that vi dS = − vi k dxdy = − vz ( x, y,0)dxdy .
So
x =1
y =1
x=0
y=0
v i dS = − 

z = 0 face
 v z ( x, y , 0) dydx
If we did the same thing with 
V
∂v
∂vx
dx dy dz and  y dx dy dz we would get the integrals
∂x
V ∂y
over the other four faces.
Therefore we find that the volume integral of div(v) is the same as the complete surface
integral 
 v i dS .
S
This proves Gauss’s theorem for the cube. There is a similar proof for any box shape.
61
13
Stokes’s theorem - the 3D version of Green’s theorem.
Green’s theorem involved line integrals around flat 2D curves like a circle in the xy plane.
There is a generalization of this to line integrals around curves that twist around in 3D space
like the picture below. This generalization involves a quantity called the curl operator.
The curl operator takes a vector field and produces another vector. It is the third of the
“vector derivatives” . The others were grad and div.
13.1
The definition of the curl operator
Curl is calculated as a cross product of the ∇ symbol and the vector field
The simplest definition is curl( A ) = ∇× A =
i
j
k
∂
∂x
Ax
∂
∂y
Ay
∂
∂z
Az
If we expand this out using the cofactor method for determinants we get
i
j
∂
∂x
Ax
∂
∂y
Ay
k
∂
∂
∂
= +i y
∂z
Ay
Az
∂
∂
∂z − j ∂x
Ax
Az
62
∂
∂
∂
∂z + k x
Az
Ax
∂
∂y
Ay
So the final formula is
curl( A ) = ∇× A = + i {
Example 1
∂Ay ∂Ax
∂A
∂Az ∂Ay
∂A
−
} − j{ z − x } + k {
−
}
∂y
∂z
∂x
∂z
∂x
∂y
Calculate ∇× A if A = xyi + z 2 j
Here Ax = xy, Ay = z 2 , Az = 0
∇× A = + i {
This is
∂ 0 ∂z 2
∂ 0 ∂ ( xy )
∂z 2 ∂ ( xy )
−
} − j{ −
} + k{
−
}
∂y
∂z
∂x
∂z
∂x
∂y
∇× A = + i {0 − 2 z } − j{0 − 0} + k {0 − x } = − 2 z i − xk
Example 2
Calculate ∇ × A if A = − yi + xj
Here Ax = − y, Ay = x, Az = 0
∂(0) ∂x
∂0 ∂(− y)
∂x ∂(− y)
∇× A = + i{
− } − j{ −
} + k{ −
}
∂y ∂z
∂x
∂z
∂x
∂y
This is
∇×A = + i{0 − 0} − j{0 − 0} + k{1 +1} = 2k
Example 3
2
Calculate ∇ × A if A = (1 − z )i
Here Ax = 1 − z 2 , Ay = 0, Az = 0
∇× A = + i {
This is
∂ 0 ∂0
∂ 0 ∂(1 − z 2 )
∂ 0 ∂ (1 − z 2 )
− } − j{ −
} + k{ −
}
∂y ∂z
∂x
∂z
∂x
∂y
∇×A = + i{0 − 0} − j{0 + 2z)} + k{0 − 0} = − 2z j
Example 4
Calculate ∇ × A if A = x i
Here Ax = x, Ay = 0, Az = 0
∇× A = + i{
This is
∂0 ∂0
∂0 ∂( x)
∂0 ∂( x)
− } − j{ −
} + k{ −
}
∂y ∂z
∂x
∂z
∂x
∂y
∇×A = + i{0 − 0} − j{0 − 0)} + k{0 − 0} = 0
Warning: One thing to be careful of is the notation ∇ × A . It does not have all the properties
of the ordinary cross product a × b . For ordinary cross products like c = a × b , the cross
product is perpendicular to both a and b . But ∇ × A is usually not perpendicular to A (as
example 1 shows because the dot product of ∇ × A and A is − 2 xyz which is usually not
zero).
63
13.2
An interpretation of curl
If the vector field A is the velocity of a liquid at the point (x, y, z) then one interpretation of
curl is that
1
curl( A ) measures the angular velocity of the liquid at each point.
2
A physical way to measure this would be to put a small “paddle wheel” in the water at a point
and see how it moves. The paddle wheel will move along with the water but it will often
rotate as it moves.
In the first diagram below the water at the top (T) of the paddle wheel is travelling faster than
the water at the bottom. So the wheel will move sideways and it will also rotate (the wheel
will rotate in the clockwise direction).
In the diagram below the water at the top (T) of the paddle wheel is travelling at the same
speed as the water at the bottom. So the wheel will move sideways but it will not rotate.
We can measure the rotation at the point (x, y, z) by the formula
1
curl( A )
2
In the examples above
1.
Calculate ∇ × A if A ( x , y , z ) = y i
The velocity is always in the x direction but it gets larger as we increase y.
Here Ax = y, Ay = 0, Az = 0
64
∇× A = + i{
This is
∂0 ∂0
∂0 ∂( y)
∂0 ∂( y)
− } − j{ −
} + k{ −
}
∂y ∂z
∂x
∂z
∂x
∂y
∇×A = + i{0 − 0} − j{0 − 0)} + k{0 −1} = − k
The paddlewheel spins around in the xy plane – it is as if it is spinning around the vertical
direction.
The minus sign means that it is spinning in the clockwise direction.
2.
Calculate ∇ × A if A ( x , y , z ) = x i
The velocity is always in the x direction. As y changes the velocity stays the same.
Here Ax = x, Ay = 0, Az = 0
∇× A = + i{
This is
∂0 ∂0
∂0 ∂( x)
∂0 ∂( x)
− } − j{ −
} + k{ −
}
∂y ∂z
∂x
∂z
∂x
∂y
∇×A = + i{0 − 0} − j{0 − 0)} + k{0 − 0} = 0
Here the paddlewheel will not spin – but will move in the x direction as it is carried along by
the water.
Example 3
A = − ω yi + ωxj we get
In this case A = − ω yi +
∇ × A = 2ω k
ωxj = ωk × r
This means that all the water is rotating about the z axis with an angular velocity ω (this is
like the way things flow inside a mixer – the further they are from the centre the faster they
move).
The combination
1
∇ × A = ω k gives exactly the right vector for this rotational
2
movement – the angular speed is
ω
and the water is rotating about the z axis.
65
If we think of the vectors as showing the velocity at different places in the xy plane then this
pattern looks like fluid rotating about the z axis.
13.3
Stokes’ theorem – a 3D version of Green’s theorem
Stokes’s theorem connects the line integral around a curve C in 3D with an integral over a
surface S that has C as its edge.
 Aid r =  curl(A)idS = ( ∇× A) i dS
C
S
S
Stokes’s theorem generalizes Green’s theorem –
This means that Green’s theorem is a special case of Stokes’s theorem when C is a curve in
the xy plane and S is the inside of C.
In this case the dS vector points upwards in the z direction so d S = k dx dy .
66
Then Stokes’s theorem becomes  Aidr =  curl(A)i k dxdy
C
S
From the definition of curl(A) we get curl(A)i k =
 Aid r =  {
C
S
∂Ay
∂x
−
∂Ay
∂x
−
∂Ax
and so we get
∂y
∂Ax
} dxdy which is Green’s theorem.
∂y
We will not go into the proof of Stokes’s theorem but it will be important if you go on to
study electromagnetism or fluid dynamics.
67
14
Combinations of grad, div and curl
So far we have found three differential operators – they were grad, div and curl:
1.
grad converts a scalar field to a vector field
Here ∇f =
∂f
∂f
∂f
i +
j+
k
∂x
∂y
∂z
2.
div converts a vector field to a scalar field
3.
∂Ay
∂Ax
∂Az
+
+
∂x
∂y
∂z
curl converts a vector field to a different vector field
∂A
∂A
∂A
∂A
∂A
∂A
curl( A) = ∇× A = + i{ z − y } − j{ z − x } + k { y − x }
∂y
∂z
∂x
∂z
∂x
∂y
Here div( A) = ∇iA = ∇i( Ax i + Ay j + Az k ) =
14.1
Combinations of grad, div and curl that occur quite often
1.
If f is a scalar field then curl ( grad f ) = 0
This combination makes sense because grad(f) is a vector and so we can take its curl. The
answer will be a vector
∂f
∂f
∂f
∂f
∂f
∂( ) ∂( ∂f )
∂( ) ∂ ( )
∂ ( ) ∂( )
∂y
∂y
curl(∇f ) = + i { ∂z −
} − j{ ∂z − ∂x } + k {
− ∂x }
∂y
∂z
∂x
∂z
∂x
∂y
∂f
∂f
∂( ) ∂( )
∂2 f
∂2 f
∂y
∂
z
The i component here is
−
=
−
= 0
∂y
∂z
∂y ∂z
∂z ∂y
All the other components are zero as well so we get curl ( grad f ) = 0
If A ( x , y , z ) is a vector field then div(curl ( A) ) = 0
2.
This combination makes sense because curl ( A ) is a vector and so we can take its div.
The answer will be a scalar.
∂A
∂A ∂A
∂A ∂A
∂A
curl( A) = + i{ z − y } − j{ z − x } + k { y − x }
∂y
∂z
∂x
∂z
∂x
∂y
The div of this will be
∂ ∂Az ∂Ay
∂ ∂Az ∂Ax
∂ ∂Ay ∂Ax
div(curl( A ) ) =
{
−
} −
{
−
} +
{
−
}
∂x ∂y
∂z
∂y ∂x
∂z
∂z ∂x
∂y
=
∂ 2 Ay
∂ 2 Ay
∂ 2 Ax
∂ 2 Ax
∂ 2 Az
∂ 2 Az
−
−
+
+
−
∂x ∂y
∂x ∂z
∂y ∂x
∂y ∂z
∂z ∂x
∂z ∂y
This cancels to zero when we use results like
68
∂ 2 Az
∂ 2 Az
.
=
∂x ∂y
∂y ∂x
14.2
The Laplacian of a scalar function
The Laplacian of a function f is the combination is div( grad f ) - this is not zero.
Here grad(f) is a vector field and then div converts it into a scalar field.
div( grad( f ) ) = div(
So
∂f
∂f
∂f
∂ ∂f
∂ ∂f
∂ ∂f
i+
j+
k) =
( ) +
( ) +
( )
∂x
∂y
∂z
∂x ∂x
∂y ∂y
∂z ∂z
div( grad( f ) ) =
∂2 f
∂2 f
∂2 f
+
+
∂x 2
∂y 2
∂z 2
The combination of second derivatives is called the Laplace operator. The symbol for it is
∇2 f .
So div( grad( f ) ) = ∇ 2 f =
∂2 f
∂2 f
∂2 f
+
+
∂x 2
∂y 2
∂z 2
14.3
Some other results (though less important )
1.
The expansion of curl(curl A)
Here A is a vector field. So curl(A) will be another vector field and finally
curl( curl A) will be a vector field again.
2
The expansion is ∇× ( ∇× A) = ∇(∇iA) − ∇ A
2
In words this is curl(curl A) = grad(div A) − ∇ A
The Laplacian of a vector field is calculated as
∇2 ( Ax i + Ay j + Az k ) = (∇2 Ax ) i + (∇2 Ay ) j + (∇2 Az )k
2
An example of a combination that does not make sense
grad( curl A ) - start with a vector A. Then curl(A) will be another vector field
We can only work out grad on a scalar field.
So we cannot calculate grad( curl A ).
3
More useful results
If A is a vector field and div( A ) = 0 then A is the curl of a vector field. This means we can
find a vector field B so that A = curl(B).
If A is a vector field and curl( A ) = 0 then A is the gradient of a scalar field. This means we
can find a scalar field f ( x , y , z ) so that A = grad( f )
These results are particularly useful in electromagnetism.
69
Module 2 Differential equations
Differential equations are used in science and engineering to express information about how
quickly quantities change (for example in time or space).
There are three key aspects to differential equations
•
Setting up the differential equation from the basic scientific information – this might
involve information about forces and Newton’s laws, electrical circuits or biological or
chemical applications.
•
Finding ways to solve these equations – for simple models we are able to get analytic
solutions for the differential equations. For more involved problems we need to use
numerical methods.
•
Interpreting the solution – particularly being able to plot graphs of the solution.
You have already met first-order ordinary differential equations in first year Maths.
This module covers ordinary differential equations (ODEs) – particularly second-order ODEs
that represent oscillating systems driven by external forces. This revises some basic
mathematical techniques (and also includes the use of Matlab software in the notes for
symbolic solutions of ODEs). We also develop a method for solving ODEs using power
series, which allows us to solve a more general class of ODE.
70
15 Ordinary differential equations (revision)
Differential equations involve an unknown function and its derivatives. Here we will call the
unknown function x(t).
Differential equations usually have many possible solutions.
From these possible solutions we pick solutions that match ‘initial conditions’.
Chapter 14 is a revision and will not be covered in the lectures.
15.1 Terms used to describe differential equations
• The order of a DE - the most common are first order and second order DE:
First order DE’s only involve dx/dt - an example is
2nd order DE's involve d 2 x / dt 2 - an example is
dx
= − 2x
dt
d 2x
= − 4x .
dt 2
• Dependent and independent variables
In
dx
= − 2 x , the independent variable is t and the dependent variable is x.
dt
This means that the solution x is a function of the variable t.
In
d2y
= − 2 y , the independent variable is x and the dependent variable y.
dx 2
• Constant coefficient DE’s – the terms involving x and its derivatives are just multiplied
by numbers.
dx
= − 2 x is a constant coefficient DE
dt
dx
= − 2tx is not a constant coefficient DE because of the t factor.
dt
• Homogeneous and inhomogeneous DE’s
Homogeneous DE’s can be written with all the x terms on the left and just 0 on the right.
An example of a homogeneous DE is
dx
+ 2 x = 0 . Physically these represent systems
dt
that have no input.
An example of an inhomogeneous DE is
dx
+ 2 x = sin(t ) . This has a driving term
dt
on the right and represents a system with an external driving force.
71
• Linear DE’s
A first order linear DE is one that can be put into the form
dx
+ a (t ) x = f (t )
dt
The left hand side only involves x and
dx
and the right hand side only involves a function
dt
of t.
A second order linear DE is one that be put in the form
d 2x
dx
+ a(t )
+ b(t ) x = f (t )
2
dt
dt
One example is
d 2x
dx
+ 2
+ tx = sin(t )
2
dt
dt
• Any DE that is not linear is called a nonlinear DE
Nonlinear DE’s involve terms like sin(x), x 2 etc
One example is
d2x
dx
+ 2
+ x2 = sin(t )
2
dt
dt
Another is
d2x
+ sin( x) = 0
dt 2
15.2 Constant coefficients homogeneous first order DE’s
This first example is a homogeneous DE and the second is an inhomogeneous DE.
Example 1
Find the general solution of
This DE can also be written as
dx
= − 2 x (long method)
dt
dx
+ 2 x = 0 so it is homogeneous DE.
dt
The method we use here is complete and is based on treating
dx
as a ratio:
dt
dx = − 2 x dt
cross multiply
dx
= − 2dt
x
get all the x terms together

dx
=  − 2 dt
x
integrate both sides (indefinite integrals)
72

dx
= − 2  dt
x
move the constant outside of the integral
loge (x) = − 2t + C
Do both indefinite integrals (C is a constant)
x = e−2t + C
(solve for x taking exponentials to undo the logs)
x = e−2t eC = Ae−2t
( expand the exponential and use A = e C )
So the general solution is x = Ae
−2t
and here A is a constant.
Example 2 A more direct way to solve
dx
= − 2x
dt
This type of constant coefficient linear DE comes up so often that people just remember that
kt
the solution is of the form x = Ae .
A can be any number. There are two ways to find k:
Method 1
kt
Just substitute x = e
dx
d kt
=
( e ) = ke kt
dt
dt
dx
So
= − 2 x gives
dt
This shows that
into both sides of the DE
k ekt = − 2ekt .
k = −2.
−2t
So the general solution of this DE is x = Ae
Method 2
.
Directly set up the characteristic equation for k
Write the DE as
dx
+ 2x = 0 .
dt
dx
by k and replace x by 1.
dt
To get the equation for k, replace
This gives
k+2 =
(the characteristic equation)
0
−2t
So k = -2 and one solution for this DE is x = e
−2t
The general solution is x = Ae .
This can match any initial (starting) condition for x
Warning:
This method only works for constant coefficient linear homogeneous DE’s.
73
Example 3
Find the solution of
dx
= − 2 x that starts with x = 3 when t = 0
dt
This is similar to example 2 except that now we want the solution that starts at 3. The
−2t
general solution from example 2 was x = Ae
.
−0
We adjust A to match the starting value. When t = 0, x = Ae
−2 t
Therefore the solution we want is x = 3e
= A, so A must be 3.
.
15.3 Constant coefficient inhomogeneous first order DE’s
These are DE’s of the form
dx
+ ax = f (t ) .
dt
Here x (t ) is the unknown and a is a constant. The type of solution that we get depends on the
form of f (t ) . The general solution for this DE is the sum of the particular solution x p (t )
and the homogeneous solution xh(t) which is found by setting f ( t ) = 0 .
Example 1:
•
Find the general solution of
dx
+ 2 x = 3et
dt
The solution has the form x = xp (t) + xh (t)
xp (t) = a particular solution of this DE . Here xp (t ) = et .
dx p
If we put x p (t ) = et we get
dt
+ 2x p = et + 2et = 3et
xh(t) is homogeneous solution.
The homogeneous equation is
dx h
+ 2 xh = 0
dt
−2t
Here xh (t ) = Ae
The combination x = x p (t ) + xh (t ) = et + Ae−2t is the general solution.
Table of particular solutions of
dx
+ ax = f (t ) for various examples of f (t )
dt
(It is also a good guide for higher order ODEs with constant coefficients)
If the RHS f(t) is
Try the following formula for xp (t ) adjust
C0 , C1 etc
constant C
C0
Ct
C1t + C0
bt
Ce
C cos( b t ) or C sin(bt )
C0ebt , b ≠ −a

− at
− at
C1te + C0e , b = −a
C0 cos(bt) + C1 sin(bt)
74
Example 2
1:
Find the general solution of
dx
+ 3 x = 4e − t
dt
Guess a particular solution – from table
−t
−t
The RHS is 4 e so we guess that the particular solution might be x = Ae
Put this into the LHS of the DE
dx
d
+ 3 x = ( Ae − t ) + 3 Ae − t = − Ae − t + 3 Ae − t = 2 Ae − t
dt
dt
−t
We match 2 A e − t to 4 e .
This means that A = 2.
So one particular solution is x p = 2 e−t
2.
Get the solution of the homogeneous DE (zero on RHS)
dx
+ 3x = 0 .
dt
The homogeneous DE is
This is
dx
= − 3x .
dt
−3t
Solving this yields the homogeneous solution: xh = Ae .
3
Add these two results
−t
The general solution of the inhomogeneous DE is x = 2 e
(You could check this by substitution that
Example 3
+ Ae−3t
dx
+ 3 x = 4 e − t ).
dt
dx
+ 3 x = 4 e − t starting with x = 1 at t = 0.
dt
Find the solution of
−t
The general solution of the inhomogeneous DE is x = 2 e
+ Ae−3t .
Match the starting value x(0) = 1
−0
−0
When t = 0 get x = 2 e + Ae
This will be 1 when A = -1.
Conclusion
Example 4
1
= 2+ A.
−t
The solution that matches initial condition x(0) = 1 is x = 2 e
Find the general solution of
dx
+ 3 x = 4 sin(t )
dt
Get one particular solution of the inhomogeneous DE
Since the RHS is 4 sin(t ) we try xp = A sin(t ) + B cos(t )
75
− e−3t
Putting this into the different terms of the DE gives
dx
= A cos(t ) − B sin(t )
dt
3 x = 3 A sin( t ) + 3 B cos( t )
So
dx
+ 3 x = (3 A − B ) sin(t ) + ( A + 3 B ) cos(t )
dt
This will match 4 sin(t ) if
(match the sin terms)
(since the cos term vanishes)
3A − B = 4
A + 3B = 0
Put A = − 3 B into 3 A − B = − 9 B − B = 4 so that − 10 B = 4
The solutions are A = 1.2 and B = -0.4
So a particular solution is xp = 1.2sin(t) − 0.4cos(t)
2
Get the solution of the homogeneous DE
This can be written as
3
dx
+ 3x = 0
dt
−3t
dx
= − 3 x so its solution is xh = Ae
dt
Combine these two results together
−3t
General solution is x = 1.2 sin(t) − 0.4cos(t) + Ae
Example 4 Find the solution of
dx
+ 3 x = 4 sin(t ) which starts with x (0) = 1 .
dt
−3t
The general solution is x = 1.2 sin(t) − 0.4cos(t) + Ae
Put t = 0 into x (t ) .
−0
Then x(0) = 0 − 0.4 + Ae
= A − 0.4.
This will be 1 when A − 0.4 = 1 so that A = 1.4.
Conclusion
x = 1.2sin(t) − 0.4cos(t) + 1.4e−3t
Example 5
Getting a particular solution using complex numbers - quicker
We want to get the general solution of
dx
+ 3 x = 4 sin(t )
dt
This method replaces 4 sin(t ) by 4 e it
We do this because
eit = cos(t ) + i sin(t )
[Euler's formula]
76
So we start with a different DE
1
dx
+ 3 x = 4 e it
dt
Get a particular solution
The particular solution is easier because the RHS is an exponential.
Guess that x p (t ) = Aeit .
dx
d
+ 3x =
( Ae it ) + 3 Ae it = iAe it + 3 Ae it = (3 + i ) Ae it
dt
dt
This will match 4 e it if
(3 + i ) A = 4
4
4(3 − i)
4(3 − i) 12 − 4i
A =
=
= 2 2 =
= 1.2 − 0.4i
3+ i
(3 + i)(3 − i)
10
3 −i
[Simplify a complex fraction by multiplying the top and bottom by the complex conjugate of
the denominator. ]
A particular solution of
Step 2
dx
it
+ 3 x = 4 e it is x p = (1.2 − 0.4i)e
dt
Now expand this particular solution into real and imaginary parts
it
Using e
= cos(t) + i sin(t) we get
xp = (1.2 − 0.4i){cos(t ) + i sin(t)} = {1.2cos(t) + 0.4sin(t)} + i{ − 0.4cos(t) +1.2sin(t)}
Finally we separate the DE and this solution into their real and imaginary parts
•
•
dx
+ 3 x = 4 cos(t ) has a particular solution xp = 1.2cos(t) + 0.4sin(t)
dt
dx
+ 3 x = 4 sin(t ) has a particular solution xp = − 0.4cos(t) +1.2sin(t)
dt
15.4 Using Matlab’s symbolic algebra package to solve first order DE’s
There is quite a large amount of algebra in these calculations. But because there is a fairly
well-defined method to solve constant coefficient DE’s the method can be programmed and
we can use the symbolic algebra part of Matlab to help us.
Numerical computing deals with numbers and variables in these programs take numerical
values.
Symbolic computing deals with strings or letters that stand for algebraic variables – e.g. x, y,
a, ab, …. This type of program is set up to apply the rules of algebra and calculus so it can
convert x + 2 x into 3x etc. Symbolic computing has limits – some DE’s do not have
solutions that can be written in a straight-forward way.
The Matlab command for trying to get a symbolic solution of an ordinary DE is dsolve.
77
Here are some examples:
1.
dx
+ x = 0 with the initial condition x = 2 when t = 0
dt
d
Matlab notation – we use D instead of
dt
dx
So we write
+ x = 0 as ‘ Dx + x = 0’.
dt
Solve
The single quotes and the capital D are essential. Do not use double quotes.
The initial condition is written as ‘ x(0) = 0’
- use single quotes again.
To solve the DE we write
>> s = dsolve( ‘ Dx + x = 0 ’, ‘ x(0) = 2’ )  note comma here
Matlab gives
>>
s = 2*exp(-t)
 this is how Matlab writes 2 e − t
2.
Solve
dx
+ x = 0 in general - i.e. without initial conditions
dt
First we define the DE
>> s = dsolve( ‘Dx + x = 0’ )
We get
>>
s = C1*exp(-t)
 C1 stands for a constant
78
16 Oscillating systems and 2nd order DE’s
The maths in this section applies to vibrating systems or “oscillating systems”.
Engineering examples include vibrating beams, vibrating structures such as platforms or
buildings (especially if they are affected by wind or earthquakes), planes and cars.
The very simplest example is a vibrating spring. This is easy to imagine and the maths is a
good introduction to more complicated examples.
Oscillations can also occur in electrical and electronic circuits (here the variable is the current
rather than the position) and there are also oscillations in biological systems (these are often
related to “feedback systems”).
Vibrating systems come in different types
• Some never lose energy while others have friction (or damping) and lose energy.
• Some are left to themselves and have no external inputs. Others (especially electrical
circuits) receive external inputs – they are called “driven systems”.
No external inputs are homogeneous DE’s. External inputs give inhomogeneous DE’s.
16.1 The 1D spring – deriving the differential equation
The simplest oscillating system is a light spring with a mass at the end.
The picture shows two situations –the spring
in ‘equilibrium’ with a weight at the end of
the spring with a weight at the end vibrating
up and down.
Here the downward direction is positive
and the upward direction is negative.
Now think about the forces involved – the
pictures below show three options
• When y > 0, the weight is pulled down by a distance +y. The spring pulls backwards (in
an upwards direction). The force here is in the negative direction.
• When you push the spring up you will feel it pressing against you in a downwards
direction. This is when y < 0. The force here is in the positive direction.
79
• The simplest formula for force when we change length of spring by y:
The force on the mass is:
Force on mass = - ky.
Here k is called the spring constant and it is positive.
Larger values of k mean that the spring is ‘stiffer’.
To get the DE we need 3 basic facts
1.
The force that acts on the weight is F = − ky .
2.
If a force F acts on a mass m then the mass will accelerate.
Newton’s 2nd law states: F = ma .
So we have the basic equation m a = F = − ky .
3.
Velocity and acceleration are related to the position y by
dv
d dy
d2y
dy
=
( ) =
and a =
.
v =
dt
dt dt
dt
dt 2
4.
So we get ma = m
d2y
= F.
dt 2
Conclusion: Combining 1 and 4 gives a second order ODE: m
d2y
= − ky
dt 2
The basic DE for a simple spring can be written in several ways
m
d2y
= − ky .
dt 2
1.
For a simple spring system
2.
d y
k
We divide by m and put ω =
so that the DE is written as
m
dt 2
2
2
80
= − ω2 y .
Writing ω 2 =
k
k
emphasizes that
is positive. Also
m
m
ω
is the vibration frequency of
the spring (dimension: radians/time).
Another example where the same or a similar DE applies
y
Here y represents the value of sideways deviation of the top
of the building from equilibrium.
16.2 Solving the simplest second order DE
d2y
=
dt 2
− ω2 y
There are two steps here – find the general solution and then match this to the starting
conditions (if they are known)
When ω = 1, the DE is
d2y
=
dt 2
−y.
Two solutions are y = sin( t ) or y = cos(t ) .
This DE is so common that students need to always remember these solutions.
General solution of
d2y
= − y is the combination y = A cos( t ) + B sin( t ) .
dt 2
The general solution of
[ remember that
d2y
= − ω 2 y is y = A cos(ω t ) + B sin(ω t )
2
dt
d
d
sin(ω t ) = ω cos(ω t ) and
cos(ω t ) = − ω sin(ω t ) ].
dt
dt
Properties of this solutions
• This is a periodic solution.
• It has a frequency of ω and its period is T =
81
2π
ω
.
16.3 Including the initial (starting) conditions
For a spring we can vary two starting values – how far it is pulled out and what its starting
velocity is.
Example 1
Find the solution of
d2 y
= − y which starts with y = 2 and dy = 0 .
2
dt
dt
Solution
•
The general solution is y (t ) = A cos(t ) + B sin(t ) .
•
When t = 0, y(0) = A cos(0) + B sin(0) = A (1) + B ( 0) = A .
y must start at 2, so A = 2.
•
Take the derivative to get y '( t ) = − A sin( t ) + B cos( t )
Put t = 0 so that y '(0) = B .
At the start the velocity is zero, so B = 0.
The solution matching these initial conditions is y ( t ) = 2 cos( t ) .
Example 2
Find the solution of
d2y
= − y which starts with y = 0 and dy = 2 .
dt
dt 2
Solution
Example 3
A spring has mass m and spring constant k. It is pulled out by a distance y = 3 and released
from rest. Find the way that the spring moves after this.
Solution
d2y
2
= −ω2 y
Here ω = k / m
2
dt
The solution has the initial condition y (0) = 3 and y '(0) = 0 .
We need to solve the DE
1
The general solution of the DE is y (t ) = A cos(ω t ) + B sin(ω t )
82
2
Use the initial condition on y.
At t = 0 we have y (0) = A cos(0) + B sin(0) = A
This must match the initial condition y (0) = 3 so A = 3
3
Use the second initial condition that y '(0) = 0 .
We differentiate the general solution get dy/dt and then put t = 0
dy
d
=
[ A cos(ω t ) + B sin(ω t ) ] = Aω ( − sin(ω t ) ) + Bω cos(ω t )
dt
dt
When t = 0, y '(0) = − ω A sin(0) + ω B cos(0) = ω B
So ω B = 0 and so B = 0.
4
The solution is y ( t ) = 3 cos(ω t )
The graph below is for this solution when ω = 1 ( i.e. y ( t ) = 3 cos( t ) ).
y(t)
x
16.4 Including friction – a more realistic model
The previous model of a spring did not
include any friction (or ‘damping”).
Damping can either come from
mechanical friction or from energy
being used up (e.g. through a resistance
in an electrical circuit). Solutions
without damping keep on oscillating
forever with the same amplitude.
Most systems have some degree of
damping. The simplest example is
when we add a force that is proportional
to the velocity.
Here y and v are both positive.
There are two forces – the spring force which is pulling back. The friction force which points
in the opposite direction to the velocity. The formulas for the two forces involved are:
spring force (k is a positive constant)
F = − av friction force ( a is a positive constant)
F = − ky
Using Newton’s law:
mass × acceleration = total force acting on spring
83
m
gives:
d2y
= − ky − av .
dt 2
m
This can be written as
d2y
dy
+ a + ky = 0 .
2
dt
dt
d2y
dy
+ f
+ ω2 y = 0 .
2
dt
dt
If we divide by m this DE we get
Here f represents the strength of the frictional force, ω is still a frequency.
Here f =
a
m
Example 1:
and ω 2 =
k
m
Solve the DE
d2y
dy
+ 2
+ 5 y = 0 with the starting conditions
2
dt
dt
y (0) = 3, y '(0) = 0
Solution
This is a constant coefficient, homogeneous 2nd order ODE
Step 1
Find the general solution of the DE
λt
We look for a solution of the form y = e .
Putting this into
This gives
d2y
dy
+ 2
+ 5y = 0
2
dt
dt
d 2eλt
deλt
+
2
+ 5eλt = 0
2
dt
dt
After differentiation:
λ2eλt + 2λeλt + 5eλt = 0
λt
2
Factorising common term eλt gives: (λ + 2λ + 5)e
λ2 + 2λ + 5 = 0
As e λ t ≠ 0 we get
=0
(characteristic equation )
[An easier way to get the characteristic equation is to replace the 2nd derivative by λ 2 , the 1st
derivative by λ and replace y by 1. This gives the characteristic equation λ 2 + 2λ + 5 = 0 ].
Solving the equation
λ =
−2 ±
λ 2 + 2λ + 5 = 0
22 − ( 4 )(1)( 5)
( 2 )(1)
=
−2 ±
−16
2
So λ = − 1 + 2 i and λ = − 1 − 2 i
84
=
−2 ± 4i
= − 1 ± 2i
2
−t + 2it
So we have two solutions y = e
−t − 2it
and y = e
−t + 2it
One way to write the general solution is y = Ae
formula:
e−t + 2it = e−t e+2 it = e−t ( cos(2 t ) + i sin(2 t ) )
+ Be−t − 2it . But according to Euler's
e−t − 2it = e−t e−2 it = e−t ( cos(2 t ) − i sin(2 t ) )
Another way to write the general solution is as a combination
y = Ce−t cos(2t) + De−t sin(2t)
Step 2
Matching initial conditions y (0) = 3, y '(0) = 0
We use the form y = Ce−t cos(2t) + De−t sin(2t)
• Start with y (0) = 3 then we get put t = 0 in the formula for y to get y (0) = C so that C = 3.
• We also calculate the derivative of y using the product rule
dy d
= { Ce − t cos( 2t ) + De − t sin( 2t )}
dt dt
= C {− e − t cos( 2t ) − 2e − t sin( 2t )} + D {− e − t sin( 2t ) + 2e − t cos( 2t )}
Putting t = 0 we get y '(0) = C { − 1} + D {2} = − C + 2 D .
This must match 0 and we have C = 3 so that so that D = 1.5.
Conclusion:
The solution that matches the initial condition is
y(t) = 3e−t cos(2t) + 1.5e−t sin(2t)
The graph of this solution is
The solution is an example of damped harmonic motion. The damping is evident in
gradually reducing amplitude of oscillations.
85
16.5 The different types of solutions for damped oscillators
d2y
dy
+ ω 2 y = 0 the characteristic
For a general DE describing damped oscillations 2 + f
dt
dt
equation is
λ2 + f λ + ω2 = 0 , which has solutions: λ1,2 =
2
2
we have f − 4ω < 0 and
−f ±
f 2 − 4ω 2
. When f < 2ω
2
λ1,2 will have an imaginary component which indicates the
presence of sin and cos in the solution that are responsible for oscillations. For f ≥ 2ω we
2
2
have f − 4ω ≥ 0 and
λ1,2 will be real numbers, and therefore the DE will have only
exponential solutions (no oscillations).
d2y
dy
+ f
+ ω 2 y = 0 for ω = 2 and various values
2
dt
dt
of f . As f increases the friction term is getting larger. All the solutions start with
y (0) = 1, y '(0) = 0 .
Here are graphs of the solutions of
• When f = 0 there is no friction and so no damping so that the spring oscillates with
constant amplitude.
• When f = 1, f < 2ω and we have decaying oscillations.
• When f = 4 , f = 2ω and we are just at the point where there are no oscillations.
• When f = 5, f > 2ω and there are no oscillations.
86
Three common terms for damped oscillators are:
• Under-damped – the solutions decreases and also oscillate ( like f = 1 example).
• Over-damped – the solutions decrease exponentially with no oscillations (f = 5) example.
• Critically damped – the border line case between under-damped and over-damped ( f = 4
here).
16.6 Electrical circuits as oscillators [optional]
The simplest example is a circuit made from three components:
• An inductance (stores magnetic energy) - voltage drop across it is V = L
• A capacitor - voltage drop across it is V =
dI
.
dt
Q
.
C
• A resistance – the voltage drop across it is V = IR .
Here L, R and C are constants. I(t) is the current flowing in the circuit at time t.
In the first diagram we start with the capacitor charged so that it has the charge +Q on one
plate and –Q on the other. We then close the switch. The charges then flow around the
circuit and eventually there is no charge left in the capacitor.
Because there is no external battery the total voltage change as we go around the circuit is
zero.
So
L
dI
Q
+
+ IR = 0
dt
C
[1]
The only current in the circuit comes from the charge moving out of the capacitor.
87
So the current is the rate of change of Q and so I =
Substituting I =
So
L
dQ
.
dt
[2]
dQ
d dQ
Q
dQ
into [1] gives L (
) +
+ R
= 0
dt
dt dt
C
dt
d 2Q
dQ
1
+ R
+ Q = 0
2
dt
C
dt
[Also the same DE is true for the current I ]
Connecting an external voltage to this circuit
If we connect an external voltage (e.g. function generator) to the circuit we get a different DE
L
d 2Q
Q
dQ
+
+ R
= V (t )
2
C
dt
dt
Here we allow for situations where the voltage depends on time.
This leads to new examples of 2nd order DE’s. However the way to solve them is exactly the
same.
16.7 Driven oscillators
This section looks at oscillating systems that are also driven by an oscillating external force.
Examples of these are
• A tall building in an earthquake – if the ground moves sideways for a while here x(t) is the
sideways displacement of the building (hopefully this is small).
• An RLC electrical circuit with an external AC power supply connected to it.
88
To understand the maths we will look at inhomogeneous DE’s of the type
d2y
dy
+ f
+ ω02 y = F cos(ω t )
2
dt
dt
Similar approach can be used to solve:
d2y
dy
+ f
+ ω02 y = F sin(ω t )
2
dt
dt
In both cases it is easier to work with a complex RHS
d2y
dy
+ f
+ ω02 y = Fe iω t
2
dt
dt
and then take real (for F cos(ω t ) ) or imaginary (for F sin(ω t ) ) part of the solution.
Way to solve these DE’s – there are 3 steps
1. Find any one solution of the inhomogeneous DE – usually by guessing. Hint: with linear
ODE’s, the response function must be similar to the driving force (RHS).
This is called the particular solution.
d2y
dy
+ f
+ ω02 y = 0 and get its general solutions. This
2
dt
dt
will involve two adjustable constants A and B.
2. Take the homogeneous DE
3. Add the results from 1 and 2 together. Then adjust A and B to match the initial conditions.
Solving this type of differential equation usually involves quite a lot of algebra – the basic
ideas are simple but the details can be messy. We can use computer algebra to carry through
the algebra for us.
Example 1
d2y
dy
+ 2
+ 2 y = cos(t )
Find a particular solution of
2
dt
dt
The algebra is simpler if we use
d2y
dy
+ 2
+ 2 y = eit and at the end take the real part.
2
dt
dt
it
This works as cos(t) is the real part of e = cos(t ) + i sin(t) .
it
Guess the particular solution as y = Ae .
Then
d2y
dy
+ 2
+ 2 y = − Aeit + 2iAeit + 2 Aeit = A(1 + 2i) eit .
2
dt
dt
2
d it
d it
e = i2eit = − eit ]
[we use
e = ieit and that
2
dt
dt
it
it
To make this match e it on the RHS we must choose A(1+ 2i) e = e
A =
So y =
1
1− 2 i
1 − 2i
1 − 2i
=
= 2 2 =
1+ 2 i
(1 + 2i)(1 − 2i)
5
1 +2
1 − 2i it
e is one particular solution that gives e it on the RHS.
5
Now we expand out y as
89
y =
1
1
i
(1 − 2i )(cos t + i sin t ) = (cos t + 2 sin t ) + (sin t − 2 cos t )
5
5
5
Conclusion:
d2y
dy
+ 2
+ 2 y = cos(t )
2
dt
dt
cos(t) is the real part of e it . So we take the real part of y.
d2y
dy
+ 2
+ 2 y = cos(t ) is y = 1 (cos t + 2 sin t ) .
One particular solution of
2
dt
5
dt
We really wanted the solution of
Example 2
Find a solution of
d2y
dy
+ 2
+ 2 y = cos(t ) with the initial condition
2
dt
dt
y(0) = 0 and y′(0) = 0
Step 1:
Find a particular solution of
We already have a particular solution y p =
d2y
dy
+ 2
+ 2 y = cos(t )
2
dt
dt
1
(cos t + 2 sin t ) but this does not match the
5
initial conditions (try putting t = 0 in this – you won’t get y = 0).
Step 2:
Find a general solution of the homogeneous solution
d2 y
dy
+ 2y = 0
The homogeneous equation was 2 + 2
dt
dt
kt
Try a solution y = e

k2 + 2k + 2 = 0 (characteristic equation)
22 − 4 × 2 ×1
−2 ± −4
−2 ± 2i
=
=
= −1 ± i
2 ×1
2
2
The solutions by this method are
k =
−2 ±
e(−1 + i)t = e−t e it = e−t cos(t) + i e−t sin(t)
e(−1 − i)t = e−te −it = e−t cos(t) − i e−t sin(t)
Any combination of these can also be changed into a combination
y = Ae−t cos(t) + Be−t sin(t)
Step 3:
Use the initial conditions to set up equations for A and B
The general solution of the inhomogeneous DE is
y =
1
2
cos(t ) + sin(t ) + Ae − t cos(t ) + Be − t sin(t )
5
5
• When t = 0, y is 0.
1
2
1
× 1 + × 0 + A ×1 + B × 0 =
+ A.
5
5
5
dy
dy
When t = 0,
in general
= 0 - first we calculate
dt
dt
dy
1
2
= − sin t +
cos t + A{− e − t cos(t ) − e − t sin(t )} + B{− e − t sin(t ) + e − t cos(t )}
dt
5
5
Putting t = 0 gives y =
•
90
2
+ A{− 1} + B{1} =
5
When t = 0, y '(0) =
2
−A + B.
5
• Solving for A and B
1
2
= 0 and
− A + B = 0.
5
5
3
and B = − .
5
The two equations for A and B are A +
These will be zero when A = −
Conclusion:
1
5
The solution that matches the initial conditions is
1
2
1
3
y = cos t + sin t − e − t cos(t ) − e − t sin(t )
5
5
5
5
This solution contains two parts:
1
2
cos t + sin t
5
5
1 −t
3
the other part of the solution − e cos(t ) − e − t sin( t ) . This is needed to match the
5
5
• the long term component
•
initial conditions but it drops to zero quite quickly.
The overall solution very rapidly becomes periodic. This solution matches the starting
conditions but it rapidly settles down to the periodic solution.
16.8
1
Using Matlab to solve 2nd order DE’s
Solving 2nd order DE
d2y
dy
+ 2
+ 2 y = 2e−2t with the initial conditions
2
dt
dt
y ( 0) = 0, y '(0) = 0
d2y
The Matlab notation for
is D2y
dt 2
Matlab notation for the DE is ‘D2y + 2*Dy + 2*y = 2*exp(-2*t)’
It is essential to use * when you multiply things together.
>> s = dsolve(‘D2y+2*Dy+2*y = 2*exp(-2*t)’, ‘y(0)=0’, ‘Dy(0)=0’)
We get
>>
s = exp(-t)*sin(t) - exp(-t)*cos(t) + exp(-2*t)
−t
−t
−2t
This stands for e sin(t) − e cos(t) + e
91
2
Solving 2nd order DE
d2y
dy
+ 2
+ 2 y = 2e−2t without initial conditions.
2
dt
dt
>> s = dsolve(‘D2y+2*Dy+2*y = 2*exp(-2*t)’ )
We get
>>
exp(-t)*sin(t)*C2+exp(-t)*cos(t)*C1+exp(-2*t)
−t
−t
−2t
This stands for C2 e sin(t ) + C1e cos(t ) + e
3
Here C1 and C2 stand for arbitrary constants.
d2y
dy
+ 2
+ 2 y = cos(t ) with y ( 0) = 0, y '(0) = 0
Find the solution of
2
dt
dt
The Matlab command is
>>
s = dsolve( ‘D2y+2*Dy+2*y = cos(t)’ , ‘ y(0) = 0 ’, ‘ Dy(0) = 0 ’ )
We get
>> s = -3/5*exp(-t)*sin(t)-1/5*exp(-t)*cos(t)+2/5*sin(t)+1/5*cos(t)
3
5
This stands for − e − t sin(t ) −
1 −t
2
1
e cos(t ) + sin(t ) + cos(t )
5
5
5
This is exactly what we got when we solved it by hand.
d 2x
dx
+ 2
+ 4 x = 0 with x ( 0 ) = 1, x '(0) = 0
4.
Find the solution of
2
dt
dt
>> s = dsolve(‘D2x + 2*Dx + 5*x = 0’, ‘x(0) = 1’, ‘Dx(0) = 0’)
We solved this before and got
x = e−t cos(2t) + 0.5e−t sin(2t)
Matlab gives
>>
s = 1/2*exp(-t)*sin(2*t)+exp(-t)*cos(2*t)
This solution is s =
5.
1 −t
e sin(2 t ) + e − t cos(2 t )
2
d2y
+ y = sin(2t ) with the initial conditions y(0) = 1 and y′(0) = 0
dt 2
The Matlab commands are
>>
s = dsolve('D2y + y = sin(2*t)', 'y(0) = 1', 'Dy(0) =0')
>>
s = 2/3*sin(t) + cost(t) - 1/3*sin(2*t)
Solve
This is y =
2
1
sin(t ) + cos(t ) − sin(2t )
3
3
To plot this solution from t = 0 to t = 20 use the ezplot command for a symbolic
variable:
>> ezplot( s, [0, 20] ); grid; shg
92
Explaining the ezplot command
The ezplot command needs 2 inputs: the symbolic expression to be plotted and the range of
values to be plotted. Here we want to plot from t =0 to t = 20 and we represent this by [0, 20].
16.9
The resonance phenomenon [optional]
The aim of this section is to see what happens when we vary the frequency of the driving term
for a damped oscillating system. This leads to the idea of resonance. At resonance a system is
giving its largest response – sometimes this is good (e.g. when you tune your radio correctly)
and sometimes it is bad (if an earthquake hits a resonant frequency for a building it will cause
more damage).
Damage to buildings during earthquakes is most likely to occur when the frequency that the
ground shakes at is the same as the frequency at which a building shakes.
A general rule of thumb is that a building’s resonant frequency is about 10 Hz divided by the
number of floors (see table). [source: http://faculty.washington.edu/tpratt/frequencies.htm]
number of floors
5
10
50
Resonant
frequency (Hz)
2.0
1.0
0.2
period of oscillations
(seconds)
0.5
1.0
5.0
An extreme example of resonance occurred
with the collapse of the Tacoma Narrows
Bridge in Washington state. Soon after the
bridge opened in 1940, motorists began to
notice its tendency to vibrate in a moderate
wind. On November 7th, 1940 the bridge
started to twist violently in a 70 kph wind.
The concrete surface cracked and the bridge
collapsed. What happened here involved
feedback as well as resonance. The bridge
went into a twisting (torsional) vibration
mode. The twisting of the bridge gave a greater surface exposed to the wind and so the
forces experienced by the bridge actually increased.
93
Engineers learnt from this that the analysis of large bridges and buildings needed to involve a
study of their dynamic interaction with wind forces as well.
16.10
The mathematics behind resonance [optional]
We look at the behaviour of a damped oscillator being driven by a periodic force. This is a
very simple mathematical model. For larger systems we usually have more DE’s but the
basic idea is similar. The simplest DE is:
d2y
dy
+ f
+ ω02 y = F cos(ω t )
2
dt
dt
where y is the response of the system (like deviation of a building from its equilibrium
position). Also in this DE:
• f represents the relative contribution of ‘friction’ or ‘damping’ in the system.
•
ω0 is the frequency of the system without any damping.
Sometimes ω0 is called the natural frequency of the system.
• ω is the ‘driving’ frequency.
• F represents a relative strength of the ‘driving’ force.
Here we only want to calculate the long-term periodic part of the solution.
It is easiest to do this using the complex exponential method.
d2y
dy
+ f
+ ω02 y = Fei ω t
1
Write the ODE as
2
dt
dt
2
3
i ωt
Then try a solution y = Ae
Then
−ω 2 Aei ωt + f iω Aei ωt + ω02 Aei ωt = Fei ω t
So
{ω02 − ω2 + iω f }A = F
Therefore the complex solution is
y =
ω02
Fe i ω t
− ω 2 + iω f
To understand how this varies with ω we
write the denominator in ‘polar form’ as
ω 02 − ω 2 + iω f
ω02 − ω2 + iω f = R eiδ
iω f
Here R is the length of the complex
number and δ is its phase.
ω 02 − ω 2
iδ
Remember that R e
= R cos(δ ) + iRsin(δ )
2
2
So ω0 − ω + iω f = R cos(δ ) + iR sin(δ )
94
Then
R =
(ω 02 − ω 2 ) 2 + f 2ω 2 and tan(δ ) =
ω02
fω
.
− ω2
Conclusion
One solution of
y (t ) =
Fe iω t
R e iδ
d2y
dy
+ f
+ ω02 y = Aei ω t is
2
dt
dt
=
F e i (ω t − δ )
(ω 02
2 2
2
−ω ) + f ω
• The amplitude of solution is given by
2
=
A (ω ) =
• The amplitude changes with the driving frequency
F
(ω 02
2 2
2
−ω ) + f ω
F
(ω 02
2 2
− ω ) + f 2ω 2
2
e i (ω t − δ )
.
ω.
• The solution is not exactly in phase with the driving term – the phase difference between
the driving term and the solution is given by tan(δ ) =
ω02
fω
.
− ω2
Going back to the original problem Take the real part of this formula we get that one solution of
d2y
dy
+ f
+ ω02 y = F cos(ωt ) is
2
dt
dt
y =
F
(ω 02 − ω 2 ) 2 + f 2ω 2
cos(ω t − δ ) = A(ω ) cos(ω t − δ ) .
95
16.11
How the solution amplitude changes with the driving frequency
[optional]
Here are graphs of the amplitude versus the driving frequency ω.
In these examples
ω0 = 2 and
f = 1, 0.5, 0.1 .
R – y-axis
ω – x-axis
Some conclusions:
• The maximum amplitude of the solution occurs near the frequency of the undamped
oscillator ( ω0 ). Often the frequency where the response is largest is called the resonant
frequency of the system.
• The smaller the friction term ( f ), the sharper the rise of the amplitude graph to its peak.
In this case the resonance curve is sharp and narrow.
The sharpness of the resonance is often expressed in terms of Q =
ω0
f
, this Q factor is
based on the natural frequency and the damping of the system without any input. Here Q
is 2, 4 and 20.
• When the driving frequency ω is large, the graphs show that amplitude of vibration is
small. The friction stops the oscillator responding immediately to the driving force and
the oscillator will do quite small, high frequency vibrations.
96
17 Using power series to solve ordinary differential equations
This is another way to solve linear first or second order, homogeneous differential equations.
It is powerful but there are some conditions on when it will work. It can be used for either of
the following types of DE’s:
dy
+ P ( x ) y = 0 provided that P ( x ) is finite at x = 0 and has any
dx
number of derivatives that are all finite at x = 0. Notice that the coefficient of dy / dx is 1.
• 1st order DE’s like
d2 y
dy
+ P(x)
+ Q(x) y = 0 provided that both P ( x ) and Q ( x )
• 2nd order DE’s like
2
dx
dx
are finite at x = 0 and have any number of derivatives that are all finite at x = 0. Notice
that the coefficient of the highest derivative ( d 2 y / dx 2 ) is 1, this ensures that the DE is in
a standard form.
In the power series method we look for a solution of the form
y( x) = a0 + a1x + a2 x 2 + a3 x3 + a4 x 4 + ...
Examples:
dy
+ y = 0 . Here P ( x ) = 1 everywhere. This P ( x ) is finite at x = 0 and has any
1.
dx
number of derivatives so the method will work here.
2
dy
+ xy = 0 . Here P ( x ) = x . This is finite at x = 0. The method will work.
dx
dy
+ y = 0 . To get this DE to a standard form we divide is by x to get
dx
dy 1
+ y = 0.
dx
x
1
Now P( x) =
and this is not finite at x = 0, so the method will not work here.
x
3
4
5
x
dy
dy
+ x
+ x 2 y = 0 . Here P ( x ) = x and Q( x) = x2 . These are both
dx
dx
finite at x = 0. Again the method will work here.
d2y
dy
d2y
1 dy
2
.
Dividing
by
x
we
get
+
+
x
y
=
0
+
+ xy = 0
2
2
dx
dx
dx
x dx
1
Here P( x) = . This is infinite at x = 0 so the method would not work.
x
x
dy
1
+ x y = 0 . Here P ( x ) = x . This is finite at x = 0, but P′( x) =
is
dx
2 x
infinite at x = 0. The power series method cannot work here.
6
97
Example 1
Using power series method on a first order DE
dy
= y
dx
Step 1
Does the method apply? (see required conditions above)
dy
dy
− y = 0 . The coefficient of
Rewrite it as
is 1 and P ( x ) = − 1 which is finite at x=0
dx
dx
and has any number of derivatives. So the method applies.
Step 2
Assume that y(x) is a power series and get its derivative
y( x) = a0 + a1x + a2 x 2 + a3 x3 + a4 x 4 + ...
dy
= a1 + 2a2 x + 3a3 x 2 + 4a4 x3 + ...
dx
Step 3
Get
dy
= y and match terms
dx
a1 + 2a2 x + 3a3 x 2 + 4a4 x3 + ... = a0 + a1x + a2 x2 + a3 x3 + a4 x4 + ...
Put both series into the DE
The two sides are supposed to be the same for all x (at least near x = 0 ). This can only
happen when the coefficients of like powers match.
a1 = a0
Constant terms
2a2 = a1
x terms
2
3a3 = a2
4a4 = a3
x terms
x3 terms
Use these relations to connect all a’s back to a0 -
Step 4
Constant
a1 = a0

x terms
2a2 = a1

x 2 terms
3a3 = a2

x3 terms
4a4 = a3

a1 = a0
1
1
a2 = a1 = a0
2
2
1
1 1
1
a3 = a2 = ( a0 ) = a0
3
3 2
6
1
1 1
1
a4 = a2 = ( a0 ) =
a0
4
4 6
24
There is a pattern here which can be spotted: it is an =
y ( x) = a0 + a0 x +
1
a0
n!
a0 2 a0 3 a0 4
x +
x +
x + ...
2!
3!
4!
Conclusion
This solution can be written as
1 2
1 3
1 4
y ( x) = a0{1 + x +
x +
x +
x + ... } = a0e x
2!
3!
4!
Note that this matches the general solution y( x) = a0e x ( this series is the Taylor expansion
for e x around x = 0 ).
This is the general solution that can fit any initial value for y.
98
Solving a 2nd order DE
Example 2
d2y
= −y
dx 2
You already know that this has two independent solutions y = cos( x) and y = sin( x )
Step 1
Does the series method apply?
d2y
dy
+ 0
+ 1y = 0 .
2
dx
dx
Here P ( x) = 0 and Q ( x) = 1 - both are finite at x = 0 and have any number of
derivatives.
Yes, because we can write the DE as
Assume y is a power series and work out the different terms
Step 2
y( x) = a0 + a1 x + a2 x2 + a3 x3 + a4 x4 + a5 x5 + ...
dy
= a1 + 2a2 x + 3a3 x 2 + 4a4 x3 + 5a5 x 4 + ...
dx
d2y
= 2a2 + 6a3 x + 12a4 x 2 + 20a5 x 3 + ...
2
dx
Step 3
Put all this into the DE
d2y
= − y and match terms
dx 2
d2y
= 2a2 + 6a3 x + 12a4 x 2 + 20a5 x 3 + ...
dx 2
− y( x) = − a0 − a1x − a2 x2 − a3 x3 − a4 x 4 − a5 x5 + ...
Now match the different powers of x:
Constant terms
2a2 = − a0
x terms
6a3 = − a1
2
x terms
3
x terms
12a4 = − a2
20a5 = − a3
Use these relations to connect all a’s back to a0
1
2a2 = − a0 
a2 = − a0
Constant terms
2
1
6a3 = − a1
a3 = − a1

x terms
6
1
1 1
1
12a4 = − a2 
a4 = − a2 = − (− a0 ) =
a0
x 2 terms
12
12 2
24
1
1
1
1
20a5 = − a3 
a5 = − a3 = − ( − a1 ) =
a1
x3 terms
20
20
6
120
Step 4
99
Conclusion: Put these back into the series solution
d2y
The solution of
= − y is
dx 2
x2
x3
x4
x5
y ( x) = a0 + a1 x − a0
− a1
+ a0
+ a1
+ ...
2
6
24
120
Because this is a 2nd order DE we have two independent solutions. This shows up with a0
and a1 being present in the final answer.
y ( x) = { a0 − a0
x2
x4
x3
+ a0
+ ... } + { a1 x − a1
2
24
6
+ a1
x5
+ ...}
120
This is the general solution of this DE. There is a pattern here – the fractions are factorials
y ( x) = a0 {1 −
x2
x4
x3
+
+ ... } + a1{ x −
2!
4!
3!
+
x5
+ ...}
5!
These are the Taylor expansions of cos(x) and sin(x) and this matches the general solution
y( x) = a0 cos( x) + a1 sin( x)
Example 3
Another way of solving
d2y
= − y - using the Σ notation
dx 2
Instead of writing y out with individual y( x) = a0 + a1x + a2 x2 + a3 x3 + ...
∞
we could use the notation y ( x) =
a x
n
n
.
n=0
Step 1
Calculate the derivatives using this notation
dy ( x)
=
dx
∞

n=0
d
(an x n ) =
dx
d 2 y ( x)
d ∞
=
nan x n −1

2
dx
dx n = 0
∞
 na x
n −1
n
n=0
∞
=
 n(n − 1)a x
n−2
n
n=0
2
The DE is
d y
= −y
dx 2
So this gives
 n(n − 1)a x
∞
∞
n −2
n
n=0
Step 2
= −  an x n
n=0
Rewrite both sides in terms of the same power
We want to match equal powers but the terms involve x n − 2 on the left and x n on the right.
We cannot do this at the moment. The trick is change symbols to get both series written in
xm .
100
∞
 n(n − 1)a x
• On the right we have y '' =
n −2
n
so we put m = n − 2 .
n=0
Then n = m + 2 and n − 1 = m + 1
The n sum starts at n = 0 so the m sum will start with m = n − 2 = 0 − 2 = − 2
∞
So

∞
n(n − 1)an x n − 2 =
n=0

(m + 2)(m + 1)am + 2 x m
m = −2
But when m = -2 and m = -1 the term (m + 2)( m + 1) am + 2 x m is zero.
∞
 (m + 2)(m + 1)a
So we can start the expansion as y '' =
m+2
xm
m=0
∞
• On the right side of last equation in step 1 we have −  an x n
we can just use m = n .
n=0
∞
So the right hand side can be written −  am x m .
m=0
Step 3
Now get the recurrence relations between the coefficients
∞
We must match
 (m + 2)(m + 1)a
m=0
∞
m+2
xm = −
 a
m=0
m
xm
The coefficients of x m must be the same for m = 0, 1, 2, …
(m + 2)(m + 1)am + 2 = − am
am + 2 = −
1
am for m ≥ 0
( m + 2)( m + 1)
Now go through the cases m = 0,1,2 etc using this recurrence formula
m
0
1
2
3
Recurrence formula
1
a2 = −
a0
(2)(1)
1
a3 = −
a1
(3)(2)
1
a4 = −
a2
(4)(3)
1
a5 = −
a3
(5)(4)
conclusion
1
a 2 = − a0
2
1
a 3 = − a1
6
1
1
a 4 = − a2 =
a0
12
24
1
1
a 5 = − a3 =
a1
20
120
These are exactly the same results that we got before.
101
Example 4
Airy’s differential equation
Step 1
Does the method apply?
d2y
= xy
dx 2
d2y
dy
+ 0.
− x. y = 0 . Here P ( x) = 0 and Q ( x) = − x , both are
2
dx
dx
finite at x = 0 and have any number of derivatives.
Yes - the DE is
Assume y is a power series and work out the different terms
Step 2
y( x) = a0 + a1x + a2 x2 + a3 x3 + a4 x4 + a5 x5 + ...
dy
= a1 + 2a2 x + 3a3 x 2 + 4a4 x3 + 5a5 x 4 + ...
dx
d2y
= 2a2 + 6a3 x + 12a4 x 2 + 20a5 x 3 + ...
2
dx
Step 3 Put all this into the DE
d2y
= xy and match terms
dx 2
d2y
= 2a2 + 6a3 x + 12a4 x 2 + 20a5 x 3 + ...
2
dx
xy( x) = a0 x + a1x2 + a2 x3 + a3 x4 + a4 x5 + a5 x6 + ...
Now match the different powers of x:
Constant terms
2a2 = 0
x terms
6a3 = a0
x 2 terms
12a4 = a1
3
x terms
Step 4
 unusual
20a5 = a2
Use these relations to connect all a’s back to a0
Constant terms
2a2 = 0

x terms
6a3 = a0

x 2 terms
12a4 = a1

x3 terms
20a5 = a2

a2 = 0
1
a3 = a0
6
1
a4 =
a1
12
1
1
a5 = − a3 =
a2 = 0
20
20
102
Conclusion: Put these back into the series solution
y ( x) = a0 + a1 x + 0 x 2 + a0
x3
x4
+ a1
+ 0 x5 + ...
6
12
We can re-write this as (including some more terms)
x3
x6
x4
x7
+ a0
+ ... } + { a1 x + a1
+ a1
+ ...}
6
180
12
504
x3
x6
x4
x7
= a0{1 +
+
+ ...} + a1{ x +
+
+ ...}
6
180
12
504
y ( x) = {a0 + a0
This is the general solution of this DE. Because this is a 2nd order DE we have two
independent solutions. This shows up with a0 and a1 being present in the final answer.
There is a pattern in the coefficients here but it is not that obvious.
103
18 Exam formula sheet
∇f =
∂f
∂f
∂f
i + j+ k
∂x ∂y
∂z
div ( v ) = ∇i v =
∂vx ∂v y ∂vz
+
+
∂x ∂y ∂z
æ ∂Vy ∂Vx ö
−
÷ dxdy ;
∂x
∂y ø
 Vid r =  çè
C
A
S
2π
0
0
2π
 cos(nt )dt = 0, n ≥ 1
 sin
= π, n ≥ 1
0
2π
0
0
 cos(nt ) cos(mt )dt = 0, n ≠ m;
2π
 sin(nt ) sin(mt )dt = 0, n ≠ m;
0
=
∂
∂x
Ax
∂
∂y
Ay
∂
∂z
Az
2
= 0, n ≥ 1
(nt )dt = π , n ≥ 1
0
2π
 t sin(at )dt
k
V
 sin(nt )dt
2π
2
j

 vidS =  div ( v ) dV
2π
 cos (nt )dt
∇×A =
i
sin( at ) − at cos(at )
+ C;
a2
 sin(nt ) cos(mt )dt
ate at − e at
+C
a2
at
 te dt =
 t cos(at )dt
=
= 0, for any n and m
cos( at ) + at sin( at )
+C
a2
If g (t ) = f (t − c ) then g(k) = e−ic k f (k)
If g (t ) = f (ct ) then g(k) =
1
k
f( )
c
c
∞
æ
æ 2π ö
æ 2π ö ö
f (t) = a0 +  ç an cos ç
nt ÷ + bn sin ç
nt
è T ø
è T ÷ø ÷ø
n=1 è
æ 2π ö
æ 2π ö
1
2
2
f (t) dt; an =  f (t)cos ç
nt ÷ dt; bn =  f (t)sin ç
nt dt

T0
T0
è T ø
T 0
è T ÷ø
T
a0 =
T
f (t) =
1
2π
T
∞

∞
f (k) eikt dk
where f (k) =
−∞

−∞
104
f (t)e− ikt dt
Download