Tutorials › Calculus III › Second Derivatives of Composite Functions

Chain Rule and Implicit Differentiation · Tutorial 359 of 999

Second Derivatives of Composite Functions

Learn to derive and apply the second derivative of a composite function along a path, accounting for both curvature of the function and acceleration of the path.

Intermediate 9 min read

What You'll Learn

  • Differentiate a function of two moving inputs twice with respect to time.
  • State the smoothness conditions needed for the second-derivative formula.
  • Separate the contributions from the function’s second partial derivatives and the path’s accelerations.
  • Apply the formula and verify results by direct differentiation.
  • Recognize why omitting the acceleration terms can give an incorrect answer.

Why a Second Derivative Has Two Sources

A quantity \(z=f(x(t),y(t))\) changes because the point \((x(t),y(t))\) moves through the input plane. Its rate of change depends on the first partial derivatives of \(f\) and on the velocities \(x'(t)\) and \(y'(t)\). Its second derivative has two kinds of contributions: the second partial derivatives of \(f\), which describe how the function changes across the plane, and the accelerations \(x''(t)\) and \(y''(t)\), which describe how the path’s velocity changes.

This distinction matters even when the function is linear. For \(f(x,y)=x+y\), all second partial derivatives of \(f\) are zero, but \(f(x(t),y(t))\) can still have a nonzero second derivative when the path accelerates.

Key idea: The second derivative along a path records both the curvature of the function and the acceleration of the input path.

The Second-Derivative Formula

Let \(f\) have continuous second partial derivatives on an open set containing the path, and suppose \(x(t)\) and \(y(t)\) are twice differentiable. Define \(z(t)=f(x(t),y(t))\). The first derivative follows from the chain rule. Differentiating it once more gives:

$$ \frac{d^2 z}{dt^2} = f_{xx}(x')^2 +2f_{xy}x'y' +f_{yy}(y')^2 +f_x x'' +f_y y''. $$

Every partial derivative of \(f\) in this formula is evaluated at \((x(t),y(t))\). The quantities \(x'\), \(y'\), \(x''\), and \(y''\) are evaluated at \(t\). Since \(f\) has continuous second partial derivatives, \(f_{xy}=f_{yx}\), so the two mixed-partial contributions combine into the term \(2f_{xy}x'y'\).

Definition: The velocity of the path \(t\mapsto (x(t),y(t))\) is \((x'(t),y'(t))\), and its acceleration is \((x''(t),y''(t))\). In the second-derivative formula, the terms involving second partial derivatives of \(f\) depend on velocity; the terms \(f_xx''+f_yy''\) depend on acceleration.

The formula can also be grouped to emphasize these two contributions:

$$ \frac{d^2 z}{dt^2} = \underbrace{f_{xx}(x')^2+2f_{xy}x'y'+f_{yy}(y')^2}_{\text{contribution from the second partial derivatives}} + \underbrace{f_xx''+f_yy''}_{\text{contribution from path acceleration}}. $$

Here, \(f_xx''\) means the product of \(f_x\) and \(x''\), not a second partial derivative. The subscripts on \(f\) denote partial derivatives; primes denote ordinary derivatives with respect to \(t\).

Why the Formula Works

The derivation starts with the first-derivative chain rule. At each time \(t\), the rate of change of \(z\) is the sum of the changes contributed by the two moving inputs:

$$ z'=f_xx'+f_yy'. $$

Differentiate both products with respect to \(t\). Applying the product rule and the chain rule to \(f_x(x(t),y(t))\) and \(f_y(x(t),y(t))\) gives:

$$ \begin{aligned} z'' &=\frac{d}{dt}(f_xx')+\frac{d}{dt}(f_yy')\\ &=\left(f_{xx}x'+f_{xy}y'\right)x'+f_xx'' +\left(f_{yx}x'+f_{yy}y'\right)y'+f_yy''\\ &=f_{xx}(x')^2+(f_{xy}+f_{yx})x'y' +f_{yy}(y')^2+f_xx''+f_yy''. \end{aligned} $$

Because \(f\) has continuous second partial derivatives, \(f_{xy}=f_{yx}\). Substituting this equality yields the stated formula. This derivation explains why neither contribution can generally be omitted: differentiating the first-derivative chain rule produces both the derivatives of the partial derivatives and the derivatives of the path velocities.

Worked Examples

Worked Example: A Polynomial Along a Curved Path

Let \(f(x,y)=x^2+3xy+y^2\), with \(x(t)=t\) and \(y(t)=t^2\). Find \(z''(1)\) using the formula, then check by direct differentiation.

First calculate the partial derivatives:

$$ f_x=2x+3y,\qquad f_y=3x+2y,\qquad f_{xx}=2,\qquad f_{xy}=3,\qquad f_{yy}=2. $$

At \(t=1\), the path values and their derivatives are:

$$ x=1,\quad y=1,\quad x'=1,\quad y'=2,\quad x''=0,\quad y''=2. $$

The first partial derivatives at \((1,1)\) are \(f_x=2(1)+3(1)=5\) and \(f_y=3(1)+2(1)=5\). Substitution into the second-derivative formula gives:

$$ \begin{aligned} z''(1) &=2(1)^2+2(3)(1)(2)+2(2)^2+5(0)+5(2)\\ &=2+12+8+0+10\\ &=32. \end{aligned} $$

For a check, substitute the path into \(f\):

$$ z(t)=t^2+3t^3+t^4,\qquad z'(t)=2t+9t^2+4t^3,\qquad z''(t)=2+18t+12t^2. $$

Thus \(z''(1)=2+18+12=32\), agreeing with the formula.

Worked Example: Mixed Partial and Acceleration Contributions

Let \(f(x,y)=xy\), \(x(t)=t^2\), and \(y(t)=t+1\). Compute \(z''(1)\) using the formula and verify it directly.

The partial derivatives are \(f_x=y\), \(f_y=x\), \(f_{xx}=0\), \(f_{xy}=1\), and \(f_{yy}=0\). At \(t=1\):

$$ x=1,\quad y=2,\quad x'=2,\quad y'=1,\quad x''=2,\quad y''=0. $$

Therefore \(f_x=2\) and \(f_y=1\) at the point \((1,2)\), and:

$$ \begin{aligned} z''(1) &=0(2)^2+2(1)(2)(1)+0(1)^2+2(2)+1(0)\\ &=0+4+0+4+0\\ &=8. \end{aligned} $$

Directly, \(z(t)=t^2(t+1)=t^3+t^2\), so \(z'(t)=3t^2+2t\) and \(z''(t)=6t+2\). Hence \(z''(1)=6+2=8\), as required. In this example, the mixed-partial term contributes \(4\), and the acceleration term contributes another \(4\).

Worked Example: A Linear Function with an Accelerating Path

Let \(f(x,y)=x+y\), \(x(t)=t^2\), and \(y(t)=t^3\). Find \(z''(1)\) using the formula and check it directly.

The first partial derivatives are \(f_x=1\) and \(f_y=1\). All second partial derivatives are zero:

$$ f_{xx}=f_{xy}=f_{yx}=f_{yy}=0. $$

At \(t=1\), \(x''=2\) and \(y''=6\). The velocity-dependent terms vanish because all second partial derivatives are zero. The acceleration terms give:

$$ z''(1)=1(2)+1(6)=8. $$

For a direct check, \(z(t)=t^2+t^3\), so \(z'(t)=2t+3t^2\) and \(z''(t)=2+6t\). Therefore \(z''(1)=2+6=8\). This confirms that zero second partial derivatives of \(f\) do not force the composite function to have zero second derivative.

When Each Contribution Matters

The formula separates naturally into two parts. If the path has zero acceleration at a time, so \(x''=y''=0\), only the second-partial contribution remains at that time. If all second partial derivatives of \(f\) vanish, only the acceleration contribution remains. In particular, for a linear function, changes in \(z'\) can come entirely from changes in the path’s velocity.

These observations are useful checks, not extra assumptions needed to use the formula. For a general function and a general path, both contributions may be nonzero. A path can also have zero velocity at an instant but nonzero acceleration; at such a time, the velocity-dependent terms vanish, while the acceleration terms may still contribute.

Common Pitfall: Forgetting the Acceleration Terms

A frequent error is to differentiate the first-derivative chain rule as though only the partial derivatives change, forgetting to differentiate \(x'\) and \(y'\). For the linear example \(f(x,y)=x+y\), \(x=t^2\), \(y=t^3\), this incomplete calculation would give:

$$ z'' \overset{\text{incorrect}}{=}0, $$

because all second partial derivatives of \(f\) are zero. But differentiating \(z'=x'+y'\) correctly gives \(z''=x''+y''\). At \(t=1\), that is \(2+6=8\), not zero. The omitted quantities were precisely the accelerations of the path.

A second check is to keep the mixed-partial contribution straight. Under the stated continuous-second-partial-derivative condition, it is \(2f_{xy}x'y'\). The factor of \(2\) arises because differentiating \(f_xx'\) produces \(f_{xy}y'x'\), while differentiating \(f_yy'\) produces \(f_{yx}x'y'\); the two terms are equal.

Why This Formula Matters

The second derivative of a composite quantity describes how its rate of change itself changes over time. In applications, a changing output may reflect both the shape of the rule \(f\) and the motion of the inputs. Separating those causes makes calculations easier to interpret and helps identify what information is needed: second partial derivatives and the path’s velocity describe one contribution, while first partial derivatives and the path’s acceleration describe the other.

Before substituting values, it is useful to record \(x,y,x',y',x'',y''\) at the time of interest. Then evaluate the needed partial derivatives at the corresponding point \((x,y)\). Finally, compare the result with direct differentiation when the composed expression is manageable. That check is especially effective at catching a missing acceleration term or an incorrect mixed-partial factor.

Check Your Understanding

Use the second-derivative formula and, where practical, verify by direct differentiation.

  1. For \(f(x,y)=x^2+y^2\), \(x(t)=t\), and \(y(t)=2t\), find \(z''(1)\).
  2. For \(f(x,y)=xy\), identify the mixed-partial contribution to \(z''\) along any twice-differentiable path.
  3. What smoothness condition allows the two mixed-partial terms to combine into \(2f_{xy}x'y'\)?
  4. For \(f(x,y)=3x-2y\), \(x(t)=t^2\), and \(y(t)=t^3\), explain why \(z''\) need not be zero even though all second partial derivatives of \(f\) are zero.
  5. If \(x''(t)=y''(t)=0\) at a particular time, which terms of the formula remain at that time?