Math Applets

Differentiability

Best linear approximation of derivative at a point:

Let D⊆RD \subseteq \mathbb{R}, f:D→Rf : D \to \mathbb{R}, and let x0∈Dx_0 \in D be an accumulation point of DD.
Then the following statements are equivalent:

i) The function ff is differentiable in x0x_0.

ii) There exists an m∈Rm \in \mathbb{R} and a function R:D→RR : D \to \mathbb{R} such that for all x∈Dx \in D it holds that

f(x)=f(x0)+m⋅(x−x0)+R(x),wherelim⁡x→x0R(x)x−x0=0.f(x) = f(x_0) + m \cdot (x - x_0) + R(x), \qquad\text{where}\qquad \lim_{x \to x_0} \frac{R(x)}{x - x_0} = 0.

If one of these conditions is fulfilled (and hence both of them), then the parameter mm
in Item ii) is uniquely determined and we have m=f′(x0)m = f'(x_0).


Tangent and Approx error:

The he tangent tt touching the graph of ff at x0x_0 is given by:

t:R→R,t(x)=f(x0)+f′(x0)(x−x0)t : \mathbb{R} \to \mathbb{R}, \qquad t(x) = f(x_0) + f'(x_0)(x - x_0)

and can be interpreted as the best linear approximation of ff at x0x_0.

The error or remainder function we make when approximating ff by its tangent tt at x0x_0:

R:D→R,x↦R(x):=f(x)−t(x)=f(x)−f(x0)−f′(x0)(x−x0).R : D \to \mathbb{R}, \qquad x \mapsto R(x) := f(x) - t(x) = f(x) - f(x_0) - f'(x_0)(x - x_0).

The error becomes “arbitrarily small” when xx is near x0x_0, i.e., lim⁡x→x0R(x)=0\lim_{x \to x_0} R(x) = 0. However, this condition can also be fulfilled by a “bad” linear approximation of ff. Therefore, it is more interesting to consider the relative error

R(x)x−x0\frac{R(x)}{x - x_0}

as a measure for the quality of a linear approximation, and to call a linear approximation “good” if lim⁡x→x0R(x)x−x0=0\lim_{x \to x_0} \frac{R(x)}{x - x_0} = 0.


How to use the applet

  • Drag the blue point x0x_0 on the curve to choose the base point P=(x0,f(x0))P=(x_0,f(x_0)).
  • Move the slider mm to choose the slope of a candidate linear approximation
L(x)=f(x0)+m(x−x0). L(x)=f(x_0)+m(x-x_0).
  • Drag the orange point xx on the curve to choose a comparison point Q=(x,f(x))Q=(x,f(x)).
  • The pink/green line is the linear function L(x)L(x) through PP with slope mm.
  • The green dashed vertical segment labeled R(x)R(x) shows the remainder (approximation error) at xx:
R(x)=f(x)−L(x). R(x)=f(x)-L(x).
  • The faint gray dashed line is the secant through PP and QQ (visual aid).
  • If mm is chosen close to the true derivative f′(x0)f'(x_0), then L(x)L(x) is a good local approximation near x0x_0, and R(x)R(x) becomes small when xx is close to x0x_0.
  • The applet highlights this situation by drawing L(x)L(x) in green (and thicker) when mm is close to f′(x0)f'(x_0).

Loading graph…
  • Hold Shift + scroll to zoom
  • Hold Shift + drag to move
  • Points shaped like <> act as sliders

Description

Link to code

Reference: Lecture Notes Calculus 1 ( May22,2022 ) Figure6.3 and Theorem6.1 page 94

This interactive applet illustrates when a linear approximation of a function at a point can be considered a “good” one.

The tangent line at x0x_0 is the best linear approximation of ff at that point.
The theorem above states that if ff is differentiable at x0x_0, then f(x)=f(x0)+m(x−x0)+R(x)f(x) = f(x_0) + m(x - x_0) + R(x),
where the remainder term R(x)R(x) satisfies lim⁡x→x0R(x)x−x0=0\lim_{x \to x_0} \frac{R(x)}{x - x_0} = 0.

A key insight is that the condition R(x)→0R(x) \to 0 alone does not guarantee a good approximation: even a poorly chosen linear function can have a remainder that vanishes in absolute terms. What matters is the behaviour of the relative remainder.

In the applet, the student can adjust the slope mm using a slider. When mm differs from f′(x0)f'(x_0), the linear approximation is bad. By dragging the point xx toward x0x_0, the sutudent can notice that, the remainder R(x)R(x) approaches 00 as x→x0x \to x_0, but the relative error R(x)x−x0\frac{R(x)}{x - x_0} does not. When the chosen line coincides with the true tangent (i.e. m=f′(x0)m = f'(x_0)), it is highlighted in green, and both the absolute and relative remainders tend to zero as xx approaches x0x_0.

    const isBestApprox = () => Math.abs(getM() - df(getX0())) < 0.2;

Thus the relative error is the difference of twp slopes: (Slope of Secant Line) - (Slope mm)

R(x)x−x0=f(x)−t(x)x−x0=f(x)−[f(x0)+m(x−x0)]x−x0=f(x)−f(x0)x−x0−m \frac{R(x)}{x - x_0} = \frac{f(x) -t(x)}{x - x_0} = \frac{f(x) -[f(x_0) +m(x -x_0)]}{x - x_0} = \frac{f(x) -f(x_0)}{x - x_0} - m

The height of the purple line mantian this ratio, since start from the secant up to the linear approximation.