1. Home
  2. Explore
  3. Mathematics
  4. Introduction to Numerical Methods

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Numerical Methods

Numerical Methods: Study Notes

1. What Numerical Methods Do

Numerical methods are systematic procedures for finding approximate solutions to mathematical problems. They are especially useful when an exact solution is difficult to calculate, takes too long to obtain, or cannot be expressed analytically.

Analytical and numerical solutions

  • An analytical solution uses mathematical reasoning and algebraic steps to find an exact answer. For example, solving x+1=0x+1=0x+1=0 gives x=−1x=-1x=−1 exactly.

  • A numerical solution uses calculations to produce an approximation. A method may test a value, measure how well it satisfies the problem, adjust it, and repeat until the approximation is sufficiently accurate.

Numerical methods therefore trade off computation time and accuracy: more calculations can often produce a more accurate result, but require more time.

For example, a numerical method applied to x+1=0x+1=0x+1=0 could test a guess such as x=0.5x=0.5x=0.5, observe that it does not make the left side equal zero, then choose further guesses. This approach would be unnecessary for such a simple equation, but it becomes valuable for complicated problems and computer-based calculations.

Numerical methods do not generally promise an exact answer. They provide an approximation whose accuracy can be controlled or assessed.


2. Systems of Linear Equations

A system of linear equations is a collection of related linear equations that share the same variables. The equations provide constraints that must be satisfied simultaneously.

Linear equations

An equation is linear when each term is either a constant or a constant multiplied by one variable. Examples include:

  • y=mx+by=mx+by=mx+b, the equation of a straight line.

  • a1x1+a2x2+b=0a_1x_1+a_2x_2+b=0a1​x1​+a2​x2​+b=0, where the aia_iai​ values and bbb are constants.

Terms such as x2x^2x2, xyxyxy, or sin⁡(x)\sin(x)sin(x) make an equation nonlinear.

The equations in a system should be independent: one should not simply be obtainable from another by basic algebraic rearrangement. For instance, x+7=0x+7=0x+7=0 and x=−7x=-7x=−7 express the same constraint, so they do not provide two independent equations.

What it means to solve a system

To solve a system is to find values for all unknown variables that satisfy every equation. The collection of all such assignments is called the solution set.

A system can have:

  • One unique solution: all equations are satisfied at one point.

  • Infinitely many solutions: the constraints overlap or leave one or more variables free.

  • No solution: the equations are inconsistent, so no point satisfies them all.

The number of equations and unknowns matters, but it does not by itself determine the number of solutions. In particular, having more unknowns than equations prevents a unique determination in the usual setting, but the system may still be consistent and have infinitely many solutions.

Matrix form

A linear system can be written compactly as

Ax=b,A\mathbf{x}=\mathbf{b},Ax=b,

where:

  • AAA is the coefficient matrix, containing the coefficients of the unknowns.

  • x\mathbf{x}x is the unknown vector, containing the variables.

  • b\mathbf{b}b is the constant vector, containing the right-hand-side values.

The rows of AAA correspond to equations; its columns correspond to variables. Thus, a system with mmm equations and nnn unknowns has an m×nm \times nm×n coefficient matrix.

An augmented matrix displays the coefficients and constants together:

[A∣b].[A\mid \mathbf{b}].[A∣b].

It represents the same system as Ax=bA\mathbf{x}=\mathbf{b}Ax=b, but makes row operations easier to organize.


3. Singular Matrices and Determinants

A singular matrix is a square matrix that is not invertible. A square matrix has the same number of rows and columns.

For a square matrix AAA, singularity is equivalent to

det⁡(A)=0.\det(A)=0.det(A)=0.

A nonsingular matrix has a nonzero determinant and is invertible.

Why singularity matters for linear systems

For a square system Ax=bA\mathbf{x}=\mathbf{b}Ax=b:

  • If AAA is nonsingular, there is a unique solution for every b\mathbf{b}b.

  • If AAA is singular, the system cannot have a unique solution: for a given b\mathbf{b}b, it may have no solution or infinitely many solutions.

Geometrically, two or more equations may describe overlapping constraints or constraints that never meet at one common point.

Geometric meaning of the determinant

The determinant measures how a linear transformation scales area in two dimensions or volume in three dimensions. More generally, its absolute value represents the factor by which the transformation scales volume.

For example, if a transformation scales one direction by 222 and another by 444, it scales area by 888, so its determinant has magnitude 888. If the determinant is zero, the transformation collapses area or volume into a lower-dimensional shape. This loss of dimension is associated with dependence among the matrix’s rows or columns and the failure of invertibility.

The determinant is especially straightforward to compute for triangular matrices: it is the product of the diagonal entries. If any diagonal entry is zero, the determinant is zero.


4. Special Matrix Forms and Substitution

Numerical methods often transform a system into a matrix form that is easier to solve.

Identity matrix

An identity matrix has ones on the main diagonal and zeros everywhere else. If the system is written as

Ix=b,I\mathbf{x}=\mathbf{b},Ix=b,

then each unknown is already given by its corresponding entry in b\mathbf{b}b.

Diagonal matrix

A diagonal matrix has nonzero entries only on its main diagonal. For

Dx=b,D\mathbf{x}=\mathbf{b},Dx=b,

each equation contains only one unknown, so each variable can be found by dividing the corresponding constant by the corresponding diagonal coefficient.

Upper triangular matrix

An upper triangular matrix has zeros below its main diagonal. Its final equation can be solved first, because it contains only the last unknown. The result is substituted into the equation above it, and the process continues upward.

This procedure is called backward substitution.

Lower triangular matrix

A lower triangular matrix has zeros above its main diagonal. Its first equation can be solved first, then substituted into the next equation. The process continues downward.

This procedure is called forward substitution.

Identity and diagonal forms are easy to solve, but transforming a system into them can require more work than forming a triangular matrix. Triangular systems are therefore common targets of direct solution methods.


5. Gaussian Elimination

Gaussian elimination transforms a system into upper triangular form using row operations. Backward substitution then produces the solution.

Constructing an augmented matrix

For a system with three unknowns, each row of the augmented matrix contains the coefficients of one equation followed by its constant. The variable columns should be kept in a consistent order, such as xxx, yyy, then zzz.

Elimination procedure

For each pivot column, the goal is to make every entry below the pivot equal to zero.

  1. Write the system as an augmented matrix.

  2. Select a pivot in the first column.

  3. Use row operations to eliminate the entries below that pivot.

  4. Move diagonally to the next pivot and repeat for the remaining columns.

  5. Once the matrix is upper triangular, use backward substitution.

A typical elimination operation has the form

Ri←Ri−mikRk,mik=aikakk,R_i \leftarrow R_i-m_{ik}R_k, \qquad m_{ik}=\frac{a_{ik}}{a_{kk}},Ri​←Ri​−mik​Rk​,mik​=akk​aik​​,

where row kkk contains the pivot, row iii is being changed, and mikm_{ik}mik​ is chosen to cancel the target entry.

The same row operation must be applied to the entire row, including its constant entry. Otherwise, the transformed matrix would represent a different system.

Row swaps and zero pivots

Rows may be swapped without changing the solution set, because this only changes the order in which the equations are presented.

A zero on the main diagonal cannot be used as a divisor in the elimination calculation. A row swap may move a nonzero entry into the pivot position. If no suitable pivot can be found, further rank analysis is needed; a zero pivot alone does not automatically prove that the original matrix is singular.

Back substitution and checking

After elimination, solve the last equation first and substitute upward. The resulting values should be checked by substituting them into the original equations. Each equation’s left-hand side should match its right-hand side.

For instance, the two-equation example in the source reduces to 3y=−23y=-23y=−2, giving y=−23y=-\frac{2}{3}y=−32​, and then x=3x=3x=3. Substitution into both original equations confirms the result.


6. Partial Pivoting

Partial pivoting improves numerical stability during elimination. Before using a pivot, it compares the pivot’s magnitude with the magnitudes of entries below it in the same column. If a larger-magnitude entry is available, the corresponding rows are swapped.

At pivot step kkk, the selected pivot is typically the entry with the largest absolute value among the eligible entries in column kkk:

∣apk∣=max⁡i≥k∣aik∣.|a_{pk}|=\max_{i\geq k}|a_{ik}|.∣apk​∣=maxi≥k​∣aik​∣.

The row containing this entry is swapped into the pivot position.

Why pivoting helps

Elimination divides by pivot values. Dividing by a very small number can amplify rounding or truncation error. Selecting a larger-magnitude pivot generally reduces this risk and avoids dividing by zero when a suitable nonzero entry is available.

Partial pivoting changes row order, not variable order. Complete or full pivoting may also rearrange columns, which changes the variable order and therefore requires tracking that rearrangement.

Pivoting adds calculations, so it is not primarily a way to make the algorithm faster. Its main purpose is to improve the reliability of the numerical result.


7. LU Factorization

LU factorization, also called LU decomposition, expresses a matrix as a product of a lower triangular matrix and an upper triangular matrix:

A=LU.A=LU.A=LU.

Here, UUU is the upper triangular matrix produced by elimination, while LLL records the elimination multipliers in a lower triangular matrix.

Solving a system with LU

To solve Ax=bA\mathbf{x}=\mathbf{b}Ax=b using A=LUA=LUA=LU:

LUx=b.LU\mathbf{x}=\mathbf{b}.LUx=b.

Introduce an intermediate vector y\mathbf{y}y satisfying

Ly=b,Ux=y.L\mathbf{y}=\mathbf{b}, \qquad U\mathbf{x}=\mathbf{y}.Ly=b,Ux=y.

Then:

  1. Solve Ly=bL\mathbf{y}=\mathbf{b}Ly=b using forward substitution.

  2. Solve Ux=yU\mathbf{x}=\mathbf{y}Ux=y using backward substitution.

Why factorization can save work

Gaussian elimination’s factorization of AAA can be expensive. If AAA stays the same while b\mathbf{b}b changes, its LLL and UUU factors can be reused. Only the forward- and backward-substitution calculations need to be repeated for each new right-hand side.

For standard elimination without row permutations,

det⁡(A)=det⁡(L)det⁡(U).\det(A)=\det(L)\det(U).det(A)=det(L)det(U).

Because triangular-matrix determinants equal the products of their diagonal entries, this can make the determinant straightforward to calculate. If pivoting is used, the row permutations must also be accounted for.


8. Direct and Iterative Numerical Methods

Direct methods

A direct method follows a finite sequence of operations to obtain a solution, subject to numerical round-off. Gaussian elimination and LU factorization are examples.

  • The algorithm has a prescribed sequence of steps.

  • Completing those steps produces a solution or reveals that the system lacks a unique solution.

  • Direct methods are often effective for small or moderately sized systems.

  • They may be computationally costly or memory-intensive for very large systems.

Iterative methods

An iterative method begins with an initial guess and repeatedly improves it.

  • Each iteration produces a new approximation.

  • The process can stop once the error is within an acceptable tolerance.

  • A good initial guess may reduce the number of iterations.

  • Iteration does not automatically guarantee convergence; the method and problem must be suitable.

Iterative methods are often useful for large systems because they update estimates repeatedly rather than carrying out a full direct factorization. A method’s success depends on whether the estimates converge to a solution.


9. Iterative Solution of Linear Systems

For a linear system Ax=bA\mathbf{x}=\mathbf{b}Ax=b, the iiith equation is

∑j=1naijxj=bi.\sum_{j=1}^{n}a_{ij}x_j=b_i.∑j=1n​aij​xj​=bi​.

An iterative method constructs updated estimates of the unknowns. A common approach rearranges each equation to solve for one variable and then uses existing estimates for the other variables.

The discrepancy between a trial vector x\mathbf{x}x and the system is measured by its residual:

r=b−Ax.\mathbf{r}=\mathbf{b}-A\mathbf{x}.r=b−Ax.

A solution estimate is satisfactory when the residual, or another specified error measure, is sufficiently small.

Diagonal dominance

A matrix is strictly diagonally dominant by rows if, for every row iii,

∣aii∣>∑j≠i∣aij∣.|a_{ii}|>\sum_{j\ne i}|a_{ij}|.∣aii​∣>∑j=i​∣aij​∣.

A commonly used, weaker form requires

∣aii∣≥∑j≠i∣aij∣|a_{ii}|\geq \sum_{j\ne i}|a_{ij}|∣aii​∣≥∑j=i​∣aij​∣

for every row, with strict inequality in at least one row. Strict row diagonal dominance is a standard sufficient condition for convergence of Jacobi and Gauss–Seidel iteration. The weaker condition alone is not a universal convergence guarantee for every matrix; further conditions may be needed.

To test a row, compare the absolute value of its diagonal entry with the sum of the absolute values of the other entries in that row. The comparison is made separately for every row.


10. Jacobi Iteration

Jacobi iteration updates every unknown using values from the previous iteration only. For aii≠0a_{ii}\ne0aii​=0, rearrange row iii to obtain

xi(k+1)=1aii(bi−∑j≠iaijxj(k)).x_i^{(k+1)} = \frac{1}{a_{ii}} \left( b_i-\sum_{j\ne i}a_{ij}x_j^{(k)} \right).xi(k+1)​=aii​1​(bi​−∑j=i​aij​xj(k)​).

The superscript kkk identifies the iteration. All values on the right-hand side come from iteration kkk, and all new values are calculated for iteration k+1k+1k+1.

Procedure

  1. Choose an initial estimate, often x(0)=0\mathbf{x}^{(0)}=\mathbf{0}x(0)=0 if no better estimate is available.

  2. Rearrange each equation to solve for a different unknown.

  3. Use all values from iteration kkk to calculate every value in iteration k+1k+1k+1.

  4. Repeat until the solution or residual error is within the required tolerance.

A better initial estimate can reduce the number of iterations. If the system is singular or the iteration diverges, the estimates will not approach a unique solution. Diagonal dominance can provide a useful convergence guarantee under the standard strict condition.

Checking convergence

One way to monitor convergence is to calculate the residual after each iteration. For a small system, the left- and right-hand sides of each original equation can be compared after inserting the current estimates.

In the hand-worked example, the estimates are checked over five iterations, and the residual of a representative equation moves closer to zero. Spreadsheet examples use a tolerance of 0.0050.0050.005 and report that the chosen stopping criterion is reached after 20 iterations.


11. Gauss–Seidel Iteration

Gauss–Seidel iteration is similar to Jacobi iteration, but it uses each newly calculated value immediately within the same iteration.

For a system ordered from variables x1x_1x1​ through xnx_nxn​,

xi(k+1)=1aii(bi−∑j<iaijxj(k+1)−∑j>iaijxj(k)).x_i^{(k+1)} = \frac{1}{a_{ii}} \left( b_i -\sum_{j<i}a_{ij}x_j^{(k+1)} -\sum_{j>i}a_{ij}x_j^{(k)} \right).xi(k+1)​=aii​1​(bi​−∑j<i​aij​xj(k+1)​−∑j>i​aij​xj(k)​).

Values for variables earlier in the ordering come from the current iteration; values later in the ordering still come from the previous iteration.

Difference from Jacobi

  • Jacobi: calculates all new values using only the previous iteration.

  • Gauss–Seidel: immediately reuses new values as they become available.

This reuse often leads to faster convergence, although it does not guarantee that every problem will converge. Both methods commonly benefit from diagonal dominance and a reasonable initial estimate.

The procedure is to choose initial values, rearrange each equation to isolate one unknown, calculate variables in sequence using the newest available values, and repeat until the error is acceptable.


12. Spreadsheets and Programming for Iterative Methods

Jacobi and Gauss–Seidel calculations can be performed by hand, but repeated arithmetic is tedious and makes errors easier. A spreadsheet or program can automate the iterations.

General spreadsheet setup

  • Store the coefficients of AAA and the constants of b\mathbf{b}b in fixed cells.

  • Create columns for the current estimates, iteration number, and error or residual.

  • Enter the rearranged equation for each variable.

  • Copy the formulas down to create further iterations.

  • Compare the residuals with a selected tolerance to determine when to stop.

Spreadsheet references to fixed coefficients must remain fixed when formulas are copied. In Excel or Google Sheets, absolute cell references serve this purpose.

Program structure

A program can store the coefficient matrix, right-hand side, initial guess, and tolerance, then run the appropriate update equations repeatedly. The stopping condition should be based on a defined error measure, and an iteration limit is useful to prevent an endless loop if convergence fails.

The examples demonstrate implementations in Excel and Google Sheets, with a target accuracy of 0.0050.0050.005. Their layouts can be expanded for larger systems by adding the required variables and equations.


13. Nonlinear Equations and Root Finding

A nonlinear equation contains at least one term that is not a constant or a constant multiplied by a single variable. Examples include x2x^2x2, xyxyxy, and exe^xex.

Solving a nonlinear equation f(x)=0f(x)=0f(x)=0 means finding a root, also called a zero, where the graph crosses or touches the xxx-axis.

A quadratic equation is a familiar example: the quadratic formula gives the roots of a particular class of nonlinear functions. Numerical root-finding methods extend the idea to functions that may not have a convenient exact formula for their roots.

Root-finding methods are commonly divided into closed methods and open methods.

Closed methods

A closed method begins with an interval whose endpoints lie on opposite sides of a root. If f(a)f(a)f(a) and f(b)f(b)f(b) have opposite signs, then a continuous function has at least one root in [a,b][a,b][a,b].

A common test is

f(a)f(b)<0.f(a)f(b)<0.f(a)f(b)<0.

Closed methods repeatedly narrow the interval. Bisection and false position are examples.

They are generally robust when the interval contains one suitable root, but may converge more slowly than open methods. An interval containing multiple roots can make it difficult to identify or isolate the desired root.

Open methods

An open method begins from one or more initial estimates rather than a guaranteed bracketing interval. Newton’s method and the secant method are examples; fixed-point iteration is another open approach.

Open methods can converge rapidly, but they may diverge or approach an unintended root if the initial estimates are unsuitable. A graph of the function can help identify useful starting values and reveal whether a proposed interval contains more than one root.


14. The Bisection Method

The bisection method is a closed root-finding method. It repeatedly halves an interval that brackets a root.

Suppose f(a)f(b)<0f(a)f(b)<0f(a)f(b)<0. Define the midpoint

c=a+b2.c=\frac{a+b}{2}.c=2a+b​.

Then evaluate f(c)f(c)f(c):

  • If f(a)f(c)<0f(a)f(c)<0f(a)f(c)<0, the root remains in [a,c][a,c][a,c]; replace bbb by ccc.

  • If f(b)f(c)<0f(b)f(c)<0f(b)f(c)<0, the root remains in [c,b][c,b][c,b]; replace aaa by ccc.

  • If f(c)=0f(c)=0f(c)=0, the midpoint is an exact root.

Repeat until the interval is sufficiently small or the midpoint’s residual is sufficiently low. The interval width is ∣b−a∣|b-a|∣b−a∣; the midpoint’s maximum distance from a root known to lie in that interval is at most half the interval width.

Strengths and limitations

  • The method is reliable when the function is continuous and the initial interval brackets a root.

  • Each iteration halves the interval width.

  • It requires a valid initial interval.

  • It does not identify which root is intended if the interval contains multiple roots.

Worked example pattern

For

f(x)=4x2+3x−3,f(x)=4x^2+3x-3,f(x)=4x2+3x−3,

the interval [0,1][0,1][0,1] brackets the positive root because the endpoint function values have opposite signs. The method repeatedly calculates midpoints and retains the half-interval whose endpoint values have opposite signs. After five iterations, the interval has narrowed to a width of 0.031250.031250.03125, meeting an error target of 0.050.050.05. The positive root is approximately 0.5690.5690.569.

Spreadsheet and code implementations

A spreadsheet can keep columns for aaa, bbb, ccc, f(a)f(a)f(a), f(b)f(b)f(b), f(c)f(c)f(c), the updated bounds, and the interval width. An IF formula can select which endpoint to replace based on the sign test.

A program follows the same logic in a loop: calculate the midpoint, test which half contains the sign change, update the bounds, and stop when the error criterion is met. Before proceeding, it should confirm that the endpoints actually bracket a root and handle cases where an endpoint is itself a root.


15. The False Position Method

The false position method, also known as regula falsi, is a closed method that retains a bracketing interval but estimates the next point using a straight line rather than the midpoint.

Given endpoints (a,f(a))(a,f(a))(a,f(a)) and (b,f(b))(b,f(b))(b,f(b)), draw the line through them and find where it crosses the xxx-axis. The intercept is

c=b−f(b)(b−a)f(b)−f(a)=a−f(a)(b−a)f(b)−f(a).c = b-\frac{f(b)(b-a)}{f(b)-f(a)} = a-\frac{f(a)(b-a)}{f(b)-f(a)}.c=b−f(b)−f(a)f(b)(b−a)​=a−f(b)−f(a)f(a)(b−a)​.

After evaluating f(c)f(c)f(c):

  • If f(a)f(c)<0f(a)f(c)<0f(a)f(c)<0, replace bbb with ccc.

  • If f(b)f(c)<0f(b)f(c)<0f(b)f(c)<0, replace aaa with ccc.

  • If f(c)=0f(c)=0f(c)=0, a root has been found.

The retained endpoints continue to bracket a root. A stopping criterion can use the change between successive estimates, ∣ck+1−ck∣|c_{k+1}-c_k|∣ck+1​−ck​∣, the interval width, or the residual ∣f(ck)∣|f(c_k)|∣f(ck​)∣.

Comparison with bisection

False position often makes a more targeted estimate than bisection and may converge in fewer iterations. However, it can make little progress if one endpoint remains fixed while the other repeatedly moves. Both methods require an initial interval that brackets the root and can be complicated by multiple roots in that interval.

For f(x)=4x2+3x−3f(x)=4x^2+3x-3f(x)=4x2+3x−3, the source example begins with [0,1][0,1][0,1]. The secant-line intercept gives a new estimate, and the sign test identifies which boundary to replace.

Spreadsheet and code implementations

A spreadsheet can store the current endpoints, endpoint function values, false-position estimate, function value at that estimate, and error. A program repeatedly calculates the intercept, updates the endpoint that preserves the sign change, and stops when the chosen error threshold is reached.

A robust implementation should check that the initial endpoints bracket a root and that the denominator f(b)−f(a)f(b)-f(a)f(b)−f(a) is not zero.


16. Newton’s Method

Newton’s method is an open root-finding method that uses the tangent line at the current estimate to produce a new estimate. It is derived from a first-order Taylor approximation.

At a current estimate xkx_kxk​, the tangent approximation is

f(x)≈f(xk)+f′(xk)(x−xk).f(x)\approx f(x_k)+f'(x_k)(x-x_k).f(x)≈f(xk​)+f′(xk​)(x−xk​).

Set the tangent approximation equal to zero and solve for its xxx-intercept. This gives

xk+1=xk−f(xk)f′(xk).x_{k+1}=x_k-\frac{f(x_k)}{f'(x_k)}.xk+1​=xk​−f′(xk​)f(xk​)​.

Thus each iteration requires both f(xk)f(x_k)f(xk​) and f′(xk)f'(x_k)f′(xk​).

Procedure and behavior

  1. Choose an initial estimate x0x_0x0​.

  2. Evaluate the function and its derivative at the current estimate.

  3. Apply the Newton update.

  4. Repeat until the change in the estimate or the residual is sufficiently small.

Newton’s method can converge very quickly near a suitable root. However, it may diverge or behave poorly when the initial estimate is unsuitable, when the derivative is zero or very small, or when the function’s shape makes the tangent update move away from the root.

Example: solving x2−2=0x^2-2=0x2−2=0

For f(x)=x2−2f(x)=x^2-2f(x)=x2−2, the derivative is f′(x)=2xf'(x)=2xf′(x)=2x. Starting with x0=2x_0=2x0​=2:

  • The first updated estimate is x1=1.5x_1=1.5x1​=1.5.

  • The second is approximately x2=1.4167x_2=1.4167x2​=1.4167.

  • The third is approximately x3=1.4142x_3=1.4142x3​=1.4142.

These estimates approach the root 2\sqrt{2}2​.

Spreadsheet and programming implementations

A spreadsheet can track the iteration number, current estimate, function value, and derivative value. The new estimate is calculated with Newton’s update and becomes the next row’s current estimate.

A program can accept the function, derivative, initial estimate, and iteration limit. It repeatedly updates the estimate. It should account for a zero derivative and ideally use a tolerance-based stopping condition rather than relying only on a fixed number of iterations. Plotting the function can help select an initial estimate, but cannot guarantee convergence.


17. The Secant Method

The secant method is an open root-finding method similar to Newton’s method, but it estimates the derivative using two recent points instead of requiring an explicit derivative.

Given estimates xk−1x_{k-1}xk−1​ and xkx_kxk​, approximate the slope by

f(xk)−f(xk−1)xk−xk−1.\frac{f(x_k)-f(x_{k-1})}{x_k-x_{k-1}}.xk​−xk−1​f(xk​)−f(xk−1​)​.

The resulting secant-line intercept gives the next estimate:

xk+1=xk−f(xk)xk−xk−1f(xk)−f(xk−1).x_{k+1} = x_k - f(x_k) \frac{x_k-x_{k-1}}{f(x_k)-f(x_{k-1})}.xk+1​=xk​−f(xk​)f(xk​)−f(xk−1​)xk​−xk−1​​.

Procedure and behavior

The method requires two initial estimates. It evaluates the function at both, calculates the next secant intercept, then replaces the older estimates with the latest pair and repeats.

  • Unlike Newton’s method, it does not require f′(x)f'(x)f′(x).

  • It is often faster than closed methods.

  • It may be less predictable than a bracketing method and can diverge.

  • The denominator must not be zero; estimates with nearly equal function values can also cause numerical difficulties.

Example: solving x2−3=0x^2-3=0x2−3=0

Using initial estimates x0=1x_0=1x0​=1 and x1=3x_1=3x1​=3, successive secant estimates include approximately 1.51.51.5, 1.6671.6671.667, and 1.7271.7271.727. These approach the positive root 3≈1.732\sqrt{3}\approx1.7323​≈1.732.

Spreadsheet and program implementations track two consecutive estimates and their function values. Each new estimate replaces the older pair in the next iteration.


18. Fixed-Point Iteration

Fixed-point iteration converts a root-finding problem into an equation of the form

x=g(x).x=g(x).x=g(x).

A fixed point is a value x∗x^\astx∗ satisfying x∗=g(x∗)x^\ast=g(x^\ast)x∗=g(x∗). To use the method:

  1. Rewrite f(x)=0f(x)=0f(x)=0 as x=g(x)x=g(x)x=g(x).

  2. Choose an initial estimate x0x_0x0​.

  3. Calculate successive values using

    xk+1=g(xk).x_{k+1}=g(x_k).xk+1​=g(xk​).
  4. Continue until successive values are sufficiently close or the residual is small.

A root of fff can be a fixed point of a suitable rearrangement, but different rearrangements of the same equation may behave very differently.

Convergence condition

A common local convergence condition is that ∣g′(x)∣<1|g'(x)|<1∣g′(x)∣<1 in an interval around the fixed point. If ∣g′(x∗)∣>1|g'(x^\ast)|>1∣g′(x∗)∣>1, nearby estimates tend to move away from the fixed point. The condition must hold in an appropriate neighborhood; checking only a distant value is not enough.

The magnitude of the slope explains the behavior:

  • If the graph of ggg is locally flatter than the line y=xy=xy=x, successive substitutions tend to approach their intersection.

  • If it is locally steeper in magnitude, the substitutions tend to move away.

Example: e0.5x−x−2=0e^{0.5x}-x-2=0e0.5x−x−2=0

This equation can be rearranged in more than one way, including

x=e0.5x−2x=e^{0.5x}-2x=e0.5x−2

and

x=2ln⁡(x+2),x=2\ln(x+2),x=2ln(x+2),

where the logarithmic rearrangement requires x+2>0x+2>0x+2>0.

The rearrangements need not have the same convergence behavior. The source example finds that the exponential form can converge from a suitable initial estimate, while the logarithmic form is unsuitable near the root because its slope magnitude is too large.

Using g(x)=e0.5x−2g(x)=e^{0.5x}-2g(x)=e0.5x−2 with x0=2x_0=2x0​=2 gives successive estimates approaching approximately −1.51-1.51−1.51. The root is about −1.51-1.51−1.51; the sequence’s reported estimate near −1.519-1.519−1.519 has a relative error of roughly 3.6%3.6\%3.6%. A different initial estimate can converge faster or diverge, so the rearrangement and starting value both matter.


19. Interpolation

Interpolation estimates values between known data points. Given discrete observations, an interpolating function passes through the supplied points and can be evaluated at intermediate inputs.

For example, if the temperature of water is measured at several times, an interpolating function can estimate the temperature at a time between measurements. Recording every possible value may be impractical, so interpolation provides estimates for the gaps between observations.

Interpolation should be distinguished from extrapolation:

  • Interpolation: estimates within the range of known data.

  • Extrapolation: estimates beyond the range of known data and is generally less reliable.

Different interpolation methods construct different functions. The choice of method affects the behavior between the data points.


20. Lagrange Polynomial Interpolation

A Lagrange polynomial is a polynomial constructed to pass through a given set of data points. If there are nnn data points with distinct inputs, the interpolating polynomial has degree at most n−1n-1n−1.

For points (xi,yi)(x_i,y_i)(xi​,yi​), the polynomial is

P(x)=∑j=0n−1yjLj(x),P(x)=\sum_{j=0}^{n-1} y_jL_j(x),P(x)=∑j=0n−1​yj​Lj​(x),

where

Lj(x)=∏k=0k≠jn−1x−xkxj−xk.L_j(x)= \prod_{\substack{k=0\\k\ne j}}^{n-1} \frac{x-x_k}{x_j-x_k}.Lj​(x)=∏k=0k=j​n−1​xj​−xk​x−xk​​.

Each basis polynomial Lj(x)L_j(x)Lj​(x) equals 111 at xjx_jxj​ and 000 at the other data inputs. Consequently, P(xj)=yjP(x_j)=y_jP(xj​)=yj​ for every supplied point.

Degree and construction

  • Two points produce a polynomial of degree at most 111, a straight line.

  • Three points produce a polynomial of degree at most $2`.

  • Four points produce a polynomial of degree at most $3`.

Each data point contributes one term to the sum. In the jjjth term, the factors for k=jk=jk=j are omitted; including one would make the denominator zero.

Checking an interpolant

Substituting each known input xix_ixi​ into the polynomial should reproduce its corresponding output yiy_iyi​. This is an important arithmetic check.

Examples from the source

  • One first-order example simplifies to P(x)=5x−5P(x)=5x-5P(x)=5x−5 and gives P(2.2)=6P(2.2)=6P(2.2)=6.

  • A second-order example gives

    P(x)=−0.25x2+3x+1.25,P(x)=-0.25x^2+3x+1.25,P(x)=−0.25x2+3x+1.25,

    and therefore P(2.5)=7.1875P(2.5)=7.1875P(2.5)=7.1875.

  • A third-order example gives the rounded polynomial

    P(x)≈0.25x3−1.5833x2+5x+0.33,P(x)\approx0.25x^3-1.5833x^2+5x+0.33,P(x)≈0.25x3−1.5833x2+5x+0.33,

    with an estimated output of approximately 7.8337.8337.833 at x=3x=3x=3.

The coefficients in these examples depend on their supplied data points. The central procedure is to form the appropriate polynomial, substitute the data, simplify, evaluate at the requested input, and check that the polynomial passes through the original points.


21. Newton Polynomials and Divided Differences

Newton polynomial interpolation also constructs a polynomial through the supplied data points. Its coefficients are calculated using divided differences.

For ordered inputs x0,x1,…,xnx_0,x_1,\ldots,x_nx0​,x1​,…,xn​, a Newton interpolating polynomial has the form

Pn(x)=f[x0]+f[x0,x1](x−x0)+f[x0,x1,x2](x−x0)(x−x1)+⋯+f[x0,…,xn]∏j=0n−1(x−xj).P_n(x) = f[x_0] +f[x_0,x_1](x-x_0) +f[x_0,x_1,x_2](x-x_0)(x-x_1) +\cdots +f[x_0,\ldots,x_n]\prod_{j=0}^{n-1}(x-x_j).Pn​(x)=f[x0​]+f[x0​,x1​](x−x0​)+f[x0​,x1​,x2​](x−x0​)(x−x1​)+⋯+f[x0​,…,xn​]∏j=0n−1​(x−xj​).

The coefficients f[x0]f[x_0]f[x0​], f[x0,x1]f[x_0,x_1]f[x0​,x1​], and higher-order terms are divided differences.

Divided-difference definitions

For the data values f(xi)f(x_i)f(xi​):

f[xi]=f(xi),f[x_i]=f(x_i),f[xi​]=f(xi​),

and the first divided difference is

f[xi,xi+1]=f(xi+1)−f(xi)xi+1−xi.f[x_i,x_{i+1}] = \frac{f(x_{i+1})-f(x_i)} {x_{i+1}-x_i}.f[xi​,xi+1​]=xi+1​−xi​f(xi+1​)−f(xi​)​.

Higher-order divided differences are computed recursively:

f[xi,…,xi+k]=f[xi+1,…,xi+k]−f[xi,…,xi+k−1]xi+k−xi.f[x_i,\ldots,x_{i+k}] = \frac{ f[x_{i+1},\ldots,x_{i+k}] - f[x_i,\ldots,x_{i+k-1}] }{ x_{i+k}-x_i }.f[xi​,…,xi+k​]=xi+k​−xi​f[xi+1​,…,xi+k​]−f[xi​,…,xi+k−1​]​.

Divided-difference tables

A table places the data inputs and outputs in the first columns, then calculates successive divided differences. The first entry at each increasing order provides the corresponding coefficient in the Newton polynomial.

This recursive structure is an important advantage: if a new data point is added, the existing polynomial terms can be retained and a new higher-order term appended, rather than rebuilding the entire expression from scratch.

Example: first-order interpolation

The source’s two-point example produces a first-order coefficient of 53\frac{5}{3}35​ and an initial value of 43\frac{4}{3}34​. The resulting polynomial is

P(x)=53x+43.P(x)=\frac{5}{3}x+\frac{4}{3}.P(x)=35​x+34​.

At x=2x=2x=2, it gives

P(2)=143≈4.667.P(2)=\frac{14}{3}\approx4.667.P(2)=314​≈4.667.

Example: second-order interpolation

For three data points, the source example calculates first-order divided differences of 222 and −0.25-0.25−0.25, followed by a second-order divided difference of −0.375-0.375−0.375. The resulting polynomial is

P(x)=−0.375x2+3.5x−1.125.P(x)=-0.375x^2+3.5x-1.125.P(x)=−0.375x2+3.5x−1.125.

At x=4x=4x=4, the output is 6.8756.8756.875. As with Lagrange interpolation, substituting each known input should reproduce its supplied output.

Lagrange and Newton forms

Both methods produce an interpolating polynomial through the same data. Lagrange form presents the polynomial directly as a weighted sum of basis polynomials. Newton form uses recursively computed divided differences and is convenient when points are added incrementally.


Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent