Module 3: Roots of Equations and Systems of Linear Algebraic Equations
Copied!
1. Introduction
Finding the roots of equations—values of \(x\) for which \(f(x) = 0\)—is one of the oldest and most fundamental problems in computational physics and engineering. From calculating the trajectory of a projectile to determining the energy levels in a quantum well, solving nonlinear equations is ubiquitous.
Similarly, systems of linear algebraic equations are the backbone of numerical analysis. They arise naturally when solving differential equations, fitting curves to data, or analyzing complex electrical circuits.
In this module, we explore methods to solve both single nonlinear equations (bracketing and open methods) and large systems of linear equations (direct methods).
2. Theory
2.1 Bracketing Methods
Bracketing methods rely on the Intermediate Value Theorem. If a continuous function \(f(x)\) has opposite signs at the endpoints of an interval \([a, b]\) (i.e., \(f(a)f(b) < 0\)), then there exists at least one root \(c \in [a, b]\) such that \(f(c) = 0\).
Bisection Method
The bisection method systematically halves the interval containing the root. Algorithm: 1. Choose lower \(x_l\) and upper \(x_u\) guesses such that \(f(x_l)f(x_u) < 0\). 2. Estimate the root \(x_r = \frac{x_l + x_u}{2}\). 3. Determine the subinterval for the next step: - If \(f(x_l)f(x_r) < 0\), the root lies in the lower subinterval. Set \(x_u = x_r\). - If \(f(x_l)f(x_r) > 0\), the root lies in the upper subinterval. Set \(x_l = x_r\). - If \(f(x_l)f(x_r) = 0\), the root equals \(x_r\). 4. Repeat until the approximate error is below a tolerance.
Convergence and Error: The absolute error after \(n\) iterations is bounded by \(E_n \le \frac{x_u^0 - x_l^0}{2^n}\). Thus, it has linear convergence.
False Position (Regula Falsi) Method
Instead of blindly bisecting the interval, False Position connects the points \((x_l, f(x_l))\) and \((x_u, f(x_u))\) with a straight line. The intersection of this line with the x-axis is the new root estimate. \[x_r = x_u - \frac{f(x_u)(x_l - x_u)}{f(x_l) - f(x_u)}\]Pros/Cons: Often faster than bisection for smooth curves, but can be much slower (one-sided convergence) for functions with significant curvature near the root.
2.2 Open Methods
Open methods require only a single starting value or two values that do not necessarily bracket the root. They can diverge but typically converge much faster than bracketing methods.
Newton-Raphson Method
Derived from the first-order Taylor series expansion: \(f(x_{i+1}) \approx f(x_i) + f'(x_i)(x_{i+1} - x_i) = 0\). Solving for \(x_{i+1}\): \[x_{i+1} = x_i - \frac{f(x_i)}{f'(x_i)}\]Convergence: Quadratic convergence for simple roots (error at step \(i+1\) is proportional to the square of the error at step \(i\)). Pitfalls: Can diverge if the initial guess is far from the root, or if \(f'(x_i) \approx 0\) (inflection points, local extrema).
2.3 Systems of Linear Algebraic Equations
A system of \(n\) linear equations can be represented as \(Ax = b\).
Gauss Elimination with Partial Pivoting
A direct method that transforms the matrix \(A\) into an upper triangular matrix using row operations, followed by backward substitution. Partial pivoting involves swapping rows to place the largest available absolute value on the diagonal to minimize round-off errors.
LU Decomposition (Doolittle’s Method)
Decomposes \(A = LU\), where \(L\) is a lower triangular matrix with 1s on the diagonal, and \(U\) is an upper triangular matrix. Once decomposed, \(Ax=b \implies LUx = b\). 1. Solve \(Ly = b\) (forward substitution). 2. Solve \(Ux = y\) (backward substitution).
Matrix Inversion via LU
The inverse of \(A\) can be found column by column by solving \(Ax_i = e_i\), where \(e_i\) is the \(i\)-th column of the identity matrix.
By hand, \(L\) and \(U\) are derived systematically row by row, resulting in the matrices printed above. Then solving \(Ly = b\) and \(Ux = y\) gives \(x_1=1.94, x_2=1.39, x_3=0.94\).
6. Practice Problems
Use the bisection method to find the root of \(f(x) = \cos(x) - x = 0\) in \([0, 1]\) to 3 decimal places.
Compare the number of iterations required to solve \(x^3 - 0.165x^2 + 3.993 \times 10^{-4} = 0\) using Bisection and False Position on \([0, 0.11]\).
Apply the Newton-Raphson method to \(f(x) = x^3 - 2x - 5 = 0\) starting with \(x_0 = 2\). What is the absolute relative error after 2 iterations?
Solve a 4x4 matrix system using Gauss Elimination with partial pivoting. Construct the matrix and RHS vector arbitrarily.
Compute the inverse of \(\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}\) manually using LU decomposition.
7. Summary
Key Formulas & Convergence Rates
Bisection: \(x_r = \frac{x_l + x_u}{2}\) | Linear Convergence \(O(2^{-n})\)
False Position: \(x_r = x_u - \frac{f(x_u)(x_l - x_u)}{f(x_l) - f(x_u)}\) | Superlinear typically, but can be slow