Motivation
A quantity often depends on variables that themselves depend on other variables. A height depends on horizontal position, while position depends on time. A function in Cartesian coordinates can also be expressed through polar coordinates. In both situations, the change travels through intermediate variables. The chain rule keeps track of every route through which an input influences the output.
Differentiability makes this tracking precise. Each stage is approximated by a linear map, so the composite is approximated by the composite of those linear maps. In coordinates, composition becomes matrix multiplication. The matrix dimensions record which quantities are inputs, which are intermediate variables, and which are outputs. Checking dimensions is therefore a mathematical way to check the dependency structure.
A directional derivative is a particularly important composite: restrict the function to a line through the base point. The chain rule then turns a gradient into a rate of change along that line. Restricting to a differentiable curve gives the corresponding rate along a moving path. These formulas connect coordinate calculations to geometric questions about ascent, descent and level sets.
Before you start
For , the Jacobian has rows and columns. We write displacements as columns, while the gradient of a scalar function is displayed as a vector and acts by a dot product. Keep the evaluation point beside each Jacobian: the outer function is evaluated at the output of the inner function.
Definitions
Definition
A derivative in a specified direction
Let be defined on an open neighbourhood of , and let be a unit vector. The directional derivative is
when the finite two-sided limit exists. Because , the parameter measures signed distance along the line.
We can use the same difference quotient with any fixed vector . That version measures change per unit of the parameter multiplying , so its speed is . When , it equals whenever the directional derivative exists. The unit-vector convention separates a geometric direction from a chosen travel speed.
The path is one specified way to approach the point. Existence of the directional derivative concerns this path only. Even the existence of directional derivatives in all directions does not automatically supply one linear approximation valid for every small displacement. The chain-rule formula below uses differentiability to supply that stronger link.
Definition
Derivative along a curve
Let be a differentiable curve, with inside the interval , and suppose is defined near . The observed quantity along the curve is the one-variable function . Its derivative at is the rate per unit of the curve parameter. The vector is the velocity, including both direction and speed.
A time derivative and a directional derivative can therefore have different units. A derivative along a path parameterized by seconds measures output per second. A unit directional derivative in spatial coordinates measures output per unit distance. Dividing the former by a nonzero speed produces the rate per distance in the current direction.
Theorem and proposition
Theorem
Matrix chain rule
Let be differentiable at , and let be differentiable at . Assume are open and the composite is defined near . Then
The matrix sizes are .
The inner derivative acts on the input displacement first. Although it is written on the right in the product, its role comes first in the composition. Reversing the two factors generally gives a different matrix or an undefined product. The evaluation point is equally essential: outer derivatives measure the response around the intermediate output actually reached from the base input.
Theorem
Rates along curves and the gradient
If is differentiable at and is differentiable at , then
In particular, for a unit vector ,
If , the maximum unit directional rate is , attained in the direction ; the minimum is its negative, attained in the opposite direction.
Cauchy–Schwarz bounds the dot product in absolute value by the gradient norm. Equality identifies the maximizing and minimizing directions. If the gradient is zero, every unit directional derivative is zero; there is no distinguished direction of first-order increase. This statement alone does not determine whether the point is an extremum.
Proof idea
Proof
Composing two linear approximations
Write , and . For a small input displacement,
Put . The outer expansion is
Substitution gives the linear term and remainder . A linear-map bound shows that for all sufficiently small . Consequently , and the outer remainder estimate gives as well. At this remainder is zero. Thus the composite has the required linear approximation with derivative .
Applying this result to the line gives the directional formula, because the derivative of this line is the column . Applying it to a general curve gives the velocity formula. No assumption that the curve has unit speed is needed.
A useful geometric consequence follows for level sets. If a differentiable curve satisfies near , then its observed value is constant. Therefore
When the gradient is nonzero, it is perpendicular to every such tangent vector. For a regular level surface in three dimensions this supplies its normal direction. The assertion concerns actual differentiable curves in the level set; it does not assume every arbitrary vector can be realized as such a tangent.
Worked examples
Worked example
Two vector stages and the order of multiplication
Let
At the intermediate output is . Thus
Multiplying in composition order gives
For example, the first row and first column combine the two routes from to the first final output: .
Check directly: the first composite component is . Its derivative at is four and its derivative is negative three. The second component is , whose corresponding derivatives are nine and two. This independently checks both matrix order and evaluation points.
Worked example
A moving path and the steepest direction
Let , and consider the path near . At this time the point is , the velocity is , and
The rate along the path is therefore . Direct substitution gives , with derivative negative four at zero.
At the same point, the steepest unit ascent direction is , with rate . The fastest descent direction is its opposite, with rate . A unit direction has zero first-order rate and is tangent to the level ellipse .
The current path direction need not be the steepest direction. It is determined by the actual velocity, while the extremal rate compares all unit directions at the same point. This comparison uses the same spatial unit for both coordinates.
Worked example
Polar coordinates and angular speed
Let , and set
The Jacobian is
For , the chain rule gives
where the partial derivatives of are evaluated at .
At the Cartesian point is , where and . Thus and . The angular tangent vector has length two, so the rate per unit distance in that tangent direction is . The factor records speed along a circle and must not be removed from an angular derivative.
Reading a dependency diagram
Suppose and each intermediate input depends on . For a fixed final input , the chain rule is
Each term corresponds to one path from through to the output. Multiply along each path and add over the intermediate variables. The row-by-column rule for a Jacobian is exactly this sum.
The derivatives in a term are evaluated at different levels of the dependency structure. The first factor uses the current intermediate values; the second uses the original input point. Writing these points before multiplying prevents the common error of evaluating every derivative at a coordinate tuple of the wrong dimension.
For a long composition, matrix multiplication is associative, so it can be grouped conveniently as long as the order of stages is preserved. Dimensions give an immediate check at every multiplication. A scalar output does not make its Jacobian a column: it is a row acting on input columns. The gradient dot-product notation expresses that same action in scalar-valued problems.
Choosing the right rate
Before calculating, identify the parameter. Is the question about change per second, per unit distance, or per unit of an angular coordinate? Normalize a direction vector when the requested rate is per distance. Keep the actual velocity when the requested rate is per time. Use the appropriate coordinate column of a transformation Jacobian when a coordinate such as angle is being varied.
Next locate the base point in every space. A curve parameter determines a spatial point; a coordinate transformation determines Cartesian inputs; an inner function determines the point where the outer derivative is evaluated. Only after these values are fixed should the derivative factors be assembled.
Finally interpret the sign and size. A negative dot product means the function decreases along the specified motion at that instant. A zero value means there is no first-order change; it does not promise that the function stays constant along the whole straight line. Curvature and higher-order effects may still change the value as the motion continues.
A tangent direction does not make a straight line a level curve
Consider at the point . Its gradient is , so the vertical unit direction has zero directional rate. Along the vertical straight line, however, the function becomes . It changes for every nonzero displacement, despite having derivative zero at the base point.
Compare this with the curve . It passes through the same point and has the same vertical velocity at zero, but it stays exactly on the level circle because . Both paths have the same first-order observed rate; their second-order departures are different. A directional derivative records the shared first-order information and does not distinguish those later effects.
This example clarifies the role of a tangent vector. It is an instantaneous velocity, rather than a promise that the corresponding entire line lies in the surface. When using a gradient as a normal vector, first establish the level-set equation and the nonzero gradient at the point. Then apply the curve calculation to actual motions in that set. The resulting orthogonality is local and precise, even when a global description of the level set is complicated.
Common mistakes
Common mistake
A direction vector and a velocity have different roles
If a direction is given by , its unit representative is . The quotient using measures travel at speed five and gives five times the unit directional rate. Normalization is required only when the question asks for rate per unit distance; normalizing an actual velocity would change a time derivative.
Do not use the gradient dot-product formula from the mere existence of partial derivatives. Its stated hypothesis is differentiability. Even if every directional derivative exists, the resulting dependence on the direction can fail to be linear. The last exercise supplies a continuous example showing exactly that failure.
Summary
The chain rule composes derivative maps and multiplies Jacobians in the order of the functions. Along a curve, a scalar rate is the gradient dotted with the velocity. For a unit direction, this gives the directional derivative, and Cauchy–Schwarz identifies steepest ascent and descent. On a level set, the gradient is perpendicular to tangent velocities. Evaluation points, matrix dimensions and the unit of the parameter keep all these interpretations consistent.
Exercises
Checkpoint
Let and . Find using the matrix chain rule.
Evaluate the outer derivative at .
Solution · Solution 1: one output after two intermediate inputs
, so and
Their product is the row .
Checkpoint
For , find the unit directional rate at the origin in the direction and the maximum unit directional rate.
Normalize the direction before taking the dot product.
Solution · Solution 2: direction and steepest rate
The function is smooth and . The given direction has unit vector , so the rate is . The maximum unit rate is , in direction . Using without normalization would give the parameter rate .
Checkpoint
Define off the origin and . Show that all directional derivatives at zero exist, but is not differentiable there.
Compute the derivative along an arbitrary fixed unit vector, then compare it with the coordinate partial derivatives.
Solution · Solution 3: directional data need not be linear
For a unit vector and nonzero , . Hence for every unit direction. The partial derivatives give candidate gradient . If were differentiable, its directional derivative in direction would be . Its actual value is , so it is not differentiable. It is nevertheless continuous because .
Lines can miss a curved approach
A useful starting point for the chain rule is a scalar inner function and a one-variable outer function . If is differentiable at and is differentiable at , with the composite defined nearby, then
This scalar case can be learned before the general matrix rule. For and , the gradient of their composite at is . The outer derivative is evaluated at , not at the input pair. Directional derivatives under a differentiability assumption can also be obtained directly from the linear remainder definition; they do not require mastering matrix multiplication first.
Worked example
Every directional derivative exists, yet continuity fails
Define the function on the whole plane by
The denominator vanishes only at the origin, where the separate value is specified. Fix one unit direction , so . We must calculate the defining quotient, not assume the gradient formula. For ,
If , division by and then passage to the limit gives
If , the entire line has , hence and . This case must be handled separately: the expression is not defined there. Thus every fixed unit direction has a finite two-sided directional derivative. Along every fixed line the function itself tends to zero as well.
Now approach along the parabola . For ,
The values do not tend to . Therefore is not continuous at the origin and cannot be differentiable there. A single such path disproves continuity; one does not need to inspect every possible curve.
Why did all the line tests miss this? A line fixes the ratio of its two coordinates. On the parabola, , so the direction changes as the point approaches the origin. The two denominator terms remain exactly balanced along that curve. On a fixed nonvertical line the term eventually dominates ; on the vertical line the numerator is zero. Statements about each fixed direction do not give a uniform estimate for directions changing with distance.
Common mistake
Existing coordinate derivatives do not authorize a chain rule
Here . If one incorrectly applied the gradient formula, every directional rate would be zero. In fact, for the defining quotient gives . Moreover , but the composite is not even continuous at zero. The chain rule cannot be used because its differentiability hypothesis for fails.
Checkpoint
4. Compare a line, a curved path and the earlier continuous example.
For the function above, find the directional derivative for and for . Evaluate for a fixed real constant and . Explain why this is a stronger continuity counterexample than the earlier with value zero at the origin.
Solution · 4. The direction must stay fixed in a directional derivative
The first derivative is ; the vertical derivative is zero. Along the family of curved paths,
Every fixed gives a nonzero limiting value while the input approaches the origin. These are paths, not lines with a fixed direction vector. The earlier has all directional derivatives but remains continuous, since . Both examples fail differentiability; only the present also fails continuity. Keep those two logical failures distinct.