26.3 Continuity, First Principles and Differentiability
AHL 5.12
- what it means for a function to be continuous at a point
- the difference between a removable and an essential discontinuity
- how to find a derivative from first principles, and the meaning of the Leibniz notation \(\frac{\mathrm{d}y}{\mathrm{d}x}\)
- why differentiable implies continuous, but not the other way round
- (Extension) how to test differentiability with left-hand and right-hand derivatives
The syllabus asks for an informal understanding of continuity and differentiability. In examinations you will not be asked to test for continuity and differentiability, so the formal test is marked Extension. First principles are used for polynomials only.
Continuity
We can use \(f(a)\) and \(\displaystyle\lim_{x \to a} f(x)\) to describe whether a graph is “unbroken” at \(x = a\).
Continuity at a point Not in the formula booklet
A function \(f\) is continuous at \(x = a\) if \(f(a)\) and \(\displaystyle\lim_{x \to a} f(x)\) both exist and
\[ \lim_{x \to a} f(x) = f(a). \]
At an endpoint of the domain, use the one-sided limit:
- if \(a\) is a left endpoint, we need \(\displaystyle\lim_{x \to a^+} f(x) = f(a)\) (approach from the right only);
- if \(a\) is a right endpoint, we need \(\displaystyle\lim_{x \to a^-} f(x) = f(a)\) (approach from the left only).
- \(a\): the value of \(x\) where we test continuity
- \(x \to a^+\): \(x\) approaches \(a\) from the right (\(x > a\))
- \(x \to a^-\): \(x\) approaches \(a\) from the left (\(x < a\))
If \(f\) is not continuous at \(x = a\), we say that \(f\) is discontinuous at \(x = a\), or has a discontinuity there. On a graph, a discontinuity looks like a hole, a jump or a break (a vertical asymptote).
Two kinds of discontinuity Not in the formula booklet
- Removable discontinuity (a hole): \(\displaystyle\lim_{x \to a} f(x)\) exists, but \(f(a)\) is not defined or is a different value. We can remove it by redefining \(f(a) = \displaystyle\lim_{x \to a} f(x)\).
- Essential discontinuity (a jump or a break): \(\displaystyle\lim_{x \to a} f(x)\) does not exist. Changing one value of \(f\) cannot fix it.
- \(a\): the value of \(x\) where the discontinuity is
For example, \(f(x) = \dfrac{x^2 - 9}{x - 3}\) has a removable discontinuity at \(x = 3\) (see Section 24.1). If we define \(f(3) = 6\), the new function is continuous.
Example 1 The graph of \(y = f(x)\), for \(-1 \leqslant x \leqslant 8.4\), is shown below. The point \((2, 1)\) is on the graph, and \((2, 4)\) is not. For the values \(x = 1, 2, 4, 6\), state where \(f\)
(a) has an essential discontinuity
(b) has a removable discontinuity
(c) is continuous.
(a) \(x = 4\): a jump (from the left \(f(x) \to 0\), but \(f(4) = 3\)), so the limit does not exist. \(x = 6\): a break, because \(f(x) \to \infty\) on both sides and \(f(6)\) is not defined.
(b) \(x = 2\): \(\displaystyle\lim_{x \to 2} f(x) = 4\), but \(f(2) = 1\). This is a hole. Redefining \(f(2) = 4\) removes it.
(c) \(x = 1\). The graph has a sharp corner there, but no hole, jump or break, so \(f\) is continuous at \(x = 1\). (It is also continuous at the endpoints \(x = -1\) and \(x = 8.4\).)
Differentiation from first principles
The gradient of the tangent at a point is found with a limit. Let \(A\big(x, f(x)\big)\) and \(B\big(x + h, f(x + h)\big)\) be two points on the curve \(y = f(x)\).
The chord \([AB]\) has gradient
\[ \frac{f(x + h) - f(x)}{(x + h) - x} = \frac{f(x + h) - f(x)}{h}. \]
As \(h \to 0\), the point \(B\) moves along the curve towards \(A\), and the gradient of the chord approaches the gradient of the tangent at \(A\). For each \(x\) there is at most one tangent gradient, so this limit is a new function of \(x\).
The derivative from first principles In the HL formula booklet
\[ y = f(x) \quad\Rightarrow\quad \frac{\mathrm{d}y}{\mathrm{d}x} = f'(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h} \]
If this limit exists at \(x = a\), then \(f\) is differentiable at \(x = a\), and \(f'(a)\) is the gradient of the tangent at \(x = a\). The domain of \(f'\) is the set of \(x\)-values for which the limit exists.
- \(h\): a small change in \(x\) (it tends to 0)
- \(a\): a value of \(x\) in the domain of \(f\)
- \(f'(a)\): the derivative at \(x = a\)
Using this definition to find \(f'(x)\) is called differentiating from first principles.
Method. (1) Write \(f(x + h)\) and expand. (2) Subtract \(f(x)\): every term without \(h\) cancels. (3) Divide by \(h\). (4) Let \(h \to 0\).
Example 2 Use first principles to find \(f'(x)\) for \(f(x) = 2x^2 + 5x\).
\(f(x + h) = 2(x + h)^2 + 5(x + h) = 2x^2 + 4xh + 2h^2 + 5x + 5h\).
\(f(x + h) - f(x) = 4xh + 2h^2 + 5h\).
\[ f'(x) = \lim_{h \to 0} \frac{4xh + 2h^2 + 5h}{h} = \lim_{h \to 0} (4x + 2h + 5) = 4x + 5. \]
Leibniz notation
If a function is given as \(f(x)\), we write its derivative as \(f'(x)\). If \(y\) is given in terms of \(x\), we use the Leibniz notation \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\).
\(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) is not a fraction. It is the limit of a fraction. Write \(\delta x\) (“a small change in \(x\)”) for \(h\), and \(\delta y\) for the change \(f(x + h) - f(x)\). Then
\[ f'(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h} = \lim_{\delta x \to 0} \frac{\delta y}{\delta x} = \frac{\mathrm{d}y}{\mathrm{d}x}. \]
The rules for differentiating quickly are in Unit 24.
Example 3 The graph of \(f(x) = 4x - x^2\) is shown below.
(a) Use the graph to estimate the gradient of the tangent at
(i) \(x = 0\)
(ii) \(x = 3\).
(b) Find \(f'(x)\) from first principles.
(c) Find \(f'(0)\) and \(f'(3)\), and hence check your estimates in (a).
(a) Draw the tangents with a ruler and read two points on each.
(i) The tangent at \((0, 0)\) passes through about \((1, 4)\): gradient \(\approx 4\).
(ii) The tangent at \((3, 3)\) passes through about \((4, 1)\): gradient \(\approx -2\).
(b) \(f(x + h) = 4x + 4h - x^2 - 2xh - h^2\), so \(f(x + h) - f(x) = 4h - 2xh - h^2\).
\[ f'(x) = \lim_{h \to 0} \frac{4h - 2xh - h^2}{h} = \lim_{h \to 0} (4 - 2x - h) = 4 - 2x. \]
(c) \(f'(0) = 4\) and \(f'(3) = 4 - 6 = -2\). Both agree with the estimates.
Differentiability and continuity
Differentiable implies continuous Not in the formula booklet
If \(f\) is differentiable at \(x = a\), then \(f\) is continuous at \(x = a\).
Proof. Suppose \(f'(a)\) exists. For \(h \neq 0\),
\[ f(a + h) - f(a) = \frac{f(a + h) - f(a)}{h} \times h. \]
Both factors have a limit as \(h \to 0\), so by the product property,
\[ \lim_{h \to 0} \big[f(a + h) - f(a)\big] = f'(a) \times 0 = 0, \qquad \text{so} \qquad \lim_{h \to 0} f(a + h) = f(a). \]
Writing \(x = a + h\), this says \(\displaystyle\lim_{x \to a} f(x) = f(a)\). So \(f\) is continuous at \(x = a\). \(\blacksquare\)
- Contrapositive (also true; see Section 6.3): if \(f\) is not continuous at \(x = a\), then \(f\) is not differentiable at \(x = a\).
- Converse (not true): a function can be continuous at \(x = a\) but not differentiable there. The usual example is a sharp corner, such as \(y = |x|\) at \(x = 0\): the graph is unbroken, but there is no single tangent.
So a graph is differentiable where it is smooth: no holes, jumps or breaks, and no sharp corners. In Example 1, \(f\) is continuous at \(x = 1\) but not differentiable there.
Testing for differentiability
We can let \(h\) approach \(0\) from one side only.
- The left-hand derivative of \(f\) at \(x = a\) is \(\;f'_-(a) = \displaystyle\lim_{h \to 0^-} \frac{f(a + h) - f(a)}{h}\).
- The right-hand derivative of \(f\) at \(x = a\) is \(\;f'_+(a) = \displaystyle\lim_{h \to 0^+} \frac{f(a + h) - f(a)}{h}\).
Test. \(f\) is differentiable at \(x = a\) (a point of its domain) if
- \(f\) is continuous at \(x = a\), and
- \(f'_-(a)\) and \(f'_+(a)\) both exist and are equal.
Example A. Prove that \(f(x) = |x + 2|\) is continuous but not differentiable at \(x = -2\).
Continuity. \(f(-2) = 0\). For \(x\) near \(-2\), \(|x + 2| \to 0\) from both sides. So \(\displaystyle\lim_{x \to -2} f(x) = 0 = f(-2)\): continuous.
Derivatives. \(f(-2 + h) - f(-2) = |h|\).
- \(h > 0\): \(\dfrac{|h|}{h} = \dfrac{h}{h} = 1\), so \(f'_+(-2) = 1\).
- \(h < 0\): \(\dfrac{|h|}{h} = \dfrac{-h}{h} = -1\), so \(f'_-(-2) = -1\).
\(f'_-(-2) \neq f'_+(-2)\), so \(f\) is not differentiable at \(x = -2\) (the graph has a sharp corner there).
Example B. Let \(f(x) = \begin{cases} 4x - 1, & x < 2 \\ x^2 + 1, & x \geqslant 2. \end{cases}\)
(a) Sketch \(y = f(x)\).
(b) Find \(f'_+(2)\) and \(f'_-(2)\).
(c) Is \(f\) differentiable at \(x = 2\)?
(a)
(b) \(f(2) = 2^2 + 1 = 5\).
Right (\(h > 0\), use \(x^2 + 1\)): \(\;\dfrac{(2 + h)^2 + 1 - 5}{h} = \dfrac{4h + h^2}{h} = 4 + h \to 4\). So \(f'_+(2) = 4\).
Left (\(h < 0\), use \(4x - 1\)): \(\;\dfrac{4(2 + h) - 1 - 5}{h} = \dfrac{2 + 4h}{h} = \dfrac{2}{h} + 4\). As \(h \to 0^-\), \(\dfrac{2}{h} \to -\infty\), so \(f'_-(2)\) does not exist.
(c) No. From the left, \(f(x) \to 7\), but \(f(2) = 5\), so \(f\) is not even continuous at \(x = 2\), and so it cannot be differentiable.
Notice the trap: the two pieces have the same slope at \(x = 2\) (both \(4\)), but this does not make \(f\) differentiable. Always check continuity first.
Common errors
| ✗ Wrong | ✓ Right | Why |
|---|---|---|
| “\(f(a)\) exists, so \(f\) is continuous at \(a\).” | Also need \(\displaystyle\lim_{x \to a} f(x) = f(a)\) | In Example 1, \(f(2) = 1\) exists but the limit is 4. |
| Continuous \(\Rightarrow\) differentiable | Differentiable \(\Rightarrow\) continuous | A sharp corner is continuous but not differentiable. |
| \(f(x + h) = f(x) + h\) | Replace every \(x\) by \((x + h)\) | e.g. \((x + h)^2 = x^2 + 2xh + h^2\). |
| Putting \(h = 0\) before dividing by \(h\) | Cancel \(h\) first, then let \(h \to 0\) | Otherwise you get \(\frac{0}{0}\). |
| Writing \(\lim_{h \to 0}\) on every line, then dropping it too early | Keep “\(\lim\)” until you let \(h \to 0\) | The final line has no \(h\) and no \(\lim\). |
Exercises
1 Let \(f(x) = \dfrac{x^2 - 16}{x - 4}\) for \(x \neq 4\), and \(f(4) = k\). Find the value of \(k\) for which \(f\) is continuous at \(x = 4\).
\(\displaystyle\lim_{x \to 4} \frac{(x + 4)(x - 4)}{x - 4} = 8\), so we need \(k = 8\).
2 Let \(f(x) = x^2 + a\) for \(x < 1\) and \(f(x) = 3x - 1\) for \(x \geqslant 1\). Find \(a\) so that \(f\) is continuous at \(x = 1\).
\(f(1) = 2\). From the left, \(f(x) \to 1 + a\). Continuity needs \(1 + a = 2\), so \(a = 1\).
3 State whether each function has a removable or an essential discontinuity at \(x = 2\).
(a) \(f(x) = \dfrac{x^2 - x - 2}{x - 2}\)
(b) \(g(x) = \dfrac{1}{x - 2}\)
(a) \(\dfrac{(x - 2)(x + 1)}{x - 2} = x + 1 \to 3\). The limit exists, so it is removable (a hole at \((2, 3)\)).
(b) \(g(x) \to \pm\infty\) near \(x = 2\), so the limit does not exist: essential (a break).
4 Use first principles to find \(f'(x)\) for \(f(x) = 3x^2\).
\(f(x + h) - f(x) = 3(x^2 + 2xh + h^2) - 3x^2 = 6xh + 3h^2\). \(\displaystyle\lim_{h \to 0} (6x + 3h) = 6x\).
5 Use first principles to find \(f'(x)\) for \(f(x) = x^2 - 7x + 4\).
\(f(x + h) - f(x) = 2xh + h^2 - 7h\). \(\displaystyle\lim_{h \to 0} (2x + h - 7) = 2x - 7\).
6 Use first principles to find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) for \(y = x^3\).
\((x + h)^3 - x^3 = 3x^2h + 3xh^2 + h^3\). \(\displaystyle\lim_{h \to 0} (3x^2 + 3xh + h^2) = 3x^2\).
7 Let \(f(x) = 5 - 2x - x^2\). Use first principles to find \(f'(x)\), and hence find the gradient of the curve at \(x = -3\).
\(f(x + h) - f(x) = -2h - 2xh - h^2\). \(\;f'(x) = \displaystyle\lim_{h \to 0} (-2 - 2x - h) = -2 - 2x\).
\(f'(-3) = -2 + 6 = 4\).
8 Use the definition \(f'(2) = \displaystyle\lim_{h \to 0} \frac{f(2 + h) - f(2)}{h}\) to find the gradient of \(y = x^2 + 3x\) at \(x = 2\).
\(f(2) = 10\). \(f(2 + h) = 4 + 4h + h^2 + 6 + 3h = 10 + 7h + h^2\). \(\displaystyle\lim_{h \to 0} \frac{7h + h^2}{h} = \lim_{h \to 0} (7 + h) = 7\).
9 Let \(f(x) = |2x - 6|\). Sketch the graph and state, with a reason, whether \(f\) is
(a) continuous at \(x = 3\) \(\qquad\) (b) differentiable at \(x = 3\).
The graph is a “V” with its vertex at \((3, 0)\); the gradients are \(-2\) on the left and \(2\) on the right.
(a) Yes: there is no hole, jump or break; \(\displaystyle\lim_{x \to 3} f(x) = 0 = f(3)\).
(b) No: there is a sharp corner at \(x = 3\) (gradient \(-2\) on the left, \(2\) on the right), so there is no single tangent.
10 Extension Let \(f(x) = x^2\) for \(x \leqslant 1\) and \(f(x) = 2x - 1\) for \(x > 1\). Find \(f'_-(1)\) and \(f'_+(1)\), and decide whether \(f\) is differentiable at \(x = 1\).
\(f(1) = 1\), and from the right \(2x - 1 \to 1\), so \(f\) is continuous at \(x = 1\).
Left: \(\dfrac{(1 + h)^2 - 1}{h} = 2 + h \to 2\). Right: \(\dfrac{2(1 + h) - 1 - 1}{h} = \dfrac{2h}{h} = 2\).
\(f'_-(1) = f'_+(1) = 2\) and \(f\) is continuous, so \(f\) is differentiable at \(x = 1\), with \(f'(1) = 2\).