Continuity¶
Change and motion · level 7, lesson 2 of 6
A question to start¶
A hiker leaves the bottom of a mountain at 6 in the morning and walks up the only trail, sometimes fast, sometimes slowly, stopping for lunch, and reaches the top at 6 in the evening. She sleeps at the top. The next morning she leaves at 6 and walks back down the same trail, again at whatever speeds she likes, arriving at the bottom at 6 in the evening.
Is there a spot on the trail that she passed at exactly the same time of day on both days?
It seems impossible to know without her timetable. Yet the answer is yes, always, and the reason is one of the simplest-sounding and deepest facts about continuous change. By the end of this lesson you will be able to prove it.
The idea¶
Continuous means "no breaks"¶
Loosely, a function is continuous if you can draw its graph without lifting your pen. Your height over your life, the temperature outside, the position of a moving car: these change continuously. They never jump from one value to another without passing through everything in between. The amount of money in a bank account, on the other hand, jumps when a payment goes in.
Limits let us say exactly what "no break" means at a single point. A function \(f\) is continuous at \(a\) when three things hold:
- \(f(a)\) is defined (there is a point on the graph at \(x = a\));
- \(\lim_{x \to a} f(x)\) exists (the graph heads for one height from both sides);
- the two agree: \(\lim_{x \to a} f(x) = f(a)\).
In words: near \(a\), the function is close to its value at \(a\). Small changes in the input give small changes in the output. A function is continuous on an interval if it is continuous at every point of it.
Three ways to break¶
Each condition can fail, and each failure looks different.
- A hole (left). The limit exists, but either \(f(a)\) is missing or it is the wrong value. This is called a removable discontinuity, because you can repair it by redefining one single value. The function \(\frac{x^2 - 1}{x - 1}\) from the last lesson has a hole at \(x = 1\); setting \(f(1) = 2\) fills it, and the result is the continuous line \(y = x + 1\).
- A jump (middle). The one-sided limits exist but differ. No choice of \(f(a)\) can repair it: whichever height you choose, one side does not lead to it. Step functions, like postage prices or parking fees, jump.
- An infinite discontinuity (right). The function blows up near \(a\), as \(\frac{1}{x - 2}\) does at \(x = 2\). There is a vertical asymptote.
Which functions are continuous?¶
Fortunately, almost every function built from a formula is continuous wherever it makes sense.
- Polynomials are continuous everywhere. In the last lesson, the limit laws gave \(\lim_{x \to a} p(x) = p(a)\) for every polynomial \(p\), and that is exactly condition 3.
- Sums, differences, products and constant multiples of continuous functions are continuous (by the limit laws).
- Quotients of continuous functions are continuous wherever the bottom is not 0. So a rational function such as \(\frac{x + 1}{x^2 - 4}\) is continuous everywhere except \(x = 2\) and \(x = -2\).
- \(\sqrt{x}\) is continuous for \(x \ge 0\); \(\sin x\), \(\cos x\) and \(2^x\) are continuous everywhere.
- Compositions (one function inside another) of continuous functions are continuous: \(\sqrt{x^2 + 1}\) is continuous everywhere.
So, in practice, to find where a formula is not continuous, look for the places where it breaks down: division by zero, square roots of negatives, and the joins in a function defined in pieces.
The intermediate value theorem¶
Here is the big fact. Its name sounds grand; its meaning is simple.
Intermediate value theorem (IVT). Suppose \(f\) is continuous on the closed interval \([a, b]\), and \(N\) is any number between \(f(a)\) and \(f(b)\). Then there is at least one number \(c\) between \(a\) and \(b\) with \(f(c) = N\).
In plain words: a continuous function cannot get from one height to another without passing through every height in between. If a graph starts below a horizontal line and ends above it, and has no breaks, it must cross the line.
The picture shows why continuity is needed. On the right, a function with a jump starts below the line \(y = N\) and ends above it, but leaps over the line without ever touching it.
Why is it true? It feels obvious, but it secretly depends on the real number line having no gaps. Here is a surprise that shows this. Suppose we only allowed rational numbers (fractions). The function \(f(x) = x^2 - 2\) is \(-1\) at \(x = 1\) and \(2\) at \(x = 2\), and it is a perfectly smooth polynomial. Yet there is no fraction \(c\) with \(f(c) = 0\), because \(c\) would have to be \(\sqrt{2}\), which is irrational (see Numbers: why root 2 is irrational). The graph slips through a gap in the fractions. The real numbers fill in all such gaps, and that "completeness" is what a full university proof of the IVT uses. You will meet it on the U of T shelf.
Using the IVT to find roots¶
The IVT is most often used to show that an equation has a solution, even when we cannot solve it with algebra.
If \(f\) is continuous and \(f(a)\) and \(f(b)\) have opposite signs, then 0 lies between them, so \(f(c) = 0\) for some \(c\) between \(a\) and \(b\).
It even gives a way to find the solution, called bisection (cutting in half). Check the sign at the midpoint; the root is in whichever half still has a sign change. Each step halves the interval, so ten steps make it about 1000 times shorter (\(2^{10} = 1024\)).
Worked examples¶
1. Making a join continuous. Find \(k\) so that this function is continuous everywhere: \(f(x) = kx + 1\) for \(x < 2\), and \(f(x) = x^2\) for \(x \ge 2\).
- Each piece is a polynomial, so the only possible break is at the join, \(x = 2\).
- From the right (and at 2): \(f(2) = 2^2 = 4\). From the left: \(kx + 1 \to 2k + 1\).
- Continuity needs \(2k + 1 = 4\), so \(k = \dfrac32\).
2. Classifying breaks. Where is \(g(x) = \dfrac{x^2 - 4}{x^2 - x - 2}\) discontinuous, and what kind of break is each?
- Factor: \(g(x) = \dfrac{(x - 2)(x + 2)}{(x - 2)(x + 1)}\). The bottom is 0 at \(x = 2\) and \(x = -1\), so \(g\) is discontinuous there and continuous everywhere else.
- At \(x = 2\): for \(x \ne 2\), \(g(x) = \dfrac{x + 2}{x + 1} \to \dfrac{4}{3}\). The limit exists, so this is a removable discontinuity (a hole at \(\left(2, \frac43\right)\)).
- At \(x = -1\): the top tends to \((-3)(1) = -3\) while the bottom tends to 0. The function blows up: an infinite discontinuity, with a vertical asymptote \(x = -1\).
3. A root by bisection. Show that \(x^3 + x - 1 = 0\) has a solution between 0 and 1, and find it to one decimal place.
- \(f(x) = x^3 + x - 1\) is a polynomial, so it is continuous. \(f(0) = -1 < 0\) and \(f(1) = 1 > 0\). By the IVT there is a root between 0 and 1.
- \(f(0.5) = 0.125 + 0.5 - 1 = -0.375\), negative, so the root is in \([0.5, 1]\).
- \(f(0.75) = 0.421875 + 0.75 - 1 = 0.171875\), positive: the root is in \([0.5, 0.75]\).
- \(f(0.625) \approx -0.1309\), negative: \([0.625, 0.75]\).
- \(f(0.6875) \approx 0.0125\), positive: \([0.625, 0.6875]\).
- \(f(0.65) = 0.274625 + 0.65 - 1 = -0.075375\), still negative, so the root lies between 0.65 and 0.6875 and rounds to 0.7. (More steps give \(0.6823\ldots\))
4. The hiker. Measure time \(t\) in hours after 6 am, from 0 to 12. Let \(U(t)\) be her distance along the trail from the bottom on the way up, and \(D(t)\) her distance from the bottom on the way down. Both are continuous (she does not teleport). Let \(f(t) = U(t) - D(t)\), which is continuous too.
- At \(t = 0\): \(U(0) = 0\) (at the bottom) and \(D(0) = L\), the full trail length (at the top). So \(f(0) = -L < 0\).
- At \(t = 12\): \(U(12) = L\) and \(D(12) = 0\), so \(f(12) = L > 0\).
By the IVT, \(f(c) = 0\) for some time \(c\): then \(U(c) = D(c)\), so at time \(c\) she was at the same spot on both days. (Picture both walks happening on the same day, by two hikers: one going up, one coming down. They must meet.)
Try it¶
- Where is \(f(x) = \dfrac{1}{x - 3}\) discontinuous, and what kind of discontinuity is it?
- The function \(\dfrac{x^2 - 9}{x - 3}\) has one discontinuity. What kind is it, and what value at \(x = 3\) would repair it?
- Find \(c\) so that \(f(x) = x^2 + c\) for \(x < 1\) and \(f(x) = 3x\) for \(x \ge 1\) is continuous.
- Show that \(x^5 - 3x + 1 = 0\) has a solution between 0 and 1.
- Use three steps of bisection on \(x^2 - 2\), starting with \([1, 2]\). What interval contains \(\sqrt{2}\) at the end?
- A courier charges 5 dollars for any parcel up to 1 kg, 8 dollars for over 1 kg up to 2 kg, and 11 dollars for over 2 kg up to 3 kg. Sketch the price against the mass. Where is it discontinuous, and of which kind?
- At noon the temperature is 2 °C and at 6 pm it is \(-3\) °C. Must the temperature have been exactly 0 °C at some moment in between? Must it have been exactly 5 °C?
- Leo says: "\(f(x) = \dfrac{1}{x}\) has \(f(-1) = -1\) and \(f(1) = 1\), so by the IVT it has a root between \(-1\) and 1." What is wrong?
Answers
- At \(x = 3\) the bottom is 0 and the top is 1, so the function blows up: an infinite discontinuity, with vertical asymptote \(x = 3\). It is continuous everywhere else.
- For \(x \ne 3\) it equals \(x + 3\), which tends to 6. So it is a removable discontinuity, repaired by setting the value at 3 to 6.
- From the left, \(x^2 + c \to 1 + c\); at 1 and from the right, \(3 \times 1 = 3\). So \(1 + c = 3\) and \(c = 2\).
- \(f(x) = x^5 - 3x + 1\) is a polynomial, so it is continuous on \([0, 1]\). \(f(0) = 1 > 0\) and \(f(1) = 1 - 3 + 1 = -1 < 0\). Since 0 is between \(-1\) and 1, the IVT gives some \(c\) in \((0, 1)\) with \(f(c) = 0\).
- \(f(1) = -1 < 0\), \(f(2) = 2 > 0\). Midpoint 1.5: \(2.25 - 2 = 0.25 > 0\), so \([1, 1.5]\). Midpoint 1.25: \(1.5625 - 2 = -0.4375 < 0\), so \([1.25, 1.5]\). Midpoint 1.375: \(1.890625 - 2 = -0.109375 < 0\), so \([1.375, 1.5]\). Indeed \(\sqrt{2} \approx 1.414\).
- A staircase: flat at 5 up to 1 kg, then flat at 8, then flat at 11. It jumps at 1 kg and at 2 kg (jump discontinuities). At exactly 1 kg the price is 5 dollars (filled dot on the lower step), and just over 1 kg it is 8 dollars.
- Temperature changes continuously, and 0 is between 2 and \(-3\), so yes, by the IVT. But 5 °C is not between 2 and \(-3\), so the IVT says nothing: the temperature may or may not have reached 5 °C (it could have risen to 6 °C at 1 pm and then fallen).
- \(\frac{1}{x}\) is not continuous on \([-1, 1]\): it breaks at \(x = 0\), so the IVT does not apply. In fact \(\frac{1}{x}\) is never 0. The graph jumps from \(-\infty\) to \(+\infty\) across the asymptote.
Common mistake¶
Using the IVT without checking continuity. The theorem needs a continuous function on the whole closed interval. Question 8 shows how it fails otherwise. Always say "\(f\) is continuous on \([a, b]\) because ..." before you use it.
Expecting the IVT to say more than it does. It says there is at least one \(c\). It does not say where, and it does not say how many: \(\sin x\) goes from \(-1\) to \(1\) and crosses 0 many times on a long interval.
Where it leads¶
- Back: Limits · Next: The derivative from first principles
- Level 7 page · Change and motion topic page
- Continuity and the gaps in the fractions: Numbers: the real numbers.
- Bisection is an algorithm; more on step-by-step methods in Logic: algorithms and flowcharts. Another way of closing in on a root, by repeating a function, is Patterns: iteration and fixed points.
- On the U of T shelf: MAT137 Unit 2: limits and continuity, where the IVT is proved from the completeness of the real numbers.