Welcome to Numerical Methods: Finding Answers When Algebra Fails!
Hello! Welcome to the chapter on Numerical Methods. Don't worry if this sounds scary—it’s actually one of the most practical and logical sections in P3!
In earlier maths, you learned to solve equations like \(x^2 - 3x + 2 = 0\) (which factorises) or \(2x - 5 = 11\) (which rearranges). But what about equations like \(e^x = 10 - x\) or \(\sin x = \ln x\)? These cannot be solved using standard algebraic techniques.
Numerical methods are techniques used to find approximations to the roots (solutions) of these complex equations, usually using repetitive calculations (iterations). These are the methods computers and calculators use behind the scenes!
Let's dive in and learn how to hunt down those tricky roots!
Section 1: Locating Roots by Change of Sign
What is a Root?
A root of an equation \(f(x) = 0\) is the value of \(x\) where the graph of \(y = f(x)\) crosses the \(x\)-axis. At this point, the value of the function, \(y\), is exactly zero.
The Change of Sign Principle
This is the simplest numerical method, based on common sense.
If a function \(f(x)\) is continuous (meaning its graph has no breaks, jumps, or asymptotes in the interval), and you find two values, \(a\) and \(b\), such that:
1. \(f(a)\) is positive (above the x-axis).
2. \(f(b)\) is negative (below the x-axis).
... then the graph must have crossed the x-axis at least once between \(a\) and \(b\). Therefore, there must be a root within the interval \((a, b)\).
Analogy: Crossing the River
Imagine the \(x\)-axis is a river. If you start on the North bank (positive \(f(x)\)) and end up on the South bank (negative \(f(x)\)), you must have crossed the river at some point. That crossing point is the root!
Step-by-Step Process for Locating a Root
- Define the Function: Make sure the equation is in the form \(f(x) = 0\). Example: If the question is \(e^x = 10 - x\), you must rewrite it as \(f(x) = e^x + x - 10 = 0\).
- Choose an Interval: The question usually provides a small interval, say \([1, 2]\), or asks you to find one.
- Test the Endpoints: Calculate \(f(1)\) and \(f(2)\).
-
Check the Sign Change:
- If \(f(1) > 0\) and \(f(2) < 0\), a sign change has occurred.
- If \(f(1) < 0\) and \(f(2) > 0\), a sign change has occurred.
- State the Conclusion: State clearly: "Since there is a change of sign between \(x=a\) and \(x=b\), and \(f(x)\) is continuous in this interval, a root must lie between \(a\) and \(b\)."
⚠️ Common Mistake Alert!
A change of sign guarantees a root only if the function is continuous. If the function has an asymptote (a break) in the interval (like \(f(x) = 1/x\)), the sign can change without crossing the axis! Always assume standard P3 functions (polynomials, exponentials, logs, trig) are continuous unless an asymptote is clearly visible in the interval.
If \(f(a)\) and \(f(b)\) have different signs, a root exists in \([a, b]\), provided \(f(x)\) is continuous. This method allows us to narrow down the location of the root to increasing levels of accuracy (e.g., to 1 decimal place).
Section 2: Iterative Methods (\(x_{n+1} = g(x_n)\))
While the change of sign method tells us where the root is, iterative methods allow us to calculate the root to a high degree of precision using a formula that repeats itself.
Step 1: Rearranging \(f(x) = 0\) to \(x = g(x)\)
The core idea is to transform the equation \(f(x) = 0\) into an equivalent form: \(x = g(x)\).
Example: Solve \(f(x) = x^3 - 3x - 5 = 0\).
There are many ways to rearrange this, leading to different functions \(g(x)\):
-
Rearrangement A (The Simplest):
\(x^3 = 3x + 5\)
\(x = \sqrt[3]{3x + 5}\)
Here, \(g(x) = \sqrt[3]{3x + 5}\). -
Rearrangement B (The Trickier One):
\(3x = x^3 - 5\)
\(x = \frac{x^3 - 5}{3}\)
Here, \(g(x) = \frac{x^3 - 5}{3}\).
Important Point: Only certain rearrangements will actually work (i.e., converge to the root). We'll look at how to tell the difference in Section 3.
Step 2: The Iteration Formula
Once you have \(x = g(x)\), you turn it into the iteration formula:
$$x_{n+1} = g(x_n)$$
This means the value of the next approximation (\(x_{n+1}\)) is calculated by substituting the current approximation (\(x_n\)) into the function \(g\).
Step 3: Calculating the Sequence
- Start with an Initial Estimate (\(x_0\)): This is usually given in the question, or you can use the result from a change of sign calculation (e.g., if the root is between 2 and 3, you might start with \(x_0 = 2.5\)).
- Calculate \(x_1\): Substitute \(x_0\) into the formula: \(x_1 = g(x_0)\).
- Calculate \(x_2\): Substitute \(x_1\) into the formula: \(x_2 = g(x_1)\).
- Repeat: Continue this process (\(x_3, x_4, x_5, \dots\)) until the values converge (they stop changing or change only in the required decimal place).
💡 Calculator Tip for Speed and Accuracy
This is vital for exams!
-
Type your initial estimate, \(x_0\), and press
=. This stores the value in the calculator's ANS memory. -
Type the iteration formula, using
ANSinstead of \(x_n\).
Example: For \(x_{n+1} = \sqrt[3]{3x_n + 5}\), you type:\(\sqrt[3]{3\text{Ans} + 5}\). -
Press
=repeatedly. Each press calculates the next term in the sequence (\(x_1, x_2, x_3, \dots\)). This is much faster and reduces rounding errors.
Handling Precision: When calculating iterative values, you must usually use high precision (at least 4 decimal places) for intermediate steps, only rounding to the final required accuracy at the end.
Iteration allows us to hone in on a root. The process is: \(f(x)=0 \rightarrow x=g(x) \rightarrow x_{n+1}=g(x_n)\). You need an initial guess and a formula that actually works (converges).
Section 3: Graphical Analysis and Convergence
Why did we say only "certain rearrangements" work? This is where the graphs come in.
Graphical Interpretation of Roots
When we are solving \(x = g(x)\), we are looking for the intersection points between two graphs:
$$y = x$$
$$y = g(x)$$
The \(x\)-coordinate of the intersection is the root \(\alpha\).
Visualizing Iteration: Staircase and Cobweb Diagrams
We plot the sequence \(x_0, x_1, x_2, \dots\) on these graphs. The iterative process is represented by moving:
- Vertically from \(x_n\) on the \(x\)-axis up (or down) to the curve \(y = g(x)\). (This calculates \(x_{n+1}\).)
- Horizontally from the curve to the line \(y = x\). (This sets the output \(x_{n+1}\) as the input for the next step.)
Repeating this process creates one of two patterns:
- Staircase Diagram: The sequence moves step-by-step directly towards the root. This happens when the function \(g(x)\) is increasing near the root.
- Cobweb Diagram: The sequence spirals inwards towards the root. This happens when the function \(g(x)\) is decreasing near the root.
If the points move *away* from the intersection point, the iteration diverges (it fails to find the root).
The Condition for Convergence
The key factor determining whether an iteration converges or diverges is the gradient of the function \(g(x)\) near the root \(\alpha\).
Let \(g'(x)\) be the derivative (gradient function) of \(g(x)\).
Rule for Convergence:
The iteration \(x_{n+1} = g(x_n)\) will converge if, and only if, the magnitude (absolute value) of the gradient of \(g(x)\) is less than 1 at the root \(\alpha\).
$$|g'(\alpha)| < 1$$
If \(|g'(\alpha)| \geq 1\), the iteration will likely diverge or oscillate without settling.
Analogy: The Gradient Steepness
The line \(y=x\) has a gradient of 1.
- If the curve \(y=g(x)\) is flatter than \(y=x\) (i.e., \(|g'(\alpha)| < 1\)), the steps in the diagram get smaller and you roll towards the root (Convergence).
- If the curve \(y=g(x)\) is steeper than \(y=x\) (i.e., \(|g'(\alpha)| > 1\)), the steps get larger and you jump further away from the root (Divergence).
How to Prove Convergence in an Exam
To prove that a given formula \(x_{n+1} = g(x_n)\) will converge to a root \(\alpha\) that lies in the interval \([a, b]\), you must show that:
$$|g'(x)| < 1 \text{ for all } x \text{ in the interval } [a, b]$$
Step-by-Step Proof:
- Find the derivative \(g'(x)\).
- Evaluate \(|g'(x)|\) at both endpoints, \(a\) and \(b\).
- Show that the maximum magnitude of the gradient in that interval is less than 1.
- Conclusion: "Since \(|g'(x)| < 1\) throughout the interval \([a, b]\), the iteration will converge to the root \(\alpha\) in this region."
Did You Know?
In the real world, mathematicians often try several different rearrangements (\(x = g(x)\)) until they find one that converges quickly. A smaller value of \(|g'(\alpha)|\) means faster convergence!
Convergence depends on the gradient of \(g(x)\). For the sequence to settle on the root, the graph \(y = g(x)\) must not be too steep where it crosses \(y = x\). We need \(|g'(x)| < 1\).