TExcelTAD
Home › Calculus in Depth › The Tangent and Velocity Problems

The Tangent and Velocity Problems

Two questions started differential calculus: what is the slope of a curve at a single point, and what is the speed of a moving object at a single instant? Both lead to the same computation, a slope of secant lines whose two points slide together, and that computation forces us to invent the limit.

For a gentler first pass, see Limits in the survey course. Here we set the problem up carefully so that the definitions in the next lessons have a clear job to do.

The tangent problem

For a circle, "tangent line" has an easy meaning: the line that touches the circle once. For a general curve that definition fails. The line y=1y = 1 touches y=cos⁡xy = \cos x at infinitely many points and is tangent at every one of them, while the line x=0x = 0 meets y=x3y = x^3 only once and is not tangent at all (the tangent at the origin is y=0y = 0, which crosses the curve).

A better idea is to approximate. Fix a point P=(a,f(a))P = (a, f(a)) on the graph and pick a second point Q=(x,f(x))Q = (x, f(x)). The secant line through PP and QQ has slope

mPQ=f(x)−f(a)x−a(x≠a)m_{PQ} = \frac{f(x) - f(a)}{x - a} \qquad (x \ne a)

As QQ slides along the curve towards PP, the secant lines pivot about PP. If their slopes settle on a number mm, we define the tangent line at PP to be the line through PP with slope mm. The tangent is the limiting position of the secants.

Take f(x)=x3−2xf(x) = x^3 - 2x and P=(2,4)P = (2, 4).

python · try it yourself
def f(x):
    return x**3 - 2*x

a = 2
print("   x        slope of secant PQ")
for x in [3, 2.5, 2.1, 2.01, 2.001, 1.999, 1.99, 1.9, 1.5]:
    m = (f(x) - f(a)) / (x - a)
    print(f"{x:7.3f}   {m:.6f}")
   x        slope of secant PQ
  3.000   17.000000
  2.500   13.250000
  2.100   10.610000
  2.010   10.060100
  2.001   10.006001
  1.999   9.994001
  1.990   9.940100
  1.900   9.410000
  1.500   7.250000

From both sides the slopes close in on 1010. The algebra confirms it: for x≠2x \ne 2,

x3−2x−4x−2=(x−2)(x2+2x+2)x−2=x2+2x+2\frac{x^3 - 2x - 4}{x - 2} = \frac{(x - 2)(x^2 + 2x + 2)}{x - 2} = x^2 + 2x + 2

and x2+2x+2x^2 + 2x + 2 gives 4+4+2=104 + 4 + 2 = 10 at x=2x = 2. So the tangent line is y−4=10(x−2)y - 4 = 10(x - 2), that is y=10x−16y = 10x - 16.

The velocity problem

A drone climbs so that its height after tt seconds is h(t)=12t−t2h(t) = 12t - t^2 metres (for 0≤t≤120 \le t \le 12). Its average velocity over [2,2+Δt][2, 2 + \Delta t] is

average velocity=change in heightelapsed time=h(2+Δt)−h(2)Δt\text{average velocity} = \frac{\text{change in height}}{\text{elapsed time}} = \frac{h(2 + \Delta t) - h(2)}{\Delta t}
python · try it yourself
from fractions import Fraction as F

def h(t):
    return 12*t - t**2

for dt in [F(1), F(1, 10), F(1, 100), F(1, 1000), F(-1, 1000)]:
    v = (h(2 + dt) - h(2)) / dt
    print(f"Δt = {str(dt):>7}   average velocity = {v} m/s")
Δt =       1   average velocity = 7 m/s
Δt =    1/10   average velocity = 79/10 m/s
Δt =   1/100   average velocity = 799/100 m/s
Δt =  1/1000   average velocity = 7999/1000 m/s
Δt = -1/1000   average velocity = 8001/1000 m/s

Exact fractions make the pattern obvious: the average velocity is exactly 8−Δt8 - \Delta t. Expanding confirms it:

h(2+Δt)−h(2)=12(2+Δt)−(2+Δt)2−20=8Δt−Δt2divide by Δt:8−Δt\begin{aligned} h(2 + \Delta t) - h(2) &= 12(2 + \Delta t) - (2 + \Delta t)^2 - 20 = 8\Delta t - \Delta t^2 \\ \text{divide by } \Delta t{:}\quad &8 - \Delta t \end{aligned}

As Δt→0\Delta t \to 0 this tends to 88, the instantaneous velocity at t=2t = 2: 8 m/s upward.

One computation, two meanings

Average velocity over [a,a+Δt][a, a + \Delta t] is exactly the slope of the secant line on the graph of position against time. So the instantaneous velocity is the slope of the tangent line to the position graph.

Tangent problem Velocity problem
Ingredients curve y=f(x)y = f(x), point aa position s(t)s(t), instant aa
Approximation secant slope (f(x)−f(a))/(x−a)(f(x) - f(a))/(x - a) average velocity (s(a+h)−s(a))/h(s(a+h) - s(a))/h
Target slope of tangent instantaneous velocity
Obstacle x=ax = a gives 0/00/0 h=0h = 0 gives 0/00/0

The obstacle is the same in both columns. Plugging in the point itself produces 0/00/0, which carries no information. What we need is the value the quotient approaches. That is the limit, defined in The Limit of a Function and made precise in The Precise Definition of a Limit. The common answer, the derivative, arrives in Derivatives and Rates of Change.

Note: Numerical tables like the ones above are evidence, not proof. Floating point also limits how far you can push them: with h = 1e-12 the subtraction f(a+h)−f(a)f(a+h) - f(a) cancels almost all significant digits. Exact fractions or algebra avoid that problem.

A picture of secants converging

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

f = lambda x: x**3 - 2*x
xs = np.linspace(0, 3.2, 200)
plt.figure(figsize=(6, 4))
plt.plot(xs, f(xs), "k", label="y = x³ − 2x")
for x, c in [(3, "C0"), (2.5, "C1"), (2.2, "C2")]:
    m = (f(x) - f(2)) / (x - 2)
    plt.plot(xs, f(2) + m*(xs - 2), c, lw=0.8, label=f"secant to x={x}, slope {m:.2f}")
plt.plot(xs, 10*xs - 16, "r--", label="tangent y = 10x − 16")
plt.ylim(-5, 25); plt.legend(fontsize=8); plt.grid(alpha=0.3)
print("secant slopes:", [round((f(x) - f(2)) / (x - 2), 2) for x in (3, 2.5, 2.2)])
secant slopes: [17.0, 13.25, 11.24]

In software

  • Physics engines store position and velocity, and a frame's velocity estimate (xnew−xold)/dt(x_{\text{new}} - x_{\text{old}})/dt is an average velocity. Smaller time steps make it closer to the instantaneous one (Game Physics).
  • Telemetry and monitoring: "requests per second" on a dashboard is a secant slope of a cumulative counter over a sampling window. Shrinking the window gives a more local rate but a noisier one.
  • Numerical differentiation in scientific code is a secant slope with a carefully chosen small hh, a trade-off between truncation error and rounding error.

Exercises

Exercise 1: Secant slope by algebra

For f(x)=x2+3xf(x) = x^2 + 3x, simplify the secant slope between x=1x = 1 and x=1+hx = 1 + h and find the slope of the tangent at x=1x = 1.

Answer

Secant slope 5+h5 + h; tangent slope 55.

Solution
f(1+h)=1+2h+h2+3+3h=4+5h+h2f(1)=4f(1+h)−f(1)h=5h+h2h=5+h(h≠0)as h→0 the slope tends to 5\begin{aligned} f(1 + h) &= 1 + 2h + h^2 + 3 + 3h = 4 + 5h + h^2 \\ f(1) &= 4 \\ \frac{f(1 + h) - f(1)}{h} &= \frac{5h + h^2}{h} = 5 + h && (h \ne 0) \\ &\text{as } h \to 0 \text{ the slope tends to } 5 \end{aligned}

Exercise 2: Tangent line equation

Using Exercise 1, write the tangent line to y=x2+3xy = x^2 + 3x at x=1x = 1.

Answer

y=5x−1y = 5x - 1

Solution
point (1,4), slope 5y−4=5(x−1)  ⟹  y=5x−1\begin{aligned} &\text{point } (1, 4), \text{ slope } 5 \\ &y - 4 = 5(x - 1) \implies y = 5x - 1 \end{aligned}

Exercise 3: Instantaneous velocity

A stone thrown upward has height s(t)=20t−5t2s(t) = 20t - 5t^2 metres. Find its velocity at t=1t = 1 and at t=3t = 3. What does the sign at t=3t = 3 mean?

Answer

1010 m/s at t=1t = 1, −10-10 m/s at t=3t = 3 (falling).

Solution
s(a+h)−s(a)=20h−5(2ah+h2)=h(20−10a−5h)average velocity=20−10a−5h→20−10a as h→0a=1: 10 m/sa=3: −10 m/s (negative: height decreasing)\begin{aligned} s(a + h) - s(a) &= 20h - 5(2ah + h^2) = h(20 - 10a - 5h) \\ \text{average velocity} &= 20 - 10a - 5h \to 20 - 10a \text{ as } h \to 0 \\ a = 1{:}\ 10\ \text{m/s} &\qquad a = 3{:}\ -10\ \text{m/s (negative: height decreasing)} \end{aligned}

Exercise 4: Average velocities in code

Write a loop printing the average velocity of s(t)=20t−5t2s(t) = 20t - 5t^2 over [3,3+h][3, 3 + h] for h=0.1,0.01,0.001h = 0.1, 0.01, 0.001, and check that it approaches the answer to Exercise 3.

Answer

About −10.5-10.5, −10.05-10.05, −10.005-10.005, tending to −10-10.

Solution

From Exercise 3 the average velocity is 20−30−5h=−10−5h20 - 30 - 5h = -10 - 5h.

python · try it yourself
s = lambda t: 20*t - 5*t**2
for h in [0.1, 0.01, 0.001]:
    print(h, round((s(3 + h) - s(3)) / h, 6))
0.1 -10.5
0.01 -10.05
0.001 -10.005

Test yourself

Why can't we find the tangent slope by putting x=ax = a directly into f(x)−f(a)x−a\frac{f(x) - f(a)}{x - a}?

  1. Because f(a)f(a) is undefined
  2. Because it gives 0/00/0
  3. Because the secant is vertical
  4. Because the curve has no slope

The average velocity of an object over [a,a+h][a, a + h] equals which quantity on the position graph?

  1. The area under the graph
  2. The height of the graph at aa
  3. The slope of the secant line through t=at = a and t=a+ht = a + h
  4. The slope of the tangent at a+ha + h

For s(t)=12t−t2s(t) = 12t - t^2, the average velocity over [2,2+Δt][2, 2 + \Delta t] is 8−Δt8 - \Delta t. What is the instantaneous velocity at t=2t = 2?

  1. 8
  2. 6
  3. 7
  4. It cannot be determined