Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Differentiation as a limit
1 Basic calculus
1.1 Differentiation as a limit
1.1.1 DEFINITION
f x
x
Figure 1: Approximation of slope over finite range of x.
x+h
Let
x x+h x = h
f f(x+h) f(x)
df f = lim h0 dx h f = lim x 0 x = lim ( tan ) = "slope" of curve f ( x ) = "gradient" of curve f ( x ) Other notations df d , f , f , f x , f , x , Df dx dx
# Additionally, especially when f = f(t), the notation f is often used to represent df/dt.
x 0
10
Basic calculus
Differentiation as a limit
1.1.2 DIFFERENTIABILITY
The derivative f exists if it is finite and defined. Must have left- and right-hand limits the same:
f ( x) f ( x h) f ( x + h) f ( x) lim = lim h 0 h 0 h h
x
Figure 2: A function with a cusp is continuous, but not differentiable at the cusp as left- and right-hand derivatives are not the same.
1.1.3 EXAMPLES
f(x) = ax, for a = const a ( x + h ) ax df d ( ax ) ah = = lim = lim = lim a = a h 0 h 0 h h 0 dx dx h
11
Basic calculus
df d ( x = dx dx
) = lim ( x + h )
h 0
1 x2
x2 ( x + h )
= lim
h 0
x2 ( x + h )
= lim
h 0
h 2 xh h 2 hx 2 ( x + h )
2
= lim
h 0
2 x h
x ( x + h)
2 2
2 x x4 = 2 x 3 =
f ( x) = xn
n n ( x + h ) xn df d ( x ) = = lim h 0 dx dx h
12
Basic calculus
[Should really look at convergence, etc., but not part of this course.] Differentiate term-by-term:
d x d n ( e ) = dx x ! dx n =0 n d xn = n = 0 dx n ! =
nx n 1 n =1 n !
x n 1 = n =1 ( n 1) ! =
n =0
xn n!
= ex
13
f ( g ( x + x ) ) f ( g ( x ) ) g ( x + x ) g ( x ) = lim x 0 x g ( x + x ) g ( x ) f ( g + g ) f ( g ) g = lim x 0 g x f ( g + g ) f ( g ) g = lim lim x 0 g 0 g x df dg = dg dx since g 0 as x 0 for g(x) (and hence y) to be continuous. y = e x Write as y = f(g(x)) where f(g) = exp(g) = eg and g(x) = x. Now f(g) = eg and g(x) = ,
dy df dg = = eg so dx dg dx = e x
14
Basic calculus
d d 1 ix ix sin x = (e e ) dx dx 2i 1 1 Similarly = ( ieix + ie ix ) = ( eix + e ix ) 2i 2 = cos x
= lim
h 0
15
Basic calculus
f ( x + h) f ( x) g ( x + h) g ( x)
f ( x + h) g ( x) f ( x) g ( x) f ( x) g ( x + h) + f ( x) g ( x) h g ( x + h) g ( x)
16
Basic calculus d n +1 n x =0 dx n +1
d3 d d d fg ) = ( f ) + 2 ( f ) + ( fg ) g g 3 ( dx dx dx dx = f + f + 2 ( f + f ) + f + fg g g g g g = f + 3 f + 3 f + fg g g g which suggests n ( n 1) ( n 2) n nm m dn n n 1 n 1 n fg ) = f ( ) g + nf ( ) g + f g + ! + f ( ) g ( ) + ! + nf ( ) + fg ( ) g n ( 2! dx m Can prove by induction. Establish true for n = 1 Assume true for arbitrary n Show true for n+1 In Cambridge we like Newton, but Calculus was invented by Sir Isaac Newton and Gottfried Wilhelm Leibniz at around the same time, each claiming to have been first. Leibniz published in 1686 whereas Newton published in 1687, but it appears that Newton actually made the breakthrough some 20 years earlier (1665/66). This led to animosity between them (at least Newton hated Leibniz), and there is/was some suggestion of plagiarism on the part of Leibniz. Newtons approach was based on the ideas of limits whereas Leibniz used geometric arguments and developed a much simpler notation, including the d/dx and integral symbols we still use. Newtons notation was almost incomprehensible, changing it depending on the context (find example), so was difficult to use and understand. (Was this Newton trying to show off?) British mathematicians used Newtons notation during the 18th century, whereas the rest of the world adopted Leibnizs notation # and made more progress. Some of Newtons notation, for example x to represent dx/dt, is still used. http://www.angelfire.com/md/byme/mathsample.html Use Leibniz rule for y = xm+n = xmxn: Exercise
17
Basic calculus
d 2 m+ n d 2 m n x = 2 (x x ) dx 2 dx m2 n m 1 = m ( m 1) x x + 2mx nx n 1 + x m n ( n 1) x n 2 = ( m 2 m + 2mn + n 2 n ) x m + n 2 = ( m + n )( m + n 1) x m + n 2
as expected. Second derivative of y = 2sinx cosx: d2 2sin x cos x = 2 ( sin x ) cos x + 2 cos x ( sin x ) + sin x ( cos x ) dx 2 = 8sin x cos x = 4sin 2 x As expected from d2/dx2(sin 2x). There are a few somewhat more complicated functions on the examples sheet.
f f f x f, x x f and f y f, y y f . x y
f(x,y) = 1 x2 x sin y + y3
Then
( x + h) = lim
h 0 h 0
x2
sin y lim
( x + h) x
18
Basic calculus
Similarly
= x lim
h 0
sin ( y + h ) sin y
h 0 h = x cos y + 3 y 2
( y + h) + lim
h
What happens if we wish to move in another direction, say at an angle to the x axis? Let s = s(cos , sin ) be a unit vector in this direction, then the slope will be f ( x + h cos , y + h sin ) f ( x, y ) df = lim h 0 ds h f ( x + h cos , y + h sin ) f ( x, y + h sin ) + f ( x, y + h sin ) f ( x, y ) = lim h0 h f ( x + h cos , y + h sin ) f ( x, y + h sin ) f ( x, y + h sin ) f ( x, y ) = lim cos + lim sin h 0 h 0 h cos h sin f ( x, y + h sin ) f ( x, y ) f ( x + h cos , y ) f ( x, y ) = lim cos + lim sin h cos 0 h sin 0 h sin h cos f f = cos + sin x y Now since x = s cos dx/ds = cos and y = s sin dy/ds = sin , we may rewrite this as df f f f dx f dy = cos + sin = + ds x y x ds y ds We shall not be using the above in this course, although you will require it in other courses. More generally, we may have a function f that depends on the variables x0, x1, xn-1, from which we may form the derivatives f/xi for i = 0,1,n1. Higher order derivatives are handled in a similar way to functions of a single variable
f x + h, y x, y = lim 2 h0 x h , f ( x + h + a, y ) f ( x + h, y ) f ( x + a , y ) f ( x, y ) lim lim a 0 a 0 a a = lim h0 h
2
f x
f x
but of course we have the possibility of taking the derivatives in different directions. So long as the limits are well behaved, then
19
Basic calculus
f y
x + h, y
Curve sketching
f y
f = lim xy h 0
2
x, y
f(x,y) = 1 x2 x sin y + y3 f f 2 f = 2 x sin y = = ( 2 x sin y ) = cos y x y x yx y f f 2 f = x cos y + 3 y 2 = = ( x cos y + 3 y 2 ) = cos y y x y xy x Other courses will require partial differentiation more than is the case for this course.
x0
(a)
x0
(b)
20
Basic calculus
Curve sketching
x0
(c)
x0
(d)
(a) df/dx > 0 for x < x0 and df/dx < 0 for x > x0 local maximum; d2f/dx2 < 0. (b) df/dx < 0 for x < x0 and df/dx > 0 for x > x0 local minimum; d2f/dx2 > 0. (c) df/dx > 0 for x < x0 and df/dx > 0 for x > x0 point of inflection; d2f/dx2 = 0. (d) df/dx < 0 for x < x0 and df/dx < 0 for x > x0 point of inflection; d2f/dx2 = 0.
Note: A point of inflection is where d2f/dx2 = 0 irrespective of the value of df/dx (provided d3f/dx3 0).
End of Lecture 2
More generally, if d(n)f/dx(n) = 0 at x = x0 n < m and d(m)f/dx(m) 0 then x0 is a turning point if m is even, or a point of inflection if m is odd. Further, if m is even, then x0 is a local maximum if d(m)f/dx(m) < 0 or a local minimum if d(m)f/dx(m) > 0. f(x) = sinx f(x) = 0 at x = n df/dx = cosx = 0 at x = (n+ ) turning points d2f/dx2 = sinx = 0 at x = n inflection points where f = 0.
f Local maximum
Points of inflection
Local minimum
21
Basic calculus f(x) = x3 + 2x2 + x + 1 As x , have f x3 At x = 0, f = 1 df/dx = 3x2 +4 x + 1 = (3x + 1)(x + 1) = 0 at x = 1 and x = 1/3. d2f/dx2 = 6x+4. At x = 1, d2f/dx2 = 2 maximum, f = 1. At x = 1/3, d2f/dx2 = 2 minimum, f = 23/27. Point of inflection at d2f/dx2 = 6x+4 = 0 x = 2/3 f = 25/27
Curve sketching
f 1
-1
-2/3
-1/3
22
Basic calculus
f
Curve sketching
x0
Consider = f(x) f(a) [giving = 0 at x=a,b] Either = 0 everywhere in [a,b], in which case = 0 in (a,b) or > 0 somewhere or < 0 somewhere. If > 0 somewhere then > 0 in some places and < 0 in some places as must be continuous and differentiable. Hence passes through zero at some point and must have a (locally) greatest value at the point. Note that if f(x) is continuous but not differentiable, then it must still have either a local maximum, a local minimum or be constant. The extremum may occur at a point where f = 0 or at a point where f is not defined (e.g. at a cusp).
23
Basic calculus
f
Curve sketching
x0
This is simply Rolles theorem relative to the line y = f ( a ) + Define new function ( x ) = f ( x ) and apply Rolles theorem.
f (b ) f ( a ) ba
( x a) .
f ( a )( b x ) + f ( b )( x a ) ba
f ( x0 ) f ( b ) f ( a ) . = g ( x0 ) g ( b ) g ( a ) f (b ) f ( a ) f ( a ) g (b) f (b) g ( a ) g (b ) g ( a )
g (b ) g ( a )
g ( x ) (so that ( a ) = ( b ) = g (b ) g ( a ) f (b ) f ( a )
),
Corollary 1
Suppose f(0) = 0 and g(0) = 0, then
g ( x)
f ( x)
g ( x ) g ( 0)
f ( x ) f (0)
24
Basic calculus
Taylor series
Corollary 2
f ( x ) f ( x0 ) = . lHpitals rule. (Sometimes spelt as x x0 g ( x ) g ( x0 ) lHospitals rule; the two are equivalent in Old French.)
If f(x0) = 0 and g(x0) = 0, then lim
f(x) ~ 0(x) c0 Can select c0 so that f(a) = 0(a). f(x) ~ 1(x) c0 + c1(x-a) Could use linear interpolation to have 1 ( x ) = f ( a ) + f(x) = 1(x) at x = a and x = b. f (b ) f ( a ) ba
Using the ideas from the mean value theorem (1.3.2) we may rewrite this as 1 ( x ) = f ( a ) + f ( x0 ) ( x a ) , for some x0. Often more convenient to have function and derivative at same location, using 1* ( x ) = f ( a ) + f ( a )( x a ) . This will give f(a) = 1(a), but in general f(b) 1(b). We will,
however, have f(a) = 1(a).
f(x) ~ 2(x) c0 + c1(xa) + c2(xa)2 We can apply the mean value theorem to the first derivative, f ( x1 ) =
some x1, and thus 2 ( x ) = f ( a ) + f ( x0 ) ( x a ) + f ( x1 )( x a ) .
2
f (b) f ( a ) ba
for
More convenient to have all derivatives at the same place, with the approximation improving with the more derivatives that are matched. Recall from 1.2.4 that
d n x = nx n 1 dx d2 n d x = n x n 1 = n ( n 1) x n 2 2 dx dx d3 n d x = n ( n 1) x n 2 = n ( n 1)( n 2 ) x n 3 3 dx dx dm n n! x = n ( n 1)! ( n m + 1) x n m = x nm m dx ( n m )!
25
Basic calculus
dn n x = n! dx n
and that xn, dxn/dx, d2xn/dx2, d(n1)xn/dx(n1) all vanish at x = 0. Similarly, (xx0)n and its first n1 derivatives all vanish at x = x0.
( x x0 ) Rn ( x; x0 ) = ( n + 1)!
n +1
f(
n +1)
( x + ( x
x )) ,
where [0,1]. The residual is equal to the next term in the series with the f(n+1) derivative evaluated at some point between x and x0. This estimate comes from repeated application of Corollary 1 of Cauchys formula to Rn ( x; x0 ) f ( x) ( x) = , noting that (n+1) = 0. n +1 n +1 ( x x0 ) ( n + 1)! ( x x0 ) ( n + 1)! Let h = x x0 so that f ( x) ( x)
( x x0 )
n +1
( n + 1)!
f ( x0 + h ) ( x0 + h ) h n +1 ( n + 1) !
and define Rn(x,x0) = (h) = f(x0+h) (x0+h) and (h) = hn+1/(n+1)! Now
(0) = 0 (0) = 0
and (n+1)(h) = 1 h.
(n)(0)
since
(n+1)
(x) = 0.
26
Basic calculus
Taylor series
( h ) ( h ) ( 0 ) ( h1 ) = = ( h ) ( h ) ( 0 ) ( h1 )
but
( h1 ) ( h1 ) ( 0 ) ( h2 ) = = ( h1 ) ( h1 ) ( 0 ) ( h2 )
( n+1)
( x0 + hn+1 )
1
n +1
f ( x) =
1 (n) n f ( x0 )( x x0 ) n = 0 n!
This will provide an accurate representation of f(x) in the neighbourhood of x0 provided Rn(x;x0) 0 as n . [This is a necessary but not sufficient condition for the summation to converge.] For some functions, convergence is achieved for any value of x, while for others, x may need to be very close to x0. f(x) = ex f = ex, , f(n) = ex. Expand about x = 0 [f and all its derivatives are unity at x = 0]. ex = 1 + x + x 2 x3 xn x n +1 x e + +! + + n ! ( n + 1)! 2! 3!
Note that for ex the series converges for all x in limit n Mclaren series f(x) = sin x f = sin x = 0 at x = 0, f = cos x = 1 at x = 0, f = sin x = 0 at x = 0, f = cos x = 1 at x = 0,
sin x = x x3 x5 + ! 3! 5!
27
Basic calculus [Can also derive from sin x = f(x) = cos x cos x = 1 x2 x4 + ! 2! 4! 1 ix ix e e 2i
Integration: fundamentals
f ( x ) = e1/ x f(0) = 0
f ( 0 ) = lim e 1/ x = lim e y = 0
2 2
x 0
f(0) = 0
f(0) = 0
which suggests f(x) = 0xn = 0 This only works asymptotically close to x = 0.
h a x1 x2 =x0 xn-1 b = xn x
dxr = xr xr-1 = h, and nh = b a. Can approximate area as trapezoids passing through fn = f(xn):
28
Basic calculus
Integration: fundamentals
f ( x ) dx 1 ( f r + f r +1 ) h = ( 1 f 0 + f1 + f 2 + ! + f n 1 + 1 f n ) h 2 2 2
r =1
This approximation is frequently referred to as the Trapezium Rule and may be used to estimate the integral, for example in a computer code. There are, however, better ways. If we let h 0 (n )
b
f ( x ) dx = lim 1 ( f r + f r +1 ) h 2
h 0 r =1
= lim ( 1 f 0 + f1 + f 2 + ! + f n 1 + 1 f n ) h 2 2
h 0
f ( x ) dx = lim ( f
a h 0
+ f1 + f 2 + ! + f n 1 + f n ) h = lim fi dxi f dx
h 0 i
It is obvious that
f ( x ) dx = f ( x ) dx + f ( x ) dx
a c b b
and
a X
f ( x ) dx + g ( x ) dx = f ( x ) + g ( x ) dx
a a
f(x) = x
x dx = lim h ( 0 + x + x
0
h 0
= + xn
= lim h 2 ( 0 + 1 + 2 + ! + ( n 1) + n 1 n ) 2
h 0
n ( n + 1) 1 = lim h 2 2 n h 0 2 1 2 2 = lim 2 n h
h 0
= 1 X2 2
Note that
d dX
1 2
f(x) = ex
X
e
0
dx = lim h e0 + e x + e x + ! + e x
1 2
h0
= lim h 1 + e h + e h
h 0
( )
+ ! + eh
( ))
n
29
Integration: fundamentals
a (1 r n )
1 r
; r 1 , so
e
0
dx = lim h
h 0
1 eh
( )
n +1
e X eh 1 h 0 eh 1 h = e X 1 lim h 0 h 0 e e X = e 1 = lim h
m f(x) M in (a,b)
( b a ) m f ( x ) dx ( b a ) M
a
Corollary
If f(x) is continuous in (a,b) then c: a < c < b such that
b
f ( x ) dx = ( b a ) f ( c )
a
30
Basic calculus
f M
m a c b x
dF = f ( x) . dx
Proof: lim
h 0
F ( x + h) F ( x) h
1 = lim h 0 h
x+h
f ( t ) dt
x
giving
f ( t ) dt hf ( x )
x
as h 0.
The function F whose derivative is f(x) is called a primitive of f. Note that f will have more than one primitive: if F is a primitive, so is F + const. The primitive is often called the indefinite integral and is written as
x
f ( t ) dt
or more simply as
f ( x ) dx
because changing the lower limit of integration simply adds a constant. The definite integral specifies both limits: 31
Basic calculus
f
a
dx =
a
b b dF dx = F ( b ) F ( a ) F ( x ) a F ( x ) a dx
f
a
dx = lim h ( f 0 + f1 + f 2 + ! f n )
h 0
= lim h
h 0 n
Fk Fk 1 h k =1
n
= ( Fk Fk 1 )
k =1
= F (b) F ( a )
= Fn F0
dx =
1 n +1 x ; n 1 n +1
e
sec
2
dx = e x
x dx = tan x
cosh x dx = sinh x
1 = 1 x + x 2 x3 + ! (only converges for x (1,1]) 1+ x
1
2
1 + x dx = 1 x + x
Integrate this term-by-term
x 3 + ! dx
1 More generally, the definition of the natural logarithm gives ln x = dt for x > 0, hence t 0 d 1 ln x = . dx x
32
Basic calculus
a b
dg df b f dx = [ fg ]a g dx or dx dx a
b
fg dx = fg f g dx + const
x cos x dx
Let f = x and g = cos x f = 1 and g = sin x
x cos x dx =
1 2
Have recurrence relation for In. Need to know I 0 cos x dx = sin x (for In with n even) and I1 = x cos x dx = x sin x + cos x (for n odd) from earlier example. Note that as In is an indefinite integral, then there is also an arbitrary constant.
f ( x ) dx , suppose we choose to express x as a function of some other variable dx s, i.e., x = x(s) and consider f ( x ( s ) ) dx . Now dx = ds , so ds
When integrating
f ( x ( s ) ) dx = f
33
dx ds ds
1 n +1 1 n +1 s + const = ( x + a ) + const n +1 n +1
In this (trivial) example, the substitution effectively translated the x axis. If dealing with a definite integral, then need to remember to transform the limits:
x1 x1 + a x1 + a
x0
( x + a)
dx =
1 n +1 n +1 1 n +1 n + a s ds = n + 1 s x + a = n + 1 ( x1 + a ) ( x0 + a ) x
0 0
I =
1 1 x2
dx
This only makes sense (with real arithmetic) when |x| 1. Noting that cos2 + sin2 = 1 suggests the substitution x = sin dx = cos d hence
1 x 1 sin (omitting the arbitrary constant)
2 2
dx =
cos
d =
cos cos
2
d = = sin 1 x
Common substitutions
1 sin2 = cos2 1 x2 better than using x = cos since dx/ds > 0 in (0,/2) 1 + tan2 = sec2 1 tanh2 = sech2 cosh2 1 = sinh2 1 + sinh2 = cosh2 1 + x2 1 x2 x2 1 x2 + 1 x = sin if |x| < 1 x = tan no limit on x x = tanh x = cosh x = sinh
These combinations often arise from Cartesian geometry as a consequence of the theorem of Pythagoras. I = dx 1 + x2
34
Option 2: Let x = sinh dx = cosh d I = dx cosh cosh d = d = d = = 1 tanh 2 d 2 2 2 1+ x 1 + sinh cosh cosh
Obviously we need to do some further manipulations. Now let tanh = sin sech2 d = cos d d = cosh 2 cos d 1 cosh2 = cosh2 sin2 1 d cos d = cosh2 (1sin2) = 1 cosh2 cos2 = 1 d = cosh 2 cos d = 2 cos cos Note that
I = 1 sin 2 dx cos = 1 tanh 2 d = d = d 2 1+ x cos cos sinh x = = sin 1 tanh = sin 1 = sin 1 2 1 + sinh 1 + x2
tanh = sin
= sin 1
x 1+ x
2
= sin 1
tan 1 + tan
2
= sin 1
Now, in the case when the limits a and b do not depend on x, then
b b dF 1 = lim f ( t , x + h ) dt f ( t , x ) dt dx h0 h a a
1 = lim f ( t , x + h ) f ( t , x ) dt h 0 h a =
b
f dt x a
t dt x
Integrate F ( x ) = x sin
0
35
Basic calculus
then differentiate
= 2 x 1 cos sin x x
dF t t t t = x sin dt = sin + x 2 cos dt dx 0 x x x x x 0 = sin
0
t t t cos dt x x x
= 2 x 1 cos sin x x
These are the same! QED.
If a = a(x) and b = b(x), then let F ( x, T ) = f ( t , x ) dt so we may write
0 T
b( x)
a( x)
f ( t , x ) dt
F ( x, a ) da F ( x, b ) db . F ( x, b ( x ) ) F ( x , a ( x ) ) + dx dx x a b
b( x)
da db f dt f ( x, a ) + f ( x, b ) dx dx x a( x)
F ( x) =
x2
(x t)
x
dt
x2
Integrate: F ( x ) =
(x t)
x
1 3 3 1 dt = ( t x ) = x3 ( x 1) 3 x 3
x2
dF d 1 3 3 3 2 2 3 = 3 x ( x 1) = x ( x 1) + x ( x 1) then differentiate dx dx = x 2 ( x 1) ( 2 x 1)
2
36
Multiple integrals
dx dx 2 2 2 2 ( x t ) dt ( x t ) t = x + ( x t ) t = x x dx dx x
2
= 2 ( x t ) dt ( x x ) + x x 2
2 x 2 2 = ( x t ) + 2 x 3 ( x 1) x x2
x2
2x
= x 2 ( x 1) + 2 x 3 ( x 1)
2
= x 2 ( x 1) ( 2 x 1)
2
This equivalence is sometimes referred to as Fubinis theorem for a rectangle. Proof can be constructed in a number of ways, but is obvious by noting that integration is the limit of summation and h ( xi , y j ) = h ( xi , y j ) .
i j j i
where A is the area a x b, c y d, and dA here is dx dy. Note that the above integrals will often not be written with the square brackets and may be written in a number of different but equivalent ways. For example
b d b d d h ( x, y ) dy dx = h ( x, y ) dy dx = dx dy h ( x, y ) a c a c a c b
37
Basic calculus
b d ( x) V = h ( x, y ) dA = h ( x, y ) dy dx A a c( x )
Special functions
Alternatively if we knew that y was in the range [c,d] and in this range we had a(y) x b(y), then
b( y ) V = h ( x, y ) dA = h ( x, y ) dx dy A c a( y )
d
Integrate f(x,y) = x2 + y2 in the triangle bounded by the lines x = 0, y = 0 and x + y = 1. Can express area as 0 x 1 with 0 y 1 x, so V = x + y dA =
2 2 A 1 1 x
0 0
+ y 2 dy dx
= x2 y + 1 y3 3
0
1 x 0
1 4 dx = x + 2 x 2 x 3 dx 3 3 0
1
1 2 1 1 1 = x x 2 + x3 x 4 = 2 3 3 0 6 3 Alternatively, can express area as 0 y 1 with 0 x 1 y, which yields the same result.
0+
dH ; H ( x ) = ( t ) dt ( x) = dx
End of Lecture 4
38