TL;DR
The derivative measures how fast a function is changing at a single point. Geometrically, it is the slope of the curve there. It is defined as the limit of average rates of change over intervals that shrink to nothing, so it needs the idea of a limit.
Derivatives turn a description of a quantity into a description of how that quantity moves, which is most of physics, economics and machine learning.
Where you'll see it: in a car's speed (the derivative of position), in the gradient that trains a neural network, and in every "marginal" cost or profit calculation.
Intuition
A speedometer for a function
A car's odometer tells you how far you have travelled. The speedometer tells you how fast you are going right now. The odometer is a function of time; the speedometer is its derivative. Speed is not "distance divided by time" for the whole trip. It is what the reading would be over the next instant, if you could zoom in far enough.
That is the whole idea. Given a function , the derivative at a point answers: if I nudge the input a tiny bit, how much does the output move, per unit of nudge?
Why it needs limits
Average rate of change is easy. Between and , the output changes by , so the average rate is that change divided by . The trouble is that gives , which means nothing. The derivative is what this average becomes as gets smaller and smaller without reaching zero. That is precisely a limit.
The picture is a secant line (a line through two points on the curve) that slides towards a tangent line (a line that touches the curve at one point). The tangent's slope is the derivative.
- f(x) = x^2
- tangent at x = 1
The math
Definition
The derivative of at is
whenever this limit exists. If it does, is differentiable at . The notation reads "f prime of x"; the equivalent Leibniz notation is .
Here is a small step added to the input, and is the average slope of the curve between and . The limit asks what that average slope approaches as the step shrinks. The quantity is the change in output, and dividing by puts it per unit of input.
Once is known, the tangent line at is
Basic rules
Computing the limit from scratch every time is slow, so we use rules that are proved once:
The last two rows use the exponential and natural logarithm. For products and compositions of functions there are the product rule and the chain rule, which build on these.
Differentiability can fail
The derivative does not exist at every point. The function has a sharp corner at . The slope from the left is and from the right is , so the two one-sided limits disagree and the limit does not exist. A continuous function can still fail to be differentiable at a corner or a cusp, and a function with a jump is not differentiable there either.
Linear approximation
Near , a differentiable function looks like its tangent line:
This is the single most useful consequence of the derivative in practice. It lets you estimate hard values from easy ones (see the square-root example below), and it is the reason gradient descent works (the next step is a small move in the direction the derivative points).
Worked examples
Let and . Then and
- .
- (valid for ).
- Let : the expression becomes .
So . Check it numerically with smaller and smaller steps:
| 1 | 7 |
| 0.1 | 6.1 |
| 0.01 | 6.01 |
| 0.001 | 6.001 |
The numbers approach 6. The general rule gives the same answer: , and .
Interpretation: near , every unit increase in raises by about 6 units.
A dropped object falls metres after seconds. Its speed at is .
- Average speed over : .
- , and .
- The difference quotient is .
- Let : the speed is m/s.
Using the power rule directly, , so . Both methods agree.
Interpretation: two seconds in, the object is moving at 20 metres per second, and that speed is still increasing at 10 m/s every second.
Estimate without a calculator. Let , so .
- Pick the nearby point , where and .
- Here . The linear approximation gives .
- The true value is about , so the error is about .
Interpretation: the tangent line at tracks the square root curve closely over a small step. The error grows as grows, and near the square root's derivative blows up, so this trick fails there.
Tradeoffs and failure modes
Derivatives are the right tool when a function is smooth and you need local behaviour. They can mislead when the data or the function does not cooperate.
| Situation | What goes wrong | Better choice |
|---|---|---|
| Function has a corner or kink (like ) | Derivative does not exist at the kink | Use a subgradient, or smooth the function (e.g. a Huber loss) |
| Estimating a derivative with a very small on a computer | Round-off error dominates; the quotient is noise | Symbolic differentiation, or automatic differentiation |
| Differentiating noisy measured data | Differences of noisy values amplify the noise | Smooth the data first, or fit a model and differentiate the model |
| Quantity only known at discrete times | No limit to take | Finite differences, |
| Large steps are needed | Linear approximation is poor far from | Use higher-order terms, or solve the problem directly |
History
Methods for tangent lines came first. Pierre de Fermat had a technique for finding maximum and minimum values in the 1630s that amounted to setting a difference quotient to zero. Isaac Newton developed his "method of fluxions" in the 1660s, treating quantities as flowing in time, and used the idea in his work on motion. Gottfried Wilhelm Leibniz developed the notation and published his account in 1684. The notation survived because it makes the chain rule look like cancellation of fractions.
Newton and Leibniz each developed calculus independently, and a long dispute over priority followed. The modern definition using limits took more than a century to settle. Augustin-Louis Cauchy gave a definition in terms of limits in the 1820s, and later nineteenth-century mathematicians, Karl Weierstrass among them, made the epsilon-delta form standard. Once the definition was rigorous, the derivative became the basis for most of applied mathematics.
Check yourself
QuestionRecall: what does the derivative represent geometrically?Show answer
It is the slope of the tangent line to the graph of at the point . It is the limit of the slopes of secant lines through and as goes to zero.
QuestionCompute and evaluate it at .Show answer
Apply the power rule and linearity term by term: and . So the derivative is . At this is .
QuestionWhy does have no derivative at , even though it is continuous there?Show answer
Continuity only says the function has no jump. Differentiability needs the difference quotient to settle to one value. From the right, for . From the left, for . The two one-sided limits differ, so the two-sided limit does not exist. The graph has a corner there, and a corner has no single tangent line.
QuestionA ball's height is metres. When is its upward speed zero, and what does that moment mean physically?Show answer
The speed is . Setting this to zero gives seconds. At that moment the ball stops rising, which is the top of its path. Its height there is metres.