Chapter 7 ยท Limit, Continuity and Differentiability

7.2 Continuity and Differentiability

A function is continuous at $a$ when its limit there equals its value, and differentiable at $a$ when the difference quotient $\frac{f(a+h)-f(a)}{h}$ has a limit as $h\to0$. We classify discontinuities, use the intermediate value theorem, prove that differentiability implies continuity, and test both properties at the junctions of piecewise formulas, the corners of $|x|$ and the jumps of $[x]$.

Imagine a simplified income-tax rule: no tax on the first $\text{โ‚น}\,3$ lakh, $5\%$ on the part of the income between $\text{โ‚น}\,3$ lakh and $\text{โ‚น}\,7$ lakh, and $10\%$ on the part above $\text{โ‚น}\,7$ lakh. The total tax $T$ is a function of the income $I$. Earn one more rupee and your tax rises by at most $10$ paise: the graph of $T$ has no jumps โ€” it is continuous. Now imagine a badly drafted rule that charged the higher rate on the whole income as soon as it crossed $\text{โ‚น}\,7$ lakh: at that point the tax would leap from $\text{โ‚น}\,20\,000$ to $\text{โ‚น}\,70\,000$, and earning one rupee more would cost $\text{โ‚น}\,50\,000$. That is a discontinuity, and real tax systems are designed to avoid it.

The sensible rule still has a feature worth noticing. The extra tax per extra rupee โ€” the slope of the graph, the marginal rate โ€” is $5\%$ just below $\text{โ‚น}\,7$ lakh and $10\%$ just above. The graph is unbroken but has a corner there, and at a corner the slope is not defined: $T$ is continuous but not differentiable at $I=7$ lakh. This section makes both ideas precise using the limits of Section 7.1. JEE Main tests them in almost every paper: find the constants that make a piecewise function continuous or differentiable, count the points where a function built from $|\ |$, $[\ ]$ or $\max/\min$ fails to be continuous or differentiable, or evaluate a derivative directly from its definition.

Continuity at a Point and Kinds of Discontinuity

๐Ÿ“˜ Definition 7.8 โ€” Continuity at a point

Let $f$ be defined on an open interval containing $a$. Then $f$ is continuous at $a$ if

$$\lim_{x\to a}f(x)=f(a),$$

that is: (i) $f(a)$ is defined, (ii) the limit exists โ€” LHL $=$ RHL โ€” and (iii) the limit equals $f(a)$. If only $\displaystyle\lim_{x\to a^-}f(x)=f(a)$ holds, $f$ is left-continuous at $a$; if only $\displaystyle\lim_{x\to a^+}f(x)=f(a)$, right-continuous. If $f$ is not continuous at a point $a$ of its domain, it is discontinuous there.

๐Ÿ“˜ Definition 7.9 โ€” Continuity on an interval

$f$ is continuous on an open interval $(a,b)$ if it is continuous at every point of it, and on a closed interval $[a,b]$ if it is continuous on $(a,b)$, right-continuous at $a$ and left-continuous at $b$. A continuous function is one that is continuous at every point of its domain. Informally, its graph over an interval can be drawn without lifting the pen.

Note the words "of its domain". $\dfrac1x$ is continuous at every point where it is defined โ€” it is a continuous function โ€” even though its graph has two separate branches. When a JEE question asks where $\dfrac1{x-1}$ "is discontinuous" in $\mathbb{R}$, it means $x=1$, where the function is not even defined; read such questions in that sense.

๐Ÿ“˜ Definition 7.10 โ€” Kinds of discontinuity

Suppose $f$ is defined near $a$, but not continuous at $a$ (or not defined at $a$).

  • Removable: $\displaystyle\lim_{x\to a}f(x)=L$ exists, but $f(a)\ne L$ or $f(a)$ is undefined. Redefining $f(a)=L$ makes $f$ continuous at $a$.
  • Jump (finite discontinuity): both one-sided limits are finite but different; the jump is $\left|\text{RHL}-\text{LHL}\right|$.
  • Infinite: at least one one-sided limit is $\pm\infty$.
  • Oscillatory: the values oscillate and at least one one-sided limit fails to exist, as for $\sin\dfrac1x$ at $0$.

The last three are non-removable: no choice of $f(a)$ mends them.

Figure 7.3 โ€” Removable: a hole with the dot in the wrong place. Jump: the two sides arrive at different heights. Infinite: the graph shoots off to infinity. Oscillatory: the graph swings faster and faster.
โœ๏ธ Example 1 โ€” Testing continuity
Decide whether each function is continuous at the given point; if not, name the kind of discontinuity. (a) $f(x)=\dfrac{x^2-9}{x-3}$ for $x\ne3$, $f(3)=5$, at $x=3$. (b) $f(x)=[x]$ at $x=2$. (c) $f(x)=\dfrac{\sin2x}{x}$ for $x\ne0$, $f(0)=k$, at $x=0$ โ€” for which $k$ is it continuous? (d) $f(x)=\dfrac{x}{|x|}+x$ for $x\ne0$, $f(0)=1$, at $x=0$.
(a) For $x\ne3$, $f(x)=x+3\to6\ne5=f(3)$. Removable discontinuity: redefining $f(3)=6$ mends it.
(b) LHL $=1$, RHL $=2=f(2)$. A jump of size $1$; $[x]$ is right-continuous but not left-continuous at every integer.
(c) $\dfrac{\sin2x}{x}=2\cdot\dfrac{\sin2x}{2x}\to2$. Continuous exactly when $k=2$; for any other $k$ the discontinuity is removable.
(d) LHL $=-1+0=-1$, RHL $=1+0=1=f(0)$: a jump of size $2$, right-continuous only. No value of $f(0)$ could mend it.
โœ๏ธ Example 2 โ€” Choosing constants for continuity
Find $a$ and $b$ so that $f$ is continuous at $x=0$, where $$f(x)=\begin{cases}\dfrac{\sin ax}{x}, & x\lt0\\[4pt] 3, & x=0\\[4pt] \dfrac{\sqrt{1+bx}-1}{x}, & x\gt0.\end{cases}$$
Find $a+b$ before you open the solution:
LHL $\dfrac{\sin ax}{x}=a\cdot\dfrac{\sin ax}{ax}\to a$ (for $a\ne0$; for $a=0$ the LHL is $0$).
RHL $\dfrac{\sqrt{1+bx}-1}{x}=\dfrac{(1+bx)-1}{x\left(\sqrt{1+bx}+1\right)}=\dfrac{b}{\sqrt{1+bx}+1}\to\dfrac b2$.
Equate Continuity at $0$ needs LHL $=$ RHL $=f(0)$: $a=3$ and $\tfrac b2=3$, so $b=6$.
Answer $a=3$, $b=6$, $a+b=9$.
๐Ÿ“ Theorem 7.10 โ€” Algebra of continuous functions

If $f$ and $g$ are continuous at $a$, then so are $f+g$, $f-g$, $fg$ and $cf$, and so is $\dfrac fg$ provided $g(a)\ne0$. If $g$ is continuous at $a$ and $f$ is continuous at $g(a)$, then $f\circ g$ is continuous at $a$.

Proof. The first part is Theorem 7.4 with $L=f(a)$, $M=g(a)$: for instance $\lim(fg)=f(a)g(a)=(fg)(a)$. For the composite: as $x\to a$, $g(x)\to g(a)$; and $f$ is continuous at $g(a)$, so $f(g(x))\to f(g(a))$. $\blacksquare$ The converse fails: $[x]$ and $\{x\}$ are both discontinuous at every integer, yet their sum $[x]+\{x\}=x$ is continuous everywhere.

๐Ÿ“ Theorem 7.11 โ€” Continuity of the standard functions

Polynomials are continuous on $\mathbb{R}$; a rational function is continuous wherever its denominator is non-zero. $\sin x$, $\cos x$, $a^x$ ($a\gt0$) and $|x|$ are continuous on $\mathbb{R}$; $\tan x$, $\cot x$, $\sec x$, $\operatorname{cosec}x$, $\log_ax$ and $\sqrt[n]{x}$ are continuous on their domains; and the inverse of a continuous strictly monotonic function on an interval is continuous. $[x]$ and $\{x\}$ are continuous at every non-integer and have a jump of size $1$ at every integer; $\operatorname{sgn}x$ is continuous except at $0$.

Proof for $\sin$ and $\cos$. $|\sin(a+h)-\sin a|$ $=\left|2\cos\!\left(a+\tfrac h2\right)\sin\tfrac h2\right|$ $\le2\left|\tfrac h2\right|=|h|\to0$, using $|\sin u|\le|u|$ from Figure 7.2; similarly for $\cos$. Polynomials and rational functions follow from Theorem 7.4; $|x|$ from $\big||x|-|a|\big|\le|x-a|$. $\blacksquare$ With Theorem 7.10, every function built from these by $+,-,\times,\div$ and composition is continuous wherever it is defined โ€” so discontinuities can only hide at the points where a formula breaks down or changes.

$f(x)=\dfrac{x^2-1}{x-1}$ for $x\ne1$ and $f(1)=2$. At $x=1$, $f$ is

Properties of Continuous Functions

A continuous function on a closed interval cannot skip a value and cannot escape to infinity. These two facts are the theoretical backbone of root-finding and of the maxima and minima of Section 7.4.

๐Ÿ“ Theorem 7.12 โ€” Intermediate value theorem (IVT)

If $f$ is continuous on $[a,b]$ and $k$ is any number between $f(a)$ and $f(b)$, then $f(c)=k$ for at least one $c\in[a,b]$. In particular, if $f(a)$ and $f(b)$ have opposite signs, $f$ has a zero in $(a,b)$.

๐Ÿ“ Theorem 7.13 โ€” Extreme value theorem

If $f$ is continuous on a closed interval $[a,b]$, then $f$ is bounded there and attains a greatest and a least value: there are $c,d\in[a,b]$ with $f(c)\le f(x)\le f(d)$ for all $x\in[a,b]$.

Both theorems rest on the completeness of the real numbers (the real line has no gaps), so we accept them without proof; the pictures are convincing โ€” an unbroken curve from below the line $y=k$ to above it must cross it. Every hypothesis matters. $\dfrac1x$ on $(0,1]$ is continuous but unbounded (the interval is not closed). $f(x)=x$ on $[0,1)$ and $f(1)=0$ is defined on a closed interval but has no greatest value (it is discontinuous at $1$). $[x]$ on $[0,2]$ jumps from $0$ to $1$ and never takes the value $\tfrac12$.

โœ๏ธ Example 3 โ€” Hunting discontinuities, and the IVT
(a) Where is $f(x)=[x]+[-x]$ discontinuous, and of what kind? (b) Find all points of $[0,2]$ where $g(x)=[x^2]$ is discontinuous. (c) Show that $x^3+x-1=0$ has a root between $0$ and $1$, and locate it between consecutive hundredths.
(a) $f(x)=0$ at integers and $-1$ elsewhere. At an integer $n$ the limit is $-1$ but $f(n)=0$: a removable discontinuity at every integer โ€” although each of $[x]$ and $[-x]$ has a jump there.
(b) $[\,u\,]$ is discontinuous only where $u$ is an integer, and $u=x^2$ increases from $0$ to $4$. So check $x^2=1,2,3,4$: $x=1,\sqrt2,\sqrt3,2$. At each interior one $g$ jumps up by $1$; at $x=2$ the LHL is $3\ne4=g(2)$, so $g$ is not left-continuous at the endpoint. At $x=0$, $g=0$ on $[0,1)$: right-continuous. Four points: $1,\sqrt2,\sqrt3,2$.
(c) $p(x)=x^3+x-1$ is continuous, $p(0)=-1\lt0$ and $p(1)=1\gt0$, so there is a root in $(0,1)$ (Theorem 7.12). $p(0.68)\approx-0.0056\lt0$ and $p(0.69)\approx0.0185\gt0$: the root lies in $(0.68,0.69)$.
Check $p$ is strictly increasing (a sum of increasing functions), so this is the only real root; it is $0.6823\ldots$

In the lab below choose the jump function ($f(x)=[x]$ for $x\ne1$, $f(1)=k$). Which value of the slider $k$ makes $f$ continuous at $x=1$?

Whatever $k$ is, the readouts show LHL $=0$ and RHL $=1$; the type stays "jump discontinuity". With $k=1$ the function is right-continuous, with $k=0$ left-continuous, and the readout says so โ€” but continuity needs the two one-sided limits to agree first, and $f(1)$ cannot change them. Compare the first function, where $k=2$ fills the hole and the verdict turns to "continuous": that discontinuity was removable.
Interactive 1 โ€” Continuity Lab: Can the Break Be Mended?

Each function has a suspicious point $a$ and a parameter $k$ โ€” sometimes $k$ is the value $f(a)$, sometimes it changes the formula. Move $k$ (or press Play, which sweeps it) and watch the three numbers of Definition 7.8: the left-hand limit, the right-hand limit and $f(a)$ (filled dot). The lab names the kind of discontinuity and tells you whether some $k$ can mend it.

0.5
LHLโ€”
RHLโ€”
$f(a)$โ€”
verdictโ€”

$f$ is continuous on $[0,2]$ with $f(0)=3$ and $f(2)=-1$. Which statement must be true?

Differentiability

For a function given by a graph, the slope of the chord from $P=(a,f(a))$ to a nearby point $Q=(a+h,f(a+h))$ is the difference quotient $\dfrac{f(a+h)-f(a)}{h}$. As $h\to0$, $Q$ slides towards $P$ and the chord turns towards the tangent at $P$. If $f(t)$ is the position of a car at time $t$, the same quotient is the average velocity over $[a,a+h]$, and its limit is the speedometer reading of the opening paragraph of Section 7.1.

๐Ÿ“˜ Definition 7.11 โ€” Derivative at a point

Let $f$ be defined on an open interval containing $a$. $f$ is differentiable at $a$ if the limit

$$f'(a)=\lim_{h\to0}\frac{f(a+h)-f(a)}{h}=\lim_{x\to a}\frac{f(x)-f(a)}{x-a}$$

exists as a real number; $f'(a)$ is the derivative of $f$ at $a$ โ€” the slope of the tangent to $y=f(x)$ at $(a,f(a))$, and the instantaneous rate of change of $f$ at $a$. Computing $f'(a)$ straight from this limit is called differentiating from first principles.

๐Ÿ“˜ Definition 7.12 โ€” One-sided derivatives; differentiability on an interval

The left-hand derivative and right-hand derivative at $a$ are

$$Lf'(a)=\lim_{h\to0^-}\frac{f(a+h)-f(a)}{h},\qquad Rf'(a)=\lim_{h\to0^+}\frac{f(a+h)-f(a)}{h}.$$

By Theorem 7.3, $f$ is differentiable at $a$ if and only if both exist (finite) and are equal. $f$ is differentiable on $(a,b)$ if it is differentiable at every point of it, and on $[a,b]$ if, in addition, $Rf'(a)$ and $Lf'(b)$ exist. The function $x\mapsto f'(x)$ is the derivative $f'$, also written $\dfrac{dy}{dx}$ or $\dfrac{d}{dx}f(x)$.

๐Ÿ“ Theorem 7.14 โ€” Differentiable implies continuous

If $f$ is differentiable at $a$, then $f$ is continuous at $a$. The converse is false.

Proof. For $h\ne0$, $f(a+h)-f(a)=h\cdot\dfrac{f(a+h)-f(a)}{h}$. As $h\to0$ the right side tends to $0\cdot f'(a)=0$ (Theorem 7.4), so $f(a+h)\to f(a)$. $\blacksquare$ For the converse take $f(x)=|x|$ at $0$: it is continuous, but $\dfrac{|h|}{h}$ is $-1$ for $h\lt0$ and $1$ for $h\gt0$, so $Lf'(0)=-1\ne1=Rf'(0)$ โ€” a corner. Read the theorem backwards too: a function that is not continuous at $a$ cannot be differentiable there. That disposes of $[x]$ at every integer at once.

A continuous function can fail to be differentiable in three ways: a corner (finite one-sided derivatives that differ, as for $|x|$), a vertical tangent (the quotient tends to $\pm\infty$, as for $\sqrt[3]{x}$ at $0$, where $\tfrac{h^{1/3}}{h}=h^{-2/3}\to\infty$), or endless wiggling (as for $x\sin\tfrac1x$ at $0$, where the quotient is $\sin\tfrac1h$).

๐Ÿ“ Theorem 7.15 โ€” Derivatives from first principles

For all $x$ in the stated domains:

$$\frac{d}{dx}x^n=nx^{n-1},\qquad \frac{d}{dx}e^x=e^x,\qquad \frac{d}{dx}\ln x=\frac1x\ (x\gt0),$$ $$\frac{d}{dx}\sin x=\cos x,\qquad \frac{d}{dx}\cos x=-\sin x,$$

where $n$ is a positive integer ($x\in\mathbb{R}$), or any rational number with $x\gt0$.

Proof. Each is a standard limit of Section 7.1 in disguise. $x^n$: with $t=x+h$, $\dfrac{t^n-x^n}{t-x}\to nx^{n-1}$ (Theorem 7.5). $\sin$: $\dfrac{\sin(x+h)-\sin x}{h}$ $=\cos\!\left(x+\tfrac h2\right)\cdot\dfrac{\sin(h/2)}{h/2}\to\cos x$ (Theorem 7.7). $\cos$: $\dfrac{\cos(x+h)-\cos x}{h}$ $=-\sin\!\left(x+\tfrac h2\right)\cdot\dfrac{\sin(h/2)}{h/2}\to-\sin x$. $e^x$: $\dfrac{e^{x+h}-e^x}{h}=e^x\cdot\dfrac{e^h-1}{h}\to e^x$ (Theorem 7.8). $\ln$: $\dfrac{\ln(x+h)-\ln x}{h}=\dfrac1x\cdot\dfrac{\ln(1+h/x)}{h/x}\to\dfrac1x$. $\blacksquare$ Section 7.3 adds the rules (sum, product, quotient, chain) that produce the derivative of every other function from these.

โœ๏ธ Example 4 โ€” First principles and one-sided derivatives
(a) Find $f'(4)$ from first principles for $f(x)=\sqrt x$. (b) Find $Lf'(2)$ and $Rf'(2)$ for $f(x)=|x-2|$. (c) Is $f(x)=x|x|$ differentiable at $0$? (d) Is $f(x)=\sqrt[3]{x}$ differentiable at $0$?
(a) $\dfrac{\sqrt{4+h}-2}{h}=\dfrac{(4+h)-4}{h\left(\sqrt{4+h}+2\right)}=\dfrac{1}{\sqrt{4+h}+2}\to\dfrac14$. (Theorem 7.15 with $n=\tfrac12$: $\tfrac12\cdot4^{-1/2}=\tfrac14$ โœ“.)
(b) $\dfrac{|h|}{h}$: $Lf'(2)=-1$, $Rf'(2)=1$. A corner โ€” continuous, not differentiable.
(c) $\dfrac{h|h|-0}{h}=|h|\to0$ from both sides: differentiable with $f'(0)=0$. Multiplying the corner of $|x|$ by $x$, which vanishes there, flattens it.
(d) $\dfrac{h^{1/3}}{h}=h^{-2/3}\to+\infty$ from both sides: not differentiable (vertical tangent), although continuous.

In the lab below choose $x^2\sin\frac1x$ (with $f(0)=0$) at $a=0$. Its graph wiggles infinitely often near $0$. As $h$ shrinks to $0.001$, what do the two difference quotients do?

At $h=0.001$ both readouts show about $0.0008$, and they shrink further as $h$ does: each quotient equals $\dfrac{h^2\sin(1/h)}{h}=h\sin\tfrac1h$, squeezed between $-|h|$ and $|h|$ (Theorem 7.6). So $f'(0)=0$ โ€” the wiggles are flattened by the factor $x^2$. Now choose $x\sin\tfrac1x$: there the quotient is $\sin\tfrac1h$, which keeps oscillating between $-1$ and $1$, and the function is not differentiable at $0$.
Interactive 2 โ€” Chord Lab: Left and Right Difference Quotients

The black point is $P=(a,f(a))$. The red chord joins $P$ to the point at $a-h$, the blue chord to the point at $a+h$; their slopes are the left and right difference quotients. Shrink $h$ (or press Play): if both slopes settle on the same number, the chords merge into the tangent and that number is $f'(a)$. A corner shows two different limits; a vertical tangent shows slopes running off to infinity.

1
$h$โ€”
left quotientโ€”
right quotientโ€”
as $h\to0$โ€”

Which of these functions is differentiable at $x=0$?

Differentiability of Piecewise, Modulus and Greatest-integer Functions

Inside an interval where $f$ is given by one standard formula, Theorems 7.10, 7.11 and 7.15 (and the rules of Section 7.3) settle continuity and differentiability at once. The real questions are at the junctions where the formula changes, at the zeros of expressions inside $|\ |$, and where expressions inside $[\ ]$ cross integers.

๐Ÿ“ Theorem 7.16 โ€” Derivative at a junction

Suppose $f(x)=g(x)$ for $a-\delta\lt x\le a$ and $f(x)=k(x)$ for $a\lt x\lt a+\delta$, where $g$ and $k$ are differentiable on an open interval containing $a$. Then $Lf'(a)=g'(a)$; $Rf'(a)$ exists if and only if $k(a)=g(a)$, and then $Rf'(a)=k'(a)$. Hence

$$f\ \text{is differentiable at }a\iff g(a)=k(a)\ \text{and}\ g'(a)=k'(a).$$

Proof. For $h\lt0$: $\dfrac{f(a+h)-f(a)}{h}=\dfrac{g(a+h)-g(a)}{h}\to g'(a)$. For $h\gt0$: $\dfrac{f(a+h)-f(a)}{h}$ $=\dfrac{k(a+h)-k(a)}{h}+\dfrac{k(a)-g(a)}{h}$; the first part tends to $k'(a)$, and the second tends to $\pm\infty$ unless $k(a)=g(a)$. $\blacksquare$ So the recipe is: first make the pieces meet, then make their slopes agree. Comparing slopes alone is not enough: $f(x)=x$ for $x\le0$ and $x+1$ for $x\gt0$ has slope $1$ on both sides but a jump, so it is not differentiable at $0$.

๐Ÿ“ Theorem 7.17 โ€” Moduli at a zero
  1. Let $g$ be differentiable at $a$ with $g(a)=0$. Then $|g|$ is differentiable at $a$ if and only if $g'(a)=0$. If $g'(a)\ne0$, $|g|$ has a corner at $a$ with one-sided derivatives $\mp|g'(a)|$.
  2. Let $\varphi$ be continuous at $a$. Then $f(x)=|x-a|\,\varphi(x)$ is differentiable at $a$ if and only if $\varphi(a)=0$.

Proof. (1) $\dfrac{|g(a+h)|-0}{h}$ $=\dfrac{|h|}{h}\cdot\left|\dfrac{g(a+h)-g(a)}{h}\right|$ $\to\pm|g'(a)|$ as $h\to0^\pm$; these agree only if $g'(a)=0$. (2) $\dfrac{|h|\,\varphi(a+h)}{h}\to\pm\varphi(a)$ as $h\to0^\pm$. $\blacksquare$ So $|x^2-1|$ has corners at $\pm1$ (simple zeros), but $|x^3|$ and $|(x-1)^2(x+2)|$ at $x=1$ are smooth (repeated zeros). And $|x-1|(x^2-1)$ is differentiable at $1$, because the factor $x^2-1$ vanishes there.

๐Ÿงญ Problem-solving strategy โ€” counting points of non-differentiability
  1. List the suspicious points: junctions of piecewise formulas; zeros of expressions inside $|\ |$; points where an expression inside $[\ ]$ or $\{\ \}$ crosses an integer; crossings of the graphs in $\max\{\cdot\}$ or $\min\{\cdot\}$; points where a root like $\sqrt[3]{\ }$ has argument $0$.
  2. At each, check continuity first: a discontinuity is automatically a point of non-differentiability (Theorem 7.14).
  3. Where $f$ is continuous, compare the one-sided derivatives: differentiate each piece (Theorem 7.16), or use Theorem 7.17 for moduli โ€” simple zero $\Rightarrow$ corner, repeated zero or a vanishing factor $\Rightarrow$ smooth.
  4. Count only the points inside the stated interval, and never count a point twice.
โœ๏ธ Example 5 โ€” Choosing constants for differentiability
$f(x)=a\,e^x+b$ for $x\lt0$ and $f(x)=\sin2x+3$ for $x\ge0$. Find $a$ and $b$ so that $f$ is differentiable at $0$, and give $f'(0)$.
Find $a$ before you open the solution:
Meet Continuity at $0$: the left piece tends to $a+b$, and $f(0)=\sin0+3=3$. So $a+b=3$.
Right slope $Rf'(0)=\displaystyle\lim_{h\to0^+}\frac{\sin2h+3-3}{h}=\lim 2\cdot\frac{\sin2h}{2h}=2$.
Left slope With $a+b=3$: $Lf'(0)=\displaystyle\lim_{h\to0^-}\frac{a\,e^h+b-3}{h}=\lim a\cdot\frac{e^h-1}{h}=a$.
Answer $a=2$, $b=1$, and $f'(0)=2$.
Check Theorem 7.16: $g(x)=2e^x+1$, $k(x)=\sin2x+3$; $g(0)=3=k(0)$ and $g'(0)=2e^0=2$, $k'(0)=2\cos0=2$ โœ“.
โœ๏ธ Example 6 โ€” Hard example: counting the bad points
Find the number of points where each function fails to be differentiable: (a) $f(x)=\left|(x-1)(x-2)^2(x-3)^3\right|$ on $\mathbb{R}$; (b) $f(x)=\max\{x^2,\ 2-x\}$ on $\mathbb{R}$; (c) $f(x)=[x]\sin(\pi x)$ on $(-2,2)$. Is the function in (c) continuous?
How many points of non-differentiability does (c) have?
(a) $g(x)=(x-1)(x-2)^2(x-3)^3$ has a simple zero at $1$ and repeated zeros at $2$ and $3$, so $g'(1)=(1-2)^2(1-3)^3=-8\ne0$ while $g'(2)=g'(3)=0$. By Theorem 7.17(1), $|g|$ has a corner only at $x=1$: one point.
(b) The graphs cross where $x^2=2-x$: $x=-2$ and $x=1$. $f=x^2$ outside $[-2,1]$ and $2-x$ inside. At $1$ the slopes are $-1$ (left) and $2$ (right); at $-2$ they are $-4$ and $-1$. Two corners.
(c) continuity On $(n-1,n)$, $f=(n-1)\sin\pi x$; on $(n,n+1)$, $f=n\sin\pi x$. At the integer $n$ both pieces tend to $0=f(n)$ because $\sin n\pi=0$: $f$ is continuous everywhere, although $[x]$ jumps.
(c) slopes By Theorem 7.16, $Lf'(n)=(n-1)\pi\cos n\pi$ and $Rf'(n)=n\pi\cos n\pi$, which always differ (as $\cos n\pi=\pm1$). So $f$ fails to be differentiable at each integer in $(-2,2)$: $-1,0,1$ โ€” three points.
โฑ Shortcut $[x]\cdot\varphi(x)$ is continuous at an integer $n$ iff $\varphi(n)=0$; it is then differentiable at $n$ iff also $\varphi'(n)=0$. Here $\varphi=\sin\pi x$ has $\varphi(n)=0$ but $\varphi'(n)=\pi\cos n\pi\ne0$.
๐Ÿš€ Beyond JEE Main (JEE Advanced) โ€” Rolle's theorem and the mean value theorem

Rolle's theorem and Lagrange's mean value theorem are in the JEE Advanced 2026 syllabus but not in the JEE Main 2026 list (they were removed from JEE Main from 2024). This box is for interest only; nothing in it is used in the exercises, the Exam corner or the quiz.

Rolle: if $f$ is continuous on $[a,b]$, differentiable on $(a,b)$ and $f(a)=f(b)$, then $f'(c)=0$ for some $c\in(a,b)$ โ€” somewhere the tangent is horizontal. Mean value theorem: if $f$ is continuous on $[a,b]$ and differentiable on $(a,b)$, then $f'(c)=\dfrac{f(b)-f(a)}{b-a}$ for some $c\in(a,b)$ โ€” somewhere the tangent is parallel to the chord. For $f(x)=x^3$ on $[0,2]$: $3c^2=\tfrac{8-0}{2}=4$, so $c=\tfrac{2}{\sqrt3}\approx1.155$. Both theorems need every hypothesis: $|x|$ on $[-1,1]$ has equal end values but no horizontal tangent, because of the corner at $0$.

โš ๏ธ JEE Main traps

1. A $\tfrac00$ formula is not a discontinuity by itself. When $f(a)$ is defined separately, compare it with the limit; continuity may well hold.

2. Continuity first. At a junction, equal slope formulas mean nothing if the pieces do not meet: $x$ and $x+1$ glued at $0$ have equal slopes but a jump, so no derivative (Theorem 7.16).

3. Differentiable $\Rightarrow$ continuous, never the reverse. $|x|$, $\sqrt[3]{x}$ and $x\sin\tfrac1x$ are continuous at $0$ but not differentiable there.

4. Not every zero of a modulus is a corner. $|g|$ has a corner at a simple zero only; $|x^3|$, $|x|\,x$, $|x-1|(x-1)$ and $|x-1|\sin\pi x$ are differentiable at the zero (Theorem 7.17).

5. $[g(x)]$ breaks where $g(x)$ crosses an integer, not where $x$ does. $[x^2]$ jumps at $x=\sqrt2$; and $[g(x)]$ at a point where $g$ touches an integer from one side only (like $[\sin x]$ at $\tfrac\pi2$) is still discontinuous.

$f(x)=|x-1|\,\varphi(x)$, where $\varphi$ is continuous and $\varphi(1)=3$. At $x=1$, $f$ is

Exercises

Unless an interval is named, functions are considered on their natural domains. For "find the number of points", justify each point you count.

I
Continuity at a point.
  • 1 $f(x)=\dfrac{x^2-25}{x-5}$ for $x\ne5$ and $f(5)=k$. Find $k$ for continuity at $5$.
  • 2 $f(x)=\dfrac{1-\cos4x}{x^2}$ for $x\ne0$ and $f(0)=k$. Find $k$ for continuity at $0$.
  • 3 $f(x)=3x+a$ for $x\lt2$ and $f(x)=x^2+1$ for $x\ge2$. Find $a$ for continuity at $2$.
  • 4 $f(x)=\dfrac{\sqrt{x+9}-3}{x}$ for $x\ne0$ and $f(0)=k$. Find $k$ for continuity at $0$.
  • 5 Name the kind of discontinuity: (a) $\operatorname{sgn}x$ at $0$; (b) $\dfrac{1}{(x+2)^2}$ at $-2$; (c) $\dfrac{x^3+8}{x+2}$ at $-2$ (give the limit there).
  • 6 $f(x)=x+a$ for $x\lt1$, $f(x)=bx^2$ for $1\le x\le3$, $f(x)=2x+12$ for $x\gt3$. Find $a$ and $b$ so that $f$ is continuous on $\mathbb{R}$, and give $a+b$.
  • 7 Find the number of points in $(0,3)$ where $f(x)=[x^2]$ is discontinuous.
  • 8 Use the intermediate value theorem to show that $x^4-3x-1=0$ has at least two real roots.
  • 9 Let $u=\dfrac{1}{x-1}$ and $f=\dfrac{1}{u^2+u-2}$. Find all points where the composite $f$, as a function of $x$, is discontinuous (undefined), and say how many there are.
1 $f(x)=x+5\to10$: $k=10$.
2 $16\cdot\dfrac{1-\cos4x}{(4x)^2}\to8$: $k=8$.
3 LHL $=6+a$, $f(2)=$ RHL $=5$: $a=-1$.
4 $\dfrac{1}{\sqrt{x+9}+3}\to\dfrac16$: $k=\tfrac16\approx0.1667$.
5 (a) jump of size $2$; (b) infinite; (c) $\dfrac{(x+2)(x^2-2x+4)}{x+2}\to12$: removable (and $f(-2)$ is undefined).
6 At $3$: $9b=2\cdot3+12=18$, $b=2$. At $1$: $1+a=b\cdot1^2=2$, $a=1$. $a+b=3$.
7 $x^2$ runs over $(0,9)$; $[x^2]$ jumps where $x^2=1,2,\dots,8$, i.e. $x=1,\sqrt2,\sqrt3,2,\sqrt5,\sqrt6,\sqrt7,2\sqrt2$: $8$ points.
8 $p(x)=x^4-3x-1$: $p(-1)=3\gt0$, $p(0)=-1\lt0$, $p(2)=9\gt0$. Sign changes on $(-1,0)$ and on $(0,2)$ give two roots.
9 $u$ is undefined at $x=1$. $u^2+u-2=(u+2)(u-1)=0$ at $u=1$ ($x=2$) and $u=-2$ ($x=\tfrac12$). Three points: $\tfrac12$, $1$, $2$.
II
Properties of continuous functions.
  • 1 Show that $x^3-5x+1=0$ has three real roots, and find consecutive integers between which each lies. How many real roots are there?
  • 2 Give an example of a function on $[0,1]$ that has no greatest value, and say which hypothesis of Theorem 7.13 it violates.
  • 3 $f$ is continuous on $[0,1]$ and $0\le f(x)\le1$ for all $x$. Prove that $f(c)=c$ for some $c\in[0,1]$ (a fixed point).
  • 4 $[x]$ and $\{x\}$ are discontinuous at every integer. Is $[x]+\{x\}$ continuous? At which integers is $[x]\cdot\{x\}$ continuous?
  • 5 Show that $\cos x=x$ has a root in $\left(0,\tfrac\pi2\right)$ and find it to two decimal places by halving the interval.
  • 6 (Modelling) A taxi charges $\text{โ‚น}\,50$ for the first $2$ km and $\text{โ‚น}\,15$ for each further kilometre or part of a kilometre. Write the fare $F(x)$ for a trip of $x$ km using $[\ ]$, find the fare for $7.3$ km, and find where $F$ is discontinuous.
1 $p(-3)=-11$, $p(-2)=3$, $p(0)=1$, $p(1)=-3$, $p(2)=-1$, $p(3)=13$. Sign changes on $(-3,-2)$, $(0,1)$, $(2,3)$: three roots, and a cubic has at most three.
2 $f(x)=x$ on $[0,1)$, $f(1)=0$: values approach $1$ but never reach it. It is not continuous at $1$.
3 $g(x)=f(x)-x$ is continuous, $g(0)=f(0)\ge0$ and $g(1)=f(1)-1\le0$. By the IVT, $g(c)=0$ for some $c\in[0,1]$, i.e. $f(c)=c$.
4 $[x]+\{x\}=x$: continuous everywhere. At an integer $n$, $[x]\{x\}$ has LHL $(n-1)\cdot1=n-1$, RHL $n\cdot0=0$ and value $0$; continuous only if $n-1=0$: only at $n=1$.
5 $g(x)=\cos x-x$: $g(0)=1\gt0$, $g\!\left(\tfrac\pi2\right)=-\tfrac\pi2\lt0$. Halving: $g(0.75)\approx-0.018$, $g(0.73)\approx0.015$, $g(0.74)\approx-0.0015$, so the root is in $(0.73,0.74)$ and $g(0.735)\gt0$ puts it in $(0.735,0.74)$: $0.74$ to two places ($0.7391$).
6 $F(x)=50$ for $0\lt x\le2$ and $F(x)=50-15\,[\,2-x\,]$ for $x\gt2$ (since $-[-t]$ rounds $t$ up). $F(7.3)=50+15\cdot6=\text{โ‚น}\,140$. $F$ jumps by $\text{โ‚น}\,15$ just after each whole number of kilometres from $2$ on: discontinuous at $x=2,3,4,\dots$ (left-continuous there).
III
Derivatives from first principles.
  • 1 $f(x)=x^2-4x$: find $f'(3)$ from first principles.
  • 2 $f(x)=\dfrac1x$: find $f'(x)$ from first principles, and $f'(2)$.
  • 3 $f(x)=\sqrt{2x+1}$: find $f'(4)$ from first principles.
  • 4 $f(x)=\cos x$: find $f'\!\left(\tfrac\pi2\right)$ from first principles.
  • 5 $f(x)=|x^2-9|$: find $Lf'(3)$ and $Rf'(3)$.
  • 6 Show that $f(x)=x^{2/3}$ is continuous but not differentiable at $0$.
  • 7 Show that $f(x)=x^2\sin\tfrac1x$ ($f(0)=0$) is differentiable at $0$, but $g(x)=x\sin\tfrac1x$ ($g(0)=0$) is not.
  • 8 If $f$ is differentiable at $a$, show that $\displaystyle\lim_{h\to0}\frac{f(a+3h)-f(a-h)}{h}=4f'(a)$, and evaluate it for $f(x)=x^3$, $a=1$.
  • 9 (Modelling) A stone dropped from a cliff has fallen $s(t)=4.9t^2$ metres after $t$ seconds. Find its speed at $t=2$ s from first principles.
1 $f(3+h)-f(3)=(9+6h+h^2-12-4h)-(-3)=2h+h^2$; divide by $h$: $2+h\to2$.
2 $\dfrac{\frac1{x+h}-\frac1x}{h}=\dfrac{-h}{hx(x+h)}=\dfrac{-1}{x(x+h)}\to-\dfrac1{x^2}$; $f'(2)=-\tfrac14$.
3 $\dfrac{\sqrt{9+2h}-3}{h}=\dfrac{2}{\sqrt{9+2h}+3}\to\dfrac26=\dfrac13$.
4 $\dfrac{\cos\left(\frac\pi2+h\right)-0}{h}=-\dfrac{\sin h}{h}\to-1$.
5 $g=x^2-9$ has a simple zero at $3$ with $g'(3)=6$: $Lf'(3)=-6$, $Rf'(3)=6$ (Theorem 7.17).
6 $h^{2/3}\to0=f(0)$: continuous. $\dfrac{h^{2/3}}{h}=h^{-1/3}\to+\infty$ as $h\to0^+$ and $-\infty$ as $h\to0^-$: a cusp, no derivative.
7 $\dfrac{h^2\sin(1/h)}{h}=h\sin\tfrac1h\to0$ (squeeze): $f'(0)=0$. $\dfrac{h\sin(1/h)}{h}=\sin\tfrac1h$ has no limit: $g$ is not differentiable at $0$ (though continuous).
8 $\dfrac{f(a+3h)-f(a)}{3h}\cdot3+\dfrac{f(a-h)-f(a)}{-h}\cdot1\to3f'(a)+f'(a)$. For $x^3$ at $1$: $f'(1)=3$, value $12$.
9 $\dfrac{4.9(2+h)^2-4.9\cdot4}{h}=4.9(4+h)\to19.6\ \text{m/s}$.
IV
Piecewise, modulus and greatest-integer functions.
  • 1 $f(x)=x^2$ for $x\le1$ and $2x-1$ for $x\gt1$. Is $f$ differentiable at $1$? If so, find $f'(1)$.
  • 2 $f(x)=ax^2+1$ for $x\le1$ and $x+b$ for $x\gt1$ is differentiable at $1$. Find $a$, $b$ and $a+b$.
  • 3 $f(x)=x^3$ for $x\le2$ and $ax+b$ for $x\gt2$ is differentiable at $2$. Find $a$ and $b$.
  • 4 Find the number of points where $f(x)=|x^2-5x+6|+|x-4|$ is not differentiable.
  • 5 Find the points where $f(x)=|x^3-x^2|$ is not differentiable.
  • 6 Find the number of points in $(-1,2)$ where $f(x)=x\,[x]$ is not differentiable.
  • 7 Where is $f(x)=\max\{x,\ x^2\}$ not differentiable?
  • 8 $f(x)=|x-2|\,(x^2+cx+2)$ is differentiable at $x=2$. Find $c$.
  • 9 Find the number of points in $(0,2\pi)$ where $f(x)=[\sin x]$ is not differentiable.
1 Values $1=1$; slopes $2x=2$ and $2$: differentiable, $f'(1)=2$.
2 Meet: $a+1=1+b$; slopes: $2a=1$. So $a=b=\tfrac12$, $a+b=1$.
3 Slopes: $a=3\cdot2^2=12$; meet: $2a+b=8$, $b=-16$.
4 $x^2-5x+6=(x-2)(x-3)$ has simple zeros $2$, $3$, and $|x-4|$ has a corner at $4$; at each, the other term is smooth. Three points.
5 $g=x^3-x^2=x^2(x-1)$: $g'(0)=0$ (repeated zero) โ€” smooth; $g'(1)=1\ne0$ โ€” corner. Only $x=1$.
6 On $(-1,0)$: $f=-x$; on $[0,1)$: $f=0$; on $[1,2)$: $f=x$. At $0$: continuous, slopes $-1$ and $0$ โ€” corner. At $1$: LHL $0\ne1=f(1)$ โ€” discontinuous. Two points.
7 $f=x^2$ for $x\le0$, $x$ on $[0,1]$, $x^2$ for $x\ge1$. Slopes at $0$: $0$ and $1$; at $1$: $1$ and $2$. Not differentiable at $x=0$ and $x=1$.
8 Need $2^2+2c+2=0$: $c=-3$. (Then $x^2-3x+2=(x-1)(x-2)$ and $f=|x-2|(x-2)(x-1)$ is smooth at $2$.)
9 On $(0,\pi)$, $0\lt\sin x\le1$, so $[\sin x]=0$ except $[\sin\tfrac\pi2]=1$; on $(\pi,2\pi)$, $[\sin x]=-1$, and $[\sin\pi]=0$. Discontinuous at $\tfrac\pi2$ (removable) and at $\pi$ (jump): two points.
๐ŸŽฏ Exam corner JEE Main ยท MCQJEE Main ยท Numerical

E1. JEE Main ยท MCQ Let $f(x)=\dfrac{e^{2x}-1}{x}$ for $x\lt0$, $f(0)=a$, and $f(x)=\dfrac{\sqrt{1+x}-1}{bx}$ for $x\gt0$. If $f$ is continuous at $0$, then (A) $a=2,\ b=\tfrac14$ (B) $a=2,\ b=4$ (C) $a=\tfrac12,\ b=\tfrac14$ (D) $a=\tfrac14,\ b=2$

LHL $2\cdot\dfrac{e^{2x}-1}{2x}\to2$.
RHL $\dfrac{1}{b\left(\sqrt{1+x}+1\right)}\to\dfrac1{2b}$.
Answer (A): $a=2$ and $\tfrac1{2b}=2$, $b=\tfrac14$.
โฑ Shortcut (B) comes from setting $\tfrac b2=2$ โ€” forgetting that $b$ is in the denominator.

E2. JEE Main ยท Numerical Find the number of points in the open interval $(-1,2)$ at which $f(x)=[x^2]$ is discontinuous. Give the answer to the nearest integer.

Range of $x^2$ On $(-1,0]$, $x^2\in[0,1)$, so $[x^2]=0$: no jumps, and at $0$ both sides give $0$. On $[0,2)$, $x^2$ increases through $[0,4)$.
Jumps $x^2=1,2,3$ at $x=1,\sqrt2,\sqrt3$.
Answer $3$.
โฑ Shortcut The trap is $x=0$: $x^2$ touches the integer $0$ there but does not cross it, so $[x^2]$ stays $0$ on both sides.

E3. JEE Main ยท MCQ Let $k$ be an integer and $f(x)=x^k\sin\dfrac1x$ for $x\ne0$, $f(0)=0$. Then $f$ is continuous but not differentiable at $x=0$ exactly when (A) $k=2$ (B) $k=1$ (C) $k\ge1$ (D) $k\ge2$

Continuity $|x^k\sin\tfrac1x|\le|x|^k\to0$ for $k\ge1$; for $k\le0$ the values do not tend to $0$. Continuous $\iff k\ge1$.
Derivative $\dfrac{f(h)}{h}=h^{k-1}\sin\tfrac1h\to0$ for $k\ge2$; for $k=1$ it is $\sin\tfrac1h$, with no limit. Differentiable $\iff k\ge2$.
Answer (B) $k=1$.

E4. JEE Main ยท Numerical $f(x)=ax^2+bx$ for $x\lt1$ and $f(x)=\ln x+3$ for $x\ge1$. If $f$ is differentiable at $x=1$, find $a^2+b^2$. Give the answer to the nearest integer.

Meet $a+b=\ln1+3=3$.
Slopes $2a+b=\dfrac11=1$ (Theorem 7.15 for $\ln x$).
Answer $a=-2$, $b=5$: $a^2+b^2=4+25=29$.

E5. JEE Main ยท MCQ Which function is continuous at $x=0$ but not differentiable there? (A) $x|x|$ (B) $x^2\sin\dfrac1x$ with $f(0)=0$ (C) $|\sin x|$ (D) $\operatorname{sgn}x$

(A), (B) Both are differentiable at $0$ with derivative $0$ (quotients $|h|$ and $h\sin\tfrac1h$).
(D) $\operatorname{sgn}$ jumps at $0$: not even continuous.
Answer (C): $\sin x$ has a simple zero at $0$ with derivative $\cos0=1\ne0$, so $|\sin x|$ has a corner with one-sided derivatives $\mp1$ (Theorem 7.17).

E6. JEE Main ยท Numerical Let $f(x)=(x^2-1)\,|x^2-3x+2|+|x-4|\cos x$. Find the sum of all points at which $f$ is not differentiable. Give the answer to the nearest integer.

Suspects $|x^2-3x+2|=|x-1|\,|x-2|$ at $x=1,2$, and $|x-4|$ at $x=4$.
$x=1$ $f$ near $1$ is $|x-1|\cdot\big[(x^2-1)|x-2|\big]+(\text{smooth})$; the bracket vanishes at $1$, so $f$ is differentiable there (Theorem 7.17(2)).
$x=2,4$ At $2$ the factor $(x^2-1)|x-1|=3\ne0$; at $4$ the factor $\cos4\ne0$. Corners at both.
Answer Points $2$ and $4$; sum $6$.
โฑ Shortcut For $|x-a|\,\varphi(x)$, ask only "is $\varphi(a)=0$?". A vanishing factor heals the corner.
๐Ÿ”ฌ Researchโ€“Teaching NexusResearch-tutored ยท optional, about 45 minutes

Research question. Speeds in sport, traffic and medicine are computed from sampled positions โ€” a difference quotient with a small but non-zero $h$. How small should $h$ be, and is "as small as possible" really best?

Why it matters. Timing gates in athletics, GPS watches, wearable heart-rate monitors and car crash recorders all estimate derivatives from data. A large $h$ blurs the instant you care about (truncation error); a tiny $h$ divides a difference of nearly equal, rounded numbers by a tiny number (rounding error). Engineers who design these systems choose the sampling interval to balance the two.

What to do.

  1. Take $f(x)=e^x$ at $a=1$, where the exact derivative is $e$. For $h=10^{-1},10^{-2},\dots,10^{-15}$ compute the forward quotient $\dfrac{f(a+h)-f(a)}{h}$ and its error.
  2. Plot the error against $h$ on logarithmic scales. You should see a "V". Where is its bottom?
  3. Repeat with the central quotient $\dfrac{f(a+h)-f(a-h)}{2h}$ (the average of the left and right quotients of Interactive 2). Where is its best $h$, and how small is its error?
  4. Explain the left arm of the V using the size of the rounding error in $f$ (about $10^{-16}$ of its value), and the right arm using the curvature of the graph.

Tools: Spreadsheet or Python with ordinary floating-point numbers.

Hand in: The table, the logโ€“log plot with both quotients, the best $h$ for each, and a recommendation (with reasons) for the sampling interval of a GPS watch that records position to the nearest metre.

Going further. Why can't the central quotient detect a corner? Compute it for $|x|$ at $0$ and compare with the one-sided quotients.

Instructor note: in double precision the forward error falls like $1.36h$ down to about $1.4\times10^{-7}$ at $h=10^{-7}$, is smallest near $h=10^{-8}$ (about $7\times10^{-9}$), then grows again ($2\times10^{-7}$ at $10^{-9}$, $4\times10^{-4}$ at $10^{-12}$, $0.4$ at $10^{-15}$). The central error falls like $0.45h^2$ to about $6\times10^{-11}$ near $h=10^{-5}$, then grows. For $|x|$ at $0$ the central quotient is exactly $0$ for every $h$ โ€” it averages away the corner.

๐Ÿงช Self-check quiz

0/5 correct

Q1. $f(x)=\dfrac{x^2-4}{x-2}$ for $x\ne2$ and $f(2)=k$. $f$ is continuous at $2$ when $k$ equals

Q2. For a function $f$ defined near $a$, which statement is always true?

Q3. The number of points at which $f(x)=|x|+|x-1|$ is not differentiable is

Q4. At $x=3$, the function $f(x)=[x]$ is

Q5. For $f(x)=x|x|$, $f'(0)$ is