Numerical Analysis

Math Preliminaries

Essential theorems from calculus that underpin numerical analysis methods.

1. Intermediate Value Theorem

Theorem Statement

If f is continuous on [a,b] and k is between f(a) and f(b),then c(a,b) such that f(c)=k\text{If } f \text{ is continuous on } [a,b] \text{ and } k \text{ is between } f(a) \text{ and } f(b), \\ \text{then } \exists \, c \in (a,b) \text{ such that } f(c) = k

In particular, if f(a)f(a) and f(b)f(b) have opposite signs, there exists a root cc where f(c)=0f(c) = 0.

Interactive Visualization

Custom function (press Enter or Apply)

Adjust the interval [a,b][a, b] to see when opposite signs guarantee a root.

Function curve
Interval endpoints
Root (when f(a)f(a) and f(b)f(b) have opposite signs)

Practice Problem

Given f(x)=x23f(x) = x^2 - 3, which interval contains a root?

2. Extreme Value Theorem

Theorem Statement

If f is continuous on [a,b], then f attains bothan absolute maximum and an absolute minimum on [a,b]\text{If } f \text{ is continuous on } [a,b], \text{ then } f \text{ attains both} \\ \text{an absolute maximum and an absolute minimum on } [a,b]

This guarantees that continuous functions on closed intervals have well-defined extrema.

Interactive Visualization

Function: f(x)=x2+4x1f(x) = -x^2 + 4x - 1 on [0,4][0, 4]. The maximum and minimum are highlighted.

Maximum point
Minimum point

3. Rolle's Theorem & Mean Value Theorem

Theorem Statements

Rolle's Theorem

If f(a)=f(b),f is continuous on [a,b] and differentiable on (a,b),then c(a,b) such that f(c)=0\text{If } f(a) = f(b), \, f \text{ is continuous on } [a,b] \text{ and differentiable on } (a,b), \\ \text{then } \exists \, c \in (a,b) \text{ such that } f'(c) = 0

Mean Value Theorem

If f is continuous on [a,b] and differentiable on (a,b),then c(a,b) such that f(c)=f(b)f(a)ba\text{If } f \text{ is continuous on } [a,b] \text{ and differentiable on } (a,b), \\ \text{then } \exists \, c \in (a,b) \text{ such that } f'(c) = \frac{f(b) - f(a)}{b - a}

MVT states there exists a point where the tangent is parallel to the secant line through endpoints.

Custom Function

Supported: + - * / ^ sin cos tan sqrt abs exp log ln pi e ( )

Interval [a, b]

Interactive Visualization

Adjust cc to find where the tangent line is parallel to the secant. Derivative computed numerically via central difference: f(x)f(x+h)f(xh)2hf'(x) \approx \frac{f(x+h)-f(x-h)}{2h}.

Secant line through endpoints
Tangent line at c

Example 1.3: Rolle's Theorem

Example 1.4: Mean Value Theorem

4. Taylor's Theorem

Theorem Statement

f(x)=k=0nf(k)(a)k!(xa)k+Rn(x)f(x) = \sum_{k=0}^{n} \frac{f^{(k)}(a)}{k!}(x-a)^k + R_n(x)

The Lagrange remainder is Rn(x)=f(n+1)(ξ)(n+1)!(xa)n+1R_n(x) = \dfrac{f^{(n+1)}(\xi)}{(n+1)!}(x-a)^{n+1} for some ξ between a and x.

Interactive Visualization

Function to approximate

sin(x) exact
P5(x) Taylor
Center a
Eval x
Polynomial degree n = 5
051015

Polynomial Formula

P5(x)=+x16x3+1120x5P_{5}(x) = + x - \frac{1}{6}x^{3} + \frac{1}{120}x^{5}

Taylor Error Bound

The Lagrange remainder gives an upper bound on the approximation error:

Rn(x)M(n+1)!xan+1,M=maxξf(n+1)(ξ)|R_n(x)| \leq \frac{M}{(n+1)!}|x-a|^{n+1}, \quad M = \max_{\xi}\left|f^{(n+1)}(\xi)\right|

f(x) exact

0.8414709848

P5(x) approx.

0.8416666667

Actual error |f(x) - P5(x)|

1.9568e-4

Error bound M/(n+1)! · |x-a|^(n+1)

1.3889e-3

Bound holds? Yes — actual error is within the bound

Max derivative bounds used per function:

  • sin(x), cos(x): M=1M = 1 (all derivatives bounded by 1)
  • e^x: M=ea+RM = e^{a+R} where R = |x - a|
  • ln(1+x): M=n! / (1+minξ)n+1M = n! \ / \ (1 + \min\xi)^{n+1}
  • 1/(1-x): M=(n+1)! / 1maxξn+2M = (n+1)! \ / \ |1 - \max\xi|^{n+2}

Worked Example 1.6

5. MVT for Integrals

Theorem Statement

If f is continuous on [a,b], then c(a,b) such that\text{If } f \text{ is continuous on } [a,b], \text{ then } \exists\, c \in (a,b) \text{ such that} abf(x)dx=f(c)(ba)\int_a^b f(x)\,dx = f(c)(b - a)

The value f(c)f(c) is the average value of ff on [a,b][a,b]. The rectangle with height f(c)f(c) and width bab - a has the same area as the region under the curve.

Function

Custom f(x) =

Supports: +, -, *, /, ^, sin, cos, tan, sqrt, exp, log, pi, e, parentheses

Interactive Visualization

Move c until the dashed rectangle matches the shaded area. The display turns green when they match (difference < 0.01).

Computed Values

0.002.00f(x)dx\displaystyle\int_{0.00}^{2.00} f(x)\,dx 4.666667
f(c)(ba) at c=1.000f(c)\cdot(b-a) \text{ at } c=1.000 4.000000
|integral − rectangle| 0.666667
Average value of f on [a, b] 2.333333
Shaded area = integral ∫f dx
Rectangle = f(c)(b−a)
Green = areas match (MVT c found)
Point c on the curve

Example 1.5: Worked Solution

6. Epsilon-Delta Limits

Formal Definition

limxaf(x)=L    ε>0,  δ>0:0<xa<δ    f(x)L<ε\lim_{x \to a} f(x) = L \iff \forall\, \varepsilon > 0,\; \exists\, \delta > 0 : 0 < |x - a| < \delta \implies |f(x) - L| < \varepsilon

ε (epsilon) is the tolerance in the output — how close f(x)f(x) must be to LL.

δ (delta) is the tolerance in the input — how close xx must stay to aa.

The game: your adversary picks any ε>0\varepsilon > 0; you must respond with a δ>0\delta > 0 that keeps f(x)f(x) inside the ε\varepsilon-band whenever xx is inside the δ\delta-band.

Preset Functions

Current: f(x)=2x+1,  a=1,  L=3f(x) = 2x + 1,\; a = 1,\; L = 3

Interactive Visualization

ε-band (output tolerance)
δ-band (input tolerance)
Function f(x)
Limit point (a, L)

Controls

ε (epsilon) = 0.500

Output tolerance: |f(x) − L| < ε

δ (delta) = 0.300

Input tolerance: 0 < |x − a| < δ

Invalid! f(x) leaves the ε-band within the δ-band. Try a smaller δ.