Chapter 3 · Continuity and Differentiability

3.3 Differentiability, Mean Value Theorems and Taylor’s Theorem

The derivative as a limit and as a continuous slope function, the chain rule, Rolle's theorem and the mean value theorems of Lagrange and Cauchy, L'Hôpital's rule, Darboux's theorem, Taylor's theorem with remainder, and convex functions — with the standard pathological examples that CSIR NET loves.

The derivative compresses the behaviour of a function near a point into a single number, the slope of the best linear approximation. Most of what calculus does with derivatives — proving inequalities, counting roots, locating maxima, computing limits, estimating errors — rests on one theorem that turns this local information into global information: the mean value theorem. If $f'$ is small on an interval, $f$ changes little there; if $f'\gt0$, $f$ increases; if $f'=0$, $f$ is constant. Cauchy's two-function version gives L'Hôpital's rule, and applying the same idea to higher derivatives gives Taylor's theorem, which says how far $f$ is from its Taylor polynomial. All of these rest on the completeness of $\mathbb{R}$ through the extreme value theorem (§3.1): Rolle's theorem needs a maximum to be attained.

Differentiability is also where intuition fails most often, and CSIR NET exploits this systematically. A function can be differentiable everywhere while its derivative is discontinuous ($x^2\sin\frac1x$); a derivative can be discontinuous, yet it can never jump (Darboux's theorem); $f'(c)\gt0$ does not make $f$ increasing near $c$; a function can have derivatives of all orders and still differ from its Taylor series ($e^{-1/x^2}$); and a continuous function can fail to be differentiable at every point (Weierstrass). This section proves the main theorems carefully, with all their hypotheses, and then tests each hypothesis against a counterexample.

The Derivative: Carathéodory's Form and the Chain Rule

📘 Definition 3.9 — Derivative; one-sided derivatives
Let $I$ be an interval, $f:I\to\mathbb{R}$ and $c\in I$. We say $f$ is differentiable at $c$ if the limit $$f'(c)=\lim_{x\to c,\ x\in I}\frac{f(x)-f(c)}{x-c}$$ $$\phantom{f'(c)}=\lim_{h\to0}\frac{f(c+h)-f(c)}{h}$$ exists as a real number; $f'(c)$ is the derivative of $f$ at $c$. Using only $x\gt c$ (resp. $x\lt c$) gives the right (resp. left) derivative $f'_+(c)$ (resp. $f'_-(c)$). At an end point of $I$ only one of them makes sense, and "differentiable" means that one-sided derivative exists; at an interior point, $f$ is differentiable iff $f'_-(c)$ and $f'_+(c)$ both exist and are equal. $f$ is differentiable on $I$ if it is differentiable at every point of $I$; then $f':I\to\mathbb{R}$ is a new function. If the difference quotient tends to $\pm\infty$, $f$ has a vertical tangent at $c$ but is not differentiable there.

The difference quotient has a hole at $x=c$. Carathéodory's reformulation fills the hole with a continuous function and thereby turns statements about derivatives into statements about continuity, which we already know how to handle (§3.1).

📐 Theorem 3.21 — Carathéodory's criterion
$f:I\to\mathbb{R}$ is differentiable at $c\in I$ if and only if there is a function $\varphi:I\to\mathbb{R}$ that is continuous at $c$ and satisfies $$f(x)-f(c)=\varphi(x)\,(x-c)\qquad\text{for all }x\in I.$$ In that case $\varphi(c)=f'(c)$, and $\varphi$ is unique.

Proof. If $f'(c)$ exists, define $\varphi(x)=\dfrac{f(x)-f(c)}{x-c}$ for $x\ne c$ and $\varphi(c)=f'(c)$. The identity holds for $x\ne c$ by construction and for $x=c$ because both sides are $0$; and $\varphi(x)\to f'(c)=\varphi(c)$ as $x\to c$, which is continuity at $c$. Conversely, if such a $\varphi$ exists, then for $x\ne c$ the difference quotient equals $\varphi(x)$, which tends to $\varphi(c)$ by continuity; so $f'(c)$ exists and equals $\varphi(c)$. Uniqueness: for $x\ne c$ the identity forces the value of $\varphi(x)$, and continuity at $c$ forces $\varphi(c)$. ∎

📐 Theorem 3.22 — Differentiability implies continuity; algebra of derivatives
Let $f,g:I\to\mathbb{R}$ be differentiable at $c\in I$ and $\alpha\in\mathbb{R}$. Then: (a) $f$ is continuous at $c$; (b) $f+g$ and $\alpha f$ are differentiable at $c$ with $(f+g)'(c)=f'(c)+g'(c)$, $(\alpha f)'(c)=\alpha f'(c)$; (c) $fg$ is differentiable at $c$ with $(fg)'(c)=f'(c)g(c)+f(c)g'(c)$; (d) if $g(c)\ne0$, then $f/g$ (defined near $c$) is differentiable at $c$ with $$\left(\frac fg\right)'(c)=\frac{f'(c)g(c)-f(c)g'(c)}{g(c)^2}.$$ The converse of (a) fails: $|x|$ is continuous but not differentiable at $0$ ($f'_-(0)=-1\ne1=f'_+(0)$).

Proof. Write $f(x)-f(c)=\varphi(x)(x-c)$ and $g(x)-g(c)=\psi(x)(x-c)$ with $\varphi,\psi$ continuous at $c$. (a) The right side $\varphi(x)(x-c)\to\varphi(c)\cdot0=0$. (b) $(f+g)(x)-(f+g)(c)=(\varphi+\psi)(x)(x-c)$ and $\varphi+\psi$ is continuous at $c$; similarly for $\alpha f$. (c) $$\begin{aligned}f(x)g(x)-f(c)g(c)&=\big(f(x)-f(c)\big)g(x)\\&\quad+f(c)\big(g(x)-g(c)\big)\\&=\big[\varphi(x)g(x)+f(c)\psi(x)\big](x-c),\end{aligned}$$ and the bracket is continuous at $c$ (since $g$ is, by (a)) with value $f'(c)g(c)+f(c)g'(c)$. (d) By (a) $g$ is nonzero on some interval $J\ni c$ of $I$. For $x\in J$, $$\frac1{g(x)}-\frac1{g(c)}=\frac{g(c)-g(x)}{g(x)g(c)}=\left[\frac{-\psi(x)}{g(x)g(c)}\right](x-c),$$ and the bracket is continuous at $c$ with value $-g'(c)/g(c)^2$. Now apply (c) to $f\cdot\frac1g$. ∎

📐 Theorem 3.23 — Chain rule
Let $I,J$ be intervals, $f:I\to\mathbb{R}$ with $f(I)\subseteq J$, and $g:J\to\mathbb{R}$. If $f$ is differentiable at $c$ and $g$ is differentiable at $f(c)$, then $g\circ f$ is differentiable at $c$ and $$(g\circ f)'(c)=g'\big(f(c)\big)\,f'(c).$$

Proof. Write $f(x)-f(c)=\varphi(x)(x-c)$ with $\varphi$ continuous at $c$, and $g(y)-g(f(c))=\psi(y)\big(y-f(c)\big)$ with $\psi$ continuous at $f(c)$. Substituting $y=f(x)$: $$\begin{aligned}g(f(x))-g(f(c))&=\psi(f(x))\big(f(x)-f(c)\big)\\&=\big[\psi(f(x))\,\varphi(x)\big](x-c).\end{aligned}$$ Since $f$ is continuous at $c$ (Theorem 3.22(a)) and $\psi$ is continuous at $f(c)$, the composite $\psi\circ f$ is continuous at $c$; so the bracket is continuous at $c$, with value $\psi(f(c))\varphi(c)=g'(f(c))f'(c)$. Theorem 3.21 finishes the proof. ∎

The familiar "proof" writes $\frac{g(f(x))-g(f(c))}{x-c}=\frac{g(f(x))-g(f(c))}{f(x)-f(c)}\cdot\frac{f(x)-f(c)}{x-c}$, which divides by zero whenever $f(x)=f(c)$ for $x$ arbitrarily close to $c$ — as happens for $f(x)=x^2\sin\frac1x$ at $c=0$. Carathéodory's form never divides.

📐 Theorem 3.24 — Derivative of an inverse function
Let $f:I\to\mathbb{R}$ be continuous and strictly monotone on an interval $I$, so that $g=f^{-1}:f(I)\to I$ exists and is continuous (continuous inverse theorem, §3.1). If $f$ is differentiable at $c\in I$ with $f'(c)\ne0$, then $g$ is differentiable at $d=f(c)$ and $$g'(d)=\frac1{f'(c)}=\frac1{f'(g(d))}.$$ If $f'(c)=0$, then $g$ is not differentiable at $d$.

Proof. Let $f(x)-f(c)=\varphi(x)(x-c)$ with $\varphi$ continuous at $c$ and $\varphi(c)=f'(c)\ne0$. For $x\ne c$, injectivity gives $f(x)\ne f(c)$, hence $\varphi(x)\ne0$; so $\varphi$ never vanishes on $I$. Put $x=g(y)$ for $y\in f(I)$: $y-d=\varphi(g(y))\big(g(y)-c\big)$, that is, $$g(y)-g(d)=\frac{1}{\varphi(g(y))}\,(y-d).$$ The function $1/(\varphi\circ g)$ is continuous at $d$ because $g$ is continuous at $d$, $\varphi$ is continuous at $g(d)=c$, and $\varphi(c)\ne0$. By Theorem 3.21, $g'(d)=1/\varphi(c)=1/f'(c)$. If $f'(c)=0$ and $g'(d)$ existed, the chain rule applied to $g\circ f=\mathrm{id}$ would give $1=g'(d)f'(c)=0$. ∎

For example $\sin$ is strictly increasing on $[-\tfrac\pi2,\tfrac\pi2]$ with $\sin'=\cos\gt0$ inside, so $\arcsin'(y)=\dfrac1{\cos(\arcsin y)}=\dfrac1{\sqrt{1-y^2}}$ for $-1\lt y\lt1$; at $y=\pm1$, where $\cos=0$, $\arcsin$ has vertical tangents. Likewise $x^3$ has derivative $0$ at $0$, so its inverse $x^{1/3}$ is not differentiable at $0$.

✏️ Example 1 — Deciding differentiability from the definition
(a) Show that $f(x)=x|x|$ is differentiable on $\mathbb{R}$ and find $f'$. Is $f'$ differentiable? (b) Let $f(x)=x^2$ for $x\in\mathbb{Q}$ and $f(x)=0$ for $x\notin\mathbb{Q}$. Find all points where $f$ is differentiable. (c) For which $\alpha\gt0$ is $|x|^\alpha$ differentiable at $0$? (d) Is $x^{2/3}$ differentiable at $0$? Find its one-sided "derivatives".
(a) For $x\gt0$, $f=x^2$ near $x$, so $f'(x)=2x$; for $x\lt0$, $f=-x^2$, so $f'(x)=-2x$. At $0$: $\dfrac{f(h)-f(0)}{h}=|h|\to0$. Hence $f'(x)=2|x|$ for all $x$. Since $|x|$ is not differentiable at $0$, $f'$ is not: $f$ is differentiable everywhere, $f'$ is continuous, but $f''(0)$ does not exist.
(b) Only at $0$ At $c\ne0$, $f$ is discontinuous: along rationals $f\to c^2\ne0$, along irrationals $f\to0$. A function that is discontinuous at $c$ is not differentiable there (Theorem 3.22(a)). At $0$: $\left|\dfrac{f(h)-f(0)}{h}\right|\le\dfrac{h^2}{|h|}=|h|\to0$, so $f'(0)=0$. A function differentiable at exactly one point.
(c) $\alpha\gt1$ $\dfrac{|h|^\alpha}{h}=\operatorname{sgn}(h)\,|h|^{\alpha-1}$. For $\alpha\gt1$ this tends to $0$. For $\alpha=1$ the one-sided limits are $\pm1$; for $0\lt\alpha\lt1$ the quotient is unbounded. So $|x|^\alpha$ is differentiable at $0$ iff $\alpha\gt1$, and then $f'(0)=0$.
(d) No $\dfrac{h^{2/3}}{h}=h^{-1/3}\to+\infty$ as $h\to0+$ and $\to-\infty$ as $h\to0-$. The graph has a cusp at $0$. (Compare $x^{1/3}$, where the quotient $h^{-2/3}\to+\infty$ from both sides: a vertical tangent.)
📘 Definition 3.10 — Local extrema and critical points
$f:I\to\mathbb{R}$ has a local maximum at $c\in I$ if there is $\delta\gt0$ with $f(x)\le f(c)$ for all $x\in I$ with $|x-c|\lt\delta$; a local minimum is defined with $\ge$; either is a local extremum. It is strict if the inequality is strict for $x\ne c$. An interior point $c$ with $f'(c)=0$ is a critical (stationary) point.
📐 Theorem 3.25 — Interior extremum theorem (Fermat)
If $f:I\to\mathbb{R}$ has a local extremum at an interior point $c$ of $I$ and $f$ is differentiable at $c$, then $f'(c)=0$.

Proof. Suppose $c$ is a local maximum (for a minimum apply this to $-f$). For $0\lt h\lt\delta$ with $c+h\in I$, $\dfrac{f(c+h)-f(c)}{h}\le0$, so $f'(c)=f'_+(c)\le0$. For $-\delta\lt h\lt0$, $\dfrac{f(c+h)-f(c)}{h}\ge0$, so $f'(c)=f'_-(c)\ge0$. Hence $f'(c)=0$. ∎

Both hypotheses matter: $f(x)=x$ on $[0,1]$ has its maximum at the end point $1$, where $f'=1$; and $|x|$ has a minimum at $0$, where it is not differentiable. The converse fails too: $x^3$ has $f'(0)=0$ but no extremum at $0$. More precisely, the proof shows: if $f'_+(c)\gt0$ then $f(x)\gt f(c)$ for all $x\gt c$ close enough to $c$ — but, as we shall see, not that $f$ is increasing near $c$.

Rolle's Theorem and the Mean Value Theorems

📐 Theorem 3.26 — Rolle's theorem
Let $f:[a,b]\to\mathbb{R}$ (with $a\lt b$) be continuous on $[a,b]$, differentiable on $(a,b)$, and suppose $f(a)=f(b)$. Then there is $c\in(a,b)$ with $f'(c)=0$.

Proof. By the extreme value theorem (§3.1), $f$ attains a maximum $M$ and a minimum $m$ on $[a,b]$. If both are attained only at end points, then $M=m=f(a)$, so $f$ is constant and $f'(c)=0$ for every $c\in(a,b)$. Otherwise $M$ or $m$ is attained at some interior point $c$; this is a local extremum and $f$ is differentiable at $c$, so $f'(c)=0$ by Theorem 3.25. ∎

Each hypothesis is needed: $|x|$ on $[-1,1]$ (not differentiable at one interior point); $f(x)=x$ on $[0,1)$ with $f(1)=0$ (discontinuous at an end point); $f(x)=x$ on $[0,1]$ (unequal end values). Note that differentiability at the end points is not required: $\sqrt{1-x^2}$ on $[-1,1]$ satisfies Rolle.

📐 Theorem 3.27 — Mean value theorem (Lagrange)
Let $f:[a,b]\to\mathbb{R}$ be continuous on $[a,b]$ and differentiable on $(a,b)$. Then there is $c\in(a,b)$ with $$f(b)-f(a)=f'(c)\,(b-a).$$ Equivalently: if $f$ is continuous on $[x,x+h]$ (or $[x+h,x]$) and differentiable inside, then $f(x+h)=f(x)+h\,f'(x+\theta h)$ for some $\theta\in(0,1)$.

Proof. Subtract the chord: $g(x)=f(x)-f(a)-\dfrac{f(b)-f(a)}{b-a}(x-a)$. Then $g$ is continuous on $[a,b]$, differentiable on $(a,b)$, and $g(a)=g(b)=0$. Rolle gives $c\in(a,b)$ with $0=g'(c)=f'(c)-\dfrac{f(b)-f(a)}{b-a}$. ∎

Geometrically: somewhere strictly between $a$ and $b$ the tangent is parallel to the chord. The point $c$ need not be unique and the theorem does not say where it is; for $f(x)=x^2$ it is always the midpoint $c=\tfrac{a+b}2$, for $\sqrt x$ on $[0,b]$ it is $c=\tfrac b4$. The power of the theorem is that it converts information about $f'$ everywhere on an interval into information about $f$.

📐 Theorem 3.28 — Consequences of the mean value theorem
Let $I$ be an interval and $f:I\to\mathbb{R}$ continuous on $I$ and differentiable at every interior point of $I$.
  1. If $f'=0$ on the interior, $f$ is constant on $I$. If $f'=g'$ on the interior (with $g$ like $f$), then $f-g$ is constant.
  2. If $f'\ge0$ on the interior, $f$ is increasing on $I$; if $f'\gt0$, strictly increasing. (Similarly for $\le$, $\lt$.) The converse of the strict statement fails: $x^3$ is strictly increasing with $f'(0)=0$.
  3. If $|f'|\le K$ on the interior, then $|f(x)-f(y)|\le K|x-y|$ for all $x,y\in I$: $f$ is $K$-Lipschitz, hence uniformly continuous (§3.2).
  4. Derivative limit theorem. If $f$ is continuous at $c\in I$, differentiable on $I\setminus\{c\}$, and $\lim_{x\to c}f'(x)=L$ exists in $\mathbb{R}$, then $f$ is differentiable at $c$ and $f'(c)=L$.

Proof. For $x\lt y$ in $I$, the MVT on $[x,y]$ gives $\xi\in(x,y)$ with $f(y)-f(x)=f'(\xi)(y-x)$. (1) The right side is $0$. Apply this to $f-g$ for the second statement. (2) The right side is $\ge0$ (resp. $\gt0$). (3) $|f(y)-f(x)|=|f'(\xi)|\,|y-x|\le K|y-x|$. (4) For $x\ne c$ near $c$, the MVT on the interval between $c$ and $x$ (where $f$ is continuous, and differentiable inside) gives $\xi_x$ strictly between $c$ and $x$ with $\dfrac{f(x)-f(c)}{x-c}=f'(\xi_x)$. As $x\to c$, $\xi_x\to c$ with $\xi_x\ne c$, so $f'(\xi_x)\to L$. ∎

Part (4) is a quick way to compute derivatives of piecewise-defined functions at the joins, and it already shows that a derivative cannot have a removable discontinuity: if $f'(x)\to L$ as $x\to c$, then $f'(c)=L$. Darboux's theorem below goes further.

Interactive 1 — Where Is the Mean Value Point?

The amber chord joins $(a,f(a))$ and $(b,f(b))$; the green tangents mark every $c\in(a,b)$ with $f'(c)$ equal to the slope of the chord. Move the right end point $b$ with the slider or press Play. Watch the number of mean value points change, and see what happens when a hypothesis fails at a point inside the interval: sometimes the conclusion fails ($|x|$), sometimes it survives anyway ($x^{1/3}$).

interval [a, b]—
chord slope—
mean value points c—
hypotheses—
📐 Theorem 3.29 — Cauchy's mean value theorem
Let $f,g:[a,b]\to\mathbb{R}$ be continuous on $[a,b]$ and differentiable on $(a,b)$. Then there is $c\in(a,b)$ with $$\big(f(b)-f(a)\big)\,g'(c)=\big(g(b)-g(a)\big)\,f'(c).$$ If moreover $g'(x)\ne0$ for all $x\in(a,b)$, then $g(b)\ne g(a)$ and $\dfrac{f(b)-f(a)}{g(b)-g(a)}=\dfrac{f'(c)}{g'(c)}$.

Proof. Let $h(x)=\big(f(b)-f(a)\big)g(x)-\big(g(b)-g(a)\big)f(x)$. It is continuous on $[a,b]$, differentiable on $(a,b)$, and a direct computation gives $h(a)=f(b)g(a)-g(b)f(a)=h(b)$. Rolle gives $c$ with $h'(c)=0$, which is the identity. If $g'\ne0$ on $(a,b)$, then $g(b)\ne g(a)$ (otherwise Rolle would give a zero of $g'$), and we may divide; $g'(c)\ne0$ as well. ∎

With $g(x)=x$ this is Lagrange's theorem. Geometrically, the curve $t\mapsto\big(g(t),f(t)\big)$ has, at some interior time $c$, a tangent parallel to the chord joining its end points. Do not try to prove Cauchy's theorem by applying Lagrange to $f$ and $g$ separately: that produces two possibly different points $c_1,c_2$.

A warning about vector- and complex-valued functions. The mean value equality is a statement about real-valued functions. For $F(t)=(\cos t,\sin t)$, i.e. $e^{it}$, on $[0,2\pi]$ we have $F(2\pi)-F(0)=0$ but $|F'(t)|=1$ for every $t$, so no $c$ satisfies $F(2\pi)-F(0)=2\pi F'(c)$. What survives is the mean value inequality $|F(b)-F(a)|\le(b-a)\sup|F'|$.

✏️ Example 2 — Inequalities and root counting with the MVT and Rolle
(a) Prove $|\sin x-\sin y|\le|x-y|$ for all real $x,y$. (b) Prove $\dfrac{x}{1+x}\lt\log(1+x)\lt x$ for $x\gt0$. (c) Find the exact number of real solutions of $2^x=x^2$.
(a) $|\sin'|=|\cos|\le1$, so Theorem 3.28(3) with $K=1$ gives the inequality.
(b) The MVT for $\log(1+t)$ on $[0,x]$: $\log(1+x)-\log1=\dfrac{x}{1+\xi}$ for some $\xi\in(0,x)$. Since $1\lt1+\xi\lt1+x$, $\dfrac{x}{1+x}\lt\dfrac x{1+\xi}\lt x$.
(c) At most three Let $g(x)=2^x-x^2$. Then $g'''(x)=(\log2)^3\,2^x\gt0$ for all $x$. If $g$ had four distinct zeros, Rolle applied between consecutive zeros would give three distinct zeros of $g'$, then two of $g''$, then one of $g'''$ — impossible. So $g$ has at most three zeros.
(c) Exactly three $g(2)=g(4)=0$, and $g(-1)=\tfrac12-1\lt0\lt1=g(0)$, so the intermediate value theorem gives a third zero in $(-1,0)$ (numerically $x\approx-0.7667$). Answer: exactly three real solutions.
🧭 Problem-solving strategy — using the mean value theorems
  1. An inequality between $f(x)$ and $f(y)$? Write $f(x)-f(y)=f'(\xi)(x-y)$ and bound $f'$ on the interval between them (Example 2(a), (b)).
  2. Exactly $k$ roots? Existence from the intermediate value theorem; "at most $k$" from Rolle: if $f^{(k)}$ never vanishes, $f$ has at most $k$ zeros (Example 2(c)). For "at most one", show $f'\ne0$, i.e. $f$ strictly monotone.
  3. Behaviour of $f$ as $x\to\infty$ from $f'$? Apply the MVT on $[M,x]$ or $[n,n+1]$ (Example 3).
  4. Two functions or a ratio? Use Cauchy's form — or L'Hôpital, which is Cauchy's form in disguise.
  5. Know the hypotheses: continuous on the closed interval, differentiable on the open one, real-valued. Check each one before quoting the theorem in a Part C option.
✏️ Example 3 — Prove or disprove: derivatives and limits at infinity
Let $f:(0,\infty)\to\mathbb{R}$ be differentiable. Prove or disprove: (a) if $f'(x)\to0$ as $x\to\infty$, then $f(x)/x\to0$; (b) if $f'(x)\to0$, then $\lim_{x\to\infty}f(x)$ exists; (c) if $\lim_{x\to\infty}f(x)$ exists, then $f'(x)\to0$; (d) if $f(x)\to L$ and $f'(x)\to M$ (both finite), then $M=0$; (e) if $f$ is bounded on $(0,1)$, then $f'$ is bounded on $(0,1)$.
(a) True Given $\varepsilon\gt0$ choose $M$ with $|f'|\lt\varepsilon$ on $[M,\infty)$. For $x\gt M$ the MVT gives $|f(x)-f(M)|\le\varepsilon(x-M)$, so $\left|\dfrac{f(x)}{x}\right|\le\dfrac{|f(M)|}{x}+\varepsilon\lt2\varepsilon$ for large $x$.
(b) False $f(x)=\log x$: $f'(x)=\tfrac1x\to0$ but $f\to\infty$. (Slowly growing functions have slowly vanishing slopes.)
(c) False $f(x)=\dfrac{\sin(x^2)}{x}\to0$, but $f'(x)=2\cos(x^2)-\dfrac{\sin(x^2)}{x^2}$ has no limit: at $x=\sqrt{2\pi n}$ it equals $2$, at $x=\sqrt{(2n+1)\pi}$ it equals $-2$. Small wiggles can be very steep.
(d) True By the MVT, $f(n+1)-f(n)=f'(\xi_n)$ with $\xi_n\in(n,n+1)$. The left side tends to $L-L=0$ and the right side to $M$ (as $\xi_n\to\infty$). So $M=0$.
(e) False $f(x)=\sqrt x$ is bounded on $(0,1)$, but $f'(x)=\dfrac1{2\sqrt x}\to\infty$ as $x\to0+$. (Conversely, $f'$ bounded on $(0,1)$ does force $f$ bounded, by Theorem 3.28(3).)

L'Hôpital's Rule, Darboux's Theorem and Pathological Derivatives

📐 Theorem 3.30 — L'Hôpital's rule
Let $-\infty\le a\lt b\le\infty$ and let $f,g:(a,b)\to\mathbb{R}$ be differentiable with $g'(x)\ne0$ for all $x\in(a,b)$. Suppose $$\lim_{x\to a+}\frac{f'(x)}{g'(x)}=L\in[-\infty,\infty],$$ and that either (i) $\lim_{x\to a+}f(x)=\lim_{x\to a+}g(x)=0$, or (ii) $\lim_{x\to a+}|g(x)|=\infty$. Then $\lim_{x\to a+}\dfrac{f(x)}{g(x)}=L$. The same holds for $x\to b-$, and hence for two-sided limits at an interior point.

Proof. Since $g'\ne0$ on $(a,b)$, Rolle's theorem shows $g$ is injective there, so $g(x)\ne g(y)$ for $x\ne y$, and $g$ is strictly monotone (continuous injective functions on intervals are, §3.1). We treat finite $L$; for $L=+\infty$ replace "$|\,\cdot-L|\lt\varepsilon$" by "$\cdot\gt K$" throughout, and $L=-\infty$ is symmetric.

Fix $\varepsilon\gt0$ and choose $c\in(a,b)$ with $\left|\dfrac{f'(t)}{g'(t)}-L\right|\lt\varepsilon$ for all $t\in(a,c)$. For $a\lt x\lt y\lt c$, Cauchy's MVT on $[x,y]$ gives $t\in(x,y)$ with $$Q(x,y):=\frac{f(y)-f(x)}{g(y)-g(x)}=\frac{f'(t)}{g'(t)},$$ so that $$|Q(x,y)-L|\lt\varepsilon.\qquad(*)$$

Case (i). Fix $y\in(a,c)$ and let $x\to a+$: $f(x)\to0$ and $g(x)\to0$. Since $g$ is strictly monotone with limit $0$ at $a$, $g(y)\ne0$. So $Q(x,y)\to f(y)/g(y)$, and $(*)$ gives $\left|\dfrac{f(y)}{g(y)}-L\right|\le\varepsilon$ for every $y\in(a,c)$. This is the claim.

Case (ii). Now fix $y=c'\in(a,c)$ and let $x\to a+$ (here $x$ is the moving point). Since $|g(x)|\to\infty$, for $x$ close to $a$ we have $g(x)\ne0$, and dividing numerator and denominator of $Q(x,c')$ by $g(x)$, $$\frac{f(x)}{g(x)}=Q(x,c')\left(1-\frac{g(c')}{g(x)}\right)+\frac{f(c')}{g(x)}.$$ Hence $$\begin{aligned}\left|\frac{f(x)}{g(x)}-L\right|&\le|Q-L|+|Q|\frac{|g(c')|}{|g(x)|}+\frac{|f(c')|}{|g(x)|}\\&\lt\varepsilon+(|L|+\varepsilon)\frac{|g(c')|}{|g(x)|}+\frac{|f(c')|}{|g(x)|},\end{aligned}$$ where $Q=Q(x,c')$. The last two terms tend to $0$ as $x\to a+$, so $|f(x)/g(x)-L|\lt2\varepsilon$ for $x$ close to $a$. ∎

Two remarks that CSIR NET tests directly. The rule is only sufficient. For $\lim_{x\to\infty}\dfrac{x+\sin x}{x}=1$, the ratio of derivatives $\dfrac{1+\cos x}{1}$ has no limit; the rule simply does not apply. The hypothesis $g'\ne0$ cannot be dropped (Stolz's example): with $f(x)=x+\sin x\cos x$ and $g(x)=e^{\sin x}f(x)$, one finds $f'(x)=2\cos^2x$ and $g'(x)=e^{\sin x}\cos x\,\big(f(x)+2\cos x\big)$. Cancelling the factor $\cos x$, which is illegitimate because it vanishes at $x=\tfrac\pi2+k\pi$, gives $\dfrac{f'}{g'}=\dfrac{2\cos x}{e^{\sin x}(f(x)+2\cos x)}\to0$, while $\dfrac fg=e^{-\sin x}$ oscillates between $e^{-1}$ and $e$ as $x\to\infty$.

✏️ Example 4 — Using (and not misusing) L'Hôpital's rule
Evaluate: (a) $\displaystyle\lim_{x\to0}\left(\frac1{\sin^2x}-\frac1{x^2}\right)$; (b) $\displaystyle\lim_{x\to0+}x^x$; (c) $\displaystyle\lim_{x\to0}\frac{e^x-1-x-x^2/2}{x^3}$; (d) $\displaystyle\lim_{x\to0}\frac{x^2\sin(1/x)}{\sin x}$, and explain why L'Hôpital's rule fails to decide it.
(a) $\tfrac13$ Combine: $\dfrac{x^2-\sin^2x}{x^2\sin^2x}$. Since $\dfrac{\sin^2x}{x^2}\to1$, it suffices to find $\lim\dfrac{x^2-\sin^2x}{x^4}$. Write $x^2-\sin^2x=(x-\sin x)(x+\sin x)$; by L'Hôpital twice, $\dfrac{x-\sin x}{x^3}\to\dfrac{1-\cos x}{3x^2}\to\dfrac{\sin x}{6x}\to\dfrac16$, and $\dfrac{x+\sin x}{x}\to2$. So the limit is $\tfrac16\cdot2=\tfrac13$.
(b) $1$ $x^x=e^{x\log x}$ and $x\log x=\dfrac{\log x}{1/x}$ is of type $\tfrac{\infty}{\infty}$: the ratio of derivatives is $\dfrac{1/x}{-1/x^2}=-x\to0$. So $x\log x\to0$ and, by continuity of $\exp$, $x^x\to e^0=1$.
(c) $\tfrac16$ Three applications of the rule: $\dfrac{e^x-1-x}{3x^2}\to\dfrac{e^x-1}{6x}\to\dfrac{e^x}{6}\to\dfrac16$. Each intermediate limit is of type $\tfrac00$, and the last one exists, so (reading backwards) each previous one exists too.
(d) $0$ Directly: $\dfrac{x^2\sin(1/x)}{\sin x}=\dfrac{x}{\sin x}\cdot x\sin\dfrac1x\to1\cdot0=0$. The ratio of derivatives is $\dfrac{2x\sin(1/x)-\cos(1/x)}{\cos x}$, which has no limit at $0$ (the term $\cos(1/x)$ oscillates). The rule's hypothesis "$\lim f'/g'$ exists" fails, so it says nothing — the limit of $f/g$ exists all the same.
📐 Theorem 3.31 — Darboux's theorem (intermediate value property of derivatives)
Let $f$ be differentiable on an interval $I$ (one-sided at end points that belong to $I$). If $a\lt b$ in $I$ and $k$ lies strictly between $f'(a)$ and $f'(b)$, then $f'(c)=k$ for some $c\in(a,b)$. Consequently:
  1. $f'(I)$ is an interval;
  2. $f'$ has no removable and no jump discontinuities — every discontinuity of a derivative is of the second kind;
  3. if $f'(x)\ne0$ for all $x\in I$, then $f'$ has constant sign and $f$ is strictly monotone;
  4. if $f'$ is monotone on $I$, then $f'$ is continuous.

Proof. Say $f'(a)\lt k\lt f'(b)$ (otherwise replace $f$ by $-f$ and $k$ by $-k$). Let $g(x)=f(x)-kx$; then $g$ is differentiable on $[a,b]$ with $g'(a)\lt0\lt g'(b)$. By the extreme value theorem $g$ attains its minimum on $[a,b]$ at some $c$. Since $g'(a)=\lim_{x\to a+}\frac{g(x)-g(a)}{x-a}\lt0$, there are $x\gt a$ arbitrarily close to $a$ with $g(x)\lt g(a)$, so the minimum is not at $a$. Likewise $g'(b)\gt0$ gives $x\lt b$ near $b$ with $g(x)\lt g(b)$, so it is not at $b$. Thus $c\in(a,b)$ is an interior minimum and $g'(c)=0$ (Theorem 3.25), i.e. $f'(c)=k$. Note that we never used continuity of $f'$ — only that $f'$ exists.

(1) is a restatement. (2) If $f'(c\pm)$ both exist, then $f'(c)=f'(c-)=f'(c+)$ by the derivative limit theorem (Theorem 3.28(4), applied on each side), so $f'$ is continuous at $c$. A function with the intermediate value property cannot have a jump either — but (2) follows here even more directly. (3) $f'(I)$ is an interval not containing $0$, so it lies in $(0,\infty)$ or in $(-\infty,0)$; apply Theorem 3.28(2). (4) A monotone function has only jump discontinuities (§3.2), and by (2) a derivative has none. ∎

So no differentiable function has derivative $\operatorname{sgn}x$, $\lfloor x\rfloor$, or the indicator of $[0,\infty)$ on an interval containing $0$ — even though such functions are Riemann integrable. Derivatives can be discontinuous, as the next example shows, but only by oscillating.

📘 Definition 3.11 — Higher derivatives; the classes $C^n$
If $f'$ is differentiable, its derivative is $f''=f^{(2)}$, and inductively $f^{(n)}=(f^{(n-1)})'$. $f$ is $n$ times differentiable on $I$ if $f^{(n)}$ exists on $I$; it is of class $C^n$ ($n$ times continuously differentiable) if moreover $f^{(n)}$ is continuous; $C^0$ is the class of continuous functions and $C^\infty=\bigcap_nC^n$ (smooth functions). Then $C^\infty\subsetneq\cdots\subsetneq C^2\subsetneq C^1\subsetneq C^0$, and "differentiable" lies strictly between $C^1$ and $C^0$.
✏️ Example 5 — The family $x^\alpha\sin(1/x)$: differentiable but not $C^1$
For $\alpha\gt0$ let $f_\alpha(x)=x^\alpha\sin\frac1x$ for $0\lt x\le1$ and $f_\alpha(0)=0$. Find all $\alpha$ for which (a) $f_\alpha$ is (right-)differentiable at $0$; (b) $f_\alpha'$ is bounded on $(0,1]$; (c) $f_\alpha'$ is continuous at $0$. (d) For $f(x)=x^2\sin\frac1x$, $f(0)=0$, on $\mathbb{R}$: classify the discontinuity of $f'$ at $0$ and check that $f'$ still has the intermediate value property.
(a) $\alpha\gt1$ $\dfrac{f_\alpha(h)-f_\alpha(0)}{h}=h^{\alpha-1}\sin\dfrac1h$. For $\alpha\gt1$, $|h^{\alpha-1}\sin\frac1h|\le h^{\alpha-1}\to0$, so $f_\alpha'(0)=0$. For $\alpha=1$ the quotient is $\sin\frac1h$, which has no limit; for $\alpha\lt1$ it is unbounded (take $h=\frac{1}{2\pi n+\pi/2}$).
(b) $\alpha\ge2$ For $x\gt0$, $f_\alpha'(x)=\alpha x^{\alpha-1}\sin\frac1x-x^{\alpha-2}\cos\frac1x$. If $\alpha\ge2$, both terms are bounded on $(0,1]$ (by $\alpha$ and $1$). If $\alpha\lt2$, the first term is bounded on $(0,1]$ when $\alpha\ge1$ but $x^{\alpha-2}\cos\frac1x$ is unbounded (take $x=\frac1{2\pi n}$, where it equals $(2\pi n)^{2-\alpha}$); for $\alpha\lt1$ evaluate at $x=\frac1{2\pi n}$ again, where the sine term vanishes. So $f'_\alpha$ is bounded iff $\alpha\ge2$ — and, by Theorem 3.28(3) and Exercise III.8, $f_\alpha$ is Lipschitz on $[0,1]$ iff $\alpha\ge2$.
(c) $\alpha\gt2$ For $\alpha\gt2$ both terms of $f'_\alpha(x)$ tend to $0=f'_\alpha(0)$. For $\alpha=2$, $f_2'(x)=2x\sin\frac1x-\cos\frac1x$ and $\cos\frac1x$ has no limit, so $f'_2$ is discontinuous at $0$. Summary: $f_\alpha$ is differentiable on $[0,1]$ iff $\alpha\gt1$, Lipschitz iff $\alpha\ge2$, and $C^1$ iff $\alpha\gt2$.
(d) On $\mathbb{R}$, $f'(x)=2x\sin\frac1x-\cos\frac1x$ ($x\ne0$) and $f'(0)=0$. Near $0$, $f'$ takes all values in $(-1,1)$ on every interval $(0,\delta)$ and $(-\delta,0)$ (where $\cos\frac1x$ runs through $[-1,1]$ and $2x\sin\frac1x$ is tiny), so neither one-sided limit exists: a discontinuity of the second kind, exactly as Darboux's theorem requires. The intermediate value property holds by Darboux's theorem — and can be seen directly: any interval containing $0$ contains points where $f'\approx1$ and points where $f'\approx-1$, and away from $0$, $f'$ is continuous.

How badly can differentiability fail for a continuous function? Completely.

📐 Theorem 3.32 — Continuous, nowhere differentiable functions
(a) (Weierstrass, 1872.) Let $0\lt a\lt1$ and let $b$ be an odd positive integer with $ab\gt1+\tfrac{3\pi}2$. Then $$W(x)=\sum_{n=0}^\infty a^n\cos(b^n\pi x)$$ is continuous on $\mathbb{R}$ and differentiable at no point. (Hardy later showed that $0\lt a\lt1$, $b\gt1$ and $ab\ge1$ suffice.)
(b) (Takagi.) Let $\phi(x)=\operatorname{dist}(x,\mathbb{Z})$, the distance from $x$ to the nearest integer. Then $$T(x)=\sum_{n=0}^\infty2^{-n}\phi(2^nx)$$ is continuous on $\mathbb{R}$ and differentiable at no point.

Proof of (b). Continuity. Let $S_N$ be the $N$-th partial sum, a continuous function. Since $0\le\phi\le\tfrac12$, $|T(x)-S_N(x)|\le\sum_{n\gt N}2^{-n-1}=2^{-N-1}$ for every $x$. Hence $|T(x)-T(y)|\le|S_N(x)-S_N(y)|+2^{-N}$, and continuity of $S_N$ gives continuity of $T$. (This is uniform convergence and the Weierstrass M-test of §5.1.)

A lemma. If $f$ is differentiable at $x$ and $u_n\le x\le v_n$ with $u_n\lt v_n$ and $v_n-u_n\to0$, then $D_n=\dfrac{f(v_n)-f(u_n)}{v_n-u_n}\to f'(x)$. Indeed, if $u_n\lt x\lt v_n$, put $\lambda_n=\frac{v_n-x}{v_n-u_n}\in(0,1)$; then $D_n=\lambda_n\frac{f(v_n)-f(x)}{v_n-x}+(1-\lambda_n)\frac{f(x)-f(u_n)}{x-u_n}$, a convex combination of two quotients that both tend to $f'(x)$ (and if $x=u_n$ or $x=v_n$, $D_n$ is itself such a quotient).

No derivative. Fix $x$, let $m_n=\lfloor2^nx\rfloor$, $u_n=m_n2^{-n}$, $v_n=(m_n+1)2^{-n}$, so $u_n\le x\lt v_n$. For $k\ge n$, $2^ku_n$ and $2^kv_n$ are integers, so $\phi(2^ku_n)=\phi(2^kv_n)=0$: these terms contribute nothing to $T(v_n)-T(u_n)$. For $k\lt n$, the interval $[2^ku_n,2^kv_n]$ has length $2^{k-n}\le\tfrac12$ and its end points are multiples of $2^{k-n}$, so it contains no point of $\tfrac12\mathbb{Z}$ in its interior; on it $\phi$ is linear with slope $\pm1$, so $x\mapsto2^{-k}\phi(2^kx)$ is linear on $[u_n,v_n]$ with slope $\pm1$. Therefore $$D_n=\frac{T(v_n)-T(u_n)}{v_n-u_n}=\sum_{k=0}^{n-1}\varepsilon_k,\qquad\varepsilon_k\in\{1,-1\},$$ where $\varepsilon_k$ does not depend on $n$ (it is the slope of the $k$-th term on the dyadic interval of length $2^{-k-1}$ containing $x$). Thus $D_{n+1}-D_n=\varepsilon_n=\pm1$ for every $n$, so $(D_n)$ is not Cauchy and does not converge. By the lemma, $T'(x)$ does not exist. ∎

For (a) the idea is the same — the $n$-th term oscillates with amplitude $a^n$ but slope of order $(ab)^n\pi$, which outgrows everything before it — but the estimates are longer, and we only need the statement. Such functions are not exotic: Brownian motion, the standard model of noisy signals and stock prices, has nowhere-differentiable paths with probability one.

Taylor's Theorem

📘 Definition 3.12 — Taylor polynomial and remainder
If $f$ is $n$ times differentiable at $c$, its Taylor polynomial of order $n$ at $c$ is $$\begin{aligned}T_n(x)&=\sum_{k=0}^n\frac{f^{(k)}(c)}{k!}(x-c)^k\\&=f(c)+f'(c)(x-c)+\cdots+\frac{f^{(n)}(c)}{n!}(x-c)^n,\end{aligned}$$ the unique polynomial of degree $\le n$ with $T_n^{(k)}(c)=f^{(k)}(c)$ for $k=0,\dots,n$. The remainder is $R_n(x)=f(x)-T_n(x)$. For $c=0$, $T_n$ is the Maclaurin polynomial.
📐 Theorem 3.33 — Taylor's theorem with the Lagrange and Cauchy remainders
Let $n\ge0$, let $I$ be an interval, and let $f:I\to\mathbb{R}$ be such that $f^{(n)}$ is continuous on $I$ and $f^{(n+1)}$ exists at every interior point of $I$. Let $c,x\in I$ with $x\ne c$. Then there is $\xi$ strictly between $c$ and $x$ with (Lagrange form) $$R_n(x)=\frac{f^{(n+1)}(\xi)}{(n+1)!}(x-c)^{n+1},$$ and there is $\eta$ strictly between $c$ and $x$ with (Cauchy form) $$R_n(x)=\frac{f^{(n+1)}(\eta)}{n!}(x-\eta)^n(x-c).$$ For $n=0$ the Lagrange form is the mean value theorem.

Proof. Fix $x$ and regard $c$ as a variable $t$: define, for $t$ in the closed interval $J$ between $c$ and $x$, $$F(t)=f(x)-\sum_{k=0}^n\frac{f^{(k)}(t)}{k!}(x-t)^k.$$ Then $F(x)=0$ and $F(c)=R_n(x)$. $F$ is continuous on $J$ (it involves $f,\dots,f^{(n)}$) and differentiable inside, and the derivative telescopes: $$\begin{aligned}F'(t)&=-\sum_{k=0}^n\frac{f^{(k+1)}(t)}{k!}(x-t)^k\\&\quad+\sum_{k=1}^n\frac{f^{(k)}(t)}{(k-1)!}(x-t)^{k-1}\\&=-\frac{f^{(n+1)}(t)}{n!}(x-t)^n.\end{aligned}$$ Let $p\gt0$ and $G(t)=(x-t)^p$, so $G(x)=0$, $G(c)=(x-c)^p$ and $G'(t)=-p(x-t)^{p-1}\ne0$ inside $J$. Cauchy's MVT (Theorem 3.29) on $J$ gives $\zeta$ strictly between $c$ and $x$ with $$\frac{F(x)-F(c)}{G(x)-G(c)}=\frac{F'(\zeta)}{G'(\zeta)},$$ that is, $$\frac{R_n(x)}{(x-c)^p}=\frac{f^{(n+1)}(\zeta)\,(x-\zeta)^{n+1-p}}{n!\,p}.$$ Taking $p=n+1$ gives the Lagrange form ($\xi=\zeta$), and $p=1$ gives the Cauchy form ($\eta=\zeta$). (General $p$ gives the Schlömilch form.) ∎

Why two remainders? Take $f(x)=\log(1+x)$, $c=0$, so $f^{(n+1)}(t)=\dfrac{(-1)^nn!}{(1+t)^{n+1}}$ and $T_n(x)=x-\tfrac{x^2}2+\cdots+(-1)^{n+1}\tfrac{x^n}{n}$. For $0\le x\le1$ the Lagrange form gives $|R_n(x)|=\dfrac{x^{n+1}}{(n+1)(1+\xi)^{n+1}}\le\dfrac1{n+1}\to0$; in particular $\log2=1-\tfrac12+\tfrac13-\cdots$. For $-1\lt x\lt0$ the Lagrange bound $\dfrac{|x|^{n+1}}{(n+1)(1+x)^{n+1}}$ is useless when $x\lt-\tfrac12$, since then $\frac{|x|}{1+x}\gt1$. The Cauchy form rescues us: $|R_n(x)|=\dfrac{|x|}{1+\eta}\left(\dfrac{\eta-x}{1+\eta}\right)^n$ with $x\lt\eta\lt0$, and $\dfrac{\eta-x}{1+\eta}\le|x|$ (this rearranges to $\eta(1+x)\le0$). Hence $|R_n(x)|\le\dfrac{|x|^{n+1}}{1+x}\to0$, and the Maclaurin series of $\log(1+x)$ converges to it on all of $(-1,1]$. Interactive 2 shows both bounds.

📐 Theorem 3.34 — Peano's form of the remainder; the higher derivative test
(a) If $f$ is $n$ times differentiable at $c$ (so $f^{(n-1)}$ exists near $c$), then $$\lim_{x\to c}\frac{f(x)-T_n(x)}{(x-c)^n}=0,$$ i.e. $f(x)=T_n(x)+o\big((x-c)^n\big)$ as $x\to c$. (b) Let $c$ be an interior point, $n\ge2$, $f'(c)=\cdots=f^{(n-1)}(c)=0$ and $f^{(n)}(c)\ne0$. If $n$ is even, $f$ has a strict local minimum at $c$ when $f^{(n)}(c)\gt0$ and a strict local maximum when $f^{(n)}(c)\lt0$. If $n$ is odd, $f$ has no local extremum at $c$.

Proof. (a) For $n=1$ this is the definition of $f'(c)$. For $n\ge2$, $R=f-T_n$ satisfies $R(c)=R'(c)=\cdots=R^{(n)}(c)=0$, and $R^{(n-1)}$ exists near $c$. Apply L'Hôpital's rule (case (i)) $n-1$ times to $R(x)/(x-c)^n$: the successive quotients are $\dfrac{R^{(j)}(x)}{n(n-1)\cdots(n-j+1)(x-c)^{n-j}}$, all of type $\tfrac00$, with denominators having nonzero derivatives for $x\ne c$. The last one is $$\begin{aligned}\frac{R^{(n-1)}(x)}{n!\,(x-c)}&=\frac1{n!}\cdot\frac{R^{(n-1)}(x)-R^{(n-1)}(c)}{x-c}\\&\to\frac{R^{(n)}(c)}{n!}=0.\end{aligned}$$ Since this limit exists, each preceding limit exists and equals it.

(b) By (a), $f(x)-f(c)=\Big(\dfrac{f^{(n)}(c)}{n!}+\rho(x)\Big)(x-c)^n$ with $\rho(x)\to0$. For $x$ near $c$, the bracket has the sign of $f^{(n)}(c)$. If $n$ is even, $(x-c)^n\gt0$ for $x\ne c$, so $f(x)-f(c)$ has the sign of $f^{(n)}(c)$: a strict minimum or maximum. If $n$ is odd, $(x-c)^n$ changes sign at $c$, so $f(x)-f(c)$ takes both signs arbitrarily close to $c$: no extremum. ∎

Taylor series need not represent the function. Let $f(x)=e^{-1/x^2}$ for $x\ne0$ and $f(0)=0$. By induction, for $x\ne0$, $f^{(k)}(x)=P_k(1/x)\,e^{-1/x^2}$ with $P_k$ a polynomial; and since $t^me^{-t^2}\to0$ as $|t|\to\infty$, the derivative limit theorem (Theorem 3.28(4)) gives $f^{(k)}(0)=0$ for all $k$. So $f\in C^\infty(\mathbb{R})$, every Taylor polynomial at $0$ is identically $0$, and the Taylor series converges everywhere — to the zero function, not to $f$. A $C^\infty$ function equal to the sum of its Taylor series near each point is called real analytic; $e^{-1/x^2}$ is smooth but not analytic at $0$. Even an analytic function's Taylor series may converge only on a small interval: $\dfrac1{1+x^2}=\sum(-1)^kx^{2k}$ only for $|x|\lt1$.

Interactive 2 — Taylor Polynomials: When Does the Remainder Go to Zero?

The black curve is $f$, the blue curve is its Maclaurin polynomial $T_n$, and the red segment at $x^\ast$ is the actual error $|f(x^\ast)-T_n(x^\ast)|$. Press Play to raise the order $n$; move $x^\ast$ with its slider. The readouts compare the error with the guaranteed bounds from the Lagrange and Cauchy remainders. Try $\log(1+x)$ with $x^\ast=-0.7$ (Lagrange fails, Cauchy works) and $x^\ast\gt1$ (divergence), $1/(1+x^2)$ with $|x^\ast|\gt1$, and $e^{-1/x^2}$.

order n · point x*—
actual error—
Lagrange bound—
Cauchy bound—
✏️ Example 6 — Taylor's theorem as a tool: approximation, inequalities, extrema
(a) How large must $n$ be for $\sum_{k=0}^n\frac1{k!}$ to approximate $e$ with error less than $10^{-6}$? (b) Prove that $1-\dfrac{x^2}2\le\cos x\le1-\dfrac{x^2}2+\dfrac{x^4}{24}$ for all real $x$. (c) Decide whether $0$ is a local extremum of $f(x)=e^x+e^{-x}+2\cos x$ and of $g(x)=\sin x-x+\dfrac{x^3}6$.
(a) $n=9$ Lagrange form for $e^x$ at $c=0$, $x=1$: $e-\sum_{k=0}^n\frac1{k!}=\dfrac{e^\xi}{(n+1)!}$ with $0\lt\xi\lt1$, so the error lies between $\frac1{(n+1)!}$ and $\frac3{(n+1)!}$. For $n=9$: error $\lt\frac3{10!}=\frac{3}{3\,628\,800}\approx8.3\times10^{-7}\lt10^{-6}$. For $n=8$: error $\gt\frac1{9!}\approx2.8\times10^{-6}$ (the true error is $\approx3.06\times10^{-6}$). So $n=9$ is the least.
(b) Lower bound: Taylor with $n=1$: $\cos x=1+0\cdot x+\dfrac{-\cos\xi}{2}x^2\ge1-\dfrac{x^2}2$ since $\cos\xi\le1$. Upper bound: $n=3$, $T_3(x)=1-\frac{x^2}2$ (the $x^3$ coefficient is $\sin0=0$), and $R_3(x)=\dfrac{\cos\eta}{24}x^4\le\dfrac{x^4}{24}$. Both hold for all $x$, not just small ones.
(c) $f$: minimum $f'(x)=e^x-e^{-x}-2\sin x$, $f''=e^x+e^{-x}-2\cos x$, $f'''=e^x-e^{-x}+2\sin x$, $f^{(4)}=e^x+e^{-x}+2\cos x$. At $0$: $f'=f''=f'''=0$ and $f^{(4)}(0)=4\gt0$, with $n=4$ even: a strict local minimum. (Indeed $f(x)=4+\tfrac{x^4}6+\cdots$.)
(c) $g$: no extremum $g'(x)=\cos x-1+\frac{x^2}2$, $g''=-\sin x+x$, $g'''=-\cos x+1$, $g^{(4)}=\sin x$, $g^{(5)}=\cos x$. At $0$ the first four derivatives vanish and $g^{(5)}(0)=1\ne0$, with $n=5$ odd: no extremum. (Indeed $g(x)=\tfrac{x^5}{120}-\cdots$ changes sign at $0$.)

Convex Functions

📘 Definition 3.13 — Convex and concave functions
$f:I\to\mathbb{R}$ on an interval $I$ is convex if for all $x,y\in I$ and $\lambda\in[0,1]$, $$f\big(\lambda x+(1-\lambda)y\big)\le\lambda f(x)+(1-\lambda)f(y),$$ i.e. every chord lies on or above the graph. It is strictly convex if the inequality is strict whenever $x\ne y$ and $0\lt\lambda\lt1$. $f$ is (strictly) concave if $-f$ is (strictly) convex.
📐 Theorem 3.35 — Slopes of a convex function; continuity and one-sided derivatives
Let $f:I\to\mathbb{R}$ be convex.
  1. Three-chord lemma. For $x\lt y\lt z$ in $I$: $\ \dfrac{f(y)-f(x)}{y-x}\le\dfrac{f(z)-f(x)}{z-x}\le\dfrac{f(z)-f(y)}{z-y}.$
  2. At every interior point $c$ of $I$, $f'_-(c)$ and $f'_+(c)$ exist and $f'_-(c)\le f'_+(c)$; for interior $c\lt d$, $f'_+(c)\le\dfrac{f(d)-f(c)}{d-c}\le f'_-(d)$.
  3. $f$ is continuous at every interior point of $I$ (not necessarily at end points).
  4. $f$ is differentiable at all but countably many interior points.

Proof. (1) Write $y=\lambda x+(1-\lambda)z$ with $\lambda=\frac{z-y}{z-x}\in(0,1)$. Convexity gives $f(y)\le\lambda f(x)+(1-\lambda)f(z)$. Subtracting $f(x)$ and using $1-\lambda=\frac{y-x}{z-x}$: $f(y)-f(x)\le\frac{y-x}{z-x}\big(f(z)-f(x)\big)$, the first inequality. Subtracting $f(z)$ instead and using $\lambda=\frac{z-y}{z-x}$: $f(y)-f(z)\le\frac{z-y}{z-x}\big(f(x)-f(z)\big)$; dividing by $-(z-y)$ gives the second.

(2) Fix an interior $c$ and let $s(x)=\frac{f(x)-f(c)}{x-c}$ for $x\in I\setminus\{c\}$. Applying (1) to the three points $\{x,c,x'\}$ in each possible order shows that $s$ is increasing on $I\setminus\{c\}$: $s(x)\le s(x')$ whenever $x\lt x'$. As $x\to c-$, $s(x)$ increases and is bounded above by $s(z)$ for any $z\gt c$ in $I$, so $f'_-(c)=\lim_{x\to c-}s(x)$ exists; likewise $s(x)$ decreases as $x\to c+$ and is bounded below, so $f'_+(c)$ exists, and $f'_-(c)\le f'_+(c)$. For $c\lt d$, $f'_+(c)=\inf_{x\gt c}s_c(x)\le s_c(d)$, and by symmetry $s_c(d)=s_d(c)\le\sup_{x\lt d}s_d(x)=f'_-(d)$.

(3) $f(x)-f(c)=s(x)(x-c)$, and $s$ is bounded near $c$ by (2), so $f(x)\to f(c)$. (4) By (2), for interior $c\lt d$ we have $f'_-(c)\le f'_+(c)\le f'_-(d)\le f'_+(d)$, so the open intervals $\big(f'_-(c),f'_+(c)\big)$ are pairwise disjoint. Each nonempty one — that is, each point of non-differentiability — contains a rational, and distinct points get distinct rationals. ∎

At an end point continuity can fail: $f(0)=1$ and $f(x)=0$ for $0\lt x\le1$ is convex on $[0,1]$. And (4) is sharp in the sense that $|x|$, or $\sum2^{-n}|x-r_n|$ over an enumeration $(r_n)$ of $\mathbb{Q}\cap(0,1)$, is convex and non-differentiable at the points $r_n$.

📐 Theorem 3.36 — Derivative tests for convexity
Let $I$ be an open interval and $f:I\to\mathbb{R}$ differentiable. The following are equivalent: (i) $f$ is convex; (ii) $f'$ is increasing on $I$; (iii) $f(y)\ge f(x)+f'(x)(y-x)$ for all $x,y\in I$ (the graph lies above every tangent line). If $f$ is twice differentiable, they are equivalent to (iv) $f''\ge0$ on $I$. Moreover $f''\gt0$ on $I$ implies that $f$ is strictly convex; the converse fails ($x^4$).

Proof. (i)⇒(ii): for $x\lt y$, Theorem 3.35(2) gives $f'(x)=f'_+(x)\le f'_-(y)=f'(y)$. (ii)⇒(iii): by the MVT, $f(y)-f(x)=f'(\xi)(y-x)$ with $\xi$ between $x$ and $y$. If $y\gt x$ then $f'(\xi)\ge f'(x)$ and $y-x\gt0$; if $y\lt x$ then $f'(\xi)\le f'(x)$ and $y-x\lt0$. Either way $f'(\xi)(y-x)\ge f'(x)(y-x)$. (iii)⇒(i): let $z=\lambda x+(1-\lambda)y$. By (iii) at $z$: $f(x)\ge f(z)+f'(z)(x-z)$ and $f(y)\ge f(z)+f'(z)(y-z)$. Multiply by $\lambda$ and $1-\lambda$ and add: $$\begin{aligned}&\lambda f(x)+(1-\lambda)f(y)\\&\quad\ge f(z)+f'(z)\big(\lambda x+(1-\lambda)y-z\big)=f(z).\end{aligned}$$ (ii)⇔(iv) is Theorem 3.28(2) applied to $f'$ (and the converse direction: an increasing differentiable function has $f''\ge0$, since its difference quotients are $\ge0$). If $f''\gt0$, then $f'$ is strictly increasing, the inequalities above become strict for $x\ne y$, and $f$ is strictly convex. Finally $x^4$ is strictly convex ($f'=4x^3$ is strictly increasing) but $f''(0)=0$. ∎

📐 Theorem 3.37 — Jensen's inequality (finite form)
If $f:I\to\mathbb{R}$ is convex, $x_1,\dots,x_n\in I$ and $\lambda_1,\dots,\lambda_n\ge0$ with $\sum\lambda_i=1$, then $$f\Big(\sum_{i=1}^n\lambda_ix_i\Big)\le\sum_{i=1}^n\lambda_if(x_i).$$ In particular (with $f=-\log$) the weighted AM–GM inequality holds: $\prod x_i^{\lambda_i}\le\sum\lambda_ix_i$ for $x_i\gt0$.

Proof. Induction on $n$; $n=1$ is trivial and $n=2$ is the definition. If $\lambda_n=1$ the claim is trivial; otherwise put $\mu=1-\lambda_n\gt0$ and $y=\sum_{i\lt n}\frac{\lambda_i}{\mu}x_i\in I$ (a convex combination of points of the interval $I$). Then $\sum_{i\le n}\lambda_ix_i=\mu y+\lambda_nx_n$, and $$\begin{aligned}f(\mu y+\lambda_nx_n)&\le\mu f(y)+\lambda_nf(x_n)\\&\le\mu\sum_{i\lt n}\frac{\lambda_i}{\mu}f(x_i)+\lambda_nf(x_n)\\&=\sum_{i\le n}\lambda_if(x_i),\end{aligned}$$ using the case $n=2$ and then the induction hypothesis. For AM–GM, $(-\log)''=1/x^2\gt0$, so $-\log$ is convex and $-\log\sum\lambda_ix_i\le-\sum\lambda_i\log x_i$; exponentiate. ∎

✏️ Example 7 — Prove or disprove: convex functions
(a) A convex function $f:\mathbb{R}\to\mathbb{R}$ that is bounded above is constant. (b) A convex function on $(0,1)$ is bounded. (c) If $f,g$ are convex on $\mathbb{R}$, so is $fg$. (d) A convex function on $(a,b)$ that is differentiable has a continuous derivative. (e) For $a,b,c\gt0$, $\ (abc)^{1/3}\le\dfrac{a+b+c}3$.
(a) True Suppose $f(x_0)\ne f(x_1)$ for some $x_0\lt x_1$, say $f(x_1)\gt f(x_0)$, and let $s=\frac{f(x_1)-f(x_0)}{x_1-x_0}\gt0$. For $x\gt x_1$, the three-chord lemma for $x_0\lt x_1\lt x$ gives $\frac{f(x)-f(x_1)}{x-x_1}\ge s$, so $f(x)\ge f(x_1)+s(x-x_1)\to\infty$ — unbounded above. The case $f(x_1)\lt f(x_0)$ is symmetric (look at $x\to-\infty$). So $f$ is constant. (No differentiability needed.)
(b) False $f(x)=\dfrac1x$ is convex on $(0,1)$ ($f''=2/x^3\gt0$) and unbounded. Convex functions are bounded above on compact subintervals, but not necessarily near the ends of an open interval.
(c) False $f(x)=x$ and $g(x)=x^2$ are convex, but $fg=x^3$ has $(x^3)''=6x\lt0$ for $x\lt0$. (Even $f=g=x^2-1$ gives $(x^2-1)^2$, whose second derivative $12x^2-4$ is negative near $0$.)
(d) True By Theorem 3.36, $f'$ is increasing, and an increasing derivative is continuous (Theorem 3.31(4)). So a differentiable convex function on an open interval is automatically $C^1$.
(e) True Jensen with $f=-\log$, $\lambda_i=\frac13$: $\log\frac{a+b+c}3\ge\frac13(\log a+\log b+\log c)=\log(abc)^{1/3}$, and $\exp$ is increasing. Equality iff $a=b=c$ (strict convexity).
⚠️ Counterexamples and pitfalls
  1. Continuous but not differentiable: $|x|$ (corner), $x^{1/3}$ (vertical tangent), $x^{2/3}$ (cusp), $x\sin\frac1x$ at $0$ (oscillation); Weierstrass's and Takagi's functions are differentiable nowhere.
  2. Differentiable but not $C^1$: $x^2\sin\frac1x$ — its derivative exists everywhere but is discontinuous (second kind) at $0$. With $x^2\sin\frac1{x^2}$ the derivative is even unbounded on $[-1,1]$.
  3. Differentiable at a single point: $x^2$ on $\mathbb{Q}$, $0$ off $\mathbb{Q}$ (only at $0$).
  4. $f'(c)\gt0$ does not make $f$ increasing near $c$: $f(x)=x+2x^2\sin\frac1x$, $f(0)=0$, has $f'(0)=1$, but $f'\big(\frac1{2\pi n}\big)=1-2=-1$, so $f$ is not monotone on any interval around $0$.
  5. Every hypothesis of Rolle matters: $|x|$ on $[-1,1]$; $x$ on $[0,1)$ with $f(1)=0$; and the end values must be equal. Differentiability at the end points is not needed.
  6. No mean value equality for complex/vector functions: $e^{it}$ on $[0,2\pi]$.
  7. $f\to L$ does not give $f'\to0$: $\frac{\sin x^2}{x}$. $f'\to0$ does not give convergence of $f$: $\log x$. But if both $f$ and $f'$ have limits, $f'\to0$.
  8. Bounded $f$, unbounded $f'$: $\sqrt x$ on $(0,1)$; $\sin x^2$ on $\mathbb{R}$.
  9. L'Hôpital is only sufficient: $\frac{x+\sin x}{x}\to1$ though $\frac{1+\cos x}{1}$ has no limit. And $g'\ne0$ is essential: Stolz's example $f=x+\sin x\cos x$, $g=e^{\sin x}f$.
  10. Derivatives cannot jump (Darboux): there is no $f$ with $f'=\operatorname{sgn}$ or $f'=\mathbf 1_{[0,\infty)}$ on $\mathbb{R}$; but a derivative can be discontinuous ($x^2\sin\frac1x$). A derivative that is monotone is continuous.
  11. Smooth but not analytic: $e^{-1/x^2}$ has all Taylor polynomials at $0$ equal to $0$. Analytic on $\mathbb{R}$ with radius $1$: $\frac1{1+x^2}$.
  12. $f^{(n)}(c)=0$ is inconclusive until you reach the first nonzero derivative: $x^3$ (none), $x^4$ (minimum), $-x^4$ (maximum).
  13. Convexity: strictly convex does not mean $f''\gt0$ ($x^4$); convex need not be differentiable ($|x|$); convex on a closed interval need not be continuous at the end points; products of convex functions need not be convex ($x\cdot x^2$).

Exercises

I
Derivatives, Carathéodory's form and the chain rule.
  • 1 Let $f(x)=|x|^3$. Find $f'$ and $f''$. Is $f$ three times differentiable at $0$? Is $f\in C^2(\mathbb{R})$?
  • 2 Let $g$ be continuous at $0$. Prove that $f(x)=x\,g(x)$ is differentiable at $0$ with $f'(0)=g(0)$, and that $h(x)=|x|\,g(x)$ is differentiable at $0$ if and only if $g(0)=0$.
  • 3 Find the Carathéodory function $\varphi$ of $f(x)=x^3$ at $c=2$ and read off $f'(2)$.
  • 4 Prove the product rule using Theorem 3.21 only (no limits of quotients).
  • 5 Prove that if $f$ is differentiable at $c$, then $\lim_{h\to0}\dfrac{f(c+h)-f(c-h)}{2h}=f'(c)$. Show by an example that this symmetric limit may exist where $f$ is not differentiable.
  • 6 Let $f(x)=x+e^x$. Show that $f$ has a differentiable inverse on $\mathbb{R}$ and compute $(f^{-1})'(1)$.
  • 7 Let $f:\mathbb{R}\to\mathbb{R}$ satisfy $|f(x)-f(y)|\le(x-y)^2$ for all $x,y$. Prove that $f$ is constant.
  • 8 Show that $x^{1/3}$ is continuous and strictly increasing but not differentiable at $0$, and explain this with Theorem 3.24.
1 For $x\ne0$ differentiate $\pm x^3$; at $0$, $\frac{|h|^3}{h}\to0$. So $f'(x)=3x|x|$. By Example 1(a), $f''(x)=6|x|$, which is continuous but not differentiable at $0$. So $f\in C^2(\mathbb{R})$ but $f'''(0)$ does not exist.
2 $f(x)-f(0)=g(x)\cdot(x-0)$ with $g$ continuous at $0$: Theorem 3.21 gives $f'(0)=g(0)$. For $h$: $\frac{h(x)-h(0)}{x}=\operatorname{sgn}(x)\,g(x)\to\pm g(0)$ as $x\to0\pm$. The one-sided derivatives $g(0)$ and $-g(0)$ agree iff $g(0)=0$.
3 $x^3-8=(x^2+2x+4)(x-2)$, so $\varphi(x)=x^2+2x+4$ (continuous), and $f'(2)=\varphi(2)=12$.
4 See the proof of Theorem 3.22(c): $f(x)g(x)-f(c)g(c)=[\varphi(x)g(x)+f(c)\psi(x)](x-c)$, the bracket being continuous at $c$ because $g$ is continuous at $c$ (it is $\psi(x)(x-c)+g(c)$).
5 $\frac{f(c+h)-f(c-h)}{2h}=\frac12\left[\frac{f(c+h)-f(c)}{h}+\frac{f(c-h)-f(c)}{-h}\right]\to\frac12(f'(c)+f'(c))$. For $f(x)=|x|$ at $0$ the symmetric quotient is $0$ for every $h$, but $f'(0)$ does not exist.
6 $f'(x)=1+e^x\gt0$, so $f$ is strictly increasing and continuous, with $f(x)\to\pm\infty$ as $x\to\pm\infty$; thus $f:\mathbb{R}\to\mathbb{R}$ is a bijection. By Theorem 3.24 its inverse is differentiable everywhere. Since $f(0)=1$: $(f^{-1})'(1)=\frac1{f'(0)}=\frac12$.
7 $\left|\frac{f(x)-f(y)}{x-y}\right|\le|x-y|\to0$ as $x\to y$, so $f'(y)=0$ for every $y$; by Theorem 3.28(1), $f$ is constant.
8 $x^{1/3}$ is the inverse of $x^3$, which is continuous and strictly increasing, so it is continuous (§3.1). At $0$: $\frac{h^{1/3}}{h}=h^{-2/3}\to+\infty$. This is the last statement of Theorem 3.24: $(x^3)'=0$ at $0$, so the inverse cannot be differentiable at $0^3=0$.
II
Rolle's theorem and the mean value theorems.
  • 1 Find all $c$ given by the mean value theorem for $f(x)=x^3$ on $[0,2]$.
  • 2 Prove that $\dfrac{x}{1+x^2}\lt\arctan x\lt x$ for all $x\gt0$.
  • 3 Prove that $x^5+5x-3=0$ has exactly one real root, and locate it between consecutive tenths.
  • 4 Prove that for every real $k$ the polynomial $x^3-3x+k$ has at most one root in $[-1,1]$.
  • 5 Let $f$ be continuous on $[0,1]$, differentiable on $(0,1)$, with $f(0)=0$ and $f(1)=1$. Prove that there are distinct $a,b\in(0,1)$ with $\dfrac1{f'(a)}+\dfrac1{f'(b)}=2$.
  • 6 Let $f$ be differentiable on $(a,b)$ (bounded interval) with $f'$ bounded. Prove that $f$ is uniformly continuous and that $\lim_{x\to a+}f(x)$ exists.
  • 7 (Generalised Rolle.) Let $f$ be $n$ times differentiable on an interval and have $n+1$ distinct zeros there. Prove that $f^{(n)}$ has a zero. Deduce that $e^x=\alpha x^2+\beta x+\gamma$ has at most three real solutions, whatever $\alpha,\beta,\gamma$.
  • 8 Let $f:[0,\infty)\to\mathbb{R}$ be continuous, differentiable on $(0,\infty)$, with $f(0)=0$ and $f'$ increasing. Prove that $x\mapsto f(x)/x$ is increasing on $(0,\infty)$.
  • 9 For $0\lt a\lt b\lt\pi$, use Cauchy's mean value theorem to show $\dfrac{\sin b-\sin a}{\cos a-\cos b}=\cot c$ for some $c\in(a,b)$, and identify $c$.
1 $\frac{f(2)-f(0)}{2}=4=3c^2$, so $c=\frac2{\sqrt3}\approx1.1547$ (the root $-\frac2{\sqrt3}$ is outside $(0,2)$). Exactly one.
2 MVT on $[0,x]$: $\arctan x=\frac{x}{1+\xi^2}$ with $0\lt\xi\lt x$, and $1\lt1+\xi^2\lt1+x^2$.
3 $p(x)=x^5+5x-3$ has $p'(x)=5x^4+5\gt0$, so it is strictly increasing: at most one root. $p(0.5)=0.03125+2.5-3\lt0$ and $p(0.6)=0.07776+3-3\gt0$, so the root lies in $(0.5,0.6)$ (it is $\approx0.5862$).
4 $p'(x)=3x^2-3$ vanishes only at $\pm1$. If $p$ had two roots $r\lt s$ in $[-1,1]$, Rolle would give a zero of $p'$ in $(r,s)\subseteq(-1,1)$ — there is none.
5 By the IVT pick $x_0\in(0,1)$ with $f(x_0)=\frac12$. The MVT on $[0,x_0]$ and $[x_0,1]$ gives $a\in(0,x_0)$, $b\in(x_0,1)$ with $f'(a)=\frac{1/2}{x_0}$ and $f'(b)=\frac{1/2}{1-x_0}$ — both nonzero. Then $\frac1{f'(a)}+\frac1{f'(b)}=2x_0+2(1-x_0)=2$, and $a\ne b$.
6 $|f'|\le K$ gives $|f(x)-f(y)|\le K|x-y|$ (Theorem 3.28(3)), so $f$ is Lipschitz, hence UC; a UC function on a bounded open interval has finite one-sided limits at the end points (continuous extension theorem, §3.2).
7 Induction: between consecutive zeros of $f$, Rolle gives $n$ distinct zeros of $f'$; repeat to get $n+1-k$ distinct zeros of $f^{(k)}$, so one zero of $f^{(n)}$. For $g(x)=e^x-\alpha x^2-\beta x-\gamma$, $g'''=e^x\ne0$; four zeros of $g$ would force a zero of $g'''$.
8 $\left(\frac{f(x)}{x}\right)'=\frac{xf'(x)-f(x)}{x^2}$. By the MVT, $f(x)=f(x)-f(0)=xf'(\xi)$ with $0\lt\xi\lt x$, and $f'(\xi)\le f'(x)$. So $xf'(x)-f(x)\ge0$, and $f(x)/x$ is increasing (Theorem 3.28(2)).
9 With $F=\sin$, $G=\cos$ ($G'=-\sin\ne0$ on $(0,\pi)$): $\frac{\sin b-\sin a}{\cos b-\cos a}=\frac{\cos c}{-\sin c}$, i.e. the required identity. By the sum-to-product formulas the left side equals $\frac{2\cos\frac{a+b}2\sin\frac{b-a}2}{2\sin\frac{a+b}2\sin\frac{b-a}2}=\cot\frac{a+b}2$, and $\cot$ is injective on $(0,\pi)$, so $c=\frac{a+b}2$.
III
L'Hôpital's rule, Darboux's theorem and the classes $C^n$.
  • 1 Evaluate $\displaystyle\lim_{x\to0}\frac{\tan x-x}{x^3}$.
  • 2 Evaluate $\displaystyle\lim_{x\to0+}(\sin x)^x$.
  • 3 Evaluate $\displaystyle\lim_{x\to0}\left(\frac1x-\frac1{e^x-1}\right)$.
  • 4 Evaluate $\displaystyle\lim_{x\to\infty}x\left(\frac\pi2-\arctan x\right)$.
  • 5 Show that $\displaystyle\lim_{x\to\infty}\frac{2x+\sin2x}{2x+\sin x}=1$ although the ratio of the derivatives has no limit. Does this contradict Theorem 3.30?
  • 6 Is there a differentiable $f:\mathbb{R}\to\mathbb{R}$ with $f'(x)=0$ for $x\lt0$ and $f'(x)=1$ for $x\ge0$?
  • 7 Let $f$ be differentiable on an interval $I$ with $f'(x)\in\mathbb{Z}$ for all $x$. Prove that $f(x)=kx+m$ for some constants $k\in\mathbb{Z}$, $m\in\mathbb{R}$.
  • 8 Show that $f(x)=x^2\sin\frac1{x^2}$, $f(0)=0$, is differentiable on $\mathbb{R}$ but $f'$ is unbounded on $[-1,1]$. Is $f$ Lipschitz on $[-1,1]$?
  • 9 Prove directly (without quoting Theorem 3.31(4)) that if $f$ is differentiable on $(a,b)$ and $f'$ is increasing, then $f'$ is continuous.
1 $\frac{\sec^2x-1}{3x^2}=\frac{\tan^2x}{3x^2}\to\frac13$. Answer $\frac13$.
2 $x\log\sin x=x\log x+x\log\frac{\sin x}{x}$; the first term $\to0$ (Example 4(b)) and the second $\to0\cdot\log1=0$. So the limit is $e^0=1$.
3 $\frac{e^x-1-x}{x(e^x-1)}$, type $\frac00$: derivatives give $\frac{e^x-1}{e^x-1+xe^x}$, again $\frac00$, then $\frac{e^x}{2e^x+xe^x}\to\frac12$. Answer $\frac12$.
4 Write it as $\frac{\pi/2-\arctan x}{1/x}$ (type $\frac00$): $\frac{-1/(1+x^2)}{-1/x^2}=\frac{x^2}{1+x^2}\to1$. Answer $1$.
5 Divide by $2x$: $\frac{1+\frac{\sin2x}{2x}}{1+\frac{\sin x}{2x}}\to1$. The ratio of derivatives is $\frac{2+2\cos2x}{2+\cos x}=\frac{4\cos^2x}{2+\cos x}$, which is $0$ at $x=\frac\pi2+k\pi$ and $\frac43$ at $x=2k\pi$: no limit. No contradiction: Theorem 3.30 is a sufficient condition; when $\lim f'/g'$ fails to exist it says nothing.
6 No. Such an $f'$ would take the values $0$ and $1$ but not $\frac12$, contradicting Darboux's theorem. (The function $\max(x,0)$ has this derivative except at $0$, where it is not differentiable.)
7 By Darboux, $f'(I)$ is an interval; an interval contained in $\mathbb{Z}$ is a single point $\{k\}$. So $f'\equiv k$, and $f(x)-kx$ has zero derivative, hence is a constant $m$ (Theorem 3.28(1)).
8 $\left|\frac{f(h)}{h}\right|\le|h|\to0$, so $f'(0)=0$; for $x\ne0$, $f'(x)=2x\sin\frac1{x^2}-\frac2x\cos\frac1{x^2}$. At $x_n=\frac1{\sqrt{2\pi n}}$: $f'(x_n)=-2\sqrt{2\pi n}\to-\infty$. If $f$ were $K$-Lipschitz, every difference quotient would be bounded by $K$, hence so would be $|f'|$ — so $f$ is not Lipschitz on $[-1,1]$ (although it is differentiable there).
9 By §3.2 an increasing function has one-sided limits $f'(c-)\le f'(c)\le f'(c+)$ at each $c$. If $f'(c-)\lt f'(c)$, choose $k$ strictly between them and $a'\lt c$; then $f'(a')\le f'(c-)\lt k\lt f'(c)$, so by Darboux some $t\in(a',c)$ has $f'(t)=k\gt f'(c-)\ge f'(t)$ — a contradiction. Similarly on the right. Hence $f'$ is continuous.
IV
Taylor's theorem and convexity.
  • 1 Find the Maclaurin polynomial $T_2$ of $\sqrt{1+x}$ and use the Lagrange remainder to bound $|\sqrt{1.1}-T_2(0.1)|$. Compare with the actual error.
  • 2 Use Taylor expansions to evaluate $\displaystyle\lim_{x\to0}\frac{\cos x-e^{-x^2/2}}{x^4}$.
  • 3 Prove that $\sin x\ge x-\dfrac{x^3}6$ for all $x\ge0$.
  • 4 Decide whether $0$ is a local extremum of (a) $x^2-x\sin x$; (b) $\tan x-\sin x-\dfrac{x^3}2$ (near $0$).
  • 5 Use Taylor's theorem with Lagrange remainder to prove that $e$ is irrational.
  • 6 Prove that $-\log x$ is convex on $(0,\infty)$ and deduce $a^{1/3}b^{2/3}\le\dfrac a3+\dfrac{2b}3$ for $a,b\gt0$.
  • 7 Let $f,g:\mathbb{R}\to\mathbb{R}$ be convex. Prove or disprove: (a) $f+g$ is convex; (b) $\max(f,g)$ is convex; (c) $f\circ g$ is convex; (d) $f\circ g$ is convex if $f$ is also increasing.
  • 8 Let $f$ be convex on an open interval $I$ and differentiable at $c\in I$ with $f'(c)=0$. Prove that $f$ has a global minimum at $c$.
  • 9 Find constants $a,b$ such that $\sin x-x\,(a+b\cos x)=O(x^5)$ as $x\to0$, and then find $\displaystyle\lim_{x\to0}\frac{\sin x-x(a+b\cos x)}{x^5}$.
  • 10 Applied. The period of a pendulum is computed with the small-angle approximation $\sin\theta\approx\theta$. Use Taylor's theorem to find an angle $\theta_0$ (in radians and in degrees) such that the relative error $\dfrac{\theta-\sin\theta}{\theta}$ is guaranteed to be below $1\%$ for $0\lt\theta\le\theta_0$.
1 $f'=\frac12(1+x)^{-1/2}$, $f''=-\frac14(1+x)^{-3/2}$, $f'''=\frac38(1+x)^{-5/2}$; $T_2(x)=1+\frac x2-\frac{x^2}8$, so $T_2(0.1)=1.04875$. $|R_2(0.1)|=\frac{f'''(\xi)}{6}(0.1)^3\le\frac{3/8}{6}\cdot10^{-3}=6.25\times10^{-5}$. Actual: $\sqrt{1.1}=1.0488088\ldots$, error $\approx5.88\times10^{-5}$.
2 $\cos x=1-\frac{x^2}2+\frac{x^4}{24}+o(x^4)$ and $e^{-x^2/2}=1-\frac{x^2}2+\frac{x^4}8+o(x^4)$, so the numerator is $\left(\frac1{24}-\frac18\right)x^4+o(x^4)=-\frac{x^4}{12}+o(x^4)$. Limit $-\frac1{12}$.
3 Let $g(x)=\sin x-x+\frac{x^3}6$; $g(0)=0$ and $g'(x)=\cos x-1+\frac{x^2}2\ge0$ by Example 6(b). So $g$ is increasing on $[0,\infty)$ and $g(x)\ge0$.
4 (a) $x^2-x\sin x=\frac{x^4}6-\frac{x^6}{120}+\cdots$: the first nonzero derivative at $0$ is $f^{(4)}(0)=24\cdot\frac16=4\gt0$, even order: strict local minimum. (b) $\tan x=x+\frac{x^3}3+\frac{2x^5}{15}+\cdots$ and $\sin x=x-\frac{x^3}6+\frac{x^5}{120}-\cdots$, so the function is $\frac{x^5}8+\cdots$: first nonzero derivative of odd order $5$ ($f^{(5)}(0)=15$): no extremum.
5 $e=\sum_{k=0}^n\frac1{k!}+\frac{e^\xi}{(n+1)!}$ with $0\lt\xi\lt1$. If $e=\frac pq$, take $n\ge\max(q,2)$ and multiply by $n!$: $n!e-\sum_{k\le n}\frac{n!}{k!}$ is an integer, and it equals $\frac{e^\xi}{n+1}\in\left(0,\frac3{n+1}\right)\subseteq(0,1)$ — no integer lies there.
6 $(-\log x)''=\frac1{x^2}\gt0$. Jensen with $\lambda_1=\frac13$, $\lambda_2=\frac23$: $-\log\left(\frac a3+\frac{2b}3\right)\le-\frac13\log a-\frac23\log b$; exponentiate.
7 (a) True: add the two inequalities. (b) True: $\max(f,g)(\lambda x+(1-\lambda)y)\le\lambda f(x)+(1-\lambda)f(y)\le\lambda\max(f,g)(x)+(1-\lambda)\max(f,g)(y)$, and the same with $g$. (c) False: $f(x)=-x$ (linear, so convex) and $g(x)=x^2$ give $-x^2$. (d) True: $f(g(\lambda x+(1-\lambda)y))\le f(\lambda g(x)+(1-\lambda)g(y))\le\lambda f(g(x))+(1-\lambda)f(g(y))$, the first step because $f$ is increasing.
8 By Theorem 3.35(2), the slope $s(x)=\frac{f(x)-f(c)}{x-c}$ is $\ge f'_+(c)=0$ for $x\gt c$ and $\le f'_-(c)=0$ for $x\lt c$. In both cases $f(x)-f(c)=s(x)(x-c)\ge0$.
9 $x(a+b\cos x)=(a+b)x-\frac b2x^3+\frac b{24}x^5+O(x^7)$ and $\sin x=x-\frac{x^3}6+\frac{x^5}{120}+O(x^7)$. Matching: $a+b=1$, $\frac b2=\frac16$, so $b=\frac13$, $a=\frac23$. Then the difference is $\left(\frac1{120}-\frac1{72}\right)x^5+O(x^7)=-\frac{x^5}{180}+O(x^7)$; the limit is $-\frac1{180}$.
10 Lagrange with $n=2$: $\sin\theta=\theta-\frac{\cos\xi}{6}\theta^3$, so $0\le\frac{\theta-\sin\theta}{\theta}=\frac{\cos\xi}6\theta^2\le\frac{\theta^2}6$. This is below $0.01$ when $\theta\lt\sqrt{0.06}\approx0.245$ rad $\approx14.0^\circ$. (At $\theta_0=0.2449$ rad the actual relative error is $0.00997$, so the bound is nearly sharp.)
🎯 Exam corner CSIR Part BCSIR Part CGATE MA

E1. CSIR Part B The number of real solutions of $e^x=1+x+\dfrac{x^2}2$ is (A) $0$; (B) $1$; (C) $2$; (D) $3$.

Idea Let $g(x)=e^x-1-x-\frac{x^2}2$. Then $g'(x)=e^x-1-x$, and $g''(x)=e^x-1$ is negative for $x\lt0$ and positive for $x\gt0$, so $g'$ has its minimum $g'(0)=0$: $g'\gt0$ for $x\ne0$.
Work Hence $g$ is strictly increasing (its derivative vanishes only at one point), so it has at most one zero, and $g(0)=0$.
Answer (B).

E2. CSIR Part B GATE MA $\displaystyle\lim_{x\to0}\frac{\sin x-x\cos x}{x^3}$ equals (A) $0$; (B) $\tfrac16$; (C) $\tfrac13$; (D) $\tfrac12$.

Taylor $\sin x=x-\frac{x^3}6+O(x^5)$ and $x\cos x=x-\frac{x^3}2+O(x^5)$, so the numerator is $\left(\frac12-\frac16\right)x^3+O(x^5)=\frac{x^3}3+O(x^5)$.
Check L'Hôpital once: $\frac{x\sin x}{3x^2}=\frac{\sin x}{3x}\to\frac13$.
Answer (C).

E3. CSIR Part B Let $f:[0,2]\to\mathbb{R}$ be differentiable with $f(0)=1$, $f(2)=5$ and $f'(x)\le2$ for all $x$. Then $f(1)$ (A) equals $2$; (B) equals $3$; (C) equals $4$; (D) cannot be determined from the data.

Work MVT on $[0,1]$: $f(1)-f(0)=f'(\xi_1)\le2$, so $f(1)\le3$. MVT on $[1,2]$: $f(2)-f(1)=f'(\xi_2)\le2$, so $f(1)\ge3$.
Remark In fact $g(x)=f(x)-1-2x$ is decreasing with $g(0)=g(2)=0$, so $g\equiv0$ and $f(x)=1+2x$.
Answer (B).

E4. CSIR Part C Let $f(x)=x^2\sin\frac1x$ for $x\ne0$ and $f(0)=0$. Which of the following are true? (One or more options may be correct.) (A) $f$ is differentiable on $\mathbb{R}$. (B) $f'$ has a jump discontinuity at $0$. (C) $f'$ is bounded on $[-1,1]$. (D) $f$ is Lipschitz on $[-1,1]$.

(A) True $|f(h)/h|\le|h|$, so $f'(0)=0$; elsewhere $f'(x)=2x\sin\frac1x-\cos\frac1x$.
(B) False $f'$ is discontinuous at $0$, but a derivative cannot have a jump (Darboux, Theorem 3.31(2)); the discontinuity is of the second kind ($\cos\frac1x$ oscillates).
(C) True $|f'(x)|\le2|x|+1\le3$ on $[-1,1]$.
(D) True Bounded derivative on an interval ⇒ $3$-Lipschitz (Theorem 3.28(3)).
Answer (A), (C) and (D).

E5. CSIR Part C Let $f:\mathbb{R}\to\mathbb{R}$ be differentiable. Which of the following are true? (A) If $f'(x)\ne0$ for every $x$, then $f$ is injective. (B) If $f'$ takes a positive and a negative value, then $f'(c)=0$ for some $c$. (C) If $f$ is bounded, then $f'$ is bounded. (D) If $\lim_{x\to\infty}f'(x)=1$, then $\lim_{x\to\infty}f(x)=\infty$.

(A) True If $f(a)=f(b)$ with $a\lt b$, Rolle gives $f'(c)=0$. (Equivalently, Darboux: $f'$ has constant sign.)
(B) True Darboux's theorem: $f'(\mathbb{R})$ is an interval containing a positive and a negative number, hence $0$ — even though $f'$ need not be continuous.
(C) False $f(x)=\sin(x^2)$ is bounded, but $f'(x)=2x\cos(x^2)$ is unbounded.
(D) True Choose $M$ with $f'\gt\frac12$ on $[M,\infty)$; by the MVT, $f(x)\ge f(M)+\frac12(x-M)\to\infty$.
Answer (A), (B) and (D).

E6. CSIR Part C Let $f:\mathbb{R}\to\mathbb{R}$ be twice differentiable with $f''(x)\ge0$ for all $x$. Which of the following are true? (A) $f(x)\ge f(0)+f'(0)\,x$ for all $x$. (B) If $f$ is bounded above, then $f$ is constant. (C) If $f$ is strictly convex, then $f''(x)\gt0$ for all $x$. (D) $f$ has at most two real zeros.

(A) True $f$ is convex (Theorem 3.36), so its graph lies above the tangent at $0$. (Or Taylor: $f(x)=f(0)+f'(0)x+\frac12f''(\xi)x^2$.)
(B) True If $f'(c)\ne0$ for some $c$, then $f(x)\ge f(c)+f'(c)(x-c)$ is unbounded above as $x\to\pm\infty$ (in the direction of the sign of $f'(c)$). So $f'\equiv0$ and $f$ is constant (Example 7(a)).
(C) False $x^4$ is strictly convex with $f''(0)=0$.
(D) False $f(x)=\big(\max(x,0)\big)^3$ has $f''(x)=6\max(x,0)\ge0$ (it is $C^2$) and vanishes on all of $(-\infty,0]$. (A convex function with three zeros must vanish on the whole interval between the outer two.)
Answer (A) and (B).
🧑‍🏫 For the teacher

Suggested plan — 3 lectures × 60 min.

  1. Derivative and mean value theorems. Definition 3.9 and Carathéodory's form; prove the chain rule both ways and show where the naive proof breaks ($x^2\sin\frac1x$). Example 1 on the board. Fermat, Rolle (stress where the extreme value theorem enters), Lagrange; project Interactive 1 and let students predict, for $|x|$ and $x^{1/3}$, whether a mean value point exists before revealing it. Theorem 3.28 with the derivative limit theorem.
  2. Using the MVT; L'Hôpital; Darboux. Example 2 (root counting via $g'''$) and Example 3 as a "true or false" round. Cauchy's MVT and the parametric picture; L'Hôpital with the full proof of case (i) and the idea of case (ii); the two warning examples. Darboux's theorem with its proof (the minimum of $f(x)-kx$), then Example 5. Finish with the statement of Weierstrass's theorem and the parity idea behind Takagi's function.
  3. Taylor and convexity. Theorem 3.33 with the auxiliary function $F(t)$ — derive both remainders at once. The $\log(1+x)$ discussion with Interactive 2 (set $x^\ast=-0.7$ and press Play); $e^{-1/x^2}$ and $\frac1{1+x^2}$ on the widget. Example 6 and the higher derivative test. Convexity: three-chord lemma, Theorem 3.36, Jensen and AM–GM; Example 7.

Discussion questions. (1) Rolle's theorem needs the extreme value theorem. Is Rolle true for functions on $\mathbb{Q}\cap[0,1]$ (with derivatives defined through rational points only)? What goes wrong? (2) Why can a derivative be discontinuous but never jump? Give the shortest argument you can. (3) Interactive 2 shows the Lagrange bound for $\log(1+x)$ growing with $n$ at $x=-0.7$ while the error shrinks. Is the Lagrange remainder wrong there?

Misconceptions to watch for. "$f'(c)\gt0$ ⇒ increasing near $c$"; "differentiable ⇒ $C^1$"; "if $\lim f'/g'$ does not exist then $\lim f/g$ does not exist"; applying L'Hôpital to limits that are not of type $\frac00$ or $\frac\infty\infty$; proving Cauchy's MVT with two different points; using the MVT for complex-valued functions; "$f\to L$ ⇒ $f'\to0$"; "strictly convex ⇒ $f''\gt0$"; believing a $C^\infty$ function equals its Taylor series.

Suggested homework. I(1, 2, 6, 7), II(3, 5, 7, 8, 9), III(1, 3, 5, 6, 7, 8), IV(1, 3, 4, 5, 7, 9); Exam corner E3, E5, E6.

🔬 Research–Teaching NexusResearch-tutored · optional, about 45 minutes

Research question. How small should the step $h$ be when a computer approximates a derivative by a difference quotient — and why does making $h$ smaller eventually make the answer worse?

Why it matters. Engineers and scientists differentiate measured or simulated data every day: velocities from GPS tracks in sports science, strain rates in materials testing, sensitivities of climate and finance models, gradients in machine-learning code checks. Taylor's theorem predicts the truncation error of a difference quotient, while floating-point arithmetic (about 16 significant digits in double precision, unit roundoff $u=2^{-53}\approx1.1\times10^{-16}$) adds a rounding error that grows as $h$ shrinks. The best step balances the two.

What to do.

  1. Use Taylor's theorem to show that the forward quotient $D_+(h)=\frac{f(x+h)-f(x)}{h}$ has truncation error $\frac h2f''(\xi)$ and the central quotient $D_0(h)=\frac{f(x+h)-f(x-h)}{2h}$ has truncation error $\frac{h^2}{6}f'''(\eta)$ (use the intermediate value theorem to merge two third-derivative terms).
  2. Model the rounding error of $D_+$ by $\frac{2u|f(x)|}{h}$ and of $D_0$ by $\frac{u|f(x)|}{h}$. Minimise the total error in $h$ for $f=\exp$ at $x=1$ and predict the optimal step and the smallest achievable error for each formula.
  3. In a spreadsheet or a few lines of Python, compute $|D_+(h)-e|$ and $|D_0(h)-e|$ for $h=10^{-1},10^{-2},\dots,10^{-15}$, and plot them on log–log axes. Compare with your predictions.
  4. Explain the slopes of the two straight parts of each plot in terms of the orders $h$, $h^2$ and $h^{-1}$.

Tools: Python (or any spreadsheet) in double precision; a log–log plot.

Hand in: The table and the plot, your predicted and observed optimal steps, and a paragraph explaining the "V"-shaped error curves with Taylor's theorem.

Going further. Read about complex-step differentiation, $f'(x)\approx\operatorname{Im}f(x+ih)/h$, which avoids the subtraction and allows $h=10^{-20}$, and about automatic differentiation, which underlies modern machine-learning software.

Instructor note: (2) For $D_+$: minimise $\frac h2e+\frac{2ue}{h}$, so $h^\ast=2\sqrt u\approx2.1\times10^{-8}$ and the error is about $2e\sqrt u\approx5.7\times10^{-8}$. For $D_0$: minimise $\frac{h^2}6e+\frac{ue}h$, so $h^\ast=(3u)^{1/3}\approx6.9\times10^{-6}$ and the error is about $6.5\times10^{-11}$. (3) Observed (double precision): forward error $1.36\times10^{-3}$ at $h=10^{-3}$, $1.4\times10^{-7}$ at $10^{-7}$, about $7\times10^{-9}$ at $10^{-8}$, then growing again ($1.5\times10^{-6}$ at $10^{-10}$, $4\times10^{-4}$ at $10^{-12}$); central error $4.5\times10^{-7}$ at $10^{-3}$, about $6\times10^{-11}$ near $h=10^{-5}$, then growing. (4) Slopes $+1$ (forward truncation), $+2$ (central truncation) and $-1$ (rounding) on the log–log plot.

🧪 Self-check quiz

0/5 correct

Q1. Which of the following can be the derivative of a differentiable function on $\mathbb{R}$?

Q2. For $f(x)=x^2$ on $[a,b]$, the point $c$ given by the mean value theorem is

Q3. Consider $\lim_{x\to\infty}\frac{x+\sin x}{x}$. Which statement is correct?

Q4. For $f(x)=e^{-1/x^2}$ ($x\ne0$), $f(0)=0$:

Q5. Let $f$ be differentiable on an open interval. Then $f$ is convex if and only if