Calculus I for Programmers

Limits, via floating point

4 / 184
Contents

Contents

Calculus I for Programmers

0 of 184 complete

10 min read

What the limit actually claims

The loop points at an answer. Here is the statement that answer is, and why it is never 'plug in zero'.

The column pointed at 6, and then the machine ran out of digits before it got there. Neither the column nor the machine is where the 6 comes from. It comes from a claim about the function, and the claim is more careful than it first looks.

The tempting reading of lim⁡h→0q(h)=6\lim_{h \to 0} q(h) = 6 is that when h is zero, q is 6. It cannot be that. At h=0h = 0 the expression is 9−90\frac{9 - 9}{0}, which is zero over zero, and there is no number there to be equal to anything. A limit is a statement about every h near zero, with zero itself deliberately excluded.

A function with a hole in it

A smaller example makes the exclusion obvious. Take g(x)=x2−9x−3g(x) = \frac{x^2 - 9}{x - 3} and leave it exactly as written, with no tidying up. Evaluate it either side of 3, closer each time, and then at 3 itself.

Try CodePython

Add 2.99999 and 3.00001 to the list. The printed values close in on 6 from both sides, and the value at 3 itself never joins in. Read each one beside the number x + 3 while you are there.

What the language does at exactly 3 varies. Some refuse the division and report it; some hand back a special value meaning not a number. What does not vary is that there is no number to hand back. The formula has nothing to say there.

Now set the five printed values beside x+3x + 3. At x=2.9x = 2.9 the loop printed 5.899999999999993 and x+3x + 3 is 5.9; at x=3.001x = 3.001 it printed 6.00100000000014 and x+3x + 3 is 6.001. They agree to twelve digits and more, and the tails are the noise of the last lesson, since the top of this fraction is once again a subtraction of two nearly equal numbers.

The agreement is not a coincidence. For every xx other than 3 the top factors as (x−3)(x+3)(x-3)(x+3), and that (x−3)(x-3) cancels with the bottom, leaving x+3x + 3 exactly. At x=3x = 3 the cancelling is not allowed, because it divides by zero, and the formula asks for zero over zero instead.

So gg is the straight line y=x+3y = x + 3 with exactly one point picked out of it. Everywhere else it is that line, exactly, with no approximation. At x=3x = 3 it is nothing at all.

And yet 6 is clearly the right answer to the question what is gg doing near 3. That gap, between what a function does near a point and what it does at it, is the entire content of the word limit.

The promise, stated exactly

A limit is a promise about tolerances, and it is stated as a challenge and a response. Writing lim⁡x→af(x)=L\lim_{x \to a} f(x) = L asserts this: for every tolerance you name, however small, there is a window around aa such that every xx in that window, except aa itself, has f(x)f(x) within your tolerance of LL.

The tolerance is traditionally called ε\varepsilon, the Greek letter epsilon, and the window's half width is called δ\delta, delta. Written out, the promise is one line.

for every ε>0 there is a δ>0 with 0<∣x−a∣<δ  ⟹  ∣f(x)−L∣<ε\text{for every } \varepsilon > 0 \text{ there is a } \delta > 0 \text{ with } \quad 0 < |x - a| < \delta \;\Longrightarrow\; |f(x) - L| < \varepsilon
The definition of a limit. The 0 < on the left is what excludes the point itself.

The order is what makes it work. Your opponent names ε\varepsilon first and may make it as small as they like, and only then do you have to produce δ\delta. If you can always answer, the limit is LL. If there is even one tolerance that defeats every window you could offer, it is not.

Try it on the quotient. q(h)=6+hq(h) = 6 + h for every h≠0h \neq 0, so ∣q(h)−6∣=∣h∣|q(h) - 6| = |h|. Given ε\varepsilon, answer with δ=ε\delta = \varepsilon. Then any hh with 0<∣h∣<δ0 < |h| < \delta has ∣q(h)−6∣=∣h∣<ε|q(h) - 6| = |h| < \varepsilon, and there is nothing further to check. Name a millionth, get a millionth back.

Naming a tolerance, finding a window
q(h)=(3+h)2−9h=6+h(h≠0)q(h) = \frac{(3+h)^2 - 9}{h} = 6 + h \quad (h \neq 0)
4.925.4666.547.08-1-0.500.51
the quotient, at every step htop of the bandbottom of the band
A window that answers it
0.4
Top of the band
6.4
Bottom of the band
5.6

Shrink the tolerance and watch the two dashed levels close on 6. The solid stretch is the window that answers you: it is drawn only for the steps with ∣h∣<δ|h| < \delta, and every one of them lands between the levels. Band and window close together, and the window never has to reach zero, which is the whole trick. One thing the picture cannot show: h=0h = 0 is not on the graph, even though the line is drawn straight through it.

One side at a time

A point can be approached from below or from above, and the two need not agree. Approaching from below is written x→a−x \to a^- and is called the left-hand limit; from above it is x→a+x \to a^+, the right-hand limit. Each is the same promise as before, restricted to one side of the window.

lim⁡x→af(x)=L⟺lim⁡x→a−f(x)=L   and   lim⁡x→a+f(x)=L\lim_{x\to a} f(x) = L \quad\Longleftrightarrow\quad \lim_{x\to a^-} f(x) = L \;\text{ and }\; \lim_{x\to a^+} f(x) = L
A two-sided limit exists exactly when both one-sided limits exist and agree.

That gives two clean ways for a limit not to exist. The two sides can head for different numbers, or a side can head for no number at all. Here is the second kind: 1/x1/x near zero grows without bound on the right and falls without bound on the left, so neither side settles on anything.

Try CodePython

Add 0.000001 to the list. Neither column is settling, so 1/x has no limit at 0, and it has no one-sided limit there either.

When plugging in is right after all

Most limits you will meet are not dramatic. lim⁡x→1x2+3xx+1\lim_{x \to 1} \frac{x^2 + 3x}{x + 1} is 2, obtained by substituting 1 and doing the arithmetic, and that is legitimate: the bottom is not zero at x=1x = 1, the expression is perfectly well behaved there, and its value and its limit agree.

The interesting cases are the ones where substitution gives 00\frac{0}{0}, because that form tells you nothing on its own. It can hide any answer at all: the same shape gave 6 for one function and −14-\frac14 for another. The work is always to rewrite the expression so the offending factor cancels, and only then substitute.

Evaluate lim⁡x→2x2−4x−2\lim_{x \to 2} \frac{x^2 - 4}{x - 2} by hand, without running anything.

Substituting gives 00\frac{0}{0}, so factor first: x2−4=(x−2)(x+2)x^2 - 4 = (x-2)(x+2). For every x≠2x \neq 2 the expression equals x+2x + 2, and the limit only cares about x≠2x \neq 2. So the answer is 2+2=42 + 2 = 4. Note that the function still has no value at x=2x = 2; the limit does not repair that, it just reports what the neighbourhood is doing.

Check yourself

For g(x)=x2−9x−3g(x) = \frac{x^2 - 9}{x - 3}, which statement about lim⁡x→3g(x)\lim_{x \to 3} g(x) is correct?

All lessons in Calculus I for Programmers