Introduction to Solving Equations Numerically

Welcome to the world of Numerical Methods! So far in your math journey, you’ve probably spent a lot of time finding "exact" answers for equations—like solving \(x^2 - 4 = 0\) to get exactly \(2\) and \(-2\). But what happens when the equations get messy, like \(x^3 - x - 4 = 0\)? There isn't always a simple formula to use.

In this chapter, we learn how to "hunt" for roots. Instead of finding the answer in one step, we use clever techniques to get closer and closer to the truth. Don't worry if this seems a bit abstract at first; once you see the patterns, it’s like being a mathematical detective!

1. Locating Roots: The Change of Sign Method

Before we can find a root precisely, we need to know roughly where it is. A root (or zero) of a function \(f(x)\) is simply the value of \(x\) where \(f(x) = 0\).

How it Works

Imagine you are walking along a path. If at one point you are below sea level (negative height) and later you are above sea level (positive height), you must have crossed sea level (zero) at some point in between.
Mathematically, if a continuous function \(f(x)\) changes sign between \(x = a\) and \(x = b\), there must be at least one root in the interval \([a, b]\).

Step-by-Step: Finding an Interval

1. Pick two \(x\) values, say \(x=1\) and \(x=2\).
2. Calculate \(f(1)\) and \(f(2)\).
3. If one is positive and the other is negative, you've found a root! If not, try different numbers.

When the Method Fails

Caution! A change of sign is a great clue, but it's not perfect. It can fail if:
• The curve touches the x-axis but doesn't cross it (e.g., \(y = x^2\)).
• There is a vertical asymptote (a "break" in the graph) where the function jumps from negative to positive without hitting zero.
• There are multiple roots in the interval that "cancel out" the sign change visually.

Quick Review:
• Root: Where \(f(x) = 0\).
• Sign Change: If \(f(a)\) and \(f(b)\) have different signs, a root is likely between them.
• Requirement: The function must be continuous (no jumps).

Takeaway: Sign change is our "starting whistle." It tells us where to begin looking more closely.

2. Fixed Point Iteration: The \(x = g(x)\) Method

Once we have a rough idea of where the root is, we can use iteration—a process of repeating a calculation to get a more accurate result.

The Rearrangement

To use this method, we must rearrange our original equation \(f(x) = 0\) into the form \(x = g(x)\).
Example: To solve \(x^3 - x - 4 = 0\), we could rearrange it to \(x^3 = x + 4\) and then \(x = \sqrt[3]{x + 4}\). Here, our \(g(x)\) is \(\sqrt[3]{x + 4}\).

How to Iterate

1. Start with an initial guess, \(x_0\).
2. Plug \(x_0\) into \(g(x)\) to get your next value: \(x_1 = g(x_0)\).
3. Plug \(x_1\) back in to get \(x_2 = g(x_1)\).
4. Keep going! If the numbers settle down (converge), you’ve found the root.

Did you know? You can use the ANS key on your calculator to do this incredibly fast! Type your starting value and hit `=`, then type the \(g(x)\) formula using the `ANS` button instead of `x`. Keep hitting `=` to see the root emerge!

Visualising Iteration: Staircases and Cobwebs

We can draw these iterations on a graph of \(y = x\) and \(y = g(x)\).
• Staircase Diagram: The values approach the root from one side, looking like a set of steps.
• Cobweb Diagram: The values spiral inward toward the root (or outward if it fails!).

Takeaway: Iteration turns a rearrangement into a repeating loop that (hopefully) zooms in on the answer.

3. The Newton-Raphson Method

This is often the "heavy hitter" of numerical methods. It uses differentiation to find the root even faster than fixed-point iteration.

The Formula

The iteration formula is:
\(x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}\)

The Analogy

Imagine you are on a foggy hill (the curve) and want to find the valley floor (the x-axis). You look at the slope right where you are standing and follow that line straight down until it hits the ground. That spot is your next, better guess!

When Newton-Raphson Fails

Newton-Raphson is fast, but it can get "confused":
• If your guess is near a stationary point (where the gradient \(f'(x) = 0\)), the formula involves dividing by zero. The "line" becomes horizontal and never hits the x-axis!
• If the starting value is too far away, it might jump to a completely different root or just spiral away into infinity.

Quick Review:
• Newton-Raphson: Uses the tangent to find the root.
• Formula: \(x - \frac{f}{f'}\).
• Risk: Watch out for turning points!

Takeaway: Newton-Raphson is highly efficient but requires a good starting guess and a non-zero gradient.

4. Convergence: Will it Work?

Not all numerical methods work every time. When the values get closer and closer to the root, we say they converge. When they fly off or cycle around without settling, they diverge.

Common Mistakes to Avoid

• Radians vs. Degrees: Always use radians for calculus-based methods (like Newton-Raphson) involving trigonometry.
• Rearrangement Choice: In fixed-point iteration, some rearrangements of \(x = g(x)\) will work, while others will fail. Usually, the "flatter" the graph of \(g(x)\) is near the root, the better it works.
• Starting Value: If your method isn't working, try a starting value closer to the root you found during the sign-change phase.

Key Takeaway for the Chapter: Numerical methods are iterative tools. We start with a sign change to find an interval, choose a method like fixed-point iteration or Newton-Raphson, and repeat the process until our answer is as accurate as we need it to be!