Numerical Methods — Class Notes — 2021.02
1. Root Finding
1.1 Existence Theorem
Let
If
then there exists at least one
note: "If f(a)f(b)<0, the Existence Theorem applies."
Why this works: The condition
1.2 Uniqueness Theorem
Under the same hypothesis, if
note: "If f'(x) exists and preserves sign in the interval, the interval contains ONE UNIQUE zero of f(x)."
Why this works: A sign-preserving derivative means
1.3 Stopping Criteria
Two standard criteria for declaring a root found:
Criterion 1 — Function tolerance:
Criterion 2 — Interval tolerance:
If the containing interval is sufficiently small,
note: "ε is the tolerance / precision of the solution."
Practical note: Criterion 1 checks how close
2. Interval Methods
These methods require an initial bracket
2.1 Incremental Search
note: "For each value x, increment until the sign of f(x) changes (stopping criterion). When a sign change occurs, the Existence Theorem applies."
Algorithm concept:
- Start at
$x = a$ - Increment by step
$h$ :$x_{i+1} = x_i + h$ - Check sign change:
$f(x_i) \cdot f(x_{i+1}) < 0$ - When detected, the root lies in
$[x_i, x_{i+1}]$
Variants:
- Fix
$a$ and increase only$b$ until the sign changes - Define a maximum number of iterations
Trade-off: Smaller
2.2 Bisection Method
Based directly on the Existence Theorem.
At each iteration, compute the midpoint:
Update the interval:
note: "Each iteration divides the interval [a,b]. meio = a+b/2."
Convergence analysis: After
The root is guaranteed to be found within this interval. The number of iterations needed to achieve tolerance
Strengths: Simple, robust, always converges.
Weaknesses: Slow (linear convergence); halves the interval each step regardless of function shape.
2.3 False Position Method (Regula Falsi)
Instead of the midpoint, use the x-intercept of the secant line connecting
note: "x_k is the root of the line through the interval points; derived from solving a linear system."
Derivation: The line through
Setting
New interval:
Comparison with Bisection: False position tends to converge faster because it exploits the function's slope. However, for highly asymmetric functions one endpoint can remain fixed for many iterations (a known weakness called stagnation).
3. Open Methods
Open methods do not require a bracket. They may diverge, but when they converge, they do so much faster.
3.1 Newton's Method
Start with an initial guess
note: "x_k is the intersection point of the x-axis with the tangent line at x_{k-1}."
Derivation: Approximate
Setting
Convergence: Quadratic — the number of correct digits roughly doubles each iteration near the root.
Conditions for convergence: The method behaves well when:
- The initial guess is close to the root
-
$f'(x_k) \neq 0$ (no zero derivative) - The function is smooth near the root
note: "There is no guarantee it will converge."
3.2 Secant Method
Does not require the derivative — approximates it using two previous iterates.
Two initial guesses
note: "x_k is updated to the intersection of the x-axis with the secant line through x_{k-1} and x_{k-2}. Approximates f'(x) from Newton's method using past values."
Connection to Newton's method: The secant method replaces the derivative with a finite difference:
Convergence: Superlinear (order
4. Linear Systems
Goal: Find
where
4.1 Elementary Row Operations
note: "GAAV — Elementary Operations."
- Swap two rows
- Multiply a row by a nonzero constant
$c \neq 0$ - Add a multiple of one row to another
These operations transform the system into an equivalent one (same solution set) and are the foundation of all elimination methods.
4.2 Cramer's Rule
where
note: "Computationally expensive — requires n+1 determinant calculations."
Complexity:
4.3 Matrix Inverse Method
note: "Not efficient in computational terms; computing inverses generates numerical errors for large-dimension systems."
Computing
5. Direct Methods
Produce an exact solution (up to rounding error) in a finite number of operations.
5.1 Triangular Systems — $O(n^2)$
note: "Uses successive and back substitutions. Recursive solutions can be implemented since solving one row gives a partial result for the next."
Lower Triangular (Forward Substitution)
Elements above the diagonal are zero. Solved from top to bottom:
Upper Triangular (Back Substitution)
Elements below the diagonal are zero. Solved from bottom to top:
5.2 Gaussian Elimination
More general method. Transforms
note: "Uses an augmented matrix with coefficients on the left and constants on the right. Uses elementary operations to zero elements below the main diagonal."
Steps:
- Form the augmented matrix
$[A|B]$ - For each pivot column
$k$ , eliminate entries below the diagonal using:
$$m_{ik} = \frac{a_{ik}}{a_{kk}}, \quad R_i \leftarrow R_i - m_{ik} R_k$$ - Back-substitute to find the solution
Complexity:
5.3 Gauss–Jordan Method
Instead of stopping at upper triangular, eliminates elements above and below each pivot, transforming
note: "Uses more steps than Gauss. No back substitution needed. Pivot cannot be zero (PIVOTING PROBLEM)."
When the pivot
5.4 Pivoting Strategies
note: "The pivot a_kk also cannot be very small, because the multiplier m can become very large, generating rounding errors."
Partial Pivoting
At step
Swap rows
keeping multipliers bounded and reducing round-off error.
Total Pivoting
At step
Swap both the row and column. More numerically stable, but:
note: "High computational effort to find and swap the pivot. Column swapping affects variable ordering."
5.5 LU Decomposition
Factorize:
where
Solving
-
$Ly = B$ — solve by forward substitution -
$Ux = y$ — solve by back substitution
How to find
note: "U is the upper triangular result of the Gaussian elimination process. L is formed by the multipliers m_ij obtained during elimination; the main diagonal is unitary."
Why LU is advantageous:
note: "The LU decomposition can be more advantageous because we work directly with the coefficient matrix A (not the augmented), and to generalize the solution to a new constant vector it suffices to swap the B vector in the first step of solving Ly = B."
This means: factorize once ($O(n^3)$), then solve for any number of right-hand sides in
Determinant via LU
note: "The determinant of an upper triangular matrix is the product of its diagonal values. This is obtained almost for free."
6. Iterative Methods
Produce an approximate solution via a sequence:
starting from an initial guess
6.1 Jacobi Method
note: "(Obeys the row criterion)"
All updates in iteration
Matrix form:
6.2 Gauss-Seidel Method
note: "Takes advantage of the approximation made in the current step. Converges faster."
As soon as a new
6.3 Convergence Criterion — Row Criterion
For convergence of iterative methods,
note: "For each row, if the absolute value on the main diagonal is greater than or equal to the sum of the absolute values of all other elements in the row. You can also reorder rows to satisfy the criterion."
Intuition: Diagonal dominance ensures the "self-influence" of each variable is stronger than all cross-influences combined, preventing oscillation and guaranteeing convergence.
7. Polynomial Interpolation
note: "Approximation of functions whose mathematical form is unknown or difficult to compute, using a set of tabulated points/data. The discovered function is the interpolating polynomial."
Fundamental theorem: Given
Why unique? The Vandermonde matrix (coefficient matrix for the polynomial system) has nonzero determinant whenever all
note: "The matrix A of polynomial coefficients is called the Vandermonde matrix. Since no x_i (for equal degree) can be equal, the rows are linearly independent → det(A) ≠ 0 → unique polynomial!"
Basis for numerical integration.
7.1 Via Linear Systems (Vandermonde)
The polynomial:
For each given point
7.2 Lagrange Interpolation
where the Lagrange basis polynomials are:
Key property:
note: "The problem with Lagrange form is that when a new point is added, the Lagrange basis (which depends on the number of points) must be recomputed."
7.3 Newton Interpolation (Divided Differences)
Divided differences — recursive definition:
Newton's interpolating polynomial:
note: "Having n points, to extend the approximating polynomial to n+1 points it suffices to add the residual term."
Advantage over Lagrange: Adding a new point only requires computing one new divided difference and appending one term — no recomputation of previous terms.
8. Curve Fitting
Unlike interpolation (which passes through every point), curve fitting finds the best-fit function for a set of noisy data.
8.1 Least Squares (Linear Regression)
Deviation function:
note: "Used to compare model error."
Goal: Minimize
For a linear model
This yields the normal equations:
where
8.2 Coefficient of Determination
note: "The closer to 1, the better. Says how much the fitting variable corresponds to the result found."
9. Numerical Integration
Goal: Compute
when
note: "Approximate f through an interpolating polynomial. The integration over the polynomial interval will approximate the integral of the original function f."
9.1 Newton-Cotes Closed Formulas
Step size for
Node points:
note: "ATTENTION: points created from an increment of h are equidistant; if points are given as data, they MUST be equidistant."
Rectangle Rule (degree 0)
note: "Left approximation, considers f(a)."
Midpoint Rule (degree 0)
The rectangle height is evaluated at the midpoint instead of the endpoint, generally giving a better approximation.
Trapezoidal Rule (degree 1)
note: "To arrive at this equation we use Lagrange's method for the degree-1 interpolating polynomial before integrating. Like a trapezoid whose 'top' connects points a and b."
Error:
Simpson's 1/3 Rule (degree 2)
Requires three points:
note: "To arrive at this, we use Lagrange's method for the degree-2 polynomial."
Error:
Simpson's 3/8 Rule (degree 3)
Requires four points:
note: "To arrive at this, we use Lagrange's method for the degree-3 polynomial."
9.2 Composite Newton-Cotes
note: "It is not convenient to increase the polynomial degree; instead, break the original domain into segments/subintervals and apply the closed formulas repeatedly."
Divide
Composite Rectangle Rule
Composite Midpoint Rule
Composite Trapezoidal Rule
with Cotes weights:
Which expands to:
note: "c_i are the Cotes weights (values that multiply the f(x_i) functions)."
9.3 Gauss-Legendre Quadrature
note: "Does not depend on equidistant or fixed points. Freedom to choose points allows balancing sub- and over-estimation errors, more faithful to the exact value. Uses the method of undetermined coefficients from Calculus IV."
General form over
The nodes
2-Point Rule
Applying exactness conditions for polynomials up to degree 3 yields:
note: "Any integral from -1 to 1 satisfying the constraints has its exact result given by I."
For more points: A 3-point rule is exact for polynomials of degree 4 and 5. In general, an
Important requirement:
note: "Knowledge of the function definition is required, and it must be evaluated at specific points to balance the result. Experimental scattered data does not come from a mathematical form, so the function must be known."
This distinguishes Gauss quadrature from Newton-Cotes: it requires the ability to evaluate