Sei sulla pagina 1di 29

Basic calculus

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)

Define the derivative as

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

If f exists, then f is said to be differentiable. If f exists, then f 0 as x 0 f is continous.


Note: Converse is not necessarily true, i.e. continuous f does not necessarily mean f is differentiable.
f

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

Can check that left-hand derivative is equal to right-hand derivative.


f(x) = 1/x2

11

Basic calculus
df d ( x = dx dx

Rules for differentiating

) = 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

Use binomial expansion


n ( n 1) 2 n 2 n ( n 1)( n 2 ) 3 n 3 h x + h x + ! + hn xn 2! 3! = lim h 0 h n ( n 1) 2 n 2 n ( n 1)( n 2 ) 3 n 3 nhx n 1 + h x + h x + ! + hn 2! 3! = lim h 0 h n ( n 1) n 2 n ( n 1)( n 2 ) 2 n 3 hx + h x + ! = lim nx n 1 + h0 2! 3! x n + nhx n 1 + = nx n 1

Also works for n < 0.

1.2 Rules for differentiating


1.2.1 SUMS AND DIFFERENCES
Consider y = f(x) + g(x)

12

Basic calculus

Rules for differentiating


f ( x + h) + g ( x + h) f ( x) g ( x) dy d = ( f + g ) = lim h 0 dx dx h f ( x + h) f ( x) g ( x + h) g ( x) = lim + h 0 h h f ( x + h) f ( x) g ( x + h) g ( x) = lim + lim h 0 h 0 h h df dg = + dx dx

provided f and g are differentiable. Similarly


f ( x) = ex d df dg ( f g) = . dx dx dx

Exponential function can be defined in a number of ways:


x e = lim 1 + n n
x n

Can use binomial expansion


x n ( n 1) x 2 n ( n 1)( n 2 ) x 3 + + ! e x = lim 1 + n + 2 3 n n 2! n 3! n x 2 1 x3 3 2 = lim 1 + x + 1 + 1 + 2 + ! n 2! n 3! n n 2 3 x x = 1+ x + + +! 2! 3! xn = n =0 n !

[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

Basic calculus since d1/dx = 0

Rules for differentiating

1.2.2 THE CHAIN RULE


Consider y = f(g(x)): f ( g ( x + x ) ) f ( g ( x ) ) dy = lim x dx x0

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

y = f(x) Similar to above example, yielding y = eix d ix e = ieix dx df ( x ) d f ( x) = = f ( x ) . dx d ( x) (i2 = 1)

d d 1 ix ix cos x = (e + e ) dx dx 2 1 = ( ieix ie ix ) So 2 1 = ( eix e ix ) 2i = sin 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

Rules for differentiating

End of Lecture 1 1.2.3 PRODUCTS AND QUOTIENTS


Consider y = fg: f ( x + h) g ( x + h) f ( x) g ( x) dy d = ( f g ) = lim h 0 dx dx h f ( x + h) g ( x + h) f ( x + h) g ( x) + f ( x + h) g ( x) f ( x) g ( x) f ( x + h) f ( x) = lim f ( x + h ) + g ( x) h 0 h h g ( x + h) g ( x) f ( x + h) f ( x) = f ( x ) lim + g ( x ) lim h 0 h 0 h h dg df = f +g dx dx g = f + fg The product rule y = excosx Let f(x) = ex f = ex and g(x) = cosx g = sinx so dy/dx = fg + fg = ex(cosx sinx). Similarly y = f/g: h g ( x + h) g ( x)

= lim
h 0

15

Basic calculus
f ( x + h) f ( x) g ( x + h) g ( x)

Rules for differentiating

dy d f = = lim dx dx g h 0 h f ( x + h) g ( x) f ( x) g ( x + h) = lim h 0 h g ( x + h) g ( x) = lim


h 0

f ( x + h) g ( x) f ( x) g ( x) f ( x) g ( x + h) + f ( x) g ( x) h g ( x + h) g ( x)

f ( x + h) f ( x) g ( x + h) g ( x) = lim g ( x ) lim f ( x ) h 0 h g ( x + h ) g ( x ) h 0 h g ( x + h) g ( x) df dg g f = dx 2 dx g f fg g = g2 The quotient rule Clearly need g 0!

1.2.4 HIGHER DERIVATIVES


First derivative Second derivative Third derivative nth derivative Derivatives of xn: 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 )! dn n x = n! dx n for integer n df = f = f x = f, x = Df dx d df d d d2 f f 2 = f = f xx = f, x , x = D 2 f dx dx dx dx dx d d2 f d d d d3 f f 3 = f = f xxx = f , x , x , x = D 3 f dx dx 2 dx dx dx dx d d n 1 f d d d dn f n ! f n = f ( ) = Dn f n 1 dx dx dx dx dx dx

16

Basic calculus d n +1 n x =0 dx n +1

Rules for differentiating

1.2.5 LEIBNITZ THEOREM


For the nth derivative of a product Let f = f(x) and g = g(x). d ( fg ) = f g + fg dx
d2 d d fg ) = ( f ) + ( fg ) = f + f + f + fg g g g g 2 ( dx dx dx = f + 2 f + fg g g

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

Rules for differentiating

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.

1.2.6 PARTIAL DIFFERENTIATION


Frequently functions may depend on more than one variable. How do we differentiate these? Consider f(x,y). This might, for example, represent the height of a hill. In general, the slope will depend on the direction in which we are looking. Define f ( x + h, y ) f ( x, y ) f = lim , the partial derivative of f with respect to x. This is the slope, x h0 h at a given x,y in the x direction (i.e. holding y constant). Similarly
f ( x, y + h ) f ( x , y ) f = lim . Note the use of in place of d to represent the derivative. y h0 h

Other common notations:

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

1 ( x + h ) ( x + h ) sin y + y 3 (1 x 2 x sin y + y 3 ) f = lim x h 0 h


2

Then

( x + h) = lim
h 0 h 0

x2

h 0 h h = lim ( 2 x h ) sin y lim (1) h 0

sin y lim

( x + h) x

= 2 x sin y which is the same as df/dx if we treat y as a constant.

18

Basic calculus

Rules for differentiating

1 x 2 x sin ( y + h ) + ( y + h ) (1 x 2 x sin y + y 3 ) f = lim y h 0 h


3

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 + h, y + a ) f ( x + h, y ) f ( x, y + a ) f ( x, y ) lim a 0 a 0 a a = lim h0 h f ( x + h, y + a ) f ( x + h, y ) f ( x, y + a ) + f ( x, y ) = lim lim h0 a 0 ah lim 1 f ( x + h, y + a ) f ( x, y + a ) f ( x + h, y ) f ( x, y ) = lim lim a 0 a h0 h h f f x x , y + a x x , y = lim a 0 a 2 f = yx

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.

1.3 Curve sketching


Knowing the stationary points of a function f(x) can help you sketch the function. Stationary points are where df/dx = 0 and the curve is horizontal. Suppose df/dx = 0 at x = x0. Four possible cases:

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

1.3.1 ROLLES THEOREM


Let f(x) be a function such that f(x) is continuous in x [a,b] f(x) is differentiable in x (a,b) f(a) = f(b) then there exists at least one point x = x0 (a,b) such that f(x0) = 0. Proved in Part IB Analysis course, but intuitively obvious:

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).

1.3.2 MEAN VALUE THEOREM


Let f(x) be continuous in [a,b] and differentiable in (a,b), then x0 in (a,b) for which f (b) f ( a ) f ( x0 ) = . ba

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 y which has (a) = (b) = 0

1.3.3 CAUCHYS FORMULA


Consider two functions f(x) and g(x) which satisfy the conditions of the mean value theorem (i.e. continuous in [a,b] and differentiable in (a,b)), and suppose g(x) 0 everywhere in (a,b). Then, x0 in (a,b) such that

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 )

[Note that since g 0, then g(b) g(a).] Proof: Define ( x ) = f ( x )

g (b ) g ( a )

g ( x ) (so that ( a ) = ( b ) = g (b ) g ( a ) f (b ) f ( a )

),

and apply Rolles theorem shows that ( x ) = f ( x )

g ( x ) must vanish for some

x = x0, thus proving the result.


Note that cannot apply mean value theorem separately to f and g then divide as the corresponding x0 will not generally be the same.

Corollary 1
Suppose f(0) = 0 and g(0) = 0, then

g ( x)

f ( x)

g ( x ) g ( 0)

f ( x ) f (0)

f ( x ) for some 0 < < 1. g ( x )

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

1.4 Taylor series


Useful to represent some function f(x) as a linear combination (sum) of simpler functions. Particularly important in computing, but also when dealing with more complex functions. In some cases we might be happy to approximate the function in x [a,b] rather than represent it accurately.

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

( x a ) , which will give

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

Taylor series for integer 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.

1.4.1 TAYLORS THEOREM


Consider ( x ) f ( x0 ) + f ( x0 )( x x0 ) + [we assume f(n) exists] Note that for any m n, this definition gives (m)(x0) = f(m)(x0) since Define the remainder Rn(x;x0) such that f(x) = (x) + Rn(x;x0). This is generally called Taylors theorem, but is actually a tautology. Its usefulness is in ignoring Rn if Rn is small, and thus approximating f(x) with just (x). The remainder Rn(x;x0) may be considered the error in the approximation f(x) (x), when (x) contains all derivatives up to and including the nth at the point x0. For smooth functions, Rn is small if x x0 is sufficiently small. 1 dm m! m x x0 ) = =1 m ( m ! dx m! 1 1 n 2 n f ( x0 )( x x0 ) + ! + f ( ) ( x0 )( x x0 ) n! 2!

1.4.2 LAGRANGE ESTIMATE OF REMAINDER


There are several ways of estimating Rn. One of the more useful is Lagranges estimate:

( 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)= f(x0) (x0) = 0 (0) = f(x0) (x0) = 0 (n+1)(0) = f(n+1)(x0) (n)(0) = 0

(0) = 0 (0) = 0
and (n+1)(h) = 1 h.

(n)(0)

since

(n+1)

(x) = 0.

Cauchys formula gives

26

Basic calculus

Taylor series

( h ) ( h ) ( 0 ) ( h1 ) = = ( h ) ( h ) ( 0 ) ( h1 )
but

where 0 < h1 < h where 0 < h2 < h1 < h

( h1 ) ( h1 ) ( 0 ) ( h2 ) = = ( h1 ) ( h1 ) ( 0 ) ( h2 )

( n+1)

( h ) ( h1 ) ( h2 ) ( n +1) ( hn +1 ) f = = = ! = ( n +1) = ( h ) ( h1 ) ( h2 ) ( hn+1 )

( x0 + hn+1 )
1
n +1

0 < hn+1 < hn < < h2 < h1 < h

( x x0 ) f ( n+1) x + h with 0 < < 1. h n +1 n +1 whence Rn ( x; x0 ) = ( h ) = f ( ) ( x0 + hn ) = ( 0 ) ( n + 1)! ( n + 1)!


QED.

1.4.3 TAYLOR SERIES EXAMPLES


If all the derivatives of f exist and are finite, then one can take the limit n .

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

using expansion for ex]

f ( x ) = e1/ x f(0) = 0

f ( 0 ) = lim e 1/ x = lim e y = 0
2 2

x 0

f(0) = 0

2e 1/ x 4e 1/ x 8e 1/ x f ( 0 ) = lim = lim = lim x 0 x 0 3x5 x 0 15 x 7 x3 2n e 1/ x = lim x 0 1 3 ! ( 2n 1) x 2 n +1


2

f(0) = 0
which suggests f(x) = 0xn = 0 This only works asymptotically close to x = 0.

1.5 Integration: fundamentals


1.5.1 INTEGRATION AS SUM OF AREAS
f

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

Since lim 1 ( f 0 + f n ) h = 0 , then can rewrite 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 1 xn ) , where xi = ih and n = X/h. 2

= + 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

X 2 = X , which anticipates that integration is the inverse of differentiation.

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

Basic calculus Recall that for a geometric series a + ar + ar + ! + ar


2 n 1

Integration: fundamentals

a (1 r n )
1 r

; r 1 , so

e
0

dx = lim h
h 0

1 eh

( )

n +1

1 eh noting eXeh eX and eh1 h as h 0

e X eh 1 h 0 eh 1 h = e X 1 lim h 0 h 0 e e X = e 1 = lim h

Further on examples sheet.

End of Lecture 3 1.5.2 FIRST MEAN-VALUE THEOREM FOR INTEGRALS


If then

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

Fundamental theorem of calculus

m a c b x

1.6 Fundamental theorem of calculus


If f(x) is continuous in (a,x), and if F ( x ) = f ( t ) dt , then
a 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

More rigorously: First mean value theorem for integrals gives


F ( x + h) F ( x) =
x+h x+h

f ( t ) dt = hf ( x + h ) , where 0 < < 1


x

giving

f ( t ) dt hf ( x )
x

as h 0.

F ( x + h) F ( x ) 1 x+h Thus = f ( t ) dt = f ( x + h ) f ( x ) , QED. h h x

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

Toolkit for basic integration

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

1.7 Toolkit for basic integration


Differentiation Integration

d n x = nx n 1 dx d sin x = cos x dx d cos x = sin x dx d x e = ex dx d tan x = sec 2 x dx d sinh x = cosh x dx


What about integral of x1? Consider binomial expansion,

dx =

1 n +1 x ; n 1 n +1

cos x dx = sin x sin x dx = cos x

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

x 2 x3 x 4 = x + + ! (only converges for x (1,1]) 2 3 4 = ln (1 + x ) = log e (1 + x )


x

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

Integration of more complex functions

1.8 Integration of more complex functions


In general we shall encounter more complex functions than those listed in 1.7, so we need to know how to deal with them. The main approach is to transform an integral into a form you can recognise and know the integral of. There are some standard techniques you should know, and often more than one way of solving the problem. Knowing the best approach is largely a matter of practice.

1.8.1 INTEGRATION BY PARTS


Useful approach when the integrand is the product of recognisable functions.

a b

dg df b f dx = [ fg ]a g dx or dx dx a
b

fg dx = fg f g dx + const

Proof (obvious from differentiation (fg) = fg + fg):


df d b dg f dx + g dx dx = dx ( fg ) dx = [ fg ]a , by fundamental theorem. a a

x cos x dx
Let f = x and g = cos x f = 1 and g = sin x

x cos x dx = x sin x sin x dx = x sin x + cos x + const


Note: if we had selected f = cos x and g = x, then integration by parts would have given

x cos x dx =

1 2

x 2 cos x + 1 x 2 sin x dx , which is a more complex form. 2

I n x n cos x dx Need to apply integration by parts repeatedly.


I n x n cos x dx = x n sin x nx n 1 sin x dx = x n sin x + n ( n 1) x n 2 cos x n ( n 1) x n 2 cos x dx = x n sin x + n ( n 1) x n 2 cos x n ( n 1) I n 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.

1.8.2 INTEGRATION BY SUBSTITUTION

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

Basic calculus This is desirable if the new integrand, f integrate.


I = ( x + a ) dx
n

Integration of more complex functions dx is a simpler function of s which we know how to ds

Suppose x + a = s x = s a Then dx = (dx/ds) ds = ds I = ( x + a ) dx = s n ds =


n

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

We could use x = tan or x = sinh. Option 1: Let x = tan dx = sec2 d

34

Basic calculus I = dx sec2 sec 2 = d = d = = tan 1 x 2 2 2 1+ x 1 + tan sec

Differentiation under integrals

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

sinh2 = cosh2 sin2

Two different answers Or are they?

= sin 1

x 1+ x
2

= sin 1

tan 1 + tan
2

= sin 1

sin cos + sin


2 2

= sin 1 sin = = tan 1 x

They are the same!

1.9 Differentiation under integrals


Consider the definite integral F ( x ) = f ( t , x ) dt that depends on a parameter x.
a b

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

from our definition of the partial derivative in 1.2.6.


F ( x ) = x sin
0

t dt x

Integrate F ( x ) = x sin
0

t t 0 dt = x 2 cos = x 2 cos cos = x 2 1 cos x x 0 x x x

35

Basic calculus

Differentiation under integrals dF d 2 = x 1 cos = 2 x 1 cos + x 2 2 sin dx dx x x x x

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

Alternatively, differentiate then integrate:


t t t cos dt x x x

t t t = x cos t sin + sin dt x x 0 0 x t t t = x cos t sin x cos x x x 0

= 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

F ( x ) = F ( x, b ( x ) ) F ( x, a ( x ) ) = Applying the chain rule


dF F F da F db = + + dx x a dx b dx = =

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

Basic calculus Differentiating then integrating


dF = dx
x2

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

1.10 Multiple integrals


1.10.1 INTEGRATION OVER A RECTANGLE
We frequently want to integrate functions of more than one variable. For example, if h(x,y) is the height of a pile of grain in the region a x b, c y d, we may wish to know the volume V of grain. d V = h ( x, y ) dy dx a c
b

If c and d are independent of x then this is the same as


d b V = h ( x, y ) dx dy c a

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

We may also write the above repeated integrals as a double integral


d b d V = h ( x, y ) dy dx = h ( x, y ) dx dy = h ( x, y ) dA a c c a A b

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

1.10.2 INTEGRATION IN A GENERAL REGION


Of course, the region over which we wish to integrate a function will not in general be rectangular. If we know that the area A of interest falls within a x b and that c(x) y d(x), then

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.

1.10.3 INTEGRATION OF FUNCTIONS OF MORE VARIABLES


The ideas for double integration and repeated integration may, of course, be extended further to integrate over three or more variables.

1.11 Special functions


1.11.1 HEAVISIDE STEP FUNCTION
0 x < 0 H ( x ) = ? x = 0 1 x > 0

1.11.2 DIRAC DELTA FUNCTION


Limit of off-on-off as width tends to zero.
0 ( x ) = 0 x<0 x>0 x = 0 ; ( x ) dx = ( x ) dx = 1
0
x

0+

dH ; H ( x ) = ( t ) dt ( x) = dx

End of Lecture 4

38

Potrebbero piacerti anche