Chapter 10 Numerical Methods Notes – 12th Class Math Federal Board

Chapter 10, Numerical Methods, from the 12th class Mathematics, Federal Board (FBISE) book. These notes cover Importance of Numerical Methods, The Role of Numerical Methods, Computers and Numerical Methods, Basic Principle of Solving Non-linear Equations, Bisection Method, Regula Falsi Method, Newton’s Raphson Method, Numerical Integration and Simpson’s One-Third Rule. Learn the definitions and formula boxes, then try the solved examples and the exercises.
10.1 Importance of Numerical Methods
Numerical methods give approximate answers by repeated arithmetic. We use them when an exact answer is impossible, or too hard to find by direct (analytical) methods. They are used in science, engineering and finance.
- Integrals. Some functions have no simple antiderivative. For example, $\int e^{-x^2}\,dx$ (the Gaussian integral) cannot be written with basic functions. The trapezoidal rule and Simpson’s rule can give its approximate value between two limits.
- Non-linear equations. Some equations cannot be solved by algebra. For example, $\sin x+e^x+\ln x+x=0$. The bisection, Regula Falsi and Newton–Raphson methods find its root step by step.
Each repetition of the calculation is called an iteration. The value found in it is also called an iterate. The answer is often close enough for practical use.
History. Modern numerical analysis is often linked to a 1947 paper by John von Neumann and Herman Goldstine. Some writers trace it back to E. T. Whittaker in 1912.
10.2 The Role of Numerical Methods
Numerical methods are important because they do four things.
- Approximate solutions. They give a close answer when the exact answer cannot be found.
- Automate repeated calculations. They break a hard problem into a series of simple, repeated calculations. A computer can do these quickly.
- Adapt to new technology. They become more powerful as computers improve.
- Handle complex systems. They can solve systems of equations, partial differential equations and non-linear equations.
10.3 Computers and Numerical Methods
Computers are ideal for numerical methods because they do a large number of calculations quickly and accurately. Problems that would take too long by hand become possible.
With a calculator, follow the same idea.
- Write the starting values and the formula.
- Repeat the same formula with the newest values.
- Keep the full values in the calculator. Round only the final answer.
10.4 Basic Principle of Solving Non-linear Equations
First write the equation in the form $f(x)=0$.
Roots or zeros. The roots (or zeros) of $f(x)=0$ are the values of $x$ that make $f(x)$ equal to zero. For example, $x^2+5x+6=0$ has the roots $x=-2$ and $x=-3$. These are found by a direct (analytical) method.
Types of functions
- Linear function: $f(x)=ax+b$. Its root is easy to find by a direct method.
- Algebraic (polynomial) function of degree $n$: $f(x)=a_nx^n+a_{n-1}x^{n-1}+a_{n-2}x^{n-2}+\cdots+a_0$. If the degree is higher than four, direct methods are difficult and often impractical.
- Transcendental function: it contains trigonometric, exponential or logarithmic terms. For example, $e^x+\sin x+4=0$, $e^x+\ln x-7=0$ and $\tan x+x^3+x^2+10=0$. Direct methods usually fail for these equations.
Methods used in this unit
Direct methods often fail for non-linear equations, so we find approximate roots. Each method has its own advantages and limitations. This unit uses three methods.
- Bisection method
- Regula Falsi method
- Newton–Raphson method
Sign-Change Theorem · p. 278If $f(x)$ is continuous on the closed interval $[a,b]$ and $f(a)$, $f(b)$ have opposite signs, then the equation $f(x)=0$ has at least one real root between $a$ and $b$.
Why it is true
One of the numbers $f(a)$, $f(b)$ is negative and the other is positive. So $0$ lies between them. A continuous function takes every value between $f(a)$ and $f(b)$ (Intermediate Value Theorem). So $f(x)=0$ for some $x$ between $a$ and $b$.
- $y=f(x)$
Worked illustration. Take $f(x)=x^2-2$ on $[1,2]$.
The signs are opposite, so $x^2-2=0$ has a root between $1$ and $2$.
10.5 Bisection Method
The bisection method needs two starting values $x_0$ and $x_1$ with $f(x_0)f(x_1)<0$. Then $f(x)=0$ has at least one root between $x_0$ and $x_1$. We cut the interval into two halves again and again. The midpoints are $x_2,x_3,\ldots$
- Step 1. Find $x_2=\dfrac{x_0+x_1}{2}$ and then $f(x_2)$.
- Step 2. If $f(x_2)=0$, then $x_2$ is a root. Stop.
- Step 3. If $f(x_0)f(x_2)<0$, the root lies between $x_0$ and $x_2$. Take $x_3=\dfrac{x_0+x_2}{2}$.
- Step 4. If $f(x_1)f(x_2)<0$, the root lies between $x_1$ and $x_2$. Take $x_3=\dfrac{x_1+x_2}{2}$.
- Step 5. Repeat with the new values until the root has the required accuracy.
When $f(x_2)\ne0$, only one of Step 3 and Step 4 is possible. This method is simple but slow. It is also called the interval halving method or the binary-search method.
- $y=f(x)$
Worked illustration. Let $f(x)=x^2-2$; $x_0=1$, $x_1=2$. Here $f(x_0)=-1$ $(-\text{ve})$ and $f(x_1)=2$ $(+\text{ve})$.
The root lies between $x_0$ and $x_2$, that is, between $1$ and $1.5$.
The root lies between $x_2$ and $x_3$, that is, between $1.25$ and $1.5$.
After $k$ halvings the length of the interval is
When to stop. For an answer correct to $2$ decimal places, continue until both ends of the interval round to the same $2$-decimal value. For example, if the root lies between $1.413$ and $1.414$, it is $1.41$ to two decimal places.
Advantages
- It is simple and reliable.
- It always reaches a root if the continuous function changes sign over the interval.
Limitations
- It can be slow, especially if high accuracy is needed.
- We must first know an interval where the sign changes.
10.6 Regula Falsi Method
This is also called the method of false position. It needs two starting values $x_0$ and $x_1$ with $f(x_0)f(x_1)<0$. Join the points $(x_0,f(x_0))$ and $(x_1,f(x_1))$ by a straight line (a chord). The new value $x_2$ is the point where this chord cuts the $x$-axis.
In general, for $n=1,2,3,\ldots$
Provided $f(x_n)f(x_{n-1})<0$.
After each step find the sign of $f$ at the new value. Use the new value with the earlier value that gives the opposite sign.
- $y=f(x)$
- $\text{Chord}$
Where the formula comes from
The points $(x_0,f(x_0))$, $(x_2,0)$ and $(x_1,f(x_1))$ are on the same line. So the slopes are equal.
Solve for $x_2$.
The values $f(x_0)$ and $f(x_1)$ have opposite signs, so the denominator is not zero.
Worked illustration. Let $f(x)=x^2-2$; $x_0=1$, $x_1=2$. Here $f(x_0)=-1$ $(-\text{ve})$ and $f(x_1)=2$ $(+\text{ve})$.
The root lies between $x_1$ and $x_2$, that is, between $\dfrac43$ and $2$.
Convergence. This method may be faster than the bisection method. One drawback is that one end point may not move. Then the values come closer to the root from one side only.
When to stop. Continue until two successive values agree to the required number of decimal places. Then check the sign of $f(x)$ near the rounded value to be sure.
Advantages
- It converges to a root if $f$ is continuous and the starting values give opposite signs.
- It is often faster than bisection.
Disadvantages
- It can be slow in some cases.
- It does not work for all functions. It may fail to find a root if the starting values do not give opposite signs, or if the function has several roots.
10.7 Newton’s Raphson Method
Newton’s Raphson method needs one starting value $x_0$ and the derivative $f'(x)$. It is also called the method of tangents. The new value is the point where the tangent to the curve cuts the $x$-axis.
Here $f'(x_n)\ne0$.
Derivation · pp. 282–283
Let $x_0$ be an approximate root of $f(x)=0$. Let $x_0+h$ be the exact root, where $h$ is small. Then
Expand by Taylor’s theorem.
Since $h$ is small, neglect the terms with $h^2$ and higher powers of $h$. Now $h$ is only approximate.
So the first better value is
Put $x_1$ in place of $x_0$ to get the next value, and so on.
After $n$ steps we get the general formula.
- $y=f(x)$
- $\text{Tangents}$
Worked illustration. Let $f(x)=x^2-2$ and $x_0=3$. Then $f'(x)=2x$.
The exact root is $\sqrt2\approx1.4142$.
In the examples and exercises, first simplify $x_n-\dfrac{f(x_n)}{f'(x_n)}$ into one fraction, as above. Then put the values in it.
Points to remember
- If the slope $f'(x_n)$ is large, $h$ is small and the root is found in less time.
- If $x_0$ is close to the root, the root is found very quickly.
- The method fails if $f'(x_n)=0$. It may also fail if $f'$ is zero near the root. Then use the Regula Falsi method.
- If $x_0$ is not given, choose two values $a$ and $b$ such that $f(a)$ and $f(b)$ have opposite signs. If $|f(a)|<|f(b)|$, take $a$ as the starting value.
When to stop. Continue until two successive values agree to the required number of decimal places.
Advantages
- It converges rapidly.
- It can be used for many kinds of equations.
Disadvantages
- It needs the derivative.
- It depends on the starting value. A poor starting value may lead to another root or to no root.
10.8 Numerical Integration
Numerical integration means finding $\int_a^b y\,dx$ when $y=f(x)$ is given by a table of values $(x_i,y_i)$, $i=0,1,2,\ldots,n$, with $a=x_0$ and $b=x_n$. For a function of one variable this process is also called quadrature. We replace $f(x)$ by a simpler function that passes through the given points, and integrate that function.
10.8.1 Trapezoidal rule
Divide $[a,b]$ into $n$ equal parts of width $h$. Join the points of the curve by straight lines. Each strip becomes a trapezium.
The answer of this rule with $n$ parts is also written $T_n$.
Derivation · pp. 285–286
The area of a trapezium is its width times the average of its two parallel sides.
In the same way, the last strip gives
Add these $n$ integrals. Each middle value comes twice. The first and last values come once.
This is also called the multiple segment or composite trapezoidal rule. The answer usually improves when $h$ is made smaller (more parts).
Worked illustration. Take $f(x)=x^2$ on $[0,2]$ with $n=2$. Then $h=1$, $y_0=0$, $y_1=1$ and $y_2=4$.
- $y=x^2$
- $\text{Straight edges}$
10.9 Simpson’s One-Third Rule
Use this rule only when the number of parts $n$ is even.
It is also called Simpson’s rule. Its answer with $n$ parts is also written $S_n$. The proof is not needed at this level.
- The first and last values are taken once.
- The odd values $y_1,y_3,\ldots$ are multiplied by $4$.
- The other even values $y_2,y_4,\ldots$ are multiplied by $2$.
Simpson’s rule usually gives a more accurate result than the trapezoidal rule.
Worked illustration. Take $f(x)=x^2$ on $[0,2]$ with $n=2$. Then $h=1$, $y_0=0$, $y_1=1$ and $y_2=4$.
Here this equals the exact value $\left[\dfrac{x^3}{3}\right]_0^2=\dfrac83$. The trapezoidal rule gave $3$.
Exercise solutions of Chapter 10
- 10.1Exercise 10.1: Root Finding by Iteration18 questions solved step by step · Examples
- 10.2Exercise 10.2: Trapezoidal and Simpson Rules6 questions solved step by step · Examples
- RReview Exercise 106 questions solved step by step