Derivatives

Understand derivatives as slopes, tangent lines, and instantaneous rates of change.

A derivative measures how fast a function is changing at one input. On a graph, it is the slope of the tangent line. In an application, it is an instantaneous rate: velocity at one time, marginal cost at one production level, or temperature change at one moment.

This lesson builds derivatives from a familiar idea: slope between two points.

Learning objectives

After this lesson you should be able to:

  • compute and interpret average rate of change;
  • explain a derivative as a limiting tangent slope;
  • use derivative notation;
  • compute a derivative from the limit definition for simple quadratics;
  • write tangent line equations step by step;
  • interpret derivative units;
  • recognize common places where derivatives fail to exist;
  • use edumath helpers and SymPy to check derivatives and tangent lines.

Vocabulary and notation

Common derivative notations include:

\[ f'(x), \qquad \frac{dy}{dx}, \qquad \frac{d}{dx}[f(x)]. \]

They all describe a rate of change with respect to the input variable.

Derivative problem-solving roadmap

  1. Identify the function and input. What is \(f(x)\)? At what point, if any, do you need the rate?
  2. Decide the type of rate. Average rate uses two inputs. Instantaneous rate uses a derivative at one input.
  3. Compute the derivative or slope. Use a difference quotient, a derivative rule, or a known derivative.
  4. Evaluate if needed. A tangent slope at \(x=a\) is \(f'(a)\), not just \(f'(x)\).
  5. Use the result. Write a tangent line, interpret units, or determine increasing/decreasing behavior.
  6. Check. Use units, nearby slopes, or SymPy.

Average rate of change

Average rate of change from \(x=a\) to \(x=b\) is

\[ \frac{f(b)-f(a)}{b-a}. \]

This is the slope of the secant line through two points on the graph.

Walkthrough: average rate

Find the average rate of change of \(f(x)=x^2\) from \(x=1\) to \(x=3\).

  1. Identify endpoints. \(a=1\) and \(b=3\).
  2. Evaluate the function. \[ f(1)=1^2=1, \qquad f(3)=3^2=9. \]
  3. Compute output change over input change. \[ \frac{f(3)-f(1)}{3-1}=\frac{9-1}{2}=4. \]
  4. Interpret. On average, the output increases 4 units for each 1-unit increase in \(x\) over this interval.

Guided exercise: average rate with units

A position function is \(s(t)=t^2+2t\) meters. Find the average velocity from \(t=1\) to \(t=4\).

  1. What are the endpoint times?
  2. Compute \(s(1)\) and \(s(4)\).
  3. Divide change in position by change in time.
  4. What are the units?
  1. The endpoints are \(t=1\) and \(t=4\).
  2. \(s(1)=1+2=3\) and \(s(4)=16+8=24\).
  3. Average velocity is \((24-3)/(4-1)=21/3=7\).
  4. The units are meters per second if time is measured in seconds.

From secant slope to tangent slope

A secant line uses two points. A tangent line describes the graph’s direction at one point. To get a tangent slope, move the second point closer and closer to the first.

For a point \(x=a\), the difference quotient is

\[ \frac{f(a+h)-f(a)}{h}. \]

As \(h\) approaches 0, this secant slope may approach a limiting slope. That limit is the derivative at \(a\):

\[ f'(a)=\lim_{h\to 0}\frac{f(a+h)-f(a)}{h}. \]

The derivative definition

Walkthrough: derivative of \(x^2\) at one point

Find \(f'(2)\) for \(f(x)=x^2\) using the definition.

  1. Start with the definition. \[ f'(2)=\lim_{h\to0}\frac{f(2+h)-f(2)}{h}. \]
  2. Substitute the function. \[ f(2+h)=(2+h)^2, \qquad f(2)=4. \]
  3. Expand. \[ (2+h)^2=4+4h+h^2. \]
  4. Simplify the numerator. \[ \frac{(4+4h+h^2)-4}{h}=\frac{4h+h^2}{h}. \]
  5. Factor and cancel \(h\) for \(h\ne0\). \[ \frac{h(4+h)}{h}=4+h. \]
  6. Take the limit. \[ \lim_{h\to0}(4+h)=4. \]

So \(f'(2)=4\). The tangent slope of \(y=x^2\) at \(x=2\) is 4.

Derivative function

The same process can be done at a general input \(x\):

\[ f'(x)=\lim_{h\to0}\frac{(x+h)^2-x^2}{h} =\lim_{h\to0}\frac{2xh+h^2}{h} =\lim_{h\to0}(2x+h)=2x. \]

So the derivative function of \(x^2\) is \(2x\).

Tangent lines

A tangent line needs two pieces of information:

  • the point \((a,f(a))\);
  • the slope \(f'(a)\).

Then use point-slope form:

\[ y-f(a)=f'(a)(x-a). \]

Walkthrough: tangent line

Find the tangent line to \(f(x)=x^2\) at \(x=3\).

  1. Find the point. \[ f(3)=9, \] so the point is \((3,9)\).
  2. Find the derivative. \[ f'(x)=2x. \]
  3. Evaluate the slope. \[ f'(3)=6. \]
  4. Use point-slope form. \[ y-9=6(x-3). \]
  5. Simplify if requested. \[ y=6x-9. \]
  6. Check. At \(x=3\), the line gives \(y=18-9=9\), so it passes through the point.
WarningCommon tangent-line mistake

Do not stop after finding \(f'(x)\). A tangent line at \(x=a\) needs the numerical slope \(f'(a)\) and the point \((a,f(a))\).

Units and meaning

Derivative units are output units divided by input units.

  • If \(s(t)\) is position in meters and \(t\) is seconds, then \(s'(t)\) is meters per second.
  • If \(C(x)\) is cost in dollars and \(x\) is items, then \(C'(x)\) is dollars per item.
  • If \(T(t)\) is temperature in degrees and \(t\) is hours, then \(T'(t)\) is degrees per hour.

Where derivatives may fail

A function may fail to have a derivative at:

  • a corner, such as \(|x|\) at \(x=0\);
  • a cusp, where slopes become extremely steep in opposite directions;
  • a vertical tangent, where slope is undefined;
  • a discontinuity, where the graph breaks.

Continuity is necessary for differentiability, but continuity alone is not enough. A corner can be continuous but not differentiable.

Mixed practice

  1. Find the average rate of change of \(f(x)=x^2\) from \(x=2\) to \(x=5\).
  2. Use the derivative definition to find the slope of \(x^2\) at \(x=1\).
  3. If \(f'(x)=3x^2\), what is \(f'(2)\)?
  4. Write the tangent line to \(f(x)=x^2+3x\) at \(x=1\).
  5. If \(f'(a)<0\), what does that suggest graphically?
  6. If cost is dollars and production is items, what are the units of marginal cost?
  1. \((25-4)/(5-2)=21/3=7\).
  2. \([(1+h)^2-1]/h=(2h+h^2)/h=2+h\), so the limit is 2.
  3. \(f'(2)=3(2^2)=12\).
  4. \(f(1)=4\). The derivative is \(2x+3\), so the slope is 5. The line is \(y-4=5(x-1)\), or \(y=5x-1\).
  5. The function is decreasing locally.
  6. Dollars per item.

Guessing game checkpoint

Using this lesson with edumath and SymPy

Use edumath for lesson-friendly helpers and SymPy for exact symbolic checks.

from edumath.calculus import average_rate_of_change, derivative, tangent_line, finite_difference

average_rate_of_change("x**2", 1, 3)

\(\displaystyle 4\)

derivative("x**2 + 3*x")
tangent_line("x**2", 3)
finite_difference("x**2", 3)
6.000000000039306
from edumath.calculus import tangent_line_steps

solution = tangent_line_steps("x**2", 3)
print(solution.render_markdown())
Hint: A tangent line needs a point and a slope.

Answer: 6*x - 9

Use the derivative for the slope, then use point-slope form.

1. **Find the point.** f(3) = 9.
2. **Differentiate.** f'(x) = 2*x.
3. **Evaluate the slope.** f'(3) = 6.
4. **Use point-slope form.** y - 9 = 6(x - 3).
5. **Simplify.** The tangent line is 6*x - 9.

Check: Substitute the point into the line and compare slopes.
import sympy as sp

x = sp.symbols("x")
sp.diff(x**2 + 3*x, x)

\(\displaystyle 2 x + 3\)

Further reading