5. Tangent Line Approximator — Theory
The tangent line to a differentiable function \(y=f(x)\) at \(x=a\) is the line that best matches the curve
“locally” near that point. It is the limiting position of secant lines as the second point approaches \(a\).
1) Tangent line formula
\[
\text{Slope at }x=a:\quad m=f'(a)
\]
\[
\text{Point on the curve:}\quad (a,f(a))
\]
\[
\text{Tangent line:}\quad y-f(a)=f'(a)(x-a)
\]
\[
\boxed{L(x)=f(a)+f'(a)(x-a)}
\]
2) Local linearization
The tangent line function \(L(x)\) is also called the linearization of \(f\) at \(a\). For \(x\) close to \(a\),
\(L(x)\) is a good approximation:
\[
f(x)\approx L(x)\quad (x\text{ near }a).
\]
3) Secant line and “secant → tangent” idea
The slope of the secant line through the points \((a,f(a))\) and \((a+h,f(a+h))\) is
\[
m_h=\frac{f(a+h)-f(a)}{h}.
\]
As \(h\to 0\), the secant slope approaches the derivative:
\[
f'(a)=\lim_{h\to 0}\frac{f(a+h)-f(a)}{h}.
\]
4) Approximation error and a common quadratic bound
The error of linearization at \(x\) is \(f(x)-L(x)\). If \(f\) has a reasonably nice second derivative near \(a\),
the error behaves “quadratically” in the distance \(|x-a|\).
\[
\text{(Typical Taylor remainder form)}\quad
|f(x)-L(x)| \le \frac{M}{2}(x-a)^2
\]
Here \(M\) is a bound on \(|f''(x)|\) over the interval you care about (for example, \(x\in[a-w,a+w]\)).
The calculator estimates \(M\) by sampling points and taking an approximate maximum:
\[
M\approx \max_{x\in[a-w,a+w]}|f''(x)|
\]
This bound is a heuristic estimate when computed by sampling; it can miss spikes or discontinuities in \(f''\).
If the calculator cannot get finite samples of \(f''\) on the interval, it will not display a numeric \(M\).
5) Worked example: \(f(x)=\sqrt{x}\) at \(a=4\)
\[
f(x)=\sqrt{x},\quad f'(x)=\frac{1}{2\sqrt{x}},\quad f(4)=2,\quad f'(4)=\frac{1}{4}
\]
\[
L(x)=2+\frac14(x-4)=\frac14x+1
\]
6) Common issues (domain + non-differentiability)
-
Domain restrictions: for \(\sqrt{x}\) you need \(x\ge 0\). If \(a\) is outside the domain, \(f(a)\) is not defined.
-
Cusps/corners: if \(f'(a)\) does not exist or is infinite, a tangent line may not exist.
-
Vertical tangents: the slope can blow up; then the “tangent line” is vertical and not of the form \(y=mx+b\).
(This calculator currently focuses on the usual non-vertical line form.)
7) How the calculator visualizes the idea
- Plots \(f(x)\) and its tangent line \(L(x)\) on the same axes.
- Optionally shades the region between \(f\) and \(L\) (visual error).
- Optionally overlays a secant line and can animate it as \(h\to 0\).
- Optionally generates a numerical table of \(f(x)\), \(L(x)\), and \(f(x)-L(x)\) near \(a\).