0% found this document useful (0 votes)
17 views

Numerical Methods

A level notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Numerical Methods

A level notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Numerical Methods

Important Concepts: Definitions


Error: An error is the difference between a true value and an estimate or approximation of that value. If
the approximated value is 𝑥 and the actual value is 𝑋 then the 𝐸𝑟𝑟𝑜𝑟 = 𝑋 − 𝑥 𝑜𝑟 𝑥 − 𝑋. This means that
error can be negative or positive since an approximated value may be greater or less than the true value.
An approximated value may be an over estimate or an under estimate of the true value.
Absolute Error: This is a positive error, which is given by |𝐸𝑟𝑟𝑜𝑟| = |𝑥 − 𝑋|
Relative Error: This refers to the ratio of the positive numerical difference between the exact value and
the approximated value to the exact or true value. In other words relative error is the absolute error
|𝐸𝑟𝑟𝑜𝑟|
divided by the true or exact value. I.e. 𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝑒𝑟𝑟𝑜𝑟 = . Percentage error is the relative
𝑇𝑟𝑢𝑒 𝑉𝑎𝑙𝑢𝑒
error ratio expressed as a percent.
Sources of Errors
Errors in mathematical calculations can be a result of:
 Measurement errors: Errors may arise from taking wrong readings or failure to use an
appropriate instrument. Using a Vernier calipers would give an accurate result to 3 or
more decimal places instead of using a ruler which can only measure length to 1 decimal
place.
 Rounding off or approximation errors: Errors can be made during intermediate stages of
some calculations. For example, an equation may be solved to give 𝑥 = √2, and the
answer required to do further calculations. Instead of using √2, a person then uses 𝑥 =
1.41 which would give an answer which is far removed from the expected answer.
 Truncation error: Results from ignoring all but a finite number of terms of an infinite
1−𝑥 𝑥2
series. For example ignoring 𝑥 3 and higher powers of 𝑥 in evaluating √1+𝑥 ≈ 1 − 𝑥 + ,
2
1
to estimate the value of √7 by using 𝑥 = 8.
Maximum Absolute Error
When we are given an approximated value, we would have lost the original true value, but we
can estimate the maximum possible error that would give a possible range of the values. Suppose
the length of a line 𝑥 = 2.4(1 d.p). This is an approximated value, which could have come from
2.35; 2.36; 2.37; 2.38; 2.39; 2.40; 2.41; 2.42; 2.43; 2.44 … up to any other number just less
than2.45. I have just given numbers to 2 d.p, but we could have infinitely many possible
numbers if we increase the number of decimal places. However for practical purposes I have
assumed measurements to 2 decimal places. This means we can create a range of values of 𝑥 as
2.35 ≤ 𝑥 < 2.45. The upper limit is not inclusive but when we want to use 𝑥 for further
calculations where we need the maximum value of 𝑥 we use as a maximum as it just creates an
upper bound. Note that the interval is symmetrical with the approximated value being the mid

© GUNGIRA L 2020: The Specialist 0773219992


value. i.e. 𝑥 = 2.4 ± 0.05. The quantity 0.05 is called the maximum absolute error and it gives
the error bounds of an approximated value, and 2.4 is called the working value or mid value. If a
number 𝑥 is approximated to 𝑛 d.p (decimal places), then the maximum absolute error is given
1
by 2 × 10−𝑛 .

1
𝑛 = 1, 𝑚𝑎𝑥𝑖𝑚𝑢𝑚 𝑎𝑏𝑠𝑜𝑙𝑢𝑡𝑒 𝑒𝑟𝑟𝑜𝑟 = × 10−1 = 0.05
2
1
𝑛 = 2, 𝑚𝑎𝑥𝑖𝑚𝑢𝑚 𝑎𝑏𝑠𝑜𝑙𝑢𝑡𝑒 𝑒𝑟𝑟𝑜𝑟 = × 10−2 = 0.005
2
Example
Given that 𝑥 = 8.7 and 𝑦 = 0.3, each correct to one decimal place, find
(a) the value of 𝑥𝑦 and an estimate of the relative error in calculating this quantity.
1
(b) the value of 𝑦 − 𝑥 giving your answer, with error bounds to one significant figure, to
appropriate accuracy.
Suggested Solution
There are two approaches that we can use:
(a) First we need a working / mid value. We can use the approximated value to get the working
value
𝑥𝑦 = 8.7 × 0.3 = 2.61
1
We also want the maximum absolute error in each value given by 2 × 10−1 = 0.05, hence
8.65 ≤ 𝑥 < 8.75 and 0.25 ≤ 𝑦 < 0.35
Relative error can be calculated using the sum of relative errors,
0.05 0.05
𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝑒𝑟𝑟𝑜𝑟 = + = 0.172413793 ≈ 17%.
8.7 0.3

Therefore 𝑥𝑦 = 2.61 ± 17%.


Alternatively we can find the absolute error of the quantity 𝑥𝑦. This requires us to find the
maximum, minimum and working values of 𝑥𝑦.
𝑥𝑦𝑚𝑎𝑥 = 8.75 × 0.35 = 3.0625
𝑥𝑦𝑚𝑖𝑛 = 8.65 × 0.25 = 2.1625
1 1
Mid value or working value is given by 2 (max 𝑣𝑎𝑙𝑢𝑒 + min 𝑣𝑎𝑙𝑢𝑒) = 2 (3.0625 + 2.1625)

= 2.6125 = 2.61(2 dp).

© GUNGIRA L 2020: The Specialist 0773219992


1 1
Maximum absolute error = 2 (max 𝑣𝑎𝑙𝑢𝑒 − min 𝑣𝑎𝑙𝑢𝑒) = 2 (3.0625 − 2.1625) = 0.45 .
Usually maximum absolute error is rounded up to 1 significant figure, but if it is already closer
to 0.5, 0.05, 0.005 e.t.c. we take it as it is. For example, in this case, maximum absolute error is
0.45
0.45, so relative error is 2.61 × 100 = 17.2413793 ≈ 17%

Hence 𝑥𝑦 = 2.61 ± 17%∎


NOTE: If a calculated maximum absolute error is 0.321, for example or 0.0213 then it would
be rounded to 0.4or 0.03respectively, rounded up to 1 significant figure to be closer to a 5 since
a maximum absolute error must have a 5 as a significant figure as 0.5, 0.05, 0.005𝑒. 𝑡. 𝑐.
1 1
(b) (𝑦 − 𝑥) = 0.35 − 8.75 = 0.235714285
𝑚𝑎𝑥

1 1
(𝑦 − 𝑥) = 0.25 − 8.65 = 0.134393063
𝑚𝑖𝑛
1
Working value/ mid value= 2 (0.235714285 + 0.134393063) = 0.185053674 = 0.19 (2 𝑠𝑓)
1
Maximum absolute error = 2 (0.235714285 − 0.134393063) = 0.050660611 = 0.05 (1 𝑠𝑓)
1
Therefore (𝑦 − 𝑥) = 0.19 ± 0.05 ( 2 𝑠𝑓)

Small Changes: Application of differentiation


Small changes can be taken as errors where ∆𝑥or𝛿𝑥 = 𝐸𝑟𝑟𝑜𝑟. This is a very important
application of the definition of differentiation from first principles and gradient as a limit, that
𝑑𝑦 𝛿𝑦
= 𝑙𝑖𝑚𝑖𝑡𝑎𝑠 𝛿𝑥→0 (𝛿𝑥 ). If we drop the limit for a very small change in 𝑥 then
𝑑𝑥

𝛿𝑦 𝑑𝑦 𝒅𝒚
≈ 𝑑𝑥 ⇒ 𝜹𝒚 ≈ 𝒅𝒙 𝜹𝒚. This is an important result that we can use to find a change in 𝑦 if the
𝛿𝑥
change in 𝑥 is known since 𝑦 depends on 𝑥 in a given relationship such as 𝑦 = 𝑓(𝑥). In this
relationship, if 𝑥 is changed by a small amount 𝛿𝑥 then the new value is 𝑥 + 𝛿𝑥. A change in 𝑥
will also result in a corresponding change in 𝑦 given by 𝒚 + 𝜹𝒚 = 𝒇(𝒙 + 𝜹𝒙). This relationship
can be used to evaluate functions such as √16.01 or 𝑠𝑖𝑛31° without using a calculator.
Example

Without using a calculator evaluate √16.01.


Suggested Solution

First we recognize that we need a relationship of the form √𝑥, so


1
𝑑𝑦 1 1
Let 𝑦 = √𝑥, hence 𝑑𝑥 = 2 𝑥 −2 = 2 𝑥.

© GUNGIRA L 2020: The Specialist 0773219992


Next we need to evaluate this derivative using a value of 𝑥 before the change. To do this we note
that √16.01 = √16 + 0.01, hence 𝑥 = 4 and 𝛿𝑥 = 0.01. So before the change 𝑥 = 16 and using
𝑑𝑦
the relationship 𝑦 = √𝑥 then 𝑦 = √16 = 4. Now we can use this information to evaluate 𝑑𝑥 at
𝑥 = 4 and find 𝛿𝑦 when 𝑥 = 4, 𝛿𝑥 = 0.01.
1 1
⇒ 𝛿𝑦 ≈ 2√4 . 0.01 ≈ 8 . 0.01 ≈ 0.00125.

∴ √16.01 = √16 + 0.01 = 𝑓(16 + 0.01) = 𝑦 + 𝛿𝑦 = 4 + 0.00125 ≈ 4.00125∎

Evaluate 𝑠𝑖𝑛31° without using a calculator. [ HINT: You can create a


relationship 𝑦 = 𝑠𝑖𝑛𝑥 and note that differentiation is valid when 𝑥 is in radians so write 31° as
𝜋 𝜋 𝜋 𝜋
( 6 + 180) in radians. This can be written as ( 6 + 0.01745), so that 𝑥 = and 𝛿𝑥 = 0.01745]
6

Small Changes: Relative errors


𝑑𝑦
The result 𝛿𝑦 ≈ 𝑑𝑥 𝛿𝑥 can be used together with two more on relative error in 𝑥 and relative
error in 𝑦. In this case we may not know the exact value of either 𝑥 or 𝑦 so we define the relative
𝛿𝑥 𝛿𝑦
errors as: 𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝑒𝑟𝑟𝑜𝑟 𝑖𝑛 𝑥 = and 𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝑒𝑟𝑟𝑜𝑟 𝑖𝑛 𝑦 = .
𝑥 𝑦

Example

The formula 𝑇 = 2√𝑙 can be used to estimate the period 𝑇 seconds of a pendulum of length 𝑙
𝑑𝑇
metres. Obtain and hence estimate the relative error in 𝑇 corresponding to a 1% relative error
𝑑𝑙
in 𝑙 [ZIMSEC]
Suggested Solution
𝑑𝑇 1 1 1
= 2 × × 𝑙 −2 =
𝑑𝑙 2 √𝑙
𝛿𝑇 𝑑𝑇 𝑑𝑇
≈ ⇒ 𝛿𝑇 ≈ 𝛿𝑙
𝛿𝑙 𝑑𝑙 𝑑𝑙
1 𝛿𝑙 1 𝑙
⇒𝛿𝑇 ≈ 𝛿𝑥. Now given that relative error in 𝑙 is 1% then = 100 ⇒ 𝛿𝑙 = 100
√𝑙 𝑙

1 𝑙 √𝑙
∴ 𝛿𝑇 ≈ × =
√𝑙 100 100
𝛿𝑇 √𝑙 1 1 1
Relative error in 𝑇 is given by = 100 × 2√𝑙 = 200 = 2 %∎
𝑇

Example

© GUNGIRA L 2020: The Specialist 0773219992


1
Given that 𝑦 = , find an approximate percentage change in 𝑦 if 𝑥 is decreased by 5% when
√2𝑥−1
𝑥 = 5.

Suggested Solution
1 3 3
𝑑𝑦 1
𝑦 = (2𝑥 − 1)−2 and so 𝑑𝑥 = − 2 (2𝑥 − 1)−2 × 2 = −(2𝑥 − 1)−2
3
𝑑𝑦 𝑑𝑦 1
, 𝑎𝑡 𝑥 = 5, is 𝑑𝑥 = −(9)−2 = − 27
𝑑𝑥
𝛿𝑥 5
Relative error in 𝑥, ⇒ = − 100
𝑥
𝑥 1 1
⇒𝛿𝑥 = − = − , since 𝑥 = 5. Also when 𝑥 = 5, 𝑦 = from the given relationship.
20 4 3

1 1
∴ 𝛿𝑦 = − ×−
27 4
𝛿𝑦 1 1 1
Relative error in 𝑦 = = − 27 × − 4 × 3 × 100 = 36 × 100 = 2.78%∎
𝑦

The Equation 𝒇(𝒙) = 𝟎

Numerical methods do not produce exact solutions but gives approximate solutions, hence there
are errors inherent in the solutions. Before solving the equation, there is need to identify the
approximate location of the roots. When solving the equation, then we solve with approximate
solution in mind.

Location of the roots of 𝒇(𝒙) = 𝟎

There are two methods that we can use, curve sketching or sign change. This enables us to
identify two consecutive integers between which a root lies. Curve sketching is also divided into
two:

 Sketching the function 𝑦 = 𝑓(𝑥) and the root is located where 𝑓(𝑥) crosses the 𝑥 axis
(𝑓(𝑥) = 0) This may be challenging to do because in most cases the equation we wish to
solve using numerical methods cannot be solved by exact methods such as factorization.

© GUNGIRA L 2020: The Specialist 0773219992


 The second approach involves splitting the 𝑓(𝑥) = 0 into two standard functions whose
graphs can be easily sketched. The equation 𝑓(𝑥) = 0 can be rearranged to
ℎ(𝑥) = 𝑔(𝑥). The graphs of 𝑦 = ℎ(𝑥) and 𝑦 = 𝑔(𝑥) are then drawn and their
intersection points show the position of the root(s). Suppose 𝑥 3 + 𝑥 − 3 = 0, we can
3
rearrange the equation to give 𝑥(𝑥 2 + 1) = 3 ⇒ 𝑥 2 + 1 = 𝑥 so that the two functions are
3
𝑔(𝑥) = 𝑥 2 + 1 and ℎ(𝑥) = 𝑥. Alternatively we can rearrange the equation to give 𝑥 3 =
3 − 𝑥 so that we have 𝑔(𝑥) = 𝑥 3 and ℎ(𝑥) = 3 − 𝑥. We can then sketch the graphs as
follows

© GUNGIRA L 2020: The Specialist 0773219992


Or using the other arrangement it could be

The second method makes use of the sign change. It uses the argument that if a graph of 𝑓(𝑥) is
continuous and crosses the line 𝑦 = 0 or 𝑓(𝑥) = 0 between two consecutive integers 𝑎 and 𝑏 then the
root 𝛼 lies between these integers such that 𝑎 < 𝛼 < 𝑏 if the values of 𝑦; 𝑓(𝑎) and 𝑓(𝑏) have different
signs. Alternatively a root 𝛼 lies between 𝑎 and 𝑏 if 𝒇(𝒂). 𝒇(𝒃) < 𝟎.

Example

(a) Show by sketching two appropriate graphs, that the equation 𝑥 3 + 3𝑥 − 3 = 0 has only one real root.
(b) Show by calculation, that the root of the equation in (a) lies between 𝑥 = 0,8 and
𝑥=1
Suggested Solution
(a) The equation can be rearranged as 𝑥 3 = 3 − 3𝑥, so we can draw two graphs of 𝑔(𝑥) = 𝑥 3 and

© GUNGIRA L 2020: The Specialist 0773219992


ℎ(𝑥) = 3 − 3𝑥

From the graph there is only one intersection point of 𝑔(𝑥) = 𝑥 3 and ℎ(𝑥) = 3 − 3𝑥 so there is only one
real root, 𝛽 of 𝑥 3 + 3𝑥 − 3 = 0.
(b) To show that there is a root between 𝑥 = 0.8 and 𝑥 = 1, we note the equation must be written in the
form 𝑓(𝑥) = 0, so 𝑥 3 + 3𝑥 − 3 = 0 ⇒ 𝑓(𝑥) = 𝑥 3 + 3𝑥 − 3

𝑓(0.8) = (0.8)3 + 3(0.8) − 3 = −0.088

𝑓(1) = (1)3 + 3(1) − 3 = 1


Since there is a sign change or since 𝑓(0.8). 𝑓(1) = −0.088 < 0 then there is a root between 𝑥 = 0.8 and
𝑥 = 1∎
The Iterative Method
Suppose we wish to solve the equation 𝑓(𝑥) = 0 by an iterative method, we need to find a relationship of
the form 𝑥𝑛+1 = 𝑔(𝑥𝑛 ) such that 𝑥𝑛+1 is a better approximation to the solution of the equation 𝛽, than
𝑥𝑛 . This is possible by rearranging 𝑓(𝑥) = 0 in the form 𝑥 = 𝑔(𝑥). For example, suppose we wish to
1 1
solve 𝑥 2 − 3𝑥 + 1 = 0, the equation can be written as either 𝑥 = 3−𝑥 or 𝑥 = 3 − 𝑥, which are boh of the
form 𝑥 = 𝑔(𝑥). The 𝑥 on the left hand side can be set as 𝑥𝑛+1 and the one on the right hand side as 𝑥𝑛 to
1 1
give the form 𝑥𝑛+1 = 3−𝑥 or 𝑥𝑛+1 = 3 − 𝑥 . Such an arrangement can be used to generate iterations
𝑛 𝑛
𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 … .. which must converge to the root of the equation. The formula known as the iterative
formula is used repeatedly to generate successive approximations for the unknown root. It is important
that some arrangements may not converge.
Suppose we want to solve the equation 𝑥 = 𝑔(𝑥), and 𝑥 = 𝛽 is the root then we can draw the graphs of
𝑦 = 𝑥 and 𝑦 = 𝑔(𝑥) as below with an initial guess of the root as 𝑥 = 𝑥0 ;

© GUNGIRA L 2020: The Specialist 0773219992


It can be seen from the graph that on the line 𝑦 = 𝑥, 𝑥1 = 𝑔(𝑥0 ), 𝑥2 = 𝑔(𝑥1 ) 𝑒𝑡𝑐 𝑥2 = 𝑔(𝑥1 ) is closer to
the root and therefore a better approximation provided 𝑥0 , 𝑥1 , 𝑥2 ⋯ converges to the root 𝛽. In general if
𝑥𝑛 is an approximate value for the root, then 𝑥𝑛+1 is a better approximation.
Example
Show that 𝑥 2 − 3𝑥 + 1 = 0 has a root between 𝑥 = 2 and 𝑥 = 3. Show that the arrangement
1 1
𝑥𝑛+1 = is not convergent. Using the iterative formula 𝑥𝑛+1 = 3 − with 𝑥1 = 3, to find this root
3−𝑥𝑛 𝑥𝑛
correct to 3 significant figures. Give each iteration correct to 4 decimal places.
Suggested Solution
𝑓(𝑥) = 𝑥 2 − 3𝑥 + 1

𝑓(2) = 22 − 3(2) + 1 = −1
𝑓(3) = 32 − 3(3) + 1 = +1
Since there is a sign change then there is a root between 𝑥 = 2 and 𝑥 = 3∎
1 1
Using 𝑥𝑛+1 = 3−𝑥 and taking 𝑥1 = 2 (2 + 3) = 2.5
𝑛

1
𝑥2 = =2
3 − 2.5
1
𝑥3 = =1
3−2
1
𝑥4 = = 0.5
3−1

© GUNGIRA L 2020: The Specialist 0773219992


1
𝑥5 = = 0.4
3 − 0.5
There is no sign of convergence, so the iterative formula is not convergent.
1
Now using 𝑥𝑛+1 = 3 − , with 𝑥1 = 3,
𝑥𝑛

1
𝑥2 = 3 − = 2,666666667 = 2.6667 (4 𝑑𝑝)
3
1
𝑥3 = 3 − = 2.6250 (4 𝑑𝑝)
2.6667
1
𝑥4 = 3 − = 2.619047619 = 2.6190 (4 𝑑𝑝)
2.625
1
𝑥5 = 3 − = 2.618181818 = 2.6182 (4 𝑑𝑝)
2.619
The root is therefore 𝑥 = 2.62 (3 𝑠𝑓)∎
NOTE: If the number of iterations is not specified, do enough iterations until to consecutive iterations
agree to a specified degree of accuracy. Also an arrangement may not converge as 𝑥1 , 𝑥2 ⋯ maybe
divergent.
Example
3 +1)
2(𝑥𝑛
Use the iterative formula 𝑥𝑛+1 = 2 , where 𝑥0 = 1, to calculate 𝑥1, 𝑥2 and 𝑥3 giving your answers
3𝑥𝑛
correct to 6 decimal places.
Given that the iteration converges, find and simplify an equation in 𝑥 whose real root is approximated by
this iteration.
Hence write down the exact value of this root. Find the absolute errors 𝑒1 , 𝑒2 , 𝑒3 in the first three
approximations 𝑥1 , 𝑥2 , 𝑥3 , giving your answers to 6 decimal places. [ZIMSEC]
Suggested Solution
𝑥0 = 1
3
2(1 + 1)
𝑥1 = = 1.333333333 = 1.333333 (6 𝑑𝑝)
3(12 )
2(1.3333333 + 1)
𝑥2 = = 1.263888889 = 1.263889 (6 𝑑𝑝)
3(1.3333332 )
2(1.2638893 + 1)
𝑥3 = = 1.259933493 = 1.259933 (6 𝑑𝑝)
3(1.2638892 )
To find the root approximated by this iteration, we set both 𝑥𝑛 and 𝑥𝑛+1 equal to 𝑥 and simplify.
2(𝑥 3 +1)
Therefore 𝑥 = 3𝑥 2
⇒ 3𝑥 3 = 2𝑥 3 + 2 ⇒ 𝑥 3 = 2 is the equation.
3
The exact value of 𝑥 is 𝑥 = √2 = 1.25992105
The absolute errors are therefore
𝑒1 = 1.333333333 − 1.25992105 = 0.073412283 = 0.073412 (6 𝑑𝑝)

© GUNGIRA L 2020: The Specialist 0773219992


𝑒2 = 1.263888889 − 1.25992105 = 0.003967839 = 0.003968 (6 𝑑𝑝)
𝑒3 = 1.259933493 − 1.25992105 = 0.000012443 = 0.000012( 6 𝑑𝑝)∎
The Newton –Raphson Method
The Newton –Raphson method is another iterative method that depends on the fact that if 𝑓(𝑥) = 0 and
𝑥 = 𝑥0 is our first approximation for the root, then if we draw a tangent at 𝑥 = 𝑥0 on the curve then the
tangent crosses the 𝑥 axis at 𝑥 = 𝑥1 which will be a better approximation. If a tangent is drawn at this
new value of 𝑥 the tangent crosses at 𝑥2 which is closer to the root and therefore is even better
approximation. This concept is based on the concept of linear approximation and that the tangent at a
point behaves almost the same as the curve at that point and that the curve would cross the 𝑥axis at
approximately the same point as the tangent drawn at that point on the curve. This repetitive procedure is
shown in the diagram below

From the graph, as we change the values 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 ⋯ we get closer to the root 𝛽 of the equation
𝑓(𝑥) = 0.
If we take one tangent at 𝑥 = 𝑥𝑜 as below:

© GUNGIRA L 2020: The Specialist 0773219992


The gradient of the curve at 𝑃 = gradient of the tangent
Using differentiation
0 − 𝑓(𝑥0 )
𝑓 ′ (𝑥0 ) =
𝑥1 − 𝑥0

𝑥1 (𝑓 ′ (𝑥0 )) − 𝑥0 (𝑓 ′ (𝑥0 )) = −𝑓(𝑥0 )

𝑥1 (𝑓 ′ (𝑥0 )) = 𝑥0 (𝑓 ′ (𝑥0 )) − 𝑓(𝑥0 )

𝑥0 (𝑓 ′ (𝑥0 )) − 𝑓(𝑥0 )
𝑥1 =
(𝑓 ′ (𝑥0 ))

𝑓(𝑥0 )
𝑥1 = 𝑥0 − [ ′ ]
(𝑓 (𝑥0 ))

Also using the same approach for tangent at 𝑥1 we get


𝑓(𝑥1 )
𝑥2 = 𝑥1 − [ ′ ]
(𝑓 (𝑥1 ))

𝑓(𝑥𝑛 )
⇒ 𝑥𝑛+1 = 𝑥𝑛 − [ ′ ]
(𝑓 (𝑥𝑛 ))

This iterative formula is called Newton –Raphson method.


Example
1
Use Newton- Raphson method to find the root of the equation 𝑠𝑖𝑛𝑥 = 𝑥 − 2 with initial approximation as
𝑥0 = 1.

© GUNGIRA L 2020: The Specialist 0773219992


Suggested Solution
1 1
First we must write the equation in the form 𝑓(𝑥) = 0. i.e. 𝑠𝑖𝑛𝑥 − 𝑥 + 2 = 0 so 𝑓(𝑥) = 𝑠𝑖𝑛𝑥 − 𝑥 + 2.
The next stage is to differentiate

𝑓 ′ (𝑥) = 𝑐𝑜𝑠𝑥 − 1
Now we can write the Newton –Raphson method paying particular attention to its structure. Thus
1
sin 𝑥𝑛 − 𝑥𝑛 + 2
𝑥𝑛+1 = 𝑥𝑛 − [ ]
cos 𝑥𝑛 − 1

Now we can use this iterative formula to find the root of the equation

𝑥0 = 1
1
𝑠𝑖𝑛1 − 1 +
𝑥1 = 1 − [ 2] = 1 − (−0.742816396) = 1.742816397
𝑐𝑜𝑠1 − 1

1
𝑠𝑖𝑛1.7428 − 1.7428 +
𝑥2 = 1.7428 − [ 2] = 1.522886966
𝑐𝑜𝑠1.7428 − 1

1
𝑠𝑖𝑛1.52289 − 1.52289 + 2
𝑥3 = 1.52289 − [ ] = 1.497643637
𝑐𝑜𝑠1.52289 − 1

1
𝑠𝑖𝑛1.49764 − 1.49764 + 2
𝑥4 = 1.49764 − [ ] = 1.497300452
𝑐𝑜𝑠1.49764 − 1

1
𝑠𝑖𝑛1.4973 − 1.4973 + 2
𝑥5 = 1.4973 − [ ] = 1.497300389
𝑐𝑜𝑠1.4973 − 1

Therefore the root is 𝑥 = 1.4973 (4 𝑑𝑝)∎


NOTE: When dealing with trigonometrical functions that involve differentiation and integration use
radians and make sure your calculator is in radian mode.
The Trapezium Rule
The trapezium rule is a method used to approximate the area of a finite region bounded by a curve, axis
and boundary lines 𝑥 = 𝑎 and 𝑥 = 𝑏, by dividing the area into trapezia of equal width 𝑑 or ℎ. When the
𝑏
graph of 𝑦 = 𝑓(𝑥) is approximately linear for 𝑎 ≤ 𝑥 ≤ 𝑏 the value of the integral ∫𝑎 𝑓(𝑥) 𝑑𝑥 can be
approximated by the area of a trapezium as shown below:

© GUNGIRA L 2020: The Specialist 0773219992


1
The area of the shaded trapezium is 2 [𝑓(𝑎) + 𝑓(𝑏)][𝑏 − 𝑎]

By increasing the number of trapezia between 𝑎 and 𝑏 we obtain a more accurate approximation. The
increased number of trapezia gives a more linear side to the curved part thereby minimising the unwanted
area( Over estimate) or cutting off required area(Under estimate)

The trapezium rule is therefore developed using this concept of the trapezium but with an increased
number of trapezia as shown below:

© GUNGIRA L 2020: The Specialist 0773219992


The width of each trapezium is called an interval which can be represented by 𝑑 or ℎ. The lines
𝑥 = 𝑥1 , 𝑥2 , 𝑥3 ⋯ 𝑥𝑛 are called ordinates. If there are 𝑛 ordinates then there are 𝑛 − 1 intervals. The
lengths of the parallel sides of the trapezia at each ordinate are 𝑦1, 𝑦2 , 𝑦3 ⋯ 𝑦𝑛 . These values are obtained
by substituting the ordinates in the function 𝑦 = 𝑓(𝑥).
The area therefore is
𝐴𝑟𝑒𝑎 = 𝐴𝑟𝑒𝑎 𝑜𝑓𝑇1 + 𝐴𝑟𝑒𝑎𝑜𝑓 𝑇2 + 𝐴𝑟𝑒𝑎 𝑜𝑓 𝑇3 + ⋯ + 𝐴𝑟𝑒𝑎 𝑜𝑓 𝑇𝑛
1 1 1
𝐴𝑟𝑒𝑎 = (𝑦1 + 𝑦2 )ℎ + (𝑦2 + 𝑦3 )ℎ + ⋯ + (𝑦𝑛−1 + 𝑦𝑛 )ℎ
2 2 2

= [𝑦 + 𝑦2 + 𝑦2 + 𝑦3 + 𝑦3 + ⋯ +𝑦𝑛−1 + 𝑦𝑛−1 + 𝑦𝑛 ]
2 1

= [𝑦 + 𝑦𝑛 + 2(𝑦2 + 𝑦3 + ⋯ + 𝑦𝑛−1 )]
2 1
Which is the trapezium rule for approximating a finite region under a curve bounded by the graph of 𝑦 =
𝑏
𝑓(𝑥), the 𝑥-axis and the 𝑥 = 𝑎 and 𝑥 = 𝑏. i.e. ∫𝑎 𝑓(𝑥)𝑑𝑥. To find ℎ we use the formula

𝑈𝑝𝑝𝑒𝑟 𝑙𝑖𝑚𝑖𝑡 − 𝑙𝑜𝑤𝑒𝑟 𝑙𝑖𝑚𝑖𝑡 𝑏 − 𝑎


ℎ= =
𝑁𝑜 𝑜𝑓 𝑖𝑛𝑡𝑒𝑟𝑣𝑎𝑙𝑠 𝑛−1
Where 𝑛 is the number of ordinates.
Example
3 1
Use the trapezium rule with 5 ordinates to evaluate ∫1 , giving your answer correct to 3 𝑑. 𝑝.
√1+𝑥 2

© GUNGIRA L 2020: The Specialist 0773219992


Suggested Solution
3−1 1
First we calculate ℎ = 5−1 = 2. The value of ℎ will determine the number of ordinates at 𝑥1 = 1,
3 5
𝑥2 = 2 , 𝑥3 = 2, 𝑥4 = 2 and 𝑥5 = 3.

We can now use these ordinates to calculate the values of the function
1
𝑦1 = = 0.707106781
√2
1
𝑦2 = = 0.554700196
√1 + 9
4
1
𝑦3 = = 0.447213595
√5
1
𝑦4 = = 0.371390676
√1 + 25
4
1
𝑦5 = = 0.316227766
√10
1 1
∴ 𝐴𝑟𝑒𝑎 = . [0.707106781 + 0.316227766 + 2(0.554700196 + 0.447213595 + 0.371390676)]
2 2
= 0.94248587
= 0.942 (3 𝑑. 𝑝. ) ∎
Example
(a) Sketch the graph of the function 𝑦 = −𝐼𝑛𝑥
(b) Use the trapezium rule with three ordinates to estimate the area bounded by the curve 𝑦 = −𝐼𝑛𝑥, the
lines 𝑥 = 2 and 𝑥 = 3, giving your answer correct to four decimal places.
3
(c) (i) Evaluate ∫2 −𝐼𝑛𝑥 𝑑𝑥 , correct to four decimal places.

(ii) Hence calculate the percentage error in using the rule to estimate the area. Explain why the trapezium
rule gives an underestimate of the area.

© GUNGIRA L 2020: The Specialist 0773219992


Suggested Solution
(a

3−2 1 1
(b) With 3 ordinates ℎ = 2
= 2, so the ordinates are at 𝑥 = 2, 𝑥 = 2 2 , 𝑥 = 3.

Therefore 𝑦1 = −𝐼𝑛2 = −0.69314718


5
𝑦2 = −𝐼𝑛 ( ) = −0.916290731
2
𝑦3 = −𝐼𝑛3 = −1.098612289
1 1 5
𝐴𝑟𝑒𝑎 = 2 . 2 (−𝐼𝑛2 + (−𝐼𝑛3) + 2 (−𝐼𝑛 (2))) = −0.906085233.( The negative means the area is below
the 𝑥 − 𝑎𝑥𝑖𝑠 as shown on the graph by R). Hence the area is 0.9061 (4 𝑑. 𝑝. )∎
3
(c) (i) For ∫2 −𝐼𝑛𝑥 𝑑𝑥 , we can use integration by parts.
1 1
Let 𝑢 = 𝐼𝑛𝑥, 𝑑𝑢 = 𝑥 and 𝑑𝑣 = −1, 𝑣 = −𝑥, hence ∫ −𝐼𝑛𝑥 𝑑𝑥 = −𝑥𝐼𝑛𝑥 + ∫ 𝑥. 𝑥 𝑑𝑥

∫ −𝐼𝑛𝑥 𝑑𝑥 = −𝑥𝐼𝑛𝑥 + ∫ 𝑑𝑥

3
3
∫ −𝐼𝑛𝑥 𝑑𝑥 = [−𝑥𝐼𝑛𝑥 + 𝑥]
2 2

= (−3𝐼𝑛3 + 3) − (−2𝐼𝑛2 + 2)
= −3𝐼𝑛3 + 3 + 2𝐼𝑛2 − 2

© GUNGIRA L 2020: The Specialist 0773219992


= −0.909542504
Area = 0.9095 (4 𝑑. 𝑝. )
(ii) 𝐸𝑟𝑟𝑜𝑟 = 0.9095 − 0.9061 = 0.0034
0.0034
Therefore the percentage error is 0.9095 × 100 = 0.373831775 × 100 ≈ 0.37%

The trapezium rule gives an underestimate of the area since the trapezia cuts off part the area as shown on
the diagram.∎
Example
𝜋
(a) By sketching the graphs of 𝑦 = 𝑡𝑎𝑛𝑥 and 𝑦 = 4𝑥 on a single diagram for 0 ≤ 𝑥 ≤ 2 , show that the
equation 𝑡𝑎𝑛𝑥 = 4𝑥 has exactly one positive root.
(b) Show , by calculation , that the root of the equation lies between 1 and 1.5.
(c) Show that the Newton-Raphson structure can be written in the form

𝑥𝑛 𝑡𝑎𝑛2 𝑥𝑛 − 𝑡𝑎𝑛𝑥𝑛 + 𝑥𝑛
𝑡𝑎𝑛2 𝑥𝑛 − 3
(d) Use the structure in (𝑐) once starting with 𝑥1 = 1.4, to estimate the root correct to 4 decimal
places.[ZIMSEC]
Suggested Solution
(a)

From the graph there is only one intersection point hence the equation tan 𝑥 = 4𝑥 only one root 𝛽
(b) From the equation 𝑡𝑎𝑛𝑥 = 4𝑥, then 𝑓(𝑥) = 𝑡𝑎𝑛𝑥 − 4𝑥

© GUNGIRA L 2020: The Specialist 0773219992


𝑓(1) = 𝑡𝑎𝑛1 − 4 = −2.442592275
𝑓(1.5) = 𝑡𝑎𝑛1.5 − 4(1.5) = 8.101419947
Since there is a sign change between 𝑓(1) and 𝑓(1.5) or that 𝑓(1). 𝑓(1.5) < 0 then there is a root
between 1 and 1.5.
(c) 𝑓(𝑥) = 𝑡𝑎𝑛𝑥 − 4𝑥
𝑓 ′ (𝑥) = 𝑠𝑒𝑐 2 𝑥 − 4 = 𝑡𝑎𝑛2 𝑥 + 1 − 4 = 𝑡𝑎𝑛2 𝑥 − 3, using the identity 𝑡𝑎𝑛2 𝑥 + 1 = 𝑠𝑒𝑐 2 𝑥
Therefore
𝑡𝑎𝑛𝑥𝑛 − 4𝑥𝑛
𝑥𝑛+1 = 𝑥𝑛 − [ ]
𝑡𝑎𝑛2 𝑥𝑛 − 3
𝑥𝑛 (𝑡𝑎𝑛2 𝑥𝑛 − 3) − 𝑡𝑎𝑛𝑥𝑛 + 4𝑥𝑛
=
𝑡𝑎𝑛2 𝑥𝑛 − 3
𝑥𝑛 𝑡𝑎𝑛2 𝑥𝑛 − 3𝑥𝑛 − 𝑡𝑎𝑛𝑥𝑛 + 4𝑥𝑛
=
𝑡𝑎𝑛2 𝑥𝑛 − 3
𝑥𝑛 𝑡𝑎𝑛2 𝑥𝑛 − 𝑡𝑎𝑛𝑥𝑛 + 𝑥𝑛
= ∎
𝑡𝑎𝑛2 𝑥𝑛 − 3
(d) 𝑥1 = 1.4

1.4𝑡𝑎𝑛2 1.4 − 𝑡𝑎𝑛1.4 + 1.4


𝑥2 =
𝑡𝑎𝑛2 1.4 − 3
= 1.393536477 = 1.3935 (4 𝑑. 𝑝. )∎
Example
𝜋
Use the trapezium rule with 2 intervals to estimate the value of ∫02 √(1 + 𝑠𝑖𝑛𝑥) 𝑑𝑥 giving your answer to
3 significant figures. Given that the exact value of this integral is 2, calculate the relative error in your
trapezium rule approximation. [C]
Suggested Solution

Let 𝑦 = √(1 + 𝑠𝑖𝑛𝑥)


𝜋
−0 𝜋 𝜋 𝜋
2
With 2 intervals then we have 3 ordinates with ℎ = = and so 𝑥1 = 0, 𝑥2 = and 𝑥3 =
2 4 4 2

𝑦1 = √(1 + 𝑠𝑖𝑛0) = 1

𝜋
𝑦2 = √(1 + 𝑠𝑖𝑛 ) = 1.306562965
4

© GUNGIRA L 2020: The Specialist 0773219992


𝜋
𝑦3 = √(1 + sin ) = 1.414213562
2
𝜋 1
𝐴𝑟𝑒𝑎 = . (1 + √2 + 2(1.306562965)) = 1.974231602 = 1.97 (3 𝑠. 𝑓. )
4 2
0.03
If the exact value is 2, then the error = 2 − 1.97 = 0.03. The relative error is 2
× 100 = 1.5%∎

Example
The tangent at the point 𝑃(𝑥𝑛 ; 𝑥𝑛2 − 2) to the curve 𝑦 = 𝑥 2 − 2 meets the 𝑥 − 𝑎𝑥𝑖𝑠 at point 𝑄(𝑥𝑛+1 ; 0).
If 𝑥𝑛 > 0, show that

𝑥𝑛2 + 2
𝑥𝑛+1
2𝑥𝑛
Starting with 𝑥1 = 2, use this iterative formula to find successive approximations 𝑥2 , 𝑥3 for the positive
root of the equation 𝑥 2 − 2 = 0.
Hence show that
577
𝑥4 =
408
577
Find the error, to 1 significant figure, in using as an approximation to √2.
408
Suggested Solution
𝑑𝑦
The gradient of the tangent at 𝑃 is = 2𝑥 = 2𝑥𝑛 , since 𝑃(𝑥𝑛 ; 𝑥𝑛2 − 2). The equation of tangent 𝑃𝑄 is:
𝑑𝑥

𝑥𝑛2 − 2 − 0 = 2𝑥𝑛 (𝑥𝑛 − 𝑥𝑛+1 )

𝑥𝑛2 − 2 = 2𝑥𝑛2 − 2𝑥𝑛 𝑥𝑛+1

2𝑥𝑛 𝑥𝑛+1 = 2𝑥𝑛2 − 𝑥𝑛2 + 2


𝑥𝑛2 + 2
𝑥𝑛+1 = (𝑆ℎ𝑜𝑤𝑛)∎
2𝑥𝑛
𝑥1 = 2
22 + 2 6 3
𝑥2 = = =
2(2) 4 2

3 2
(2) + 2 17
𝑥3 = =
3 12
2 (2)

© GUNGIRA L 2020: The Specialist 0773219992


17 2
(12) + 2 577 6 577 1 577
𝑥4 = = × = × = (𝑆ℎ𝑜𝑤𝑛)∎
17 144 17 24 17 408
2 (12)

577
𝐸𝑟𝑟𝑜𝑟 = − √2 = 0.000002123 = 0.000002 (1 𝑠. 𝑓. )∎
408

© GUNGIRA L 2020: The Specialist 0773219992

You might also like