TExcelTAD
Home › Calculus in Depth › A Preview of Calculus

A Preview of Calculus

Calculus grew out of a handful of old problems that ordinary algebra cannot finish: the area of a curved region, the slope of a curve at one point, the speed of a body at one instant, and the sum of infinitely many numbers. This lesson shows that all of them are solved by one idea, the limit, before the rest of the course makes that idea precise.

For a gentler first look at the two main ideas, see Calculus Intro.

The area problem

Algebra handles areas of polygons: cut them into triangles. A circle has no corners, so the ancient trick was to approximate it by polygons with more and more sides and see what the areas approach. A regular nn-gon inscribed in a circle of radius 1 consists of nn triangles with two sides 1 and apex angle 2π/n2\pi/n, so its area is

An=n⋅12⋅sin⁡(2π/n)A_n = n \cdot \tfrac{1}{2} \cdot \sin(2\pi/n)
python · try it yourself
import math

for n in [6, 12, 24, 96, 1000, 100000]:
    area = n / 2 * math.sin(2 * math.pi / n)
    print(f"n = {n:>6}:  area = {area:.10f}   gap to π = {math.pi - area:.2e}")
n =      6:  area = 2.5980762114   gap to π = 5.44e-01
n =     12:  area = 3.0000000000   gap to π = 1.42e-01
n =     24:  area = 3.1058285412   gap to π = 3.58e-02
n =     96:  area = 3.1393502030   gap to π = 2.24e-03
n =   1000:  area = 3.1415719828   gap to π = 2.07e-05
n = 100000:  area = 3.1415926515   gap to π = 2.07e-09

The area of the circle is the limit of the polygon areas, π\pi. Notice the gap shrinks by a factor of about 100 each time nn grows by 10: the error behaves like a constant times 1/n21/n^2. Measuring how fast an approximation converges will be a recurring theme (it is what separates a good numerical method from a bad one).

The same strategy works for the region under a graph: cover it with thin rectangles, add their areas, and let the width go to zero. That limit is the definite integral, the subject of chapter 5 (Areas and Distances).

python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

f = np.sqrt
n = 8
xs = np.linspace(0, 4, n + 1)
plt.figure(figsize=(6, 4))
t = np.linspace(0, 4, 400)
plt.plot(t, f(t), color="black", label="y = √x")
plt.bar(xs[:-1], f(xs[1:]), width=4 / n, align="edge", alpha=0.35, edgecolor="C0", label="right-endpoint rectangles")
plt.legend()
plt.title("Approximating the area under y = √x on [0, 4]")
for m in [8, 80, 800, 8000]:
    x = np.linspace(0, 4, m + 1)
    print(m, round(float(np.sum(f(x[1:])) * 4 / m), 6))
print("exact 16/3 =", round(16 / 3, 6))
8 5.765042
80 5.381061
800 5.33826
8000 5.333831
exact 16/3 = 5.333333

Right-endpoint rectangles overshoot here because x\sqrt{x} is increasing; as nn grows the overshoot disappears.

The tangent problem

What is the slope of the curve y=1/xy = 1/x at the point P=(2,12)P = (2, \tfrac{1}{2})? A slope needs two points, and the tangent line touches the curve at only one. So take a second point Q=(2+h,1/(2+h))Q = (2 + h, 1/(2 + h)) on the curve, compute the slope of the secant line PQPQ, and let QQ slide towards PP:

m(h)=12+h−12h=2−(2+h)2h(2+h)=−12(2+h)m(h) = \frac{\frac{1}{2 + h} - \frac{1}{2}}{h} = \frac{2 - (2 + h)}{2h(2 + h)} = \frac{-1}{2(2 + h)}

As h→0h \to 0 this tends to −14-\frac{1}{4}. That is the slope of the tangent, and it is the derivative of 1/x1/x at 2.

python · try it yourself
f = lambda x: 1 / x
for h in [1, 0.1, 0.01, -0.01, -0.1, 0.0001]:
    print(f"h = {h:>7}:  secant slope = {(f(2 + h) - f(2)) / h:.6f}")
h =       1:  secant slope = -0.166667
h =     0.1:  secant slope = -0.238095
h =    0.01:  secant slope = -0.248756
h =   -0.01:  secant slope = -0.251256
h =    -0.1:  secant slope = -0.263158
h =  0.0001:  secant slope = -0.249988

From both sides the slopes close in on −0.25. The algebra above is a proof; the table is evidence.

Velocity

If s(t)s(t) is the position of a car, the average velocity over [t,t+h][t, t + h] is (s(t+h)−s(t))/h(s(t + h) - s(t))/h, the slope of a secant on the position graph. The velocity at the instant tt is the limit as h→0h \to 0. So the velocity problem and the tangent problem are the same problem. This is worked out in The Tangent and Velocity Problems.

Infinite sums

Zeno's paradox: to cross a room you first cover half the distance, then half of what is left, and so on, so you must complete infinitely many steps. The total distance is

12+14+18+116+⋯\frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + \cdots

The partial sums are 12,34,78,…\frac{1}{2}, \frac{3}{4}, \frac{7}{8}, \ldots, and the nnth one equals 1−1/2n1 - 1/2^n, which has limit 1. An infinite sum is defined as the limit of its partial sums, when that limit exists. Not every such sum has one: 1+12+13+14+⋯1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \cdots grows without bound, though extremely slowly. Chapter 11 builds the tests that tell the two cases apart (Series).

One idea behind everything

Problem Approximation Exact answer is the limit of
area under a curve sum of rectangle areas sums as the width→0\text{width} \to 0
tangent slope secant slope secant slopes as h→0h \to 0
instantaneous velocity average velocity averages as the interval→0\text{interval} \to 0
infinite sum partial sum partial sums as n→∞n \to \infty

The Fundamental Theorem of Calculus (chapter 5) then reveals that the area problem and the tangent problem are inverse to each other.

In software

Programs live inside the "approximation" column of that table. A physics engine advances a game by small time steps and adds up velocity×Δt\text{velocity} \times \Delta t (a Riemann sum). An optimiser estimates gradients from small differences (secant slopes). math.sin and math.exp are computed from a few terms of an infinite series. Knowing that the exact answer is a limit tells you what to expect: smaller steps and more terms help, up to the point where floating-point rounding takes over, a trade-off studied in Numerical Calculus and Floating Point.

Exercises

Exercise 1: Rectangles under a line

Divide [0,2][0, 2] into nn equal pieces and use right-endpoint rectangles under y=xy = x. Find a formula for the total area in terms of nn and its limit.

Answer

Sn=2(n+1)/nS_n = 2(n + 1)/n, with limit 2.

Solution
width=2nheights=2knfor k=1,…,nSn=∑2kn⋅2n=4n2⋅∑k=4n2⋅n(n+1)2=2(n+1)nSn=2+2n→2\begin{aligned} \text{width} &= \frac{2}{n} \\ \text{heights} &= \frac{2k}{n} && \text{for } k = 1, \ldots, n \\ S_n &= \sum \frac{2k}{n} \cdot \frac{2}{n} = \frac{4}{n^2} \cdot \sum k = \frac{4}{n^2} \cdot \frac{n(n + 1)}{2} = \frac{2(n + 1)}{n} \\ S_n &= 2 + \frac{2}{n} \to 2 \end{aligned}

The exact area is the triangle 12⋅2⋅2=2\tfrac{1}{2} \cdot 2 \cdot 2 = 2, as it should be.

Exercise 2: A secant slope by algebra

For y=x2+1y = x^2 + 1, find the slope of the secant line through x=3x = 3 and x=3+hx = 3 + h, simplify it, and find the tangent slope at x=3x = 3.

Answer

Secant slope 6+h6 + h; tangent slope 6.

Solution
(3+h)2+1−(9+1)h=9+6h+h2−9h=6+h(h≠0)as h→0:6+h→6\begin{aligned} \frac{(3 + h)^2 + 1 - (9 + 1)}{h} &= \frac{9 + 6h + h^2 - 9}{h} = 6 + h && (h \ne 0) \\ \text{as } h \to 0{:}\quad 6 + h &\to 6 \end{aligned}

Exercise 3: A repeating decimal as a series

Write 0.333…0.333\ldots as an infinite sum, find the nnth partial sum and its limit.

Answer

0.3+0.03+0.003+⋯0.3 + 0.03 + 0.003 + \cdots; Sn=(1−10−n)/3S_n = (1 - 10^{-n})/3; the limit is 13\frac{1}{3}.

Solution

The terms are 3/10k3/10^k. The partial sum of a geometric sum with first term a=310a = \frac{3}{10} and ratio r=110r = \frac{1}{10} is a(1−rn)/(1−r)a(1 - r^n)/(1 - r):

Sn=310(1−10−n)910=1−10−n3→13S_n = \frac{\frac{3}{10}(1 - 10^{-n})}{\frac{9}{10}} = \frac{1 - 10^{-n}}{3} \to \frac{1}{3}

Exercise 4: Perimeters approach the circumference

The perimeter of a regular nn-gon inscribed in a circle of radius 1 is 2n⋅sin⁡(π/n)2n \cdot \sin(\pi/n). Print it for n=6,60,600,6000n = 6, 60, 600, 6000 and compare with 2π2\pi.

Answer

6.0,6.28031…,6.28315…,6.283185…→2π≈6.2831856.0, 6.28031\ldots, 6.28315\ldots, 6.283185\ldots \to 2\pi \approx 6.283185.

Solution

Each side subtends the angle 2π/n2\pi/n, so its length is 2sin⁡(π/n)2\sin(\pi/n) (half the side is sin⁡(π/n)\sin(\pi/n)).

python · try it yourself
import math

for n in [6, 60, 600, 6000]:
    print(n, round(2 * n * math.sin(math.pi / n), 8))
print("2π =", round(2 * math.pi, 8))
6 6.0
60 6.28031475
600 6.2831566
6000 6.28318502
2π = 6.28318531

Test yourself

What single idea solves the area, tangent, velocity and infinite-sum problems?

  1. Factoring
  2. The limit
  3. The Pythagorean theorem
  4. Logarithms

The secant slope of y=1/xy = 1/x between x=2x = 2 and x=2+hx = 2 + h is −12(2+h)-\frac{1}{2(2 + h)}. What is the tangent slope at x=2x = 2?

  1. −12-\frac{1}{2}
  2. 14\frac{1}{4}
  3. 0
  4. −14-\frac{1}{4}

Which of these infinite sums has a finite value?

  1. 1+12+13+14+⋯1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \cdots
  2. 1+1+1+⋯1 + 1 + 1 + \cdots
  3. 12+14+18+⋯\frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \cdots
  4. 1+2+3+⋯1 + 2 + 3 + \cdots