Chapter 06
Derivative and Derivative Function: Instantaneous Slope, the Compass of Learning
Differentiation gives the instantaneous rate of change (slope) at a point. The derivative as a function is the basis for gradient descent and backprop in deep learning.
Math diagram by chapter
Select a chapter to see its diagram below. View the flow of basic math at a glance.
Left: Tangent line — the line that touches the curve at exactly one point. Its slope is the derivative there. Right: Line through two points — the line through two points on the curve. As the points get closer, this line approaches the tangent, and that limit is the derivative.
Pick one point (2, 4) on the curve . We want to measure the slope at this point.
The derivative is the slope of the tangent line. The limit of the "line through two points" slopes (as the points get closer) is the tangent slope.
What are differentiation and the derivative?
The derivative is the instantaneous rate of change at a point on the curve—how steep the graph is there. Geometrically it is the slope of the tangent line at that point. Just as a speedometer shows the speed at each instant, the derivative tells you how sensitively the output responds when the input changes by a tiny amount.
Mathematically, this slope is obtained by taking the limit (Limit) of the 'average slope between two very close points' and then sending the distance between the two points to zero. The formula is (the denominator is the distance between two points, the numerator is the change in ). The value obtained through this process is called the derivative coefficient and is written as . A large value means a steep slope; zero means flat.
The derivative function is the new function that assigns to each the slope at that point. So instead of computing the slope at every point by hand, you plug into the derivative formula—it is a "slope generator." The process of finding it is called differentiation.
- ItemBelow
- DescriptionCommon differentiation formulas.
- Item
- DescriptionMeans the derivative.
| Item | Description |
|---|---|
| Below | Common differentiation formulas. |
| Means the derivative. |
- FormulaConstant
- Descriptionderivative is 0
- FormulaPower
- Descriptionbring down , exponent
- FormulaExponential
- Descriptionderivative is still
- FormulaExponential
- Description
- FormulaNatural log
- Description
- FormulaLog (base a)
- Description
- Formulasin
- Descriptionderivative is cos
- Formulacos
- Descriptionderivative is
- Formulatan
- Descriptionderivative is
- FormulaSum/difference
- Descriptiondifferentiate each part and add or subtract
- FormulaConstant multiple
- Descriptionkeep constant, differentiate the rest
- FormulaProduct rule
- Description(first′)×second + first×(second′)
- FormulaQuotient rule
- Description(top′×bottom − top×bottom′) / bottom²
- FormulaIntuition (product)
- Descriptionfirst derivative × second + first × second derivative. In the limit the two changes add up, so you get these two terms.
- FormulaIntuition (quotient)
- DescriptionWrite the quotient as top × (1/bottom) and use the product rule. The derivative of (1/bottom) gives the usual formula.
| Formula | Description |
|---|---|
| Constant | derivative is 0 |
| Power | bring down , exponent |
| Exponential | derivative is still |
| Exponential | |
| Natural log | |
| Log (base a) | |
| sin | derivative is cos |
| cos | derivative is |
| tan | derivative is |
| Sum/difference | differentiate each part and add or subtract |
| Constant multiple | keep constant, differentiate the rest |
| Product rule | (first′)×second + first×(second′) |
| Quotient rule | (top′×bottom − top×bottom′) / bottom² |
| Intuition (product) | first derivative × second + first × second derivative. In the limit the two changes add up, so you get these two terms. |
| Intuition (quotient) | Write the quotient as top × (1/bottom) and use the product rule. The derivative of (1/bottom) gives the usual formula. |
- FormulaConstant
- Numeric example(5)'=0, (-3)'=0
- Solution stepderivative is 0
- Formula
- Numeric example, at : 12
- Solution stepbring down , exponent
- Formula
- Numeric exampleat : 1; at :
- Solution stepunchanged by differentiation
- Formula
- Numeric example
- Solution stepmultiply by
- Formula
- Numeric exampleat :
- Solution stepderivative is
- Formulasin
- Numeric exampleat : 1
- Solution stepsin → cos
- Formulacos
- Numeric exampleat : 0
- Solution stepcos →
- FormulaSum
- Numeric example
- Solution stepdifferentiate each term and add
- FormulaConstant multiple
- Numeric example
- Solution stepkeep constant, differentiate rest
- FormulaProduct
- Numeric example
- Solution step(first′)×second + first×(second′)
- FormulaQuotient
- Numeric example → at : 0
- Solution step(top′×bottom−top×bottom′)/bottom²
| Formula | Numeric example | Solution step |
|---|---|---|
| Constant | (5)'=0, (-3)'=0 | derivative is 0 |
| , at : 12 | bring down , exponent | |
| at : 1; at : | unchanged by differentiation | |
| multiply by | ||
| at : | derivative is | |
| sin | at : 1 | sin → cos |
| cos | at : 0 | cos → |
| Sum | differentiate each term and add | |
| Constant multiple | keep constant, differentiate rest | |
| Product | (first′)×second + first×(second′) | |
| Quotient | → at : 0 | (top′×bottom−top×bottom′)/bottom² |
In everyday terms, the derivative is a compass for finding the optimum. When you want to go from a mountain top to the lowest valley, you follow the slope under your feet downward. The derivative computes that slope in exact numbers. Where the slope is zero you are at a peak (maximum) or a valley floor (minimum), so the derivative is essential for finding minima and maxima.
Deep learning models must minimize the error (loss) between the correct answer and the prediction. The gradient is what tells us how to change each of the model's many weights () so that the error decreases. By differentiating, we learn whether slightly increasing a given weight would increase or decrease the error, and we update weights in the direction that reduces the error fastest.
Backpropagation applies this derivative idea in reverse for efficient learning. It works backward from the output, step by step, computing how much each step contributed to the final error. To differentiate through stacked functions we use differentiation of composite functions (chain rule); the basic derivative formulas in this chapter are exactly what make that work.
In general, the derivative is used for sensitivity analysis: how much does the whole result swing when one variable is nudged? In economics we ask how demand changes when price changes a little; in physics we measure how position changes over time (velocity). So anywhere we quantify how a small change in a cause affects the outcome, we use the derivative.
In AI training, every parameter update depends on derivative values. When we use libraries like PyTorch or TensorFlow, the loss is differentiated with respect to each weight in an instant. Moving the weights in the opposite direction of that derivative is gradient descent. The formulas in this chapter are the first key to understanding how AI gets smarter through computation.
To find the derivative, identify which rules apply (power, exponential, log, trig, product, quotient, chain), then apply them and simplify.
Example problems and solutions are in the table below.
- ProblemEx 1.
- SolutionPower and sum:
- ProblemEx 2.
- SolutionProduct rule:
- ProblemEx 3.
- SolutionQuotient rule:
| Problem | Solution |
|---|---|
| Ex 1. | Power and sum: |
| Ex 2. | Product rule: |
| Ex 3. | Quotient rule: |
Problem types and how to solve
- TypePower
- Formula
- How to get at . Bring down the exponent, subtract 1, then plug in .
- TypeLinear
- Formula
- How to get at . The slope is the derivative, so the answer is regardless of .
- TypeQuadratic
- Formula
- How to get at . Twice the coefficient times , plus the linear coefficient.
- TypeConstant × power
- Formula
- How to get at . Keep , multiply by the derivative of .
| Type | Formula | How to get at |
|---|---|---|
| Power | . Bring down the exponent, subtract 1, then plug in . | |
| Linear | . The slope is the derivative, so the answer is regardless of . | |
| Quadratic | . Twice the coefficient times , plus the linear coefficient. | |
| Constant × power | . Keep , multiply by the derivative of . |
Example (power)
For , find the derivative at , i.e. .
Solution
, so . → Answer 12
Example (linear)
For , find .
Solution
The derivative of a linear function is the slope, so . Hence for any . → Answer 3
Example (quadratic)
For , find .
Solution
, so . → Answer 8
Example (constant × power)
For , find .
Solution
, so . → Answer 8