Download - NM-2-2011-2012-02-Notes.pdf
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
1/17
NM-2-2011-2012-02-Notes page 1 of 20
Lesson-2:
Fundamental ofDifferentiation
Edited:
Surjatin Wiriadidjaja
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
2/17
NM-2-2011-2012-02-Notes page 2 of 20
1.IntroductionObjectives:
understand the basics of differentiation, relate the slopes of the secant line and tangent line to the derivative of a function,
find derivatives of polynomial, trigonometric and transcendental functions,
use rules of differentiation to differentiate functions,
find maxima and minima of a function, and
apply concepts of differentiation to real world problems.
The concepts of differentiation to be described are applicable in learning about numerical
methods.
These include the concepts of the secant line, the slope of a tangent line as a background to
solving nonlinear equations using the Newton-Raphson method, finding maxima and minima offunctions as a means of optimization, the use of the Taylor series to approximate functions, etc.
The derivative of a function represents the rate of change of a variable with respect to another
variable. For example, the velocity of a body is defined as the rate of change of the location of
the body with respect to time. The location is the dependent variable while time is the
independent variable. Now if we measure the rate of change of velocity with respect to time,
we get the acceleration of the body. In this case, the velocity is the dependent variable while
time is the independent variable.
Whenever differentiation is introduced to a student, two concepts of the secant line and
tangent line (Figure 1) are revisited.
Let P and Q be two points on the curve as shown in Figure 1. The secant line is the straight line
drawn through P and Q .
Q
P
f(x)
x
secant line
tangent line
Figure 1 Function curve with tangent and secant lines.
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
3/17
NM-2-2011-2012-02-Notes page 3 of 20
The slope of the secant line (Figure 2) is then given as
aha
afhafmPQ
)(
)()(secant,
h
afhaf )()(
As Q moves closer and closer to P, the limiting portion is called the tangent line. The slope of the
tangent line tangent,PQm then is the limiting value of secant,PQm as 0h .
h
afhafm
hPQ
)()(lim
0tangent,
Derivative of a FunctionRecall from calculus, the derivative of a function )(xf at ax is defined as
h
afhafaf
h
)()(lim)(
0
)(xf
P
Q
))(,( afa
a
))(,( xfx
ax
)()( afxf
x
Figure 5 Graph showing the second definition of the
x
P
Q
a a+h
)(xf
Figure 2 Calculation of the secant line.
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
4/17
NM-2-2011-2012-02-Notes page 4 of 20
Second Definition of DerivativesThere is another form of the definition of the derivative of a function. The derivative of the function
)(xf at ax is defined as
ax
afxfaf
ax
)()(lim)(
As ax , the definition is nothing but the slope of the tangent line at P.
Finding equations of a tangent lineOne of the numerical methods used to solve a nonlinear equation is called the Newton-Raphson
method. This method is based on the knowledge of finding the tangent line to a curve at a point. Let us
look at an example to illustrate finding the equation of the tangent line to a curve.
Other Notations of DerivativesDerivates can be denoted in several ways. For the first derivative, the notations are
dx
dyandyxf
dx
dxf ,),(),(
For the second derivative, the notations are
2
2
2
2
,),(),(dx
ydandyxf
dx
dxf
For the thn derivative, the notations are
n
nn
n
nn
dx
ydyxf
dx
dxf ,),(),(
)()(
Theorems of DifferentiationSeveral theorems of differentiation are given to show how one can find the derivative of different
functions.
Theorem 1The derivative of a constant is zero. If kxf )( , where k is a constant, 0)( xf .
Theorem 2
The derivative ofnxxf )( , where 0n is
1)(
nnxxf .
Theorem 3
The derivative of )()( xkgxf , where k is a constant is )()( xgkxf .
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
5/17
NM-2-2011-2012-02-Notes page 5 of 20
Theorem 4
The derivative of )()()( xvxuxf is )()()( xvxuxf .
Theorem 5The derivative of
)()()( xvxuxf
is
)()()()()( xudx
dxvxv
dx
dxuxf . (Product Rule)
Theorem 6The derivative of
)(
)()(
xv
xuxf
is
2))((
)()()()(
)(xv
xvdx
dxuxu
dx
dxv
xf
(Quotient Rule)
Table of Derivatives
,
)(xf )(xf
0, nxn 1nnx
nkx 0n 1nknx
)(xsin )(xcos
)(xcos )(xsin
)(xtan )(2 xsec
)(xsinh )(xcosh
)(xcosh )(xsinh
)(xtanh )(1 2 xtanh
)(1
xsin
21
1
x
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
6/17
NM-2-2011-2012-02-Notes page 6 of 20
1
||
22
xx
x
1
||
22xx
x
Chain Rule of DifferentiationSometimes functions that need to be differentiated do not fall in the form of simple functions or the
forms described previously. Such functions can be differentiated using the chain rule if they are of the
form ))(( xgf . The chain rule states
)())(())((( xgxgfxgfdx
d
For example, to find )(xf of42 )23()( xxxf , one could use the chain rule.
)23()(2
xxxg
26)( xxg
3))((4))(( xgxgf
)(1 xcos 2
1
1
x
)(1 xtan
21
1
x
)(xcsc )()( xcotxcsc
)(xsec )()( xtanxsec
)(xcot )(2 xcsc
)(xcsch )()( xcschxcoth
)(xsech )()( xsechxtanh
)(xcoth )(1 2 xcoth
)(
1
xcsc
)(1xsec
)(1 xcot
21
1
x
xa
xaaln )(
)(xlnx
1
)(xloga)(
1axln
xe
xe
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
7/17
NM-2-2011-2012-02-Notes page 7 of 20
)26()23(4))23(( 3242 xxxxxdx
d
Implicit DifferentiationSometimes, the function to be differentiated is not given explicitly as an expression of the
independent variable. In such cases, how do we find the derivatives? We will discuss this via examples.
Higher order derivativesSo far, we have limited our discussion to calculating first derivative, )(xf of a function )(xf . What if
we are asked to calculate higher order derivatives of )(xf .
A simple example of this is finding acceleration of a body from a function that gives the location of the
body as a function of time. The derivative of the location with respect to time is the velocity of the
body, followed by the derivative of velocity with respect to time being the acceleration. Hence, the
second derivative of the location function gives the acceleration function of the body.
Finding maximum and minimum of a functionThe knowledge of first derivative and second derivative of a function is used to find the
minimum and maximum of a function. First, let us define what the maximum and minimum of a
function are. Let )(xf be a function in domain D , then
(A) )(af is the maximum of the function if )()( xfaf for all values of x in the domain D .(B) )(af is the minimum of the function if )()( xfaf for all values of x in the domain D .
The minimum and maximum of a function are also the critical values of a function. An extreme value
can occur in the interval
at end points .
a point in where .
a point in where does not exist.
These critical points can be the local maximas and minimas of the function (See Figure 8).
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
8/17
NM-2-2011-2012-02-Notes page 8 of 20
f(x)
x
Figure 8The plot shows critical points of )(xf in ],[ dc .
Absolute Minimum
Local Minimum
Local
Minimum
Local Maximum
(f (x) does not exist)
Absolute Maximum
Local Maximum
c d
maximum
minimum
x
Figure 7 Graph illustrating the concepts of maximum and minimum.
Domain = [c,d]
c d
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
9/17
NM-2-2011-2012-02-Notes page 9 of 20
Figure 11 shows the maximum of the function occurring at a singular point. The function )(xf has a
sharp corner at ax .
)(xf
x
)(af
ax
Figure 11 Graph demonstrates the concept of a singular point with
discontinuous slope at ax
x
xxf /1)(
)(xf
Figure 10 Function that has no maximum or minimum.
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
10/17
NM-2-2011-2012-02-Notes page 10 of 20
2.Differentiation of
Continuous FunctionsAfter reading this chapter, you should be able to:
derive formulas for approximating the first derivative of a function,
derive formulas for approximating derivatives from Taylor series,
derive finite difference approximations for higher order derivatives, and
use the developed formulas in examples to find derivatives of a function.
The derivative of a function at x is defined as
To be able to find a derivative numerically, one could make x finite to give,
Knowing the value of x at which you want to find the derivative of xf , we choose a value of x to
find the value of xf . To estimate the value of xf , three such approximations are suggested as
follows.
Forward Difference Approximation of the First Derivative
From differential calculus, we know
For a finite x ,
The above is the forward divided difference approximation of the first derivative. It is called forward
because you are taking a point ahead of x . To find the value of xf at ixx , we may choose
another point x ahead as 1 ixx . This gives
where
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
11/17
NM-2-2011-2012-02-Notes page 11 of 20
Figure 1 Graphical representation of forward difference approximation of first derivative.
Backward Difference Approximation of the First DerivativeWe know
x
xfxxfxf
x
0lim
For a finite x ,
x
xfxxfxf
If x is chosen as a negative number,
x
xfxxfxf
xxxfxf
This is a backward difference approximation as you are taking a point backward from x . To find the
value of xf at ixx , we may choose another point x behind as 1 ixx . This gives
where 1 ii xxx
)(xf
xx x x
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
12/17
NM-2-2011-2012-02-Notes page 12 of 20
Figure 2 Graphical representation of backward difference approximation of first derivative.
Forward Difference Approximation from Taylor Series
Taylors theorem says that if you know the value of a function )(xf at a point ix and all its derivatives
at that point, provided the derivatives are continuous between ix and 1ix , then
2
111!2
iii
iiiii xxxf
xxxfxfxf
Substituting for convenience ii xxx 1
2
1 !2
xxf
xxfxfxf iiii
x
xf
x
xfxfxf iiii
!2
1
xO
x
xfxfxf iii
1
The xO term shows that the error in the approximation is of the order of x .
Can you now derive from the Taylor series the formula for the backward divided difference
approximation of the first derivative?
As you can see, both forward and backward divided difference approximations of the first
derivative are accurate on the order of xO . Can we get better approximations? Yes, another
method to approximate the first derivative is called the central difference approximation of the
first derivative.
From the Taylor series
)(xf
xxx x
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
13/17
NM-2-2011-2012-02-Notes page 13 of 20
32
1 !3
!2
xxf
xxf
xxfxfxf iiiii (1)
and
32
1
!3
!2
x
xf
x
xf
xxfxfxf
ii
iii(2)
Subtracting Equation (2) from Equation (1)
3
11 !3
22 x
xfxxfxfxf iiii
211
!32
xxf
x
xfxfxf iii
i
211
2xO
x
xfxf ii
hence showing that we have obtained a more accurate formula as the error is of the order of 2xO .
Figure 3 Graphical representation of central difference approximation of first derivative.
Finite Difference Approximation of Higher DerivativesOne can also use the Taylor series to approximate a higher order derivative. For example, to
approximate xf , the Taylor series is
)(xf
xx xxx x
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
14/17
NM-2-2011-2012-02-Notes page 14 of 20
32
2 2!3
2!2
2 xxf
xxf
xxfxfxf iiiii (3)
where
xxxii 22
321
!3!2x
xfx
xfxxfxfxf ii
iii
(4)
where
xxx ii 1
Subtracting 2 times Equation (4) from Equation (3) gives
32
12 2 xxfxxfxfxfxf iiiii
xxf
x
xfxfxfxf i
iiii
22
12
xO
x
xfxfxfxf iiii
2
12 2 (5)
The formula given by Equation (5) is a forward difference approximation of the second derivative and
has an error of the order of xO . Can we get a formula that has a better accuracy? Yes, we can
derive the central difference approximation of the second derivative.
The Taylor series is
...!4!3!2
432
1
xxf
xxf
xxf
xxfxfxf iiiiii (6)
where
xxx ii 1
432
1!4!3!2
xxf
xxf
xxf
xxfxfxf iiiiii
(7)
where
xxx ii 1
Adding Equations (6) and (7), gives
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
15/17
NM-2-2011-2012-02-Notes page 15 of 20
...12
2
42
11
xxfxxfxfxfxf iiiii
...
12
22
2
11
xxf
x
xfxfxfxf iiiii
2
2
11 2 xOx
xfxfxf iii
3.Differentiation ofDiscrete Functions
After reading this chapter, you should be able to:
find approximate values of the first derivative of functions that are given at discrete data points, and
use Lagrange polynomial interpolation to find derivatives of discrete functions.
To find the derivatives of functions that are given at discrete points, several methods are available.
Although these methods are mainly used when the data is spaced unequally, they can be used for data
that is spaced equally as well.
Forward Difference Approximation of the First DerivativeWe know
x
xfxxfxf
x
0lim
For a finite x ,
x
xfxxf
xf
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
16/17
NM-2-2011-2012-02-Notes page 16 of 20
Figure 1 Graphical representation of forward difference approximation of first derivative.
So given 1n data points nn yxyxyxyx ,,,,,,,, 221100 , the value of )(xf for 1 ii xxx ,1,...,0 ni , is given by
ii
iii
xx
xfxfxf
1
1
Direct Fit Polynomials
In this method, given 1n data points nn yxyxyxyx ,,,,,,,, 221100 , one can fit a thn orderpolynomial given by
nnn
nn xaxaxaaxP
1
110
To find the first derivative,
12121 12)(
n
n
n
n
n
n xnaxanxaadx
xdPxP
Similarly, other derivatives can also be found.
Lagrange Polynomial
In this method, given nn yxyx ,,,, 00 , one can fit a thn order Lagrangian polynomial given by
n
i
iin xfxLxf0
)()()(
)(xf
xx x x
-
7/29/2019 NM-2-2011-2012-02-Notes.pdf
17/17
NM-2-2011-2012-02-Notes page 17 of 20
where n in )(xfn stands for theth
n order polynomial that approximates the function )(xfy and
n
ijj ji
j
ixx
xxxL
0
)(
)(xLi is a weighting function that includes a product of 1n terms with terms of ij omitted.
Then to find the first derivative, one can differentiate xfn once, and so on for other derivatives.
For example, the second order Lagrange polynomial passing through 221100 ,and,,,, yxyxyx is
21202
101
2101
200
2010
212 xf
xxxx
xxxxxf
xxxx
xxxxxf
xxxx
xxxxxf
Differentiating the above equation gives
2
1202
101
2101
200
2010
212
222xf
xxxx
xxxxf
xxxx
xxxxf
xxxx
xxxxf
Differentiating again would give the second derivative as
21202
1
2101
0
2010
2
222xf
xxxxxf
xxxxxf
xxxxxf