Download as pdf or txt
Download as pdf or txt
You are on page 1of 100

Numerical Methods

Pure Mathematics

Wardaya College
Top University Class
August 2019

1 / 100
Numerical Methods

In mathematics, a numerical method is a mathematical tool to solve


numerical problems. Numerical methods are used to approximate the
solution of complicated problems. There are different kinds of numerical
problems that can be solved using numerical methods, some of them
include
finding a solution of an equation f (x) = 0,
finding a definite integral of a function,
finding a derivative of a function,
etc.
Numerical methods are usually used for problems whose exact solutions
cannot be computed easily. The study of a numerical method is called a
numerical analysis, while the implementation of a numerical method with
an appropriate convergence check in a programming language is called a
numerical algorithm.

2 / 100
Solving Equations

Consider a quadratic equation ax 2 + bx + c = 0 where a, b and c are real


numbers. The exact solutions to the equation can be computed using a
quadratic formula. These solutions are called analytical solutions (or
algebraic solutions). When we solve the equation for exact solutions, we
are solving the equation analytically (or algebraically).

Consider the equations x 5 − 5x + 3 = 0 and e x = 4x. We see that these


equations cannot be solved analytically. We may decide to draw their
graphs, either manually or using a graphic calculator or computer
software as follows.

3 / 100
Solving Equations

The graph shows that the equation x 5 − 5x + 3 = 0 has three roots, lying
in the intervals [−2, −1], [0, 1] and [1, 2], while the equation e x = 4x has
two roots, lying in the intervals [0, 1] and [2, 3]. The problem now is how
to find the roots to any required degree of accuracy and as efficiently as
possible using numerical methods. The solutions obtained using
numerical methods are called numerical solutions.

In many real problems, equations are obtained for which solutions using
analytic methods are not possible, but for which we nonetheless want to
know the answers. In this section, we introduce several numerical
methods for solving such equations.

4 / 100
Root Finding Methods

There are several methods currently known to solve an equation


numerically, although some of them will not be discussed in this section.
These methods include
Decimal search method
Bisection method
Secant method
False position method (regula falsi)
Newton-Raphson method
Steffensen’s method
Inverse quadratic interpolation method
Brent’s method
Fixed point iteration method
etc.

5 / 100
Root Finding Methods

Most of the numerical methods are used to solve equations of the form
f (x) = 0. Solving an equation of the form f (x) = g (x) is the same as
finding the roots of the function h(x) ≡ f (x) − g (x) = 0. Thus root
finding algorithms allow solving any equations defined by functions.

Most root finding methods do not guarantee that they will find all the
roots to of an equation. In particular, if such method does not find any
root, it does not mean that no root exists.

Some root finding methods, such as decimal search and bisection


methods, use Intermediate Value Theorem, thus requiring the functions
to be continuous. They require finding a point f (x) on each side of
y = 0. Such algorithms are hence also called change of sign methods or
bracketing methods.

6 / 100
Root Finding Methods

Most numerical root finding methods use iteration, producing a sequence


(defined recursively) of numbers that are expected to converge towards
the root as a limit. They require one or more initial guesses of the root
as starting values, then each iteration of the algorithm produces a
successively more accurate approximation to the root. Since the iteration
must be stopped at some point, these methods produce an approximate
to the root, not an exact solution. The iteration is stopped when the
process has obtained an estimate of the root with a certain degree of
accuracy α, which is called the tolerance value.

7 / 100
Continuous Functions

Definition
A function f defined in the domain D is continuous at the point x = a if
and only if
lim f (x) = f (a)
x→a

This directly implies that f (x) must be defined at x = a and the limit
lim f (x) exists. Otherwise, the function f is discontinuous at x = a.
x→a

Definition
Furthermore the function f is continuous on the interval I if it is
continuous at every point in I . If I contains endpoints, continuity on I
means continuous from the right or left at the endpoints.

8 / 100
Continuous Functions

Intuitively, the function f is continuous at the point x = a if and only if


the curve y = f (x) does not break at x = a. The function f is
continuous on an interval I if and only if the curve y = f (x) in the
interval I is a single unbroken curve. This means that the curve does not
contain breaks (jumps or holes) or vertical asymptotes.

Example
All polynomials are continuous on all real numbers.
The functions sin x, cos x and e x are continuous on all real numbers.
f (x)
All rational functions are continuous on all real numbers
g (x)
except at the points where g (x) = 0.
The function tan x is continuous on all real numbers except at the
(2k − 1)π
points x = where k is an integer.
2

9 / 100
Continuous Functions
Example
1
The following graph shows the curve y = . Since the curve has a break
x
at x = 0 (in fact, a vertical asymptote) then the function is not
continuous at x = 0.

The following graph shows the curve of a cubic function


y = (x + 3)(x − 1)2 . The curve has no jumps or holes. Therefore the
function is continuous everywhere on the real numbers.

10 / 100
Intermediate Value Theorem

Theorem
Let f be a continuous function on the interval [a, b]. If u is a real number
between f (a) and f (b) (i.e. f (a) ≤ u ≤ f (b) or f (b) ≤ u ≤ f (a)), then
there exists a real number c on the interval [a, b] such that f (c) = u.
This is known as Intermediate Value Theorem.

Theorem
The above theorem immediately implies that for a function f continuous
on the interval [a, b], if f (a)f (b) ≤ 0 (i.e. either f (a) and f (b) have
opposite signs or one is zero), then there exists a real number c on the
interval [a, b] such that f (c) = 0.

11 / 100
Intermediate Value Theorem

The proof of the theorem requires rigorous mathematical analysis and will
not be shown here. However, it is easy to derive the theorem by intuition.
Since the function f is continuous on [a, b], the curve y = f (x) does not
contain breaks or vertical asymptotes. Hence in order to reach the point
(b, f (b)) from (a, f (a)), the values of f (x) must contain all values on the
interval [f (a), f (b)]. This is shown in the following figure.

12 / 100
Intermediate Value Theorem

The converse of the theorem is not true however, as there may be one or
more values c in the interval [a, b] such that f (c) = 0. A simple example
is for f (x) = x 2 − x. We have f (−1) > 0 and f (2) > 0, but
f (0) = f (1) = 0. The function f (x) = x 2 is an example where only one
root exists, as we have f (x) = 0 for x = 0 and f (x) > 0 for other values
of x.

13 / 100
Root Bracketing

Definition
Let f be a continuous function. We say that an interval [a, b] brackets
the root of f if there exists c in the interval (a, b) such that f (c) = 0.

The Intermediate Value Theorem implies that if f is continuous on the


interval [a, b] and f (a)f (b) < 0 then (a, b) brackets the root.

14 / 100
Decimal Search Method

The decimal search method aims to estimate a solution to the equation


f (x) = 0 where f is continuous function. The procedure begins by
finding an integer n such that f (n) and f (n + 1) have opposite signs
(there is a sign change). Then by IVT, there exists a root between n and
n + 1. The integer part of this root is therefore n. We proceed to find
the first decimal point by evaluating f (x) for different values of x until
there exists a sign change. This process is repeated to look for the
second decimal point, third decimal point, and so on.

15 / 100
Decimal Search Method

Example
In the previous example, we see that the function f (x) = x 5 − 5x + 3 has
a root between 0 and 1. We proceed to find this root by taking
increments in x of size 0.1, working out the value of f (x).

x 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7


f (x) 3.00 2.50 2.00 1.50 1.01 0.53 0.08 -0.33

We can see there is a sign change between 0.6 and 0.7. Therefore there
exists a root between 0.6 and 0.7. We narrow down the interval and
continue with increments of 0.01 as follows.

x 0.60 0.61 0.62


f (x) 0.08 0.03 -0.01

This shows that the root lies between 0.61 and 0.62.

16 / 100
Decimal Search Method

Example cont.
An alternative way of expressing this information is that the root can be
taken as 0.615 with a maximum error of ±0.005, or the root is 0.6 (to 1
decimal place).
This process can be continued by considering x = 0.611, x = 0.612, . . .
to obtain the root to any required number of decimal places.

Each step of the decimal search procedure involves dividing an interval


into ten parts. Notice that when the fraction part of a root is 0.99...
Then when performing the decimal search method, we have to compute
all nine values f (0.1), f (0.2), . . . , f (0.9). Hence the algorithm may take a
long time to find a root if we do it manually.

17 / 100
Bisection Method

The bisection method aims to estimate the solution to the equation


f (x) = 0. The method is similar to the decimal search, but instead of
dividing each interval into ten parts and looking for a sign change, in this
case the interval is divided into two equal parts (it is bisected). The
procedure generally performs faster than the decimal search method.

The procedure begins by looking for two real numbers such that f (a) and
f (b) have opposite signs. By IVT, there exists a root between a and b.
a+b
Let c = . Since f (a) and f (b) have opposite signs, then either
2
f (c) = 0 (which gives c as the root) or f (c) has the same signs as
exactly one of f (a) and f (b). Therefore either [a, c] or [c, b] brackets the
root and we have then reduced the interval. Repeating the procedure, we
shall obtain an estimate of the root.

18 / 100
Bisection Method

The bisection method procedure can be summarised in the following


algorithm.
1 set two real numbers a and b such that f (a)f (b) < 0 and set a
tolerance value α.
a+b
2 set c = .
2
3 if |b − a| < α then return c, otherwise go to step 4.
4 if f (c)f (a) < 0 then set b = c, if f (c)f (b) < 0 then set a = c.
5 repeat from step 2.

19 / 100
Bisection Method

Example
As in the earlier example for the root in the interval [0, 1], we start by
taking the mid-point of the interval x = 0.5.
Since f (0.5) ≈ 0.53 > 0, then the root lies between 0.5 and 1.
We proceed by taking the mid-point of the second interval, x = 0.75.
Since f (0.75) ≈ −0.51 < 0, then the root lies between 0.5 and 0.75.
The mid-point of this further reduced interval is x = 0.625.
Since f (0.625) ≈ −0.03 < 0, then the root lies between 0.5 and 0.625.
Stopping here, we can estimate the root to 0.5625 with a maximum error
of ±0.0625. We may continue the process until the required degree of
accuracy is obtained.

20 / 100
Fixed Point Method

Definition
Let f be a continuous function. We say a real number x is a fixed value
of f if and only if f (x) = x.

The fixed point method aims to estimate the fixed point of a continuous
function f , that is, the solution to equations in the form f (x) = x, rather
than f (x) = 0.

21 / 100
Fixed Point Theorem

Theorem
Let f be a continuous function and x0 , x1 , x2 , . . . be a sequence of real
numbers satisfying

xi = f (xi−1 ), for i = 1, 2, 3, . . .

Suppose that the sequence x0 , x1 , x2 , . . . converges to x. Then x is a


fixed point of f .

Proof
The proof of the above theorem is omitted.

22 / 100
Fixed Point Method

The fixed point method procedure begins with setting an initial value x0
and then generates the sequence x1 , x2 , x3 , . . . iteratively by the equation

xi = f (xi−1 )

for i = 1, 2, 3, . . . . The iteration stops upon getting a value xn that is


close enough (with a tolerance of α) to xn−1 . The value xn is the fixed
point estimate of the root to the equation f (x) = x.

The method procedure can be summarised in the following algorithm.


1 set an initial value xn and a tolerance value α
2 set xn+1 = f (xn )
3 if |xn+1 − xn | < α then return xn , otherwise set xn = xn+1 and repeat
from step 2.

23 / 100
Fixed Point Method

Example
The equation x 5 − 5x + 3 = 0 in earlier example can be rewritten in a
number of ways. One of these is 5x = x 5 + 3, giving

x5 + 3
x = f (x) =
5
The following figure shows the graph of y = x and y = f (x) in this case.

24 / 100
Fixed Point Method

Example cont.
This provides the basis for the iterative formula

xn5 + 3
xn+1 =
5
Taking x0 = 1 as a starting point to find the root in the interval [0, 1],
successive approximations are

x1 = 0.8, x2 = 0.6655, x3 = 0.6261, x4 = 0.6192,


x5 = 0.6182, x6 = 0.6181, x7 = 0.6180, x8 = 0.6180

In this case the iteration has converged to 0.6180 quite rapidly to the
root which we are looking.

25 / 100
Fixed Point Method
Example cont.

5
Consider a different rearrangement of the equation such as x = 5x − 3,
which leads to the iterative formula

xn+1 = 5 5xn − 3

Taking the same value x0 = 1 as a starting point, the resulting sequence


of approximations is

x1 = 1.1487, x2 = 1.2237, x3 = 1.2554, x4 = 1.2679,


x5 = 1.2727, x6 = 1.2746, x7 = 1.2753, x8 = 1.2755
x9 = 1.2756, x10 = 1.2757, x11 = 1.2757

The sequence has converged to a value, but in this case not to the root
we are looking for. The procedure obtains the root in the interval [1, 2].
If instead we had taken x0 = 0 as the initial point and apply the iteration,
we would have obtained a sequence converging to the value
x = −1.6180, the root in the interval [−2, −1].
26 / 100
Fixed Point Method
Example cont.
The effect of several repeats of this procedure is shown in the following
figure.

The successive steps look like a staircase approaching the root; this type
of diagram is called a staircase diagram. In other examples, the
following diagram may be produced, and is called a cobweb diagram.

27 / 100
Fixed Point Method

Whether the sequence x0 , x1 , x2 , . . . converges or not depends on the


choice of f (x). The rearrangement of the equation into the form
x = f (x) will allow convergence to a root a of the equation, provided
that −1 < f 0 (x) < 1 for values of x close to the root a.

Consider the two rearrangements of x 5 − 5x + 3 = 0 which were


suggested earlier.
√ As shown in the following figure, the gradient of the
curve y √= 5 5x − 3 near A is greater than 1. This makes
xn+1 = 5 5xn − 3 an unsuitable iterative formula for finding the root in
the interval [0, 1].

28 / 100
Fixed Point Method

When an equation has two or more roots, a single rearrangement will not
usually find all of them. This is demonstrated in the following figure.

29 / 100
Benefits and Drawbacks of Root Finding Methods

Solving equations using numerical methods gives some advantages over


analytical methods. These include
it is a fast and easy method to implement, computer softwares may
help.
provided the initial values can be obtained and the function is
continuous, the roots can always be obtained.
However, there are also several disadvantages such as
most of them do not work for non-continuous functions.
most of them may only be useful to find one of many roots of
equations.
although the maximum error of the estimate is small, it may still be
not good enough.

30 / 100
Using Root Finding Methods

When applying the root finding methods discussed earlier, it is important


to take note of the following points.
Numerical methods should only be used when analytic methods are
not available. If an equation can be solved analytically, it is the right
method to use.
A good practice is to start by drawing a sketch graph of the function
whose equation we are trying to solve. This may shows us the
number of roots the equation has and their approximate positions. It
may also warn us of possible difficulties with particular methods.
When using a calculator or a computer software, ensure that the
range of values of x is sufficiently large to find all the roots.
Always give a statement about the accuracy of a solution (e.g. to 5
decimal places, or ±0.0005) which should be obtained by the
numerical method itself. A solution obtained by a numerical method
is worthless without this.
The most suitable method for solving one equation may not be that
for solving another.
31 / 100
Numerical Integration

Suppose we want to find the area under the curve y = f (x) for
a < x < b. In some cases we cannot do this by integration due to the
following
The function f (x) is not integrable in the interval (a, b), such as
Dirichlet functions.
The function f (x) is integrable, but there is no closed form for the
integral, or requires techniques we are not familiar with. An example
2
of such functions is f (x) = e −x .
The function f (x) is not defined in algebraic form, instead just have
a set of points (perhaps derived from an experiment).
In these cases, we can always find an approximate value of the integral
using a numerical method. This is called numerical integration.

32 / 100
Numerical Integration

When using a numerical method to find an integral, we need to have a


clear picture in mind of the graph of the function, and how our method
estimates the area beneath it.

There are several numerical integration methods. Some of these include


Trapezium rule
Midpoint rule
Adaptive quadrature
Extrapolation methods

33 / 100
Trapezium Rule

Consider a function f (x) defined on the interval [a, b]. We wish to


approximate the integral
Z b
f (x) dx
a

Suppose that the interval [a, b] is divided into n equal partitions


(x0 , x1 ), (x1 , x2 ), (x2 , x3 ), . . . , (xn−1 , xn ), each being a smaller interval on
[a, b] where
b−a
xi = a + i, for i = 0, 1, 2, . . . , n
n
b−a
Each interval is a strip of width h = . We can then construct n
n
trapeziums, one in each interval (xi , xi+1 ), to approximate the value of
the integral as shown in the following.

34 / 100
Trapezium Rule

The i-th trapezium has parallel sides with length yi−1 = f (xi−1 ) and
b−a
yi = f (xi ) and the distance between them is h = .
n

35 / 100
Trapezium Rule

Let Ai be the area of the i-th trapezium. Recall that the formula for the
area A of a trapezium is A = 12 h(a + b) where a and b are the length of
its parallel sides and h is the distance between them.
An approximate value of the integral is therefore given by

A1 + A2 + · · · + An
1 1 1
= h(y0 + y1 ) + h(y1 + y2 ) + · · · + h(yn−1 + yn )
2 2 2
1
= h(y0 + 2y1 + 2y2 + · · · + 2yn−1 + yn )
2
1
= h(f (x0 ) + 2f (x1 ) + 2f (x2 ) + · · · + 2f (xn−1 ) + f (xn ))
2
b−a b−a
where h = and xi = a + i for i = 0, 1, 2, . . . , n.
n n

36 / 100
Trapezium Rule
Example

The following figure shows the area under the curve y = 5x − x 2 for
values of x between 0 and 4, by two trapeziums of equal width.

In this√case, we have√h = 2, x0 = 0, x1 = 2 √
and x2 = 4. Therefore
y0 = 0 = 0, y1 = 6 ≈ 2.4495 and y2 = 4 = 2. We compute the
area of the trapeziums as follows
1
Trapezium A = (2)(0 + 2.4495) = 2.4495
2
1
Trapezium B = (2)(2.4495 + 2) = 4.4495
2
Total = 2.4495 + 4.4495 ≈ 6.8990
37 / 100
Trapezium Rule

Example cont.
For greater accuracy, we may consider four trapeziums as shown in the
following figure

In this case, we √
have h = 1, x0√= 0, x1 = 1, √x2 = 2, x3 = 3 and x4 = 4.
Therefore
√ y 0 = 0 = 0, y =
1 √ 4 = 2, y 2 = 6 ≈ 2.4495,
y3 = 6 ≈ 2.4495 and y4 = 4 = 2.

38 / 100
Trapezium Rule

Example cont.
The area is estimated in just the same way
1
Trapezium P = (1)(0 + 2) = 1.0000
2
1
Trapezium Q = (1)(2 + 2.4495) = 2.2247
2
1
Trapezium R = (1)(2.4495 + 2.4495) = 2.4495
2
1
Trapezium S = (1)(2.4495 + 2) = 2.2247
2
Total = 1.0000 + 2.2247 + 2.4495 + 2.2247 ≈ 7.8990

39 / 100
Trapezium Rule

Example cont.
In the example, the first two estimates are 6.8990 and 7.8990. We can
see from the figure with four trapeziums, that the trapeziums all lie
underneath the curve, and so in this case the trapezium rule estimate of
7.8990 must be too small. However, we cannot say by how much. In
order to obtain more accuracy, we need to take progressively more strips
to find the value to which the estimate converges. Using 8 strips gives an
estimate of 8.2407, and 16 strips gives 8.3578. The first figure, 8, looks
reasonably certain but it is still not clear about the second figure. We
need to take even more strips to be able to decide. In the example, the
convergence is unusually slow because of the high curvature of the curve.

40 / 100
Trapezium Rule

Example cont.
Consider the following figure

We can see that the trapezium rule estimate will underestimate the area
in (i) but will overestimate the area in (iii). This is because, in (i), all the
trapeziums generated will lie underneath the curve, while in (iii), some
parts of each trapeziums will lie above the curve. However in (ii), we are
not be able to tell the case since some trapeziums will underestimate the
area and some others will overestimate the area.

41 / 100
Exercise Problem 1
Find the roots of x 5 − 5x + 3 = 0 in the intervals [−2, −1] and [1, 2],
correct to 2 decimal places, using
decimal search, and
interval bisection.
Comment on the ease and efficiency with which the roots are approached
by each method.
Solution
1 We use decimal search to find the root in the interval [−2, −1] as
follows.
x -1.9 -1.8 -1.7 -1.6
f (x) -12.26 -6.90 -2.70 0.51
Therefore the root lies between −1.7 and −1.6.
x -1.68 -1.66 -1.64 -1.62 -1.61
f (x) -1.98 -1.30 -0.66 -0.06 0.23
Therefore the root lies between −1.62 and −1.61.
42 / 100
Exercise Problem 1 cont.

Since f (−1.615) ≈ 0.09 > 0 then the root lies between −1.62 and
−1.615. Hence the root is −1.62, correct to 2 decimal places.
We then proceed to find the root between 1 and 2 as follows.
x 1.1 1.2 1.3
f (x) -0.89 -0.51 0.21
Therefore the root lies between 1.2 and 1.3.
x 1.22 1.24 1.26 1.27 1.28
f (x) -0.40 -0.27 -0.12 -0.05 0.04
Therefore the root lies between 1.27 and 1.28. Since
f (1.275) ≈ −0.005 < 0 then the root lies between 1.275 and 1.28.
Hence the root is 1.28, correct to 2 decimal places.

43 / 100
Exercise Problem 1 cont.

2 We use bisection method to find the root between −2 and −1. We


have f (−2) = −19 < 0 and f (−1) = 7 > 0. We proceed to take the
midpoints of the interval and reduced it.
Since f (−1.5) ≈ 2.90 > 0, then the root lies between −2 and −1.5.
Since f (−1.75) ≈ −4.66 < 0, then the root lies between −1.75 and
−1.5.
Since f (−1.625) ≈ −0.21 < 0, then the root lies between −1.625
and −1.5.
Since f (−1.563) ≈ 1.49 > 0, then the root lies between −1.625 and
−1.563.
Since f (−1.594) ≈ 1.49 > 0, then the root lies between −1.625 and
−1.594.
Since f (−1.610) ≈ 0.25 > 0, then the root lies between −1.625 and
−1.610.
Since f (−1.618) ≈ 0.02 > 0, then the root lies between −1.625 and
−1.618.
Hence the root is −1.62, correct to 2 decimal places.

44 / 100
Exercise Problem 1 cont.

2 We use the same method to find the root between 1 and 2. We


have f (1) = −1 < 0 and f (2) = 25 > 0. We proceed to take the
midpoints of the interval and reduced it.
Since f (1.5) ≈ 3.09 > 0, then the root lies between 1 and 1.5.
Since f (1.25) ≈ −0.20 < 0, then the root lies between 1.25 and 1.5.
Since f (1.375) ≈ 1.04 > 0, then the root lies between 1.25 and
1.375.
Since f (1.313) ≈ 0.33 > 0, then the root lies between 1.25 and
1.313.
Since f (1.282) ≈ 0.05 > 0, then the root lies between 1.25 and
1.282.
Since f (1.266) ≈ −0.08 < 0, then the root lies between 1.266 and
1.282.
Since f (1.275) ≈ −0.014 < 0, then the root lies between 1.275 and
1.282.
Hence the root is 1.28, correct to 2 decimal places.

45 / 100
Exercise Problem 1 cont.

Here we see that both methods require a large number of computations.


The bisection method converges very slowly to the root.

46 / 100
Exercise Problem 2

1 Use a systematic search for a change of sign, starting with x = −2,


to locate intervals of unit length containing each of the three roots of

x 3 − 4x 2 − 3x + 8 = 0
2 Use the method of interval bisection to obtain each of the roots
correct to 2 decimal places.
3 Use your last intervals in part 2, to give each roots in the form
a ± (0.5)n where a and n are to be determined.

Solution
1 Let f (x) = x 3 − 4x 2 − 3x + 8. We compute the function for integer
values x starting with x = −2 as follows
x -2 -1 0 1 2 3 4 5
f (x) -10 6 8 2 -6 -10 -4 18
Therefore by IVT, there exists a root in each of the intervals
(−2, −1), (1, 2) and (4, 5).
47 / 100
Exercise Problem 2 cont.

2 We use bisection method to find the root between −2 and −1.


Since f (−1.5) ≈ 0.125 > 0, then the root lies between −2 and −1.5.
Since f (−1.75) ≈ −4.36 < 0, then the root lies between −1.75 and
−1.5.
Since f (−1.625) ≈ −1.98 < 0, then the root lies between −1.625
and −1.5.
Since f (−1.5625) ≈ −0.89 < 0, then the root lies between −1.5625
and −1.5.
Since f (−1.53125) ≈ −0.38 < 0, then the root lies between
−1.53125 and −1.5.
Since f (−1.515625) ≈ −0.12 < 0, then the root lies between
−1.515625 and −1.5.
Since f (−1.5078125) ≈ 0.001 > 0, then the root lies between
−1.515625 and −1.5078125.
Since f (−1.51171875) ≈ −0.06 < 0, then the root lies between
−1.51171875 and −1.5078125.
Hence we deduce that the root is −1.51, correct to 2 decimal places.

48 / 100
Exercise Problem 2 cont.

We proceed to find the root between 1 and 2.


Since f (1.5) ≈ −2.125 < 0, then the root lies between 1 and 1.5.
Since f (1.25) ≈ −0.05 < 0, then the root lies between 1 and 1.25.
Since f (1.125) ≈ 0.99 > 0, then the root lies between 1.125 and
1.25.
Since f (1.1875) ≈ 0.47 > 0, then the root lies between 1.1875 and
1.25.
Since f (1.21875) ≈ 0.21 > 0, then the root lies between 1.21875
and 1.25.
Since f (1.234375) ≈ 0.08 > 0, then the root lies between 1.234375
and 1.25.
Since f (1.2421875) ≈ 0.02 > 0, then the root lies between
1.2421875 and 1.25.
Since f (1.24609375) ≈ −0.01 < 0, then the root lies between
1.2421875 and 1.24609375.
Since f (1.244140625) ≈ 0.002 > 0, then the root lies between
1.244140625 and 1.24609375.

49 / 100
Exercise Problem 2 cont.

Since f (1.2451171875) ≈ −0.01 < 0, then the root lies between


1.244140625 and 1.2451171875.
Since f (1.24462890675) ≈ −0.002 < 0, then the root lies between
1.244140625 and 1.24462890675.
Hence we deduce that the root is 1.24, correct to 2 decimal places.
We proceed to find the root between 4 and 5.
Since f (4.5) ≈ 4.63 > 0, then the root lies between 4 and 4.5.
Since f (4.25) ≈ −0.23 < 0, then the root lies between 4.25 and 4.5.
Since f (4.375) ≈ 2.05 > 0, then the root lies between 4.25 and
4.375.
Since f (4.3125) ≈ 0.87 > 0, then the root lies between 4.25 and
4.3125.
Since f (4.28125) ≈ 0.31 > 0, then the root lies between 4.25 and
4.28125.
Since f (4.265625) ≈ 0.04 > 0, then the root lies between 4.25 and
4.265625.
Since f (4.2578125) ≈ −0.10 < 0, then the root lies between
4.2578125 and 4.265625.
50 / 100
Exercise Problem 2 cont.

Since f (4.26171875) ≈ −0.03 < 0, then the root lies between


4.26171875 and 4.265625. Since f (4.263671875) ≈ 0.002 > 0, then
the root lies between 4.26171875 and 4.263671875.
Hence we deduce that the root is 4.26, correct to 2 decimal places.
3 Taking the midpoints and the range of the smallest intervals that
contain each root respectively, we obtain that the three roots are
given by

x = −1.509765625 ± 0.001953125
= −1.509765625 ± (0.5)9 ,
x = 1.244384765875 ± 0.000244140625
= 1.244384765625 ± (0.5)12 , and
x = 4.262695313 ± 0.0009765625
= 4.262695313 ± (0.5)10

51 / 100
Exercise Problem 3
The diagram shows a sketch of the graph of f (x) = e x − x 3 without
scales.

1 Use a systematic search for a change of sign to locate intervals of


unit length containing each of the roots.
2 Use a change of sign method to find each of the roots correct to 3
decimal places.

52 / 100
Exercise Problem 3 cont.

Solution
1 Based on the graph, the equation f (x) = 0 has two roots. We have
f (1) ≈ 1.72 > 0, f (2) ≈ −0.61 < 0, f (4) ≈ −9.40 < 0 and
f (5) ≈ 23.41 > 0. Since f is continuous, then by IVT, there exists a
root in the interval [1, 2] and there exists another root in the interval
[4, 5].
2 We use decimal search to find the first root between 1 and 2.
x 1.2 1.4 1.6 1.8 1.9
f (x) 1.59 1.31 0.86 0.21 -0.18
Therefore the root lies between 1.8 and 1.9.
x 1.82 1.84 1.85 1.86
f (x) 0.14 0.07 0.03 -0.01
Therefore the root lies between 1.85 and 1.86.

53 / 100
Exercise Problem 3 cont.

x 1.852 1.854 1.856 1.857 1.858


f (x) 0.02 0.01 0.005 0.01 -0.003
Therefore the root lies between 1.857 and 1.858. Since
f (1.8575) ≈ −0.001 < 0, then the root lies between 1.857 and
1.8575. Hence the root is 1.857, correct to 3 decimal places. We
proceed to find the other root between 4 and 5.
x 4.2 4.4 4.5 4.6
f (x) -7.40 -3.73 -1.11 2.15
Therefore the root lies between 4.5 and 4.6.
x 4.51 4.52 4.53 4.54
f (x) -0.81 -0.51 -0.20 0.11
Therefore the root lies between 4.53 and 4.54.

54 / 100
Exercise Problem 3 cont.

x 4.532 4.534 4.536 4.537


f (x) -0.14 -0.08 -0.01 0.02
Therefore the root lies between 4.536 and 4.537. Since
f (4.5365) ≈ 0.003 > 0, then the root lies between 4.536 and
4.5365. Hence the root is 4.536, correct to 3 decimal places.

55 / 100
Exercise Problem 4
Consider the following functions
1
y=
x
x
y= 2
x +1
x2
y= 2
x +1
For each of the above functions,
1 sketch the curve,
2 write down any roots, and
3 investigate what happens when you use a change of sign method
with a starting interval of [−0.3, 0.7].

56 / 100
Exercise Problem 4 cont.

Solution
1 The graphs of the three curves are shown respectively in the
following figure, from left to right.

1 x
2 The function y = has no root while the functions y = 2 and
x x +1
x2
y= has exactly one root, which is x = 0.
x2+1

57 / 100
Exercise Problem 4 cont.

1
3 For the case y = . Since y < 0 and x < 0 and y > 0 when x > 0,
x
then the change of sign method will produce a root convergent to 0.
However 0 is not a root in this case. This happens because the
function is not continuous.
x
For the case y = 2 . Since the denominator x 2 + 1 > 0 for all
x +1
x, here we have a continuous function. Furthermore since y < 0
when x < 0 and y > 0 when x > 0, then the change of sign method
will produce a root that converges to 0. This is exactly the root.
The method is successful.
x2
For the case y = 2 . We have y > 0 when x 6= 0, the curve
x +1
only touches the x-axis at x = 0. Since there is no sign change at
any point, therefore the method fails to find the root.

58 / 100
Exercise Problem 5

1 Show that the equation e −x − x + 2 = 0 has a root in the interval


[2, 3].
2 The equation is rearranged into the form x = e −x + 2. Use the
iterative formula suggested by this rearrangement to find the value
of the root to 3 decimal places.

Solution
1 Let f (x) = e −x − x + 2. We have f (2) ≈ 0.14 > 0 and
f (3) ≈ −0.95 < 0. Since f is continuous, then by IVT, there exists
a root in the interval [2, 3] as desired.
2 We use the iterative formula xn+1 = e −xn + 2 with initial value
x0 = 2.5. We obtain

x1 = 2.0821, x2 = 2.1247, x3 = 2.1195, x4 = 2.1201


x5 = 2.1200, x6 = 2.1200

Hence the root is 2.120, correct to 3 decimal places.

59 / 100
Exercise Problem 6
The sequence of values given by the iterative formula
3xn 2
xn+1 = + 3
4 xn

with initial value x0 = 2, converges to α.


1 Use this iteration to calculate α correct to 2 decimal places showing
the result of each iteration correct to 4 decimal places.
2 State an equation which is satisfied by α and hence find the exact
value of α.

Solution
1 Using the iterative formula, we obtain

x1 = 1.7500, x2 = 1.6857, x3 = 1.6818, x4 = 1.6818

Since the sequence converges to 1.6818, we obtain that the value of


the root α is 1.68, correct to 2 decimal places.

60 / 100
Exercise Problem 6 cont.

2 The value of α satisfies the equation


3x 2
x= + 3
4 x

which is equivalent to x 4 = 8. Hence the exact value of α is 4
8.

61 / 100
Exercise Problem 7

1 By sketching a suitable pair of graphs, show that the equation

cos x = 2 − 2x

where x is in radians, has only one root for 0 ≤ x ≤ 12 π


2 Verify by calculation that this root lies between 0.5 and 1.
3 Show that, if a sequence of values given by the iterative formula
1
xn+1 = 1 − cos xn
2
converges, then it converges to the root of the equation in part 1.
4 Use this iterative formula, with initial value x0 = 0.6, to determine
this root correct to 2 decimal places. Give the result of each
iteration to 4 decimal places.

62 / 100
Exercise Problem 7 cont.

Solution
1 We sketch the graph of y = cos x and y = 2 − 2x for 0 ≤ x ≤ 21 π in
the following figure.

Since the two curves intersect at one point, then the equation
cos x = 2 − 2x has only one root as desired.
2 Let f (x) = cos x − 2 + 2x. We have f (0.5) ≈ −0.12 < 0 and
f (1) ≈ 0.54 > 0. Since f is continuous, then by IVT, f has a root
between 0.5 and 1. This root satisfies the equation cos x = 2 − 2x
as desired.

63 / 100
Exercise Problem 7 cont.

Solution
3 Suppose that the sequence converges to x. Then we have
1
x =1− cos x
2
which is equivalent to cos x = 2 − 2x. Hence the sequence converges
to the root as desired.
4 Using the iterative formula, we obtain

x1 = 0.5873, x2 = 0.5838, x3 = 0.5828, x4 = 0.5825


x5 = 0.5825

Hence the root is 0.58, correct to 2 decimal places.

64 / 100
Exercise Problem 8
The diagram shows the curve y = x 2 cos x, for 0 ≤ x ≤ 21 π, and its
maximum point M.

1 Show by differentiation that the coordinate of M satisfies the


2
equation tan x = .
x
2 Verify by calculation that this equation has a root (in radians)
between 1 and 1.2.  
2
3 Use the iterative formula xn+1 = tan−1 to determine this root
xn
correct to 2 decimal places. Give the result of each iteration to 4
decimal places.

65 / 100
Exercise Problem 8 cont.

Solution
1 Let x be the x-coordinate of M. Then we have f 0 (x) = 0. Therefore

2x cos x − x 2 sin x = 0
2
since x 6= 0, then the above equation is equivalent to tan x = as
x
desired.
2
2 Let f (x) = tan x − . We have f (1) ≈ −0.44 < 0 and
x
f (1.2) ≈ 0.90 > 0. Since f is continuous, then by IVT, f has a root
2
between 1 and 1.2. This root satisfies the equation tan x = as
x
desired.
3 Using the iterative formula with initial value x0 = 1.1, we obtain

x1 = 1.0680, x2 = 1.0803, x3 = 1.0755, x4 = 1.0774


x5 = 1.0767, x6 = 1.0770, x3 = 1.0769, x4 = 1.0769

Hence the root is 1.08, correct to 2 decimal places.


66 / 100
Exercise Problem 9

1 By sketching a suitable pair of graphs, show that the equation

ln x = 2 − x 2

has only one root.


2 Verify by calculation that this root lies between x = 1.3 and x = 1.4.
3 Show that, if a sequence of values given by the iterative formula
p
xn+1 = 2 − ln xn

converges, then it converges to the root of the equation in part 1.


p
4 Use the iterative formula xn+1 = 2 − ln xn to determine the root
correct to 2 decimal places. Give the result of each iteration to 4
decimal places.

67 / 100
Exercise Problem 9 cont.

Solution
1 We sketch the graph of y = ln x and y = 2 − x 2 in the following
figure.

Since the two curves intersect at one point, then the equation
ln x = 2 − x 2 has only one root as desired.
2 Let f (x) = ln x − 2 + x 2 . We have f (1.3) ≈ −0.05 < 0 and
f (1.4) ≈ 0.30 > 0. Since f is continuous, then by IVT, f has a root
between 1.3 and 1.4. This root satisfies the equation ln x = 2 − x 2 .

68 / 100
Exercise Problem 9 cont.

Solution
3 Suppose that the sequence converges to x. Then we have

x = 2 − ln x

which is equivalent to ln x = 2 − x 2 . Hence the sequence converges


to the root as desired.
4 Using the iterative formula with an initial value x0 = 1.35, we obtain

x1 = 1.3038, x2 = 1.3171, x3 = 1.3132, x4 = 1.3143


x5 = 1.3140, x6 = 1.3141, x7 = 1.3141

Hence the root is 1.31, correct to 2 decimal places.

69 / 100
Exercise Problem 10
The equation x 3 − 2x − 2 = 0 has one real root.
1 Show by calculation that this root lies between x = 1 and x = 2.
2 Prove that, if a sequence of values given by the iterative formula

2xn3 + 2
xn+1 =
3xn2 − 2

converges, then it converges to this root.


3 Use the iterative formula to calculate the root correct to 2 decimal
places. Give the result of each iteration to 4 decimal places.

Solution
1 Let f (x) = x 3 − 2x − 2. We have f (1) = −3 < 0 and f (2) = 2 > 0.
Since f is continuous, then by IVT, there exists a root between 1
and 2 as desired.

70 / 100
Exercise Problem 10 cont.

2 Suppose that the sequence converges to x. Then we have

2x 3 + 2
x=
3x 2 − 2

It is easy to see that this equation is equivalent to x 3 − 2x − 2 = 0.


Hence the sequence converges to the root as desired.
3 Using the iterative formula with an initial value x0 = 1.5, we obtain

x1 = 1.8421, x2 = 1.7728, x3 = 1.7693, x4 = 1.7693

Hence the root is 1.77, correct to 2 decimal places.

71 / 100
Exercise Problem 11
The speed v in ms−1 of a train given at time t seconds in the following
table.

t 0 10 20 30 40 50 60
v 0 5.0 6.7 8.2 9.5 10.6 11.6

The distance that the train has travelled is given by the area under the
graph of the speed (vertical axis) against time (horizontal axis).
1 Estimate the distance the train travels in this 1 minute period.
2 Give two reasons why your method cannot give a very accurate
answer.

72 / 100
Exercise Problem 11 cont.

Solution
1 We use trapezium rule with n = 6 strips of width h = 10 to estimate
the area under the graph. The estimate area under the graph is
given by
1
(10)(0 + 2(5.0 + 6.7 + 8.2 + 9.5 + 10.6) + 11.6) = 458
2
Hence the estimate of the distance the train travels is 458 m.
2 The above method cannot give a very accurate answer because the
speeds are not given to a high level of accuracy. Furthermore,
trapezium rule estimates the curve by a by a straight line.

73 / 100
Exercise Problem 12
Z 1
1 π
The definite integral 2
dx is known to equal .
0 1 + x 4
1 Using the trapezium rule for four strips, find an approximation for π.
2 Repeat your calculation with 10 and 20 strips to obtain closer
estimates.
3 If you did not know the value of π, what value whould you give it
with confidence on the basis of your estimates in part 1 and 2?

74 / 100
Exercise Problem 12 cont.

Solution
1
Let f (x) = . We have f (0) = 1 and f (1) = 0.5.
1 + x2
R1
1 We estimate the integral 0 f (x) dx using n = 4 strips of width
1
h = . The estimate of the integral is given by
4
        
1 1 1 2 3
A= · f (0) + 2 f +f +f + f (1)
2 4 4 4 4
1
≈ (1 + 2(0.9412 + 0.8 + 0.64) + 0.5)
8
≈ 0.7828

Hence the approximate value of π is given by 4A ≈ 3.1312, correct


to 4 decimal places.

75 / 100
Exercise Problem 12 cont.

Solution
1
3 Using n = 10 strips of width h = . The estimate of the integral is
10
given by
9   !
1 1 X i
A= · f (0) + 2 f + f (1)
2 10 10
i=1
9
!
1 X 1
= 1+2 2 + 0.5
20 1+ i
i=1 10
≈ 0.7850

Hence the approximate value of π is given by 4A ≈ 3.1399, correct


to 4 decimal places.

76 / 100
Exercise Problem 12 cont.

Solution
1
Using n = 20 strips of width h = . The estimate of the integral is
20
given by
19   !
1 1 X i
A= · f (0) + 2 f + f (1)
2 20 20
i=1
19
!
1 X 1
= 1+2 2 + 0.5
40 1+ i
i=1 20
≈ 0.7853

Hence the approximate value of π is given by 4A ≈ 3.1412, correct


to 4 decimal places.
3 The approximate value obtained by using 20 strips should give the
best estimate for π. Here we deduce the value of π is approximately
equal to 3.14.

77 / 100
Exercise Problem 13
The trapezium rule is used to estimate the value of
Z 1.6 p
I = 1 + x 2 dx
0


1 Draw the graph of y = 1 + x 2 for 0 ≤ x ≤ 1.6.
2 Use strip widths of 0.8, 0.4, 0.2 and 0.1 to find approximations to
the value of the integral.
3 State the value of the integral to as many decimal places as you can
justify.

78 / 100
Exercise Problem 13 cont.

Solution

Let f (x) = 1 + x 2 for 0 ≤ x ≤ 1.6. We have f (0) = 1 and
f (1.6) ≈ 1.8868
1 The desired graph is shown in the following figure.

2 We use trapezium rule with strip widths h = 0.8 and


1.6 − 0
n= = 2 trapeziums. The estimate of the integral is given by
0.8
1
(0.8)(f (0) + 2f (0.8) + f (1.6))
2
= (0.4) (1 + 2(1.2806) + 1.8868) ≈ 2.1792

79 / 100
Exercise Problem 13 cont.

Solution
We then use trapezium rule with strip widths h = 0.4 and
1.6 − 0
n= = 4 trapeziums. The estimate of the integral is given by
0.4
1
(0.4)(f (0) + 2(f (0.4) + f (0.8) + f (1.2)) + f (1.6))
2
= (0.2) (1 + 2(1.0770 + 1.2806 + 1.5620) + 1.8868) ≈ 2.1452

We then use trapezium rule with strip widths h = 0.2 and


1.6 − 0
n= = 8 trapeziums. The estimate of the integral is given by
0.2
7
1 X
(0.2)(f (0) + 2 f (0.2i) + f (1.6))
2
i=1
7 p
!
X
= (0.1) 1 + 2 1+ (0.2i)2 + 1.8868 ≈ 2.1368
i=1

80 / 100
Exercise Problem 13 cont.

Solution
Finally, using trapezium rule with strip widths h = 0.1 and
1.6 − 0
n= = 16 trapeziums gives the estimate
0.1
15
1 X
(0.1)(f (0) + 2 f (0.1i) + f (1.6))
2
i=1
15 p
!
X
= (0.05) 1 + 2 1+ (0.1i)2 + 1.8868 ≈ 2.1346
i=1

Hence the approximate value of the integral is 2.1792, 2.1452,


2.1368 and 2.1346 respectively.
3 As greater number of strips gives better estimates, we deduce that
the value of the integral is 2.13, correct to 2 decimal places.

81 / 100
Exercise Problem 14
ln x
The diagram shows the part of the curve y = for 0 < x ≤ 4. The
x
curve cuts the x-axis at A and its maximum point is M.

1 Write down the coordinates of A.


2 Show that the x-coordinate of M is e, and write down the
y -coordinate of M in terms of e.
3 Use the trapezium rule with three intervals to estimate the value of
Z 4
ln x
dx
1 x
correct to 2 decimal places.
4 State with a reason, whether the trapezium rule gives an
underestimate or an overestimate of the true value of the integral in
part 3.
82 / 100
Exercise Problem 14 cont.

Solution
ln x
Let f (x) = for 0 < x ≤ 4.
x
ln x
1 We have = 0 if and only if x = 1. Hence the coordinate of A is
x
(1,0).
2 Let xM be the x-coordinate of M. Then we have f 0 (xM ) = 0.
Therefore
1
xM xM − ln xM
2 =0
xM
which is equivalent to 1 − ln xM = 0. Therefore xM= e 
and
ln e 1 1
f (xM ) = = . Hence the coordinate of M is e, .
e e e

83 / 100
Exercise Problem 14 cont.

4−1
3 We use trapezium rule with n = 3 intervals of width h = =1
3
to estimate the integral. We have f (1) = 0, f (2) ≈ 0.3466,
f (3) ≈ 0.3662 and f (4) ≈ 0.3466. Hence the estimate of the
integral is given by
1
h(f (1) + 2(f (2) + f (3)) + f (4))
2
1
= (1)(0 + 2(0.3466 + 0.3662) + 0.3466) ≈ 0.8861
2
Hence the estimate value of the integral is 0.89, correct to 2 decimal
places.
4 It can be seen that the trapeziums all lie below the curve. Hence the
trapezium rule gives an underestimate of the true value of the
integral.

84 / 100
Exercise Problem 15
1
The diagram shows a sketch of the curve y = for values of x
1 + x3
from −0.6 to 0.6.

1 Use the trapezium rule with two intervals, to estimate the value of
Z 0.6
1
dx
−0.6 1 + x3

giving your answer correct to 2 decimal places.


2 Explain, with reference to the diagram, why the trapezium rule may
be expected to give a good approximation to the true value of the
integral in this case.
85 / 100
Exercise Problem 15 cont.

Solution
1
Let f (x) = for −0.6 ≤ x ≤ 0.6.
1 + x3
1 We use trapezium rule with n = 2 intervals of width
0.6 − (−0.6)
h= = 0.6 to estimate the integral. We have
2
f (−0.6) ≈ 1.2755, f (0) = 1 and f (0.6) ≈ 0.8224. Hence the
estimate of the integral is given by
1
h(f (−0.6) + 2f (0) + f (0.6))
2
1
= (0.6)(1.2755 + 2(1) + 0.8224) ≈ 1.2294
2
Hence the estimate value of the integral is 1.23, correct to 2 decimal
places.
2 It can be seen that one trapezium gives an overestimate of the area
while the other trapezium gives an underestimate of the area. Hence
the trapezium rule is expected to give a good approximation.
86 / 100
Supplement Materials
The following materials will not be covered in the test.

87 / 100
Limit of a Function

The limit of a function f is the value that a function approaches as the


argument approaches some value. In formulas, a limit of a function is
usually written as
lim f (x) = L
x→c

The above information is read as ”the limit of f of x as x approaches c


equals L”. This can also be written as f (x) → L as x → c.
The above statement is however only intuitive and not a formal definition.
The mathematical definition of limit is presented in the following.

Definition
The limit of a function f (x) as x approaches c equals L, written lim = L
x→c
if and only if for every real number  > 0, there exists a real number
δ > 0 such that |f (x) − L| <  for all real number x such that |x − c| < δ.

88 / 100
Proof of the Intermediate Value Theorem

Theorem
Let f be a continuous function defined on the interval [a, b] satisfying.
Suppose that u is a real number such that f (a) < u < f (b) or
f (b) < u < f (a). Then there exists a real number c in the interval (a, b)
such that f (c) = u.

Proof
We shall only prove for the case f (a) < u < f (b), the other case is
similar. Let S be the set of all real numbers x in the interval [a, b] such
that f (x) < u. Since f (a) < u and f (b) > u, then S is not empty and is
bounded from above by b. Therefore, by completeness property, there
exists a smallest real number c such that c is greater than every element
in S, we say c is the supremum or the least upper bound of S, written
c = sup S. Since f is continuous at c, we have lim x = f (c). We shall
x→c
prove by contradiction that f (c) = u.

89 / 100
Proof of the Intermediate Value Theorem

Assume that f (c) < u, then u − f (c) > 0. Since lim x = f (c) then there
x→c
exists δ > 0 such that |f (x) − f (c)| < u − f (c) for every x such that
|x − c| < δ. This implies that, there exists a real number x > c such that
f (x) < u − f (c) + f (c) = u. This leads to a contradiction to the fact
that c is the upper bound of S.
Now assume that f (c) > u, then f (c) − u > 0. Since lim x = f (c) then
x→c
there exists δ > 0 such that |f (x) − f (c)| < f (c) − u for every x such
that |x − c| < δ. This implies that, for every real number x > c − δ we
have f (x) > u − f (c) + f (c) = u. Therefore c − δ is an upper bound of
S less than c, which leads to a contradiction to the fact that c is the
least upper bound of S.
Hence f (c) = u and the proof is complete.

90 / 100
Newton-Raphson Method

Newton-Raphson method (or sometimes called Newton’s method) aims


to estimate a solution to the equation f (x) = 0 where f is a
differentiable function. The method produces sequence of approximations
which are getting closer to the root.

Suppose that f is a differentiable function on the interval (a, b). Assume


that we have x0 is an approximation to the root of f (x) = 0. We look to
derive for a better approximation. The equation of the tangent line to
the curve y = f (x) at x = x0 is given by

y = f 0 (x0 )(x − x0 ) + f (x0 )

where f 0 denotes the derivative of f . The x-intercept of the line is taken


as the better approximation of the root, which leads to
0 = f 0 (x0 )(x − x0 ) + f (x0 ). Solving for x gives

f (x0 )
x = x0 −
f 0 (x0 )
91 / 100
Newton-Raphson Method

The Newton-Raphson method begins by taking an initial guess x0 and


generating a sequence defined by

f (xi )
xi+1 = xi − , for i = 0, 1, 2, . . .
f 0 (xi )

The iteration stops after obtaining a term in the sequence that is close
(within a tolerance value α) to the preceding term. The iteration may
also be stopped after obtaining a term x such that f (x) is approximately
0. This term is the estimate of the root of the equation f (x) = 0. Note
that in order for this method to work, the value x0 should be chosen such
that f 0 (x0 ) 6= 0.

92 / 100
Newton-Raphson Method

Example
In the earlier example, we look for a root of the equation
x 5 − 5x + 3 = 0. Let f (x) = x 5 − 5x + 3. The derivative of this function
is f 0 (x) = 5x 4 − 5. We set x0 = 0 and generate a sequence defined by

xi5 − 5xi + 3
xi+1 = xi −
5x 4 − 5
giving

x1 = 0.6, x2 ≈ 0.6179, x3 ≈ 0.6180, x4 = 0.6180, . . .

Here we see that the sequence has converged relatively fast to the desired
root x ≈ 0.6180. To obtain the other two roots, we need to use different
values for x0 . Note that in this case, any real number x0 except −1 and 1
(such that 5x04 − 5 6= 0) will imply the sequence to converge to a root.

93 / 100
Secant Method

The secant method aims to estimate a solution to the equation f (x) = 0


where f is a continuous function. The method uses a succession of roots
of secant lines to better approximate the root. The secant method can
be thought of as a finite difference approximation of Newton-Raphson
method.

Suppose that f is a continuous function on the interval (a, b). The


method starts by taking two real numbers x0 and x1 and giving a better
estimate of the root. We construct a line through the points (x0 , f (x0 ))
and (x1 , f (x1 )) as shown in the figure.

94 / 100
Secant Method
The equation of this line is given by

f (x1 ) − f (x0 )
y= (x − x1 ) + f (x1 )
x1 − x0
The root of this linear function, the value of x such that y = 0, is given
by
x1 − x0
x = x1 − f (x1 )
f (x1 ) − f (x0 )
This value of x is used for the next term of the sequence and the process
is then repeated.

The secant method involves taking initial guesses x0 and x1 which should
be chosen to lie close to the root, and generating a sequence defined by
xi+1 − xi
xi+2 = xi+1 − f (xi+1 ) , for i = 0, 1, 2, . . .
f (xi+1 ) − f (xi )

The iteration should be stopped after obtaining a term x such that f (x)
is approximately 0.
95 / 100
Steffensen’s Method

Steffensen’s method aims to estimate a solution to the equation


f (x) = 0. The method is similar to Newton-Raphson method. However,
the slope function f 0 (xi ) in the denominator is estimated.

The method begins with taking an initial guess x0 and generating a


sequence defined by

f (xi )
xi+1 = xi − , for i = 0, 1, 2, . . .
g (xi )

where the slope function g (xi ) is a composite of the original function


with the formula
f (xi + f (xi ))
g (xi ) = −1
f (xi )

96 / 100
Finite Difference

A finite difference is a mathematical expression of the form


f (x + b) − f (x + a) where f is a function. When a finite difference is
divided by b − a, the result is called a difference quotient. The finite
difference is used to approximate derivatives of a function at a certain
point.

Recall the derivative of the function f at x is given by

f (x + h) − f (x)
f 0 (x) = lim
h→0 h
Hence the derivative f 0 (x) at the point x = x0 can be approximated by

f (x0 + h) − f (x0 )
h
where a small value h (approximately 0) is chosen. Using smaller values
of h generally leads to a better estimate of the derivative, although it is
not always the case.
97 / 100
Finite Difference

There are three common forms of finite difference.


Forward difference, estimate f 0 (x) by

f (x + h) − f (x)
h
Backward difference, estimate f 0 (x) by

f (x) − f (x − h)
h
Central difference, estimate f 0 (x) by

f (x + 12 h) − f (x − 12 h)
h

98 / 100
Midpoint Rule

Z b
The midpoint rule is used to estimate the definite integral f (x) dx
a
where f is a function defined on the interval [a, b]. The method is similar
to the trapezium rule, however the area of the region is estimated by
rectangles instead. The interval [a, b] is divided into n equal partitions
(x0 , x1 ), (x1 , x2 ), (x2 , x3 ), . . . , (xn−1 , xn ), each being a smaller interval on
[a, b] where
b−a
xi = a + i, for i = 0, 1, 2, . . . , n
n
b−a
Each interval is a strip of width h = . We then construct n
n
rectangles, one in each interval (xi , xi+1 ). Each rectangle has width h and
height defined by the function f on the midpoint of the interval.

99 / 100
Midpoint Rule

 
b−a xi−1 + xi
The i-th rectangle has width h = and height f . The
n 2
area of each rectangle is therefore given by
 
xi−1 + xi
Ai = hf
2

Hence an approximate value of the integral is given by

A1 + A2 + · · · + An
     
x0 + x1 x1 + x2 xn−1 + xn
= hf + hf + · · · + hf
2 2 2
      
x0 + x1 x1 + x2 xn−1 + xn
=h f +f + ··· + f
2 2 2

100 / 100

You might also like