Let be an open interval and let . If the input moves from to , then the input changes by and the value of the function changes by For , the ratio
(1)
is the average rate of change between the two points. Geometrically, it is the slope of the line that goes through and . The derivative is the limiting slope as . Thus is the fixed point at which the derivative is evaluated, while is the moving input.
Definition 1.1 (Derivative). The function is differentiable at if there is such that The number is the derivative of at , written . If is differentiable at every point of , then denotes the derivative function .
Figure 1.1. Left: for the difference quotient (1) is the rise over the run , that is, the slope of the secant line through and . Right: as the second point slides along the graph toward the first and the secants rotate toward a single limiting line. Its slope is the derivative , and the line itself is the tangent to the graph at .
We begin with three direct computations of the derivative using the definition.
Example 1.2 (Constant, affine, and quadratic functions).
Fix , and let .
If , then for every , so .
If , then so . The slope of an affine function is the same at every point.
If , then Thus . In particular, .
1.2 Derivative as a linear approximation
Definition 1.1 has an equivalent form that will extend cleanly to several variables. Because is open, is defined for every sufficiently small change , so the limit below makes sense.
Theorem 1.3 (Derivative as a linear approximation).
Let be an open interval, let , and let . Then is differentiable at if and only if there is such that
(2)
In that case is unique, and .
Proof. The proof relies on two facts. First, for any real-valued function of , if and only if as (see Lecture 2). Second, for all and . We have: where the first equivalence is by the definition of differentiability, the second equivalence is by subtracting from both sides, the third equivalence is the first fact, and the fourth equivalence is the second fact. Furthermore, the in Definition 1.1 is unique and equals , so the in (2) is also unique and equals . ◻
Setting gives an equivalent moving-point form of (2):
(3)
In both forms is fixed. In (2), ; in (3), the input tends to .
The reason why Equation 2 is called derivative as a linear approximation is as follows. Let in the numerator of (2). Then, , where is the linear approximation of evaluated at , while is the remainder term. The condition in (2), now written as as says that the remainder term is negligible compared to as .
Example 1.4 (Reading the derivative from an expansion).
Let be given by , and let . The function evaluated at is
The remainder satisfies Therefore the linear coefficient is the derivative: .
We now have two ways of calculating derivatives for functions from to : the difference-quotient Definition 1.1 and the linear-expansion method of Theorem 1.3. The latter method is generalizable to functions of several variables, so we will use it in the next section.
Let be an open interval, let , and let . If is differentiable at , then is continuous at .
Proof (optional). For small enough that , where the last line uses Definition 1.1. Hence which is continuity of at . ◻
The converse fails: a continuous function need not be differentiable.
Example 1.6 (Continuity without differentiability).
Let be given by . At the origin, , so is continuous. But for , the difference quotient equals when and when . It has no limit as , so is not differentiable at .
Theorem 1.7 (Rules of differentiation). Let and be differentiable at , and let . Then
;
;
if , then
Its proof uses Definition 1.1 and is left as an exercise.
Theorem 1.8 (Chain rule). Let be open intervals, let satisfy , and let . If is differentiable at and is differentiable at , then is differentiable at and
Proof (optional). Write . Because is open, for every sufficiently small , and for those define By Definition 1.1, as , so is continuous at . Multiplying by ,
(4)
which holds for every in the domain of , including .
Next, let tend to zero with , and set . Since is continuous at by Theorem 1.5, , so for every sufficiently small , (4) reads Dividing by , As , the first factor tends to by Definition 1.1. For the second, as noted above, and is continuous at , so . Hence ◻
1.4 Useful theorems for functions of one variable
Theorem 1.9 (Interior extremum). Let , let , and let . Suppose is differentiable at and that for some , Then . The same conclusion holds if instead for every such .
Proof (optional). Because , we have for every sufficiently small . For such with the hypothesis gives , and dividing by preserves the inequality when and reverses it when : Since is differentiable at , the two-sided limit of the difference quotient exists, so both one-sided limits exist and equal . Letting gives , and letting gives , so . For the reversed inequality, apply this to . ◻
Theorem 1.10 (Rolle’s theorem). Let and let be continuous on and differentiable on . If , then there is such that .
Proof (optional). If is constant, then for every .
Otherwise for some . Suppose . Since is compact and is continuous, Theorem 3.5 from Lecture 2 gives a maximizer of on . We thus have in particular, . Then is differentiable at , and holds for every , including those with for some . By Theorem 1.9, we conclude that .
If instead , run the same argument with being a minimizer. ◻
Theorem 1.11 (Mean value theorem). Let and let be continuous on and differentiable on . Then there is such that
Proof (optional). Let Then is continuous on , differentiable on , and . By Theorem 1.10 there is with yielding the result. ◻
2 Real-valued functions of several variables
In this section, we consider functions from to . Input vectors are column vectors. We use for a generic or moving input and for a fixed point at which a derivative is evaluated. Thus is the change from to .
2.1 Partial derivatives
Recall from Lecture 3 that is the th standard basis vector of , with in coordinate and in every other coordinate. For a real number , the vector has in coordinate and elsewhere, and adds to coordinate of while leaving every other coordinate of unchanged.
Definition 2.1 (Partial derivative). Let be open, let , and let . The th partial derivative of at , where , is provided the limit exists.
This is an ordinary one-variable derivative: hold all variables except fixed and differentiate with respect to .
Example 2.2 (A function of two variables). Let be given by Holding fixed and differentiating in , and then reversing their roles, gives
2.2 Differentiability and functions
Partial derivatives describe a function only along the coordinate lines through a point. Differentiability requires one linear approximation to work for small changes in all directions at once. A linear map from to has the form for some , so and , which were scalars in the one-variable case, are now both vectors.
Definition 2.3 (Differentiability). Let be open, let , and let . The function is differentiable at if there is such that where the limit is over with . It is differentiable on if it is differentiable at every point of .
When , the vector and the coefficient are scalars, , and . Thus Definition 2.3 is exactly the linear-approximation form of the one-variable derivative in Theorem 1.3. Only the form of the linear term has changed.
Equivalently,
(5)
The same rule must work for every way in which can approach zero.
Alternatively, set . Then is differentiable at if and only if there is such that
(6)
The base point is fixed in this limit; is the moving input.
Definition 2.4 (Gradient). If all partial derivatives of exist at , the gradient of at is the column vector
When is differentiable, the vector in its linear approximation is exactly the gradient.
Theorem 2.5 (Consequences of differentiability).
Let be open and let be differentiable at , with vector as in Definition 2.3. Then every partial derivative of exists at and In particular, the vector is unique. Moreover, is continuous at .
Proof (optional). Fix and set . Then and , so Definition 2.3 gives Equivalently, so the difference quotient tends to . Thus the th partial derivative exists and equals . Repeating the argument for every gives , and because the partial derivatives are defined independently of , this also proves uniqueness.
For continuity, the Cauchy–Schwarz inequality gives and Thus (5) gives . ◻
Example 2.6 (A linear approximation in two variables).
Let be given by , and let . Expanding around gives The constant is and the linear term is . If , the absolute value of the remainder is at most After division by , this bound tends to zero. Thus is differentiable at and
The converse of the first claim in Theorem 2.5 is false: partial derivatives can exist without a valid linear approximation. A convenient condition rules out this problem.
Definition 2.7 ( function). Let be open. A function is on , or continuously differentiable on , if every partial derivative exists on and is continuous as a function from to .
Theorem 2.8 ( implies differentiable). If is on the open set , then is differentiable on and the gradient is continuous.
We use this theorem without proof. It provides the usual way to verify differentiability: compute the partial derivatives and check that they are continuous. In particular, polynomials are on , and rational functions are wherever their denominators are nonzero.
The implications established in this section are None of the converses holds in general.
The linear approximation can also be written using differential notation.
Remark 2.9 (Differential notation). If is differentiable at , its differential at is the linear map Thus is exactly the linear term in Economics texts often write the same expression as Here labels a coordinate change; it is not the product of a number and . We use the actual changes when applying the differential.
2.3 Directional derivatives
A partial derivative permits only one coordinate to change. A directional derivative allows the coordinates to change together in fixed proportions: for , varying traces the line through .
Definition 2.10 (Directional derivative). Let be open, let , and let . The directional derivative of at in the direction is provided the limit exists.
Taking gives the th partial derivative. We do not require , so specifies both the relative changes in the coordinates and their scale. When is differentiable, its gradient gives every directional derivative.
Theorem 2.11 (Directional derivatives from the gradient).
Let be open and let be differentiable at . Then, for every , the directional derivative exists and
Proof (optional). If , the difference quotient is zero for every , so the result holds. If , substitute into (5) and use : Moreover, Taking the limit proves the first equality; the second writes out the inner product coordinate by coordinate. ◻
2.4 Steepest increase
To compare directions independently of scale, we restrict to unit vectors and ask which one gives the largest directional derivative.
Theorem 2.12 (Steepest increase). Let be open, let be differentiable at , and suppose . Define the unit vector Among all unit vectors , the directional derivative has its unique maximum at and its unique minimum at . The corresponding values are
Proof (optional). Write . For every unit vector , Theorem 2.11 and the Cauchy–Schwarz inequality give The unit vector satisfies , so it attains the bound. If a unit vector also attains it, then and Hence . Applying the maximum result to gives the minimum and its unique minimizer. ◻
Thus the gradient points in the direction of steepest increase, and its norm is the largest rate of increase per unit change. By Theorem 2.11, exactly when . In this case, and are orthogonal. If , every directional derivative is zero, so first-order information does not select a direction of increase or decrease.
This result underlies gradient descent, an algorithm used to train many machine-learning and AI models. If is the loss function and is the current parameter vector, gradient descent chooses a step size and updates The negative gradient gives the direction of steepest local decrease, while determines the size of the step.
3 Vector-valued functions
3.1 Jacobians
A map has outputs. Its linear approximation is therefore a linear map from to , represented by an matrix.
Definition 3.1 (Jacobian). Let be open, let , and let . The map is differentiable at if there is an matrix such that where the limit is over with . The matrix is the derivative, or Jacobian, of at , written . If , the scalar-valued maps are the component functions of . The map is on if every component is on .
Equivalently,
(7)
The linear term has dimensions so each row corresponds to an output and each column to an input.
With the moving input , the same definition is
(8)
Theorem 3.2 (Entries of the Jacobian). The map is differentiable at if and only if every component is differentiable at . In that case the Jacobian is unique and Thus the th row of is .
Proof (optional). Suppose first that is differentiable with derivative , and let . Since the absolute value of each coordinate of is at most , Thus is differentiable, and Theorem 2.5 gives
Conversely, suppose each is differentiable, and define by If is the approximation error for component , then . Because there are only finitely many components, Thus is differentiable with derivative . The first part identifies every entry of any possible derivative, so the Jacobian is unique. ◻
Let be given by Then The two rows correspond to the two outputs, and the three columns correspond to the inputs .
For a scalar-valued function , the Jacobian is a row, whereas the gradient is an column:
(9)
Consequently, . The gradient is convenient for geometric statements, while the Jacobian is convenient for composition. When , both contain the ordinary derivative .
3.2 The multivariable chain rule
The one-variable chain rule says that derivatives multiply. The same rule holds for functions between Euclidean spaces, with matrix multiplication in place of scalar multiplication.
Theorem 3.4 (Chain rule). Let and be open. Let satisfy , and let . If is differentiable at and is differentiable at , then is differentiable at and
We use this theorem without proof. Using the row description from Theorem 3.2, the product is The product is , the required size for the derivative of . The outer rows are evaluated at , while the inner rows are evaluated at . When , the formula reduces to the one-variable chain rule.
A useful special case follows a curve through the domain of a real-valued function.
Corollary 3.5 (Derivative along a curve). Let be open, let be differentiable at , where is an open interval, and let be differentiable at . Then
Example 3.6 (A vector-valued composition). Define To find the derivative of at , compute Because , the chain rule gives The dimensions are , as required for a map from to .
For a direct check, Differentiating the components at again gives .