2  Derivatives and differentiation

2.1 Derivative and local approximation

Suppose \(f\) is defined on an open interval containing \(a\). Its derivative at \(a\) is the finite limit \[f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}h,\] when that limit exists. Equivalently, \[f(a+h)=f(a)+f'(a)h+r(h),\qquad\frac{r(h)}h\to0.\] The affine expression \(f(a)+f'(a)h\) is the local linear approximation. The notation \(r(h)=o(h)\) means exactly the displayed limit; it does not claim the error is zero.

Differentiability at \(a\) implies continuity there: the increment is \(h\) times a quotient with finite limit. The converse fails. For \(f(x)=|x|\), the difference quotient at \(0\) is \(1\) from the right and \(-1\) from the left, although \(f\) is continuous.

2.1.1 Worked example: from the definition

For \(f(x)=x^2\), \[\frac{(a+h)^2-a^2}{h}=2a+h\longrightarrow2a.\] Thus \(f'(a)=2a\). At \(a=3\), \(f(3+h)=9+6h+h^2\): the exact error in the linear approximation is \(h^2\). For \(h=0.01\), the approximation \(9.06\) differs from \(3.01^2=9.0601\) by \(0.0001\).

2.2 Differentiation rules

If \(f\) and \(g\) are differentiable at \(x\), then \[\begin{aligned} (cf+g)'&=cf'+g',\\ (fg)'&=f'g+fg',\\ \left(\frac fg\right)'&=\frac{f'g-fg'}{g^2}\quad(g(x)\ne0). \end{aligned}\] For the chain rule, if \(g\) is differentiable at \(x\) and \(f\) is differentiable at \(g(x)\), then \((f\circ g)'(x)=f'(g(x))g'(x)\).

Why the product rule works. Write \[f(x+h)g(x+h)-f(x)g(x) =[f(x+h)-f(x)]g(x+h)+f(x)[g(x+h)-g(x)].\] Divide by \(h\) and use differentiability and continuity. The chain rule follows by substituting the local linear approximation for \(g\) into that for \(f\); this argument also handles increments for which \(g(x+h)=g(x)\).

Useful formulas include \((x^n)'=nx^{n-1}\) for positive integers \(n\), \((e^x)'=e^x\), \((\log x)'=1/x\) for \(x>0\), \((\sin x)'=\cos x\) and \((\cos x)'=-\sin x\) (angles in radians). The exponential and trigonometric formulas require their own foundational limit results; they do not follow from the product rule alone.

2.2.1 Worked example: chain and product rules

On \(x>0\), let \(y=x^2\log x+e^{3x}\). Then \[y'=2x\log x+x+3e^{3x}.\] The factor \(3\) comes from the derivative of the inner function \(3x\). The domain restriction comes from \(\log x\).

2.3 Mean Value Theorem

Rolle’s theorem. If \(f\) is continuous on \([a,b]\), differentiable on \((a,b)\), \(a<b\), and \(f(a)=f(b)\), then some \(c\in(a,b)\) satisfies \(f'(c)=0\).

Proof sketch. The Extreme Value Theorem gives extrema. If \(f\) is constant the result is immediate. Otherwise, since the endpoint values agree, a maximum or minimum occurs in the interior. At a differentiable interior extremum, difference quotients from opposite sides force the derivative to vanish.

Mean Value Theorem. If \(f\) is continuous on \([a,b]\) and differentiable on \((a,b)\), with \(a<b\), then for some \(c\in(a,b)\), \[f'(c)=\frac{f(b)-f(a)}{b-a}.\] Subtract the secant line from \(f\) and apply Rolle’s theorem.

Consequently, on an interval, \(f'>0\) implies strict increase and \(f'=0\) everywhere implies constancy. If \(|f'|\le M\), then \(|f(b)-f(a)|\le M|b-a|\) whenever the theorem’s hypotheses hold on the interval between \(a\) and \(b\).

2.3.1 Worked example: an error bound

For \(f(x)=\sqrt{x}\) on \([4,4.1]\), \(f'(x)=1/(2\sqrt{x})\le1/4\). Hence \[0<\sqrt{4.1}-2\le0.1/4=0.025.\] The local linear estimate is \(2.025\). The bound controls the change from \(2\); bounding the error of the linear estimate itself would require further information, such as a bound on \(f''\).

2.4 Critical points and optimization

An interior local extremum of a differentiable function must have derivative zero. A zero derivative is not sufficient: \(x^3\) has derivative zero at \(0\) but no extremum there. To optimize a continuous function on \([a,b]\), compare values at endpoints and at all interior points where the derivative is zero or does not exist. If there are infinitely many such points, further analysis may be needed.

For \(f(x)=x^3-3x\) on \([-2,2]\), \(f'=3x^2-3\) vanishes at \(\pm1\). Values are \(f(-2)=-2\), \(f(-1)=2\), \(f(1)=-2\), \(f(2)=2\). The maximum is \(2\) and the minimum is \(-2\), each attained twice.

2.5 Exercises

  1. Differentiate \(\log(1+x^2)\) on \(\mathbb R\).
  2. Does Rolle’s theorem apply to \(|x|\) on \([-1,1]\)? Explain.
  3. Find the tangent line to \(1/x\) at \(x=2\).
  4. Use the Mean Value Theorem to show \(|\sin b-\sin a|\le|b-a|\).
  1. \(2x/(1+x^2)\); the logarithm’s argument is always positive.
  2. No: differentiability fails at \(0\), even though continuity and equal endpoint values hold.
  3. \(y=1/2-(x-2)/4\).
  4. For \(a\ne b\), apply the theorem on the interval between them and use \(|\cos c|\le1\). For \(a=b\) the inequality is immediate.

Next: recover accumulation from derivatives.