← SciSim / Mathematics

Derivative as a Limit & Geometric Interpretation

From secant slope to tangent slope: watch the limit form before your eyes.
🎓 Tier: HSC → Standard Undergraduate

📊 Section 1 — Interactive Simulation

Pick a function, drag $h$ toward zero, and watch the secant rotate into the tangent. The slope $f'(a) = \displaystyle\lim_{h\to 0}\frac{f(a+h)-f(a)}{h}$ emerges as a number.

f(x) plot
f(a)
f(a+h)
secant slope
f′(a) analytic
error |sec − f′|
left slope
right slope
differentiable?

Animation

Function Preset

Parameters

Display Options

Tips

• Press ▶ Play to animate $h$ shrinking.
• Toggle Symmetric for $\frac{f(a+h)-f(a-h)}{2h}$ — error is $O(h^2)$ instead of $O(h)$.
• For $\abs{x}$ at $a=0$: left slope $=-1$, right slope $=+1$ — not differentiable.

💡 Section 2 — The Idea, Step by Step

One idea, climbing gently from a car's speedometer to the formal limit.

Picture driving. Your speedometer reads 54 km/h right now — at this single instant. But "speed" is supposed to be distance divided by time, and a single instant has no stretch of distance and no stretch of time. So how can the needle point at a number at one frozen moment? That puzzle is exactly what the derivative answers: it's the speed of any changing quantity at a single instant.

The trick is to refuse to use one instant. Instead, look at a short interval and measure the ordinary, everyday "average rate" — how much the output changed, divided by how much the input changed. For a function $f$, starting at a point $a$ and stepping forward by a small amount $h$, that average rate is the slope of the line through two points on the graph (a secant line):

$$\text{average rate} \;=\; \frac{\text{rise}}{\text{run}} \;=\; \frac{f(a+h)-f(a)}{h}.$$

Try a real number. Let $f(x)=x^2$ and watch the rate near $a=1$. From $x=1$ to $x=1.1$ the rise is $1.21-1=0.21$ over a run of $0.1$, giving $2.1$. Shrink the step: from $1$ to $1.01$ the rate is $\frac{1.0201-1}{0.01}=2.01$. Shrink again and you get $2.001$. The numbers are clearly homing in on $2$ — they just never are exactly $2$ for any real step.

So take the last step honestly: let the run shrink toward zero and ask what value the rates approach. That limit is the derivative, written $f'(a)$:

$$f'(a) \;=\; \lim_{h\to 0}\frac{f(a+h)-f(a)}{h}.$$

For $f(x)=x^2$ this works out to $f'(a)=2a$, so $f'(1)=2$ — matching the numbers above. Geometrically, as $h\to 0$ the secant line through the two points stops being a chord and becomes the tangent line just kissing the curve at $a$; the derivative is that tangent's slope. In the sim above, the a slider sets where you measure, the h slider is the run (on a log scale so you can push it tiny), and the readouts compare the secant slope against the exact answer.

Try this in the sim above. (1) Keep $f(x)=x^2$, press ▶ Play, and watch the orange secant rotate until it lands on the tangent while the "error" readout collapses toward zero. (2) Turn on the Symmetric toggle and shrink $h$ again — the error drops far faster, because the symmetric quotient is accurate to $O(h^2)$ instead of $O(h)$. (3) Choose $f(x)=\abs{x}$ at $a=0$: the left slope reads $-1$ and the right slope reads $+1$, they never agree, so the limit — and the derivative — simply does not exist at that corner.

📐 Section 3 — Definition & Derivation

From average rate of change to instantaneous rate via the limit.

Definition · The Derivative

Let $f$ be defined on an open interval containing $a$. The derivative of $f$ at $a$ is $$f'(a) \;=\; \lim_{h \to 0}\frac{f(a+h)-f(a)}{h} \;=\; \lim_{x \to a}\frac{f(x)-f(a)}{x-a},$$ provided this limit exists. If it does, $f$ is differentiable at $a$.

Geometrically: $f'(a)$ is the slope of the tangent line to $y=f(x)$ at the point $(a, f(a))$.

Symbol Table

SymbolMeaningType
$f$The function under study$D \to \R$
$a$Point of differentiationReal, interior of $D$
$h$Secant offset, $h \to 0$Real, $\neq 0$
$\Delta f$Rise: $f(a+h)-f(a)$Real
$\Delta f / h$Difference quotient (secant slope)Real
$f'(a)$Derivative — limit of secant slopesReal (or DNE)
$f'_-(a),\,f'_+(a)$Left/right derivativesReal or DNE

Derivation — $\dfrac{d}{dx}x^n = n x^{n-1}$ from First Principles

Step 1 · Set up
Let $f(x)=x^n$, $n\in\N$. Compute $f'(a) = \lim_{h\to 0}\dfrac{(a+h)^n - a^n}{h}$.
Step 2 · Binomial expansion
$(a+h)^n = \displaystyle\sum_{k=0}^{n}\binom{n}{k}a^{n-k}h^k = a^n + n a^{n-1}h + \binom{n}{2}a^{n-2}h^2 + \cdots + h^n.$
Step 3 · Subtract $a^n$, divide by $h$
$\dfrac{(a+h)^n - a^n}{h} = n a^{n-1} + \binom{n}{2}a^{n-2}h + \cdots + h^{n-1}.$
Step 4 · Take the limit
Every term except $n a^{n-1}$ contains a factor of $h$, so vanishes as $h \to 0$: $f'(a) = n a^{n-1}.$
Step 5 · Differentiability ⇒ Continuity
If $f'(a)$ exists, $\lim_{h\to 0}[f(a+h)-f(a)] = \lim_{h\to 0}\dfrac{f(a+h)-f(a)}{h}\cdot h = f'(a)\cdot 0 = 0$, so $f(a+h)\to f(a)$. Converse false: $\abs{x}$ is continuous at $0$ but not differentiable.
Step 6 · Two-sided test
$f'(a)$ exists iff $f'_-(a)=f'_+(a)$, both finite. The simulation displays both via $h=\pm 10^{-7}$.
Step 7 · Conclusion
$\boxed{f'(a) = \displaystyle\lim_{h\to 0}\dfrac{f(a+h)-f(a)}{h}.}$

Simulation ↔ Symbol Mapping

slider a point $a$ where the derivative is evaluated
slider h secant offset $h$ (logarithmic, $10^{-6}$ to $10^{0.3}$)
slider direction $+1$ uses $h>0$ (right secant), $-1$ uses $h<0$ (left secant)
readout secant slope $\frac{f(a+h)-f(a)}{h}$ — current value of difference quotient
readout f′(a) analyticknown closed-form derivative for the chosen preset
readout error $\abs{\text{secant} - f'(a)}$ — shrinks $O(h)$ forward, $O(h^2)$ symmetric
readout left/right slope$f'_-(a),\ f'_+(a)$ from samples at $h=\pm 10^{-7}$
toggle Symmetric switches to $\frac{f(a+h)-f(a-h)}{2h}$, central difference

Worked Example — $f(x)=\sqrt{x}$ at $a=4$

$f'(4) = \displaystyle\lim_{h\to 0}\dfrac{\sqrt{4+h}-2}{h}$. Multiply by conjugate $\dfrac{\sqrt{4+h}+2}{\sqrt{4+h}+2}$:

$=\displaystyle\lim_{h\to 0}\dfrac{(4+h)-4}{h(\sqrt{4+h}+2)}=\lim_{h\to 0}\dfrac{1}{\sqrt{4+h}+2}=\dfrac{1}{4}.$

$\boxed{f'(4)=\tfrac{1}{4}}$, matching $f'(x)=\tfrac{1}{2\sqrt{x}}$ at $x=4$.

Reference: Stewart, J. — Calculus, 8th ed., Ch. 2 §2.7 "Derivatives and Rates of Change", §2.8 "The Derivative as a Function"; Spivak, M. — Calculus, 4th ed., Ch. 9 "Derivatives"; Thomas, G.B. — Calculus, 14th ed., Ch. 3.

❓ Section 4 — Frequently Asked Questions

🧮Conceptual Why is the derivative defined as a limit, not just $\frac{f(a+h)-f(a)}{h}$ for some small $h$?

For any specific $h$, $\frac{f(a+h)-f(a)}{h}$ is a secant slope, not a tangent slope — it depends on which $h$ you chose. The derivative is a single number characteristic of $f$ at $a$, independent of any $h$. The limit collapses the family of all secants into one tangent.

Key takeaway: secant slopes approximate; the derivative is the exact tangent slope.
🔬Simulation When I drag $h$ very close to zero, why do values get jittery?

Floating-point catastrophic cancellation. When $h\approx 10^{-9}$, $f(a+h)-f(a)$ subtracts two nearly-equal doubles, losing ~9 of ~16 digits. Below $h\approx 10^{-8}$ the secant slope oscillates randomly. Optimal $h$ for the forward quotient is $h^*\approx \sqrt{\eps_{\text{mach}}}\approx 1.5\times 10^{-8}$. The error graph shows the U-shape: truncation error decreases, then roundoff increases.

Key takeaway: in math $h\to 0$; in numerics there's a sweet spot $h^* \sim \sqrt{\eps_{\text{mach}}}$.
🌍Applied Where do derivatives appear outside calculus class?

Velocity = derivative of position; acceleration = derivative of velocity (Newton). Marginal cost in economics is $dC/dq$. Machine learning trains neural networks via gradient descent — every weight update is $w \leftarrow w - \eta\,\partial L/\partial w$. Image-processing edge detection uses derivatives (Sobel filter). PID controllers anticipate overshoot via derivative-of-error. Population growth, chemical reaction rates, Bayesian belief updates — all derivatives.

Key takeaway: any "rate of change" is a derivative — physics, economics, ML, control all live on derivatives.
💡Non-Obvious Can a function be differentiable yet have a discontinuous derivative?

Yes. Take $f(x)=x^2\sin(1/x)$ for $x\neq 0$ and $f(0)=0$. By squeeze, $f'(0)=\lim_{h\to 0}h\sin(1/h)=0$. But for $x\neq 0$, $f'(x)=2x\sin(1/x)-\cos(1/x)$ — the $\cos(1/x)$ term oscillates as $x\to 0$, so $\lim_{x\to 0}f'(x)$ does not exist. So $f'$ is defined everywhere yet discontinuous at $0$. (Darboux's theorem: $f'$ still has the intermediate value property — derivatives can't have jump discontinuities even when discontinuous.)

Key takeaway: differentiable everywhere ⇏ derivative is continuous — but it always has IVT (Darboux).
📐Computational Forward vs symmetric difference: how much accuracy do you actually gain?

Taylor: $f(a+h)=f(a)+h f'(a)+\tfrac{h^2}{2}f''(a)+\tfrac{h^3}{6}f'''(a)+\cdots$. Forward quotient $=f'(a)+\tfrac{h}{2}f''(a)+O(h^2)$, error is $O(h)$. Symmetric quotient $=f'(a)+\tfrac{h^2}{6}f'''(a)+O(h^4)$, error is $O(h^2)$. With $h=0.01$, forward gives ~3 correct digits, symmetric gives ~6. Optimal $h$: forward $\sim \sqrt{\eps_{\text{mach}}}$, symmetric $\sim \eps_{\text{mach}}^{1/3}$.

Key takeaway: symmetric difference is the right default — same code, double the digits.
🎓Deep / Advanced Connection to linear approximation and higher dimensions?

$f$ is differentiable at $a$ iff there's a constant $L$ with $f(a+h)=f(a)+Lh+o(h)$, where $o(h)/h\to 0$. The derivative is the unique linear map best approximating $f$ near $a$. Generalizes verbatim to $\R^n$: $f:\R^n\to\R^m$ differentiable at $a$ means $\exists$ linear $L:\R^n\to\R^m$ with $f(a+h)=f(a)+Lh+o(\norm{h})$. That $L$ is the Jacobian. The 1D limit definition is just the scalar case.

Key takeaway: the derivative IS the best linear approximation — that's why it generalizes to gradients and Jacobians.
🧮Conceptual Why does $\abs{x}$ fail to be differentiable at $0$ even though it's continuous?

One-sided difference quotients: $f'_+(0)=\lim_{h\to 0^+}\abs{h}/h=\lim h/h=1$. $f'_-(0)=\lim_{h\to 0^-}\abs{h}/h=\lim (-h)/h=-1$. The two one-sided derivatives exist but disagree, so the two-sided limit doesn't exist. At the corner of the V, no single tangent line — left tangent has slope $-1$, right has slope $+1$.

Key takeaway: corners are continuous but not differentiable — left and right slopes disagree.
Best resource: 3Blue1Brown — "The paradox of the derivative" (Essence of Calculus, Ch. 2); Paul's Online Math Notes — "The Definition of the Derivative" (https://tutorial.math.lamar.edu/Classes/CalcI/DefnOfDerivative.aspx); MIT OCW 18.01 — Single Variable Calculus (Jerison); Khan Academy — Differential Calculus.

⚠️ Section 5 — Misconceptions & Common Errors

A · Conceptual Misconceptions
❌ Misconception: "$dy/dx$ is a literal fraction — multiply both sides by $dx$ freely." ✅ Correction: $dy/dx$ is single-symbol notation for a limit, not a quotient. Manipulating it "as a fraction" works in many contexts (separation of variables, chain rule) only because of theorems being applied silently. In differential geometry, $dx,dy$ are covectors. In higher dimensions, $\nabla f$ is a vector, not a quotient — the fraction intuition breaks. 📖 Reference: Spivak — Calculus, 4th ed., Ch. 9 (Leibniz notation discussion).
❌ Misconception: "If $f$ is continuous at $a$, then $f$ is differentiable at $a$." ✅ Correction: Backwards. Differentiable ⇒ continuous (Step 5). Converse fails dramatically: $\abs{x}$ is continuous at $0$ but not differentiable. Weierstrass's function is continuous on $\R$ but differentiable nowhere. By Baire category, "most" continuous functions are nowhere differentiable. 📖 Reference: Rudin — Principles of Mathematical Analysis, 3rd ed., Theorem 5.2; §7.18.
❌ Misconception: "$f'(a)$ tells you the slope of $f$ at the point $a$ — rise/run for that point." ✅ Correction: A single point has no rise or run — both are zero. $f'(a)$ is the limit of rise/run as the run shrinks. It's a property of $f$'s local behaviour near $a$, not of the point itself. The tangent line through $(a,f(a))$ has slope $f'(a)$, and the line — not $f$ itself — has well-defined rise/run. 📖 Reference: Tall, D. — "Concept image and concept definition: a misleading slogan", PME 12 (1988).
B · Common Procedural Errors
❌ Error: "$\dfrac{d}{dx}[f(x)g(x)] = f'(x)g'(x).$" ✅ Correct: Product rule: $(fg)'=f'g+fg'$. Quick test: $f=g=x$, so $fg=x^2$. Wrong: $1\cdot 1=1$; right: $2x$, at $x=2$ gives $4$. Rule: $\frac{(fg)(a+h)-(fg)(a)}{h}=\frac{f(a+h)-f(a)}{h}g(a+h)+f(a)\frac{g(a+h)-g(a)}{h}$. 🔍 Why students do this: pattern-match "derivative distributes" from the (true) sum rule $(f+g)'=f'+g'$ to the (false) product version.
❌ Error: "$\dfrac{d}{dx}[f(g(x))] = f'(g'(x)).$" ✅ Correct: Chain rule: $\frac{d}{dx}f(g(x))=f'(g(x))\cdot g'(x)$. Test: $f(u)=u^2,\ g(x)=\sin x$. Wrong: $f'(\cos x)=2\cos x$. Right: $2\sin x\cdot\cos x=\sin(2x)$. At $x=\pi/4$, wrong gives $\sqrt{2}$, right gives $1$. 🔍 Why students do this: push the prime mark inside the function, instead of treating composition as "outer-prime × inner-prime".
❌ Error: "$\displaystyle\lim_{h\to 0}\dfrac{(2+h)^3-8}{h}=\dfrac{8-8}{0}=0.$" ✅ Correct: $0/0$ is indeterminate. Expand: $(2+h)^3=8+12h+6h^2+h^3$. So $\frac{(2+h)^3-8}{h}=12+6h+h^2 \to 12$. Hence $f'(2)=12$, matching $3x^2$ at $x=2$. 🔍 Why students do this: treat "$0/0$" as a numerical answer instead of a flag that algebraic simplification is needed first.
Education research: Tall, D. — "The transition to advanced mathematical thinking", Handbook of Research on Mathematics Teaching (1992); Vinner, S. — "The role of definitions in the teaching and learning of mathematics", in Tall (ed.) Advanced Mathematical Thinking (1991); Zandieh, M. — "A theoretical framework for analyzing student understanding of the concept of derivative", CBMS Issues in Mathematics Education 8, 103–127 (2000); Orton, A. — "Students' understanding of differentiation", Educational Studies in Mathematics 14(3), 235–250 (1983).