Errors and Flow Chart Notes
Errors and Flow Chart Notes
Errors and Flow Chart Notes
ERRORS
Binary operations of rounding errors using propagation
Absolute Error in addition/sum (x+y)
If 𝑥 is a positive number rounded off to 𝑋 creating an error 𝑒𝑥 ; and if 𝑦 is a
positive number rounded off to 𝑌 creating an error 𝑒𝑦 ; the error in the
sum (𝑥 + 𝑦) can be got as follows.
Note: In this case, exact values are 𝑥, 𝑦 and approximate values are 𝑋, 𝑌
respectively.
Method 1:
Let 𝑧 = 𝑥 + 𝑦 where 𝑥 and 𝑦 are rounded off with errors 𝑒𝑥 𝑎𝑛𝑑 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦 , 𝑧 = 𝑍 + 𝑒, 𝑍 =𝑋+𝑌
𝑍 + 𝑒 = 𝑋 + 𝑒𝑥 + 𝑌 + 𝑒𝑦
𝑍 + 𝑒 = 𝑋 + 𝑌 + 𝑒𝑥 + 𝑒𝑦
𝑒 = 𝑒𝑥 + 𝑒𝑦
|𝑒| = |𝑒𝑥 + 𝑒𝑦 |
|𝑒| ≤ |𝑒𝑥 | + |𝑒𝑦 |
maximum absolute error in sum = |𝑒𝑥 | + |𝑒𝑦 |
Method 2:
Let 𝑋 𝑎𝑛𝑑 𝑌 be the approximations to 𝑥 𝑎𝑛𝑑 𝑦, with errors 𝑒𝑥 𝑎𝑛𝑑 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦
⟹ 𝑋 = 𝑥 − 𝑒𝑥 , 𝑌 = 𝑦 − 𝑒𝑦
{(𝑥 + 𝑒𝑥 ) + (𝑦 + 𝑒𝑦 )} − {(𝑥 − 𝑒𝑥 ) + (𝑦 − 𝑒𝑦 )}
=
2
(𝑥 + 𝑦) + (𝑒𝑥 + 𝑒𝑦 ) − {(𝑥 + 𝑦) − (𝑒𝑥 + 𝑒𝑦 )}
=
2
2(𝑒𝑥 + 𝑒𝑦 )
=
2
𝑒 = 𝑒𝑥 + 𝑒𝑦
|𝑒| = |𝑒𝑥 + 𝑒𝑦 |
|𝑒| ≤ |𝑒𝑥 | + |𝑒𝑦 |
maximum absolute error in sum = |𝑒𝑥 | + |𝑒𝑦 |
In summary:
(i). The maximum possible error in the addition (𝑥 + 𝑦) is = |𝑒𝑥 | + |𝑒𝑦 |.
(ii). The maximum relative error in the addition (𝑥 + 𝑦) is
|𝑒𝑥 | + |𝑒𝑦 | |𝑒𝑥 | + |𝑒𝑦 |
= , or, =
𝑥+𝑦 𝑋+𝑌
(iii). The maximum percentage error in the addition (𝑥 + 𝑦) is
|𝑒𝑥 | + |𝑒𝑦 | |𝑒𝑥 | + |𝑒𝑦 |
= × 100% , or, = × 100%
𝑥+𝑦 𝑋+𝑌
Absolute Error in subtraction/difference (x-y)
If 𝑥 is a positive number rounded off to 𝑋 creating an error 𝑒𝑥 ; and if 𝑦 is a
positive number rounded off to 𝑌 creating an error 𝑒𝑦 ; the error in the
difference (𝑥 − 𝑦) can be got as follows.
Method 1:
Let 𝑧 = 𝑥 − 𝑦 where 𝑥 and 𝑦 are rounded off with errors 𝑒𝑥 𝑎𝑛𝑑 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦 , 𝑧 = 𝑍 + 𝑒, 𝑍 =𝑋−𝑌
𝑍 + 𝑒 = (𝑋 + 𝑒𝑥 ) − (𝑌 + 𝑒𝑦 )
𝑍 + 𝑒 = 𝑋 − 𝑌 + 𝑒𝑥 + 𝑒𝑦
𝑒 = 𝑒𝑥 − 𝑒𝑦
|𝑒| = |𝑒𝑥 − 𝑒𝑦 |
|𝑒| ≤ |𝑒𝑥 | + |−𝑒𝑦 |
|𝑒| ≤ |𝑒𝑥 | + |𝑒𝑦 |
maximum absolute error in subtraction = |𝑒𝑥 | + |𝑒𝑦 |
Method 2:
Let 𝑋 𝑎𝑛𝑑 𝑌 be the approximations to 𝑥 𝑎𝑛𝑑 𝑦, with errors 𝑒𝑥 𝑎𝑛𝑑 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦
⟹ 𝑋 = 𝑥 − 𝑒𝑥 , 𝑌 = 𝑦 − 𝑒𝑦
exact = (𝑥 − 𝑦), approximate = (𝑋 − 𝑌)
akasunabu@gmail.com, greenhill acdemy mathematics Department. 2020. Page 2
MASTERING A-LEVEL MATHEMATICS PAPER 2
error, 𝑒 = (𝑥 − 𝑦) − (𝑋 − 𝑌)
= (𝑥 − 𝑦) − {(𝑥 − 𝑒𝑥 ) − (𝑦 − 𝑒𝑦 )}
= (𝑥 − 𝑦) − {(𝑥 − 𝑦) − (𝑒𝑥 − 𝑒𝑦 )}
𝑒 = 𝑒𝑥 − 𝑒𝑦
|𝑒| = |𝑒𝑥 − 𝑒𝑦 |
|𝑒| ≤ |𝑒𝑥 | + |−𝑒𝑦 |
|𝑒| ≤ |𝑒𝑥 | + |𝑒𝑦 |
maximum absolute error in subtraction = |𝑒𝑥 | + |𝑒𝑦 |
Method 3:
Let 𝑧 = 𝑥 − 𝑦 where 𝑥 𝑎𝑛𝑑 𝑦 are rounded off with errors 𝑒𝑥 𝑎𝑛𝑑 𝑒𝑦
respectively.
𝑧𝑚𝑎𝑥 = 𝑥𝑚𝑎𝑥 − 𝑦𝑚𝑖𝑛 , 𝑧𝑚𝑖𝑛 = 𝑥𝑚𝑖𝑛 − 𝑦𝑚𝑎𝑥
𝑧𝑚𝑎𝑥 − 𝑧𝑚𝑖𝑛
𝑒𝑟𝑟𝑜𝑟, 𝑒=
2
{ + 𝑒𝑥 − (𝑦 − 𝑒𝑦 )} − { − 𝑒𝑥 ) − (𝑦 + 𝑒𝑦 )}
(𝑥 ) (𝑥
=
2
(𝑥 − 𝑦) + (𝑒𝑥 + 𝑒𝑦 ) − {(𝑥 − 𝑦) − (𝑒𝑥 + 𝑒𝑦 )}
=
2
2(𝑒𝑥 + 𝑒𝑦 )
=
2
𝑒 = 𝑒𝑥 + 𝑒𝑦
|𝑒| = |𝑒𝑥 + 𝑒𝑦 |
|𝑒| ≤ |𝑒𝑥 | + |𝑒𝑦 |
maximum absolute error in subtraction = |𝑒𝑥 | + |𝑒𝑦 |
In summary:
(i). The maximum possible error in the subtraction (𝑥 − 𝑦) is = |𝑒𝑥 | +
|𝑒𝑦 |.
(ii). The maximum relative error in the subtraction (𝑥 − 𝑦) is
|𝑒𝑥 | + |𝑒𝑦 | |𝑒𝑥 | + |𝑒𝑦 |
= , or, =
𝑥−𝑦 𝑋−𝑌
(iii). The maximum percentage error in the subtraction (𝑥 − 𝑦) is
|𝑒𝑥 | + |𝑒𝑦 | |𝑒𝑥 | + |𝑒𝑦 |
= × 100% , or, = × 100%
𝑥−𝑦 𝑋−𝑌
Relative Error in multiplication/product (xy)
If 𝑥 is a positive number rounded off to 𝑋 creating an error 𝑒𝑥 ; and if 𝑦 is a
positive number rounded off to 𝑌 creating an error 𝑒𝑦 ; the relative error
in the product (𝑥𝑦) can be got depending on the format of the question
asked.
𝑒 𝑒𝑥 𝑒𝑦
= +
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| |=| + |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| |≤| |+| |
𝑧 𝑥 𝑦
𝑒𝑥 𝑒𝑦
maximum relative error in product = | | + | |
𝑥 𝑦
Method 3:
Let 𝑧 = 𝑥𝑦 where 𝑥 𝑎𝑛𝑑 𝑦 are rounded off with errors 𝑒𝑥 𝑎𝑛𝑑 𝑒𝑦
respectively.
𝑧𝑚𝑎𝑥 = 𝑥𝑚𝑎𝑥 𝑦𝑚𝑎𝑥 , 𝑧𝑚𝑖𝑛 = 𝑥𝑚𝑖𝑛 𝑦𝑚𝑖𝑛
𝑧𝑚𝑎𝑥 − 𝑧𝑚𝑖𝑛
error, 𝑒=
2
{(𝑥 + 𝑒𝑥 )(𝑦 + 𝑒𝑦 )} − {(𝑥 − 𝑒𝑥 )(𝑦 − 𝑒𝑦 )}
=
2
{𝑥𝑦 + 𝑥𝑒𝑦 + 𝑦𝑒𝑥 + 𝑒𝑥 𝑒𝑦 } − {𝑥𝑦 − 𝑥𝑒𝑦 − 𝑦𝑒𝑥 + 𝑒𝑥 𝑒𝑦 }
=
2
2(𝑥𝑒𝑦 + 𝑦𝑒𝑥 )
=
2
∴ 𝑒 = 𝑦𝑒𝑥 + 𝑥𝑒𝑦
𝑒 𝑦𝑒𝑥 𝑥𝑒𝑦
= +
𝑧 𝑥𝑦 𝑥𝑦
𝑒 𝑒𝑥 𝑒𝑦
= +
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| |=| + |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| |≤| |+| |
𝑧 𝑥 𝑦
𝑒𝑥 𝑒𝑦
maximum relative error in product = | | + | |
𝑥 𝑦
Note that in this case where the question asked requires one to get
Absolute error
relative error using the formula of: Relative error = ; the
Exact value
approximate values must be eliminated such that only the exact values
and the errors of the approximate values remain.
exact values must be eliminated such that only the approximate values
together with their corresponding errors remain. Note also that Method 3
can’t work in this case since that method involves using the exact values
yet they have to be eliminated.
In summary:
(i). The maximum possible error in the product (𝑥𝑦) is
= 𝑦|𝑒𝑥 | + 𝑥|𝑒𝑦 | , or, = 𝑌|𝑒𝑥 | + 𝑌|𝑒𝑦 |
(ii). The maximum relative error in the product (𝑥𝑦)is
𝑒𝑥 𝑒𝑦 𝑒𝑥 𝑒𝑦
= | |+| | , or, =| |+| |
𝑥 𝑦 𝑋 𝑌
(iii). The maximum percentage error in the product (𝑥𝑦) is
𝑒𝑥 𝑒𝑦 𝑒𝑥 𝑒𝑦
= {| | + | |} × 100% , or, = {| | + | |} × 100%
𝑥 𝑦 𝑋 𝑌
Relative Error in multiplication/product (x y) 2
𝑒 2𝑒𝑥 𝑒𝑦
| |=| + |
𝑧 𝑥 𝑦
𝑒 2𝑒𝑥 𝑒𝑦
| |≤| |+| |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ 2| | + | |
𝑧 𝑥 𝑦
𝑒𝑥 𝑒𝑦
maximum relative error = 2 | | + | |
𝑥 𝑦
Method 2:
Let 𝑋 and 𝑌 be the approximations to 𝑥 and 𝑦, with errors 𝑒𝑥 and 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦
⟹ 𝑋 = 𝑥 − 𝑒𝑥 , 𝑌 = 𝑦 − 𝑒𝑦
exact, 𝑧 = (𝑥 2 𝑦), approximate, 𝑍 = (𝑋 2 𝑌)
error, 𝑒 = (𝑥 2 𝑦) − (𝑋 2 𝑌)
= (𝑥 2 𝑦) − {(𝑥 − 𝑒𝑥 )2 (𝑦 − 𝑒𝑦 )}
= (𝑥 2 𝑦) − {(𝑥 2 − 2𝑥𝑒𝑥 + 𝑒𝑥 2 )(𝑦 − 𝑒𝑦 )}
= (𝑥 2 𝑦) − {𝑦𝑥 2 − 2𝑥𝑦𝑒𝑥 + 𝑦𝑒𝑥 2 − 𝑥 2 𝑒𝑦 + 2𝑥𝑒𝑥 𝑒𝑦 − 𝑒𝑥 2 𝑒𝑦 }
= 2𝑥𝑦𝑒𝑥 − 𝑦𝑒𝑥 2 + 𝑥 2 𝑒𝑦 − 2𝑥𝑒𝑥 𝑒𝑦 + 𝑒𝑥 2 𝑒𝑦
suppose 𝑒𝑥 ≪ 𝑥 and 𝑒𝑦 ≪ 𝑦, ⟹ 𝑒𝑥 𝑒𝑦 ≈ 0, 𝑒𝑥 2 ≈ 0, and,
𝑒𝑥 2 𝑒𝑦 ≈ 0
𝑒 = 2𝑥𝑦𝑒𝑥 + 𝑥 2 𝑒𝑦
𝑒 2𝑥𝑦𝑒𝑥 𝑥 2 𝑒𝑦
= 2 + 2
𝑧 𝑥 𝑦 𝑥 𝑦
𝑒 2𝑒𝑥 𝑒𝑦
= +
𝑧 𝑥 𝑦
𝑒 2𝑒𝑥 𝑒𝑦
| |=| + |
𝑧 𝑥 𝑦
𝑒 2𝑒𝑥 𝑒𝑦
| |≤| |+| |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ 2| | + | |
𝑧 𝑥 𝑦
𝑒𝑥 𝑒𝑦
maximum relative error = 2 | | + | |
𝑥 𝑦
Note that in this case where the question asked requires one to get
Absolute error
relative error using the formula of: Relative error = ; the
Exact value
approximate values must be eliminated such that only the exact values
and the errors of the approximate values remain.
∴ 𝑒 = 2𝑋𝑌𝑒𝑥 + 𝑋 2 𝑒𝑦
𝑒 2𝑋𝑌𝑒𝑥 𝑋 2 𝑒𝑦
= 2 + 2
𝑧 𝑋 𝑌 𝑋 𝑌
𝑒 2𝑒𝑥 𝑒𝑦
= +
𝑧 𝑋 𝑌
𝑒 2𝑒𝑥 𝑒𝑦
| |=| + |
𝑧 𝑋 𝑌
𝑒 2𝑒𝑥 𝑒𝑦
| |≤| |+| |
𝑧 𝑋 𝑌
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ 2| | + | |
𝑧 𝑋 𝑌
𝑒𝑥 𝑒𝑦
maximum relative error = 2 | | + | |
𝑋 𝑌
Note that in this case where the question asked requires one to get
Absolute error
relative error using the formula of: Relative error = ; the
Approximate value
exact values must be eliminated such that only the approximate values
together with their corresponding errors remain. Note also that Method 3
can’t work in this case since that method involves using the exact values
yet they have to be eliminated.
In summary:
(i). The maximum possible error in the product (𝑥 2 𝑦) is
= 2𝑥𝑦|𝑒𝑥 | + 𝑥 2 |𝑒𝑦 | , or, = 2𝑋𝑌|𝑒𝑥 | + 𝑋 2 |𝑒𝑦 |
(ii). The maximum relative error in the product (𝑥 2 𝑦) is
𝑒𝑥 𝑒𝑦 𝑒𝑥 𝑒𝑦
= 2| |+ | | , or, = 2| | + | |
𝑥 𝑦 𝑋 𝑌
(iii). The maximum percentage error in the product (𝑥 𝑦) is 2
𝑒𝑥 𝑒𝑦 𝑒𝑥 𝑒𝑦
= {2 | | + | |} × 100% , or, = {2 | | + | |} × 100%
𝑥 𝑦 𝑋 𝑌
Likely questions for error in product:
Qn 1: The numbers X and Y were estimated with maximum possible
errors of ∆𝑋 and ∆𝑌 respectively. Show that the percentage relative error
in 𝑋𝑌
∆𝑋 ∆𝑌
[ + ] × 100%
𝑋 𝑌
Qn 2: Two numbers X and Y are rounded to 𝑥 𝑎𝑛𝑑 𝑦 with errors 𝑒1 𝑎𝑛𝑑 𝑒2
respectively. Show that the maximum relative error made in the
approximating 𝑋 2 𝑌 by 𝑥 2 𝑦 is
𝑒1 𝑒2
2 | | + | |.
𝑥 𝑦
Qn 3: Two decimal numbers 𝑥 𝑎𝑛𝑑 𝑦 are recorded off to give 𝑋 and 𝑌
with the errors 𝐸1 𝑎𝑛𝑑 𝐸2 respectively. Show that the maximum relative
error recorded in approximating 𝑥 2 𝑦 𝑏𝑦 𝑋 2 𝑌 is given by:
𝐸1 𝐸2
2| |+| |
𝑋 𝑌
Relative Error in division/quotient (x/y)
If 𝑥 is a positive number rounded off to 𝑋 creating an error 𝑒𝑥 ; and if 𝑦 is a
positive number rounded off to 𝑌 creating an error 𝑒𝑦 ; the error in the
product (𝑥 ⁄𝑦) can be got depending on the format of the question asked.
Case 1: If the question asked is interpreted and requires one to get
Absolute error
relative error using the formula of: Relative error = ; such a
Exact value
question can be answered using any of the two methods below.
Method 1:
𝑥
Let 𝑧 = where 𝑥 𝑎𝑛𝑑 𝑦 are rounded off with errors 𝑒𝑥 and 𝑒𝑦
𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦 , 𝑧 =𝑍+𝑒
⟹ 𝑋 = 𝑥 − 𝑒𝑥 , 𝑌 = 𝑦 − 𝑒𝑦 , 𝑍 =𝑧−𝑒
𝑋
𝑍=
𝑌
𝑥 − 𝑒𝑥
𝑧−𝑒 =
𝑦 − 𝑒𝑦
(𝑥 − 𝑒𝑥 ) × (𝑦 + 𝑒𝑦 )
𝑧−𝑒 =
(𝑦 − 𝑒𝑦 ) × (𝑦 + 𝑒𝑦 )
𝑥𝑦 − 𝑥𝑒𝑦 + 𝑦𝑒𝑥 − 𝑒𝑥 𝑒𝑦
𝑧−𝑒 =
𝑦 2 − 𝑒𝑦 2
suppose 𝑒𝑥 ≪ 𝑥 and 𝑒𝑦 ≪ 𝑦, ⟹ 𝑒𝑥 𝑒𝑦 ≈ 0, 𝑒𝑦 2 ≈ 0
𝑥𝑦 − 𝑥𝑒𝑦 + 𝑦𝑒𝑥
𝑧−𝑒 =
𝑦2
𝑥𝑦 𝑥𝑒𝑦 𝑦𝑒𝑥
𝑧−𝑒 = 2 − 2 + 2
𝑦 𝑦 𝑦
𝑥 𝑥𝑒𝑦 𝑒𝑥
𝑍+𝑒 = − 2 +
𝑦 𝑦 𝑦
𝑒𝑥 𝑥𝑒𝑦
𝑒= − 2
𝑦 𝑦
𝑒 𝑒𝑥 𝑥𝑒𝑦 𝑥
= ( − 2 )⁄( )
𝑧 𝑦 𝑦 𝑦
𝑒 𝑒𝑥 𝑥𝑒𝑦 𝑦
= ( − 2 )( )
𝑧 𝑦 𝑦 𝑥
𝑒 𝑒𝑥 𝑒𝑦
= −
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| |=| − |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ | | + |− |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| |≤| |+| |
𝑧 𝑥 𝑦
𝑒𝑥 𝑒𝑦
maximum relative error = | | + | |
𝑥 𝑦
Method 2:
Let 𝑋 and 𝑌 be the approximations to 𝑥 and 𝑦, with errors 𝑒𝑥 𝑎𝑛𝑑 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦
⟹ 𝑋 = 𝑥 − 𝑒𝑥 , 𝑌 = 𝑦 − 𝑒𝑦
𝑥 𝑋
exact = , approximate =
𝑦 𝑌
𝑥 𝑋 𝑥 𝑥 − 𝑒𝑥
error, 𝑒 = − = −{ }
𝑦 𝑌 𝑦 𝑦 − 𝑒𝑦
𝑥 (𝑥 − 𝑒𝑥 ) × (𝑦 + 𝑒𝑦 ) 𝑥 𝑥𝑦 + 𝑥𝑒𝑦 − 𝑦𝑒𝑥 − 𝑒𝑥 𝑒𝑦
= −{ }= −
𝑦 (𝑦 − 𝑒𝑦 ) × (𝑦 + 𝑒𝑦 ) 𝑦 𝑦 2 − 𝑒𝑦 2
suppose 𝑒𝑥 ≪ 𝑥 and 𝑒𝑦 ≪ 𝑦, ⟹ 𝑒𝑥 𝑒𝑦 ≈ 0, 𝑒𝑦 2 ≈ 0
𝑥 𝑥𝑦 − 𝑥𝑒𝑦 + 𝑦𝑒𝑥
∴𝑒= −
𝑦 𝑦2
𝑥 𝑥𝑦 𝑥𝑒𝑦 𝑦𝑒𝑥
= − 2+ 2 − 2
𝑦 𝑦 𝑦 𝑦
𝑥𝑒𝑦 𝑒𝑥
𝑒= 2 −
𝑦 𝑦
𝑒 𝑥𝑒𝑦 𝑒𝑥 𝑥
= ( 2 − )⁄( )
𝑧 𝑦 𝑦 𝑦
𝑒 𝑥𝑒𝑦 𝑒𝑥 𝑦
= ( 2 − )( )
𝑧 𝑦 𝑦 𝑥
𝑒 𝑒𝑦 𝑒𝑥
= −
𝑧 𝑦 𝑥
𝑒 𝑒𝑥 𝑒𝑦
| | = |− + |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ |− | + | |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| |≤| |+| |
𝑧 𝑥 𝑦
𝑒𝑥 𝑒𝑦
maximum relative error = | | + | |
𝑥 𝑦
Note that in this case where the question asked requires one to get
Absolute error
relative error using the formula of: Relative error = ; the
Exact value
approximate values must be eliminated such that only the exact values
and the errors of the approximate values remain.
Method 2:
Let 𝑋 and 𝑌 be the approximations to 𝑥 and 𝑦, with errors 𝑒𝑥 and 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦
𝑥 𝑋
exact, 𝑧 = , approximate, 𝑍 =
𝑦 𝑌
𝑥 𝑋
error, 𝑒= −
𝑦 𝑌
𝑋 + 𝑒𝑥 𝑋
={ }−
𝑌 + 𝑒𝑦 𝑌
(𝑋 + 𝑒𝑥 ) × (𝑌 − 𝑒𝑦 ) 𝑋
={ }−
(𝑌 + 𝑒𝑦 ) × (𝑌 − 𝑒𝑦 ) 𝑌
𝑋𝑌 − 𝑋𝑒𝑦 + 𝑌𝑒𝑥 − 𝑒𝑥 𝑒𝑦 𝑋
= −
𝑌 2 − 𝑒𝑦 2 𝑌
suppose 𝑒𝑥 ≪ 𝑋 and 𝑒𝑦 ≪ 𝑌, ⟹ 𝑒𝑥 𝑒𝑦 ≈ 0, 𝑒𝑦 2 ≈ 0
𝑋𝑌 − 𝑋𝑒𝑦 + 𝑌𝑒𝑥 𝑋
𝑒= −
𝑌2 𝑌
𝑋𝑌 𝑋𝑒𝑦 𝑌𝑒𝑥 𝑋
= 2− 2 + 2 −
𝑌 𝑌 𝑌 𝑌
𝑋 𝑋𝑒𝑦 𝑒𝑥 𝑋
= − 2 + −
𝑌 𝑌 𝑌 𝑌
𝑒𝑥 𝑋𝑒𝑦
∴𝑒= − 2
𝑌 𝑌
𝑒 𝑒𝑥 𝑋𝑒𝑦 𝑋
= ( − 2 )⁄( )
𝑍 𝑌 𝑌 𝑌
𝑒 𝑒𝑥 𝑋𝑒𝑦 𝑌
= ( − 2 )( )
𝑍 𝑌 𝑌 𝑋
𝑒 𝑒𝑥 𝑒𝑦
= −
𝑧 𝑋 𝑌
𝑒 𝑒𝑥 𝑒𝑦
| |=| − |
𝑍 𝑋 𝑌
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ | | + |− |
𝑍 𝑋 𝑌
𝑒 𝑒𝑥 𝑒𝑦
| |≤| |+| |
𝑍 𝑋 𝑌
𝑒𝑥 𝑒𝑦
maximum relative error = | | + | |
𝑋 𝑌
Note that in this case where the question asked requires one to get
Absolute error
relative error using the formula of: Relative error = ; the
Approximate value
exact values must be eliminated such that only the approximate values
together with their corresponding errors remain. Note also that Method 3
can’t work in this case since that method involves using the exact values
yet they have to be eliminated.
In summary:
(i). The maximum possible error in the quotient (𝑥 ⁄𝑦) is
|𝑒𝑥 | 𝑥|𝑒𝑦 | |𝑒𝑥 | 𝑋|𝑒𝑦 |
= + 2 , or, = + 2
𝑦 𝑦 𝑌 𝑌
𝑒𝑥 𝑋𝑒𝑦
− 2
𝑌 𝑌
(ii). The maximum relative error in the quotient (𝑥 ⁄𝑦) is
𝑒𝑥 𝑒𝑦 𝑒𝑥 𝑒𝑦
= | |+| | , or, =| |+| |
𝑥 𝑦 𝑋 𝑌
(iii). The maximum percentage error in the quotient (𝑥 ⁄𝑦) is
𝑒𝑥 𝑒𝑦 𝑒𝑥 𝑒𝑦
= {| | + | |} × 100% , or, = {| | + | |} × 100%
𝑥 𝑦 𝑋 𝑌
Error in division/quotient (x /y) 2
𝑦𝑥 2 2𝑥𝑦𝑒𝑥 𝑥 2 𝑒𝑦
𝑧−𝑒 = 2 − + 2
𝑦 𝑦2 𝑦
2 2
𝑥 2𝑥𝑒𝑥 𝑥 𝑒𝑦
𝑧−𝑒 = − + 2
𝑦 𝑦 𝑦
2
2𝑥𝑒𝑥 𝑥 𝑒𝑦
−𝑒 = − + 2
𝑦 𝑦
2
2𝑥𝑒𝑥 𝑥 𝑒𝑦
𝑒= − 2
𝑦 𝑦
2
𝑒 2𝑥𝑒𝑥 𝑥 𝑒𝑦 𝑥2
=( − 2 )⁄( )
𝑧 𝑦 𝑦 𝑦
2
𝑒 2𝑥𝑒𝑥 𝑥 𝑒𝑦 𝑦
=( − 2 ) ( 2)
𝑧 𝑦 𝑦 𝑥
𝑒 2𝑒𝑥 𝑒𝑦
= −
𝑧 𝑥 𝑦
𝑒 2𝑒𝑥 𝑒𝑦
| |=| − |
𝑧 𝑥 𝑦
𝑒 2𝑒𝑥 𝑒𝑦
| |≤| | + |− |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ 2| | + | |
𝑧 𝑥 𝑦
𝑒𝑥 𝑒𝑦
maximum relative error = 2 | | + | |
𝑥 𝑦
Method 2:
Let 𝑋 and 𝑌 be the approximations to 𝑥 and 𝑦, with errors 𝑒𝑥 and 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦
⟹ 𝑋 = 𝑥 − 𝑒𝑥 , 𝑌 = 𝑦 − 𝑒𝑦
2
𝑥 𝑋2
exact, 𝑧 = , approximate, 𝑍 =
𝑦 𝑌
2 2 (𝑥 − 𝑒𝑥 )2
𝑥 𝑋 𝑥
error, 𝑒= − = −{ }
𝑦 𝑌 𝑦 𝑦 − 𝑒𝑦
𝑥 (𝑥 2 − 2𝑥𝑒𝑥 + 𝑒𝑥 2 ) × (𝑦 + 𝑒𝑦 )
= −{ }
𝑦 (𝑦 − 𝑒𝑦 ) × (𝑦 + 𝑒𝑦 )
𝑥 𝑦𝑥 2 − 2𝑥𝑦𝑒𝑥 + 𝑦𝑒𝑥 2 + 𝑥 2 𝑒𝑦 − 2𝑥𝑒𝑥 𝑒𝑦 + 𝑒𝑥 2 𝑒𝑦
= −
𝑦 𝑦 2 − 𝑒𝑦 2
suppose 𝑒𝑥 ≪ 𝑥 and 𝑒𝑦 ≪ 𝑦,
⟹ 𝑒𝑥 𝑒𝑦 ≈ 0, 𝑒𝑥 2 ≈ 0, 𝑒𝑥 2 ≈ 0 and 𝑒𝑥 2 𝑒𝑦 ≈ 0
𝑥 𝑦𝑥 2 − 2𝑥𝑦𝑒𝑥 + 𝑥 2 𝑒𝑦
= −
𝑦 𝑦2
𝑥 𝑦𝑥 2 2𝑥𝑦𝑒𝑥 𝑥 2 𝑒𝑦
= − 2 + − 2
𝑦 𝑦 𝑦2 𝑦
2
2𝑥𝑒𝑥 𝑥 𝑒𝑦
= − 2
𝑦 𝑦
2
𝑒 2𝑥𝑒𝑥 𝑥 𝑒𝑦 𝑥2
=( − 2 )⁄( )
𝑧 𝑦 𝑦 𝑦
2
𝑒 2𝑥𝑒𝑥 𝑥 𝑒𝑦 𝑦
=( − 2 ) ( 2)
𝑧 𝑦 𝑦 𝑥
𝑒 2𝑒𝑥 𝑒𝑦
= −
𝑧 𝑥 𝑦
𝑒 2𝑒𝑥 𝑒𝑦
| |=| − |
𝑧 𝑥 𝑦
𝑒 2𝑒𝑥 𝑒𝑦
| |≤| | + |− |
𝑧 𝑥 𝑦
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ 2| | + | |
𝑧 𝑥 𝑦
𝑒𝑥 𝑒𝑦
maximum relative error = 2 | | + | |
𝑥 𝑦
Note that in this case where the question asked requires one to get
Absolute error
relative error using the formula of: Relative error = ; the
Exact value
approximate values must be eliminated such that only the exact values
and the errors of the approximate values remain.
(𝑋 2 + 2𝑋𝑒𝑥 + 𝑒𝑥 2 ) × (𝑌 − 𝑒𝑦 )
𝑍+𝑒=
(𝑌 + 𝑒𝑦 ) × (𝑌 − 𝑒𝑦 )
𝑌𝑋 + 2𝑋𝑌𝑒𝑥 + 𝑌𝑒𝑥 2 − 𝑋 2 𝑒𝑦 − 2𝑋𝑒𝑥 𝑒𝑦 − 𝑒𝑥 2 𝑒𝑦
2
𝑍+𝑒=
𝑌 2 − 𝑒𝑦 2
suppose 𝑒𝑥 ≪ 𝑋 and 𝑒𝑦 ≪ 𝑌,
⟹ 𝑒𝑥 𝑒𝑦 ≈ 0, 𝑒𝑥 2 ≈ 0, 𝑒𝑥 2 ≈ 0 and 𝑒𝑥 2 𝑒𝑦 ≈ 0
𝑌𝑋 2 + 2𝑋𝑌𝑒𝑥 − 𝑋 2 𝑒𝑦
𝑍+𝑒 =
𝑌2
𝑌𝑋 2
2𝑋𝑌𝑒𝑥 𝑋 2 𝑒𝑦
𝑧−𝑒 = 2 + − 2
𝑌 𝑌2 𝑌
2 2
𝑋 2𝑋𝑒𝑥 𝑋 𝑒𝑦
𝑧−𝑒 = − + 2
𝑌 𝑌 𝑌
2𝑋𝑒𝑥 𝑋 2 𝑒𝑦
−𝑒 = − + 2
𝑌 𝑌
2
2𝑋𝑒𝑥 𝑋 𝑒𝑦
𝑒= − 2
𝑌 𝑌
𝑒 2𝑋𝑒𝑥 𝑋 2 𝑒𝑦 𝑋2
=( − 2 )⁄( )
𝑍 𝑌 𝑌 𝑌
2
𝑒 2𝑋𝑒𝑥 𝑋 𝑒𝑦 𝑌
=( − 2 ) ( 2)
𝑍 𝑌 𝑌 𝑋
𝑒 2𝑒𝑥 𝑒𝑦
= −
𝑍 𝑋 𝑌
𝑒 2𝑒𝑥 𝑒𝑦
| |=| − |
𝑍 𝑋 𝑌
𝑒 2𝑒𝑥 𝑒𝑦
| |≤| | + |− |
𝑍 𝑋 𝑌
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ 2| | + | |
𝑍 𝑋 𝑌
𝑒𝑥 𝑒𝑦
maximum relative error = 2 | | + | |
𝑋 𝑌
Method 2:
Let 𝑋 and 𝑌 be the approximations to 𝑥 and 𝑦, with errors 𝑒𝑥 and 𝑒𝑦
respectively.
𝑥 = 𝑋 + 𝑒𝑥 , 𝑦 = 𝑌 + 𝑒𝑦
𝑥2 𝑋2
exact, 𝑧 = , approximate, 𝑍 =
𝑦 𝑌
2 2 2
𝑥 𝑋 (𝑋 + 𝑒𝑥 ) 𝑋2
error, 𝑒= − ={ }−
𝑦 𝑌 𝑌 + 𝑒𝑦 𝑌
(𝑋 2 + 2𝑋𝑒𝑥 + 𝑒𝑥 2 ) × (𝑌 − 𝑒𝑦 ) 𝑋2
={ }−
(𝑌 + 𝑒𝑦 ) × (𝑌 − 𝑒𝑦 ) 𝑌
𝑌𝑋 2 + 2𝑋𝑌𝑒𝑥 + 𝑌𝑒𝑥 2 − 𝑋 2 𝑒𝑦 − 2𝑋𝑒𝑥 𝑒𝑦 − 𝑒𝑥 2 𝑒𝑦 𝑋 2
= −
𝑌 2 − 𝑒𝑦 2 𝑌
suppose 𝑒𝑥 ≪ 𝑋 and 𝑒𝑦 ≪ 𝑌, ⟹ 𝑒𝑥 𝑒𝑦 ≈ 𝑒𝑥 ≈ 𝑒𝑥 ≈ 0 and 𝑒𝑥 2 𝑒𝑦 ≈ 0
2 2
𝑌𝑋 2 + 2𝑋𝑌𝑒𝑥 − 𝑋 2 𝑒𝑦 𝑋 2
∴𝑒= −
𝑌2 𝑌
2 2
𝑌𝑋 2𝑋𝑌𝑒𝑥 𝑋 𝑒𝑦 𝑋 2
𝑒= 2 + − 2 −
𝑌 𝑌2 𝑌 𝑌
2𝑋𝑌𝑒𝑥 𝑋 2 𝑒𝑦
𝑒= − 2
𝑌2 𝑌
2
𝑒 2𝑋𝑒𝑥 𝑋 𝑒𝑦 𝑋2
=( − 2 )⁄( )
𝑍 𝑌 𝑌 𝑌
2
𝑒 2𝑋𝑒𝑥 𝑋 𝑒𝑦 𝑌
=( − 2 ) ( 2)
𝑍 𝑌 𝑌 𝑋
𝑒 2𝑒𝑥 𝑒𝑦
= −
𝑍 𝑋 𝑌
𝑒 2𝑒𝑥 𝑒𝑦
| |=| − |
𝑍 𝑋 𝑌
𝑒 2𝑒𝑥 𝑒𝑦
| |≤| | + |− |
𝑍 𝑋 𝑌
𝑒 𝑒𝑥 𝑒𝑦
| | ≤ 2| | + | |
𝑍 𝑋 𝑌
𝑒𝑥 𝑒𝑦
maximum relative error = 2 | | + | |
𝑋 𝑌
Note that in this case where the question asked requires one to get
Absolute error
relative error using the formula of: Relative error = ; the
Approximate value
exact values must be eliminated such that only the approximate values
together with their corresponding errors remain. Note also that Method 3
can’t work in this case since that method involves using the exact values
yet they have to be eliminated.
In summary:
(i). The maximum possible error in the quotient (𝑥 2 ⁄𝑦) is
2𝑥|𝑒𝑥 | 𝑥 2 |𝑒𝑦 | 2𝑋|𝑒𝑥 | 𝑋 2 |𝑒𝑦 |
= + , or, = +
𝑦 𝑦2 𝑌 𝑌2
(ii). The maximum relative error in the quotient (𝑥 2 ⁄𝑦) is
𝑒𝑥 𝑒𝑦 𝑒𝑥 𝑒𝑦
= 2| |+ | | , or, = 2| | + | |
𝑥 𝑦 𝑋 𝑌
(iii). The maximum percentage error in the quotient (𝑥 𝑦) is
2⁄
𝑒𝑥 𝑒𝑦 𝑒𝑥 𝑒𝑦
= {2 | | + | |} × 100% , or, = {2 | | + | |} × 100%
𝑥 𝑦 𝑋 𝑌
Likely questions for error in Quotient
Qn 1: X and Y are approximate values with errors X, Y respectively.
𝑋
Show that the maximum error in is
𝑌
𝑋 ∆𝑋 ∆𝑌
{| | + | |}.
𝑌 𝑋 𝑌
Qn 2: The numbers X and Y are rounded off to 𝑥 𝑎𝑛𝑑 𝑦 with the errors
𝑒1 𝑎𝑛𝑑 𝑒2 respectively. Show that the maximum relative error made in the
approximation of
𝑋 𝑥 𝑒1 𝑒2
𝑏𝑦 𝑖𝑠, | | + | |.
𝑌 𝑦 𝑥 𝑦
Qn 3: The numbers A and B are rounded off to 𝑎 𝑎𝑛𝑑 𝑏 with the errors
𝑒1 𝑎𝑛𝑑 𝑒2 respectively. Show that the maximum relative error made in the
approximation of
𝐴 𝑎 𝑒1 𝑒2
𝑏𝑦 𝑖𝑠, | | + | |.
𝐵 𝑏 𝑎 𝑏
Qn 4: The numbers 𝑥 𝑎𝑛𝑑 𝑦 are approximated with possible errors of
∆𝑥 𝑎𝑛𝑑 ∆𝑦 respectively. Show that the maximum absolute error in the
𝑥
quotient is given by
𝑦
𝑦∆𝑥 + 𝑥∆𝑦
𝑦2
Qn 5: The numbers 𝑥 𝑎𝑛𝑑 𝑦 are measured with possible errors of
∆𝑥 𝑎𝑛𝑑 ∆𝑦 respectively. Show that the maximum absolute error in the
𝑥
quotient is given by
𝑦
|𝑦||∆𝑥| + |𝑥||∆𝑦|
𝑦2
−𝐵±√𝐵2 −4𝐴𝐶
(ii). If 𝐴𝑥 2 + 𝐵𝑥 + 𝐶 = 0, then 𝑥 = is an algorithm for solving
2𝐴
the quadratic equation.
A problem may be, finding the sum, mean, power or factorial of particular
numbers (counting number, natural numbers, whole numbers), finding
the root of an equation e.t.c.
The basic statements used in flow charts
In a flow chart, all steps needed to carry out an algorithm are broken
down into simple elements known as statements. There are no set rules
for drawing a flow chart. i.e. the same program can be represented by
different flow charts.
However, there are six basic statements used in a flow chart used in a
flow chart.
1) Start (begin) statement
2) Read statement
3) Assignment statement
4) Conditional statement
5) Print statement
6) Stop (end) statement
(1). The “Start/begin” statement
The machine won’t start unless it is told to do so. The program to be fed
into the computer must have a “start” statement. This also must appear
on the flow chart.
According to the convention, the start statement is enclosed in an oval or
round ended box as shown below.
START OR START
READ: A, B
The statement (READ: A, B) in this box means that the next two numbers
in the storage memory are read and they become values of A and B.
(3). The “Assignment” statement
The assignment statement has three parts;
i. The left part that represents the name of the variable.
ii. The operator which is in the middle. This can take any one of the
following =, ≠, >, ≥, <, ≤.
iii. The right part that represents the new value of the variable in the
left part.
According to the convention, the assignment statement is enclosed in a
rectangular shaped box.
Note: The operator “=” is used to mean, “… becomes equal to …” or “Let …
be equal to …”
For example:
Statement Meaning
This means that “𝑥 becomes 1.2”;
or “let 𝑥 be equal to 1.2.”; Or
“record the value 1.2 in the stored
x = 1.2 to be called 𝑥.”
Note: Such a statement in used in a
program where it is necessary to
give a quantity a known value.
This means that “let the constant 𝜋
be equal to 3.14.”
Note: Such a statement in used in a
π = 3.14 program where it is necessary to
give a quantity a known value.
Is YES/NO
………….
?
YES/NO
Is NO Is
YES
x=5 OR x=5
? ?
YES NO
PRINT: A, B
The statement (PRINT: A, B) in this box means that means that you print
out the value held in the stores called A and B respectively.
(6). The “Stop/end” statement
The machine has to be instructed to stop where necessary. Otherwise, it
will repeat the execution of the programme endlessly.
The “stop” instruction must be put on the flow chart at the end of the
program.
According to the convention, the stop statement is enclosed in an oval or
round ended box.
STOP OR STOP
Note: A flow chart may contain any number of “stop” statements but has
only one “start” statement.
The flow line
The arrows (shown below) which show the direction of the sequence of
statements are referred to as flow lines.
OR
So far, the six statements above can be connected together to form a flow
chart as shown below.
START
Read statement
Assignment
statement
Decision No
statement
Yes
Print statement
STOP
Counters, loops and sentinels
We use the counter when we know the exact number of equations to be
solved. A counter is made to increase by a specific quantity e.g. 1, 2, 3, e.t.c
A loop is a group of statements that are used more than once. Before the
counter is increased, a loop would have been completed.
When the number of loops to be executed is known, a sentinel is used.
A sentinel is a number used as a signal to stop the input because it is not a
valid value of the variable in the read statement.
For example, consider a section extract from a flow chart that was
designed to obtain the squares of the first eight natural numbers (S) and
the first eight odd numbers (N) using 𝑆 = 0 𝑎𝑛𝑑 𝑁 = 1 as the starting
values to be read.
Loop
S=S+N
N=N+2
”
ck 5 ?
Is
h e =1
N = 15 No
rc N
te “is
?
un nt
el
co e
in
a em
Yes
nt
is tat
se
s
Proceed to the a
e
is
Th
print statement
15
START
S=0
N=1
S=S+N
N=N+2
Is
N = 15 No
?
Yes
PRINT: S, N
STOP
Drawing flow charts with loops
A flow chart with a loop is in the form shown below
START
Read statement
Assignment
Loop
statement
assignment
Decision No
statement
Yes
Print statement
STOP
Sample questions
Qn 1: (a). Show that the Newton Raphson’s iterative formula for finding
the natural logarithm of a number N is given by
(𝑥𝑛 − 1)𝑒 𝑥𝑛 + 𝑁
𝑥𝑛+1 = , 𝑤ℎ𝑒𝑟𝑒 𝑛 = 0, 1, 2, 3, ….
𝑒 𝑥𝑛
(b). Draw a flow chart that
(i). Reads the initial approximation of the root, 𝑥0 and 𝑁.
(ii). Computes and prints 𝑁 and its logarithm after 4 iterations or gives
the logarithm correct to 3 decimal places.
(iii). Perform a dry run for 𝑁 = 10.0 and 𝑥0 = 2.
Sol: (a).
𝑙𝑒𝑡, 𝑥 = log 𝑒 𝑁 , ⟹ 𝑒 𝑥 = 𝑁, ⟹ 𝑒𝑥 − 𝑁 = 0
𝑓(𝑥) = 𝑒 𝑥 − 𝑁, 𝑓 ′ (𝑥) = 𝑒 𝑥
𝑓(𝑥𝑛 ) = 𝑒 𝑥𝑛 − 𝑁, 𝑓 ′ (𝑥𝑛 ) = 𝑒 𝑥𝑛
𝑓(𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 − , 𝑛 = 0, 1, 2, …
𝑓′ (𝑥𝑛 )
𝑒 𝑥𝑛 − 𝑁 𝑥𝑛 𝑒 𝑥𝑛 − (𝑒 𝑥𝑛 − 𝑁) 𝑥𝑛 𝑒 𝑥𝑛 − 𝑒 𝑥𝑛 + 𝑁
𝑥𝑛+1 = 𝑥𝑛 − = =
𝑒 𝑥𝑛 𝑒 𝑥𝑛 𝑒 𝑥𝑛
𝑥
(𝑥𝑛 − 1)𝑒 𝑛 + 𝑁
𝑥𝑛+1 = , 𝑛 = 0, 1, 2, 3, ….
𝑒 𝑥𝑛
(b). Flow chart
START
n=0
Read: N, x0
xn
xn+1 = e (xn - 1) + N
e xn n=n+1
Is Is
No No
xn+1 - xn < 0.0005 n=3
?
?
Yes
Yes
PRINT: N, xn+1
STOP
Dry run
𝑛 𝑥𝑛 𝑥𝑛+1 |𝑥𝑛+1 − 𝑥𝑛 |
0 2 2.3533 0.3533
1 2.3533 2.3039 0.0494
2 2.3039 2.3026 0.0013
3 2.3026 2.3026 0.0000
START
n=0
Read: N, x0
xn
xn+1 = e (xn - 1) + N
e xn n=n+1
Is No
n=3
?
Yes
PRINT: N, xn+1
STOP
Dry run
𝑛 𝑥𝑛 𝑥𝑛+1
0 2 2.3533
1 2.3533 2.3039
2 2.3039 2.3026
3 2.3026 2.3026