Functions and limits

Calculus is the mathematics of change. Its first tool is the limit: the value a function gets closer and closer to as its input approaches some point.

Getting closer without arriving

Look at f(x) = sin(x) ÷ x. At x = 0 the formula gives 0 ÷ 0, which means nothing. But we can ask what happens near 0: try x = 1, 0.1, 0.01, 0.001 and watch.

from math import sin

for x in [1, 0.1, 0.01, 0.001]:
    print("x =", x, " sin(x)/x =", round(sin(x) / x, 6))

for n in [1, 10, 100, 1000]:
    print("n =", n, " (1 + 1/n)^n =", round((1 + 1 / n) ** n, 5))
Open in compiler

The values settle on 1. We write: the limit of sin(x)/x as x approaches 0 is 1. The function never has to reach x = 0 for the limit to exist.

The second loop shows another famous limit. As n grows, (1 + 1/n)ⁿ approaches e ≈ 2.71828, the number behind compound interest and exponential growth.

Continuity

A function is continuous at a point when its limit there equals its value there: you can draw the graph without lifting the pen. Polynomials, sin and cos are continuous everywhere; 1/x is not continuous at 0.

Common mistakes

  • Thinking 0 ÷ 0 means "the answer is 0" or "there is no limit". It only means this formula cannot tell you yet; look closer.
  • Pushing x to tiny values like 10⁻²⁰ on a computer. Floating-point numbers have about 16 digits, so very tiny inputs give rounding garbage, not a better answer.

Quick check

1. What does sin(x)/x approach as x approaches 0?
2. Putting x = 0 straight into sin(x)/x gives…
3. (1 + 1/n)ⁿ approaches which number as n grows?
My notes

Write down what you want to remember from this lesson. Notes are saved on this device as you type, and appear on your dashboard.