Tutorials › Calculus III › Second Derivatives of Products

Computing Partial Derivatives · Tutorial 318 of 999

Second Derivatives of Products

Apply the product rule twice to find pure and mixed second partials of products, and check that no resulting term is lost.

Beginner 11 min read

What You'll Learn

  • Derive the pure second-partial formulas for a product of two functions.
  • Compute a mixed second partial while retaining each term from both product-rule applications.
  • Recognize when a factor’s derivative is zero because it does not depend on the differentiation variable.
  • Handle a repeated factor by treating it as two factors in the product rule.
  • Verify second-partial calculations by differentiating the original product directly.

Why a Second Product Derivative Needs Care

A first partial derivative of a product has two terms: either factor can be differentiated. Taking another partial derivative applies the product rule to both of those terms, so each can produce two more. The result is not just a repeated version of one term: every contribution must be retained.

This matters especially for mixed partials. When both factors depend on both variables, differentiating first with respect to \(x\) and then with respect to \(y\) produces four terms. A reliable calculation records them before simplifying.

Key idea: To find a second partial derivative of a product, first differentiate the product once, then apply the product rule separately to every term that results.

Second Partials of a Product

Let \(f\) and \(g\) be functions of \(x\) and \(y\) with the required first and second partial derivatives. Write \(h=fg\). A subscript indicates differentiation with respect to that variable; for instance, \(f_{xy}\) means differentiate \(f\) first with respect to \(x\), then with respect to \(y\).

For a pure second partial, apply the product rule twice in the same variable. For a mixed partial \(h_{xy}\), first differentiate with respect to \(x\), then differentiate the result with respect to \(y\). This order matters in organizing the calculation; equality with \(h_{yx}\) is a separate question.

Formulas: If \(h=fg\), then
$$ \begin{aligned} h_{xx}&=f_{xx}g+2f_xg_x+fg_{xx},\\ h_{yy}&=f_{yy}g+2f_yg_y+fg_{yy},\\ h_{xy}&=f_{xy}g+f_xg_y+f_yg_x+fg_{xy}. \end{aligned} $$
The displayed mixed formula is for differentiating first with respect to \(x\), then with respect to \(y\). Each formula requires the indicated derivatives of both factors to exist.

Why the Formulas Have These Terms

The pure formula follows by applying the ordinary partial product rule twice. Begin with \(h_x=f_xg+fg_x\). Differentiate both summands with respect to \(x\); each summand produces two terms:

$$ \begin{aligned} h_{xx} &=\frac{\partial}{\partial x}(f_xg)+\frac{\partial}{\partial x}(fg_x)\\ &=(f_{xx}g+f_xg_x)+(f_xg_x+fg_{xx})\\ &=f_{xx}g+2f_xg_x+fg_{xx}. \end{aligned} $$

The middle contribution occurs twice: once when differentiating \(f_xg\), and once when differentiating \(fg_x\). That is the reason for the coefficient \(2\). For the mixed partial, start with the same first derivative but differentiate each summand with respect to \(y\):

$$ \begin{aligned} h_{xy} &=\frac{\partial}{\partial y}(f_xg)+\frac{\partial}{\partial y}(fg_x)\\ &=(f_{xy}g+f_xg_y)+(f_yg_x+fg_{xy})\\ &=f_{xy}g+f_xg_y+f_yg_x+fg_{xy}. \end{aligned} $$

Unlike the pure formula, the mixed formula generally has four distinct terms. In particular, both factors may contribute a first derivative in each cross term, and both factors may also contribute a mixed second derivative.

Worked Examples

Worked Example: A Product with One Variable-Independent Factor

Let \(h(x,y)=(x^2+1)(y^3+2y)\). Find \(h_{xx}\) and \(h_{yy}\). Set \(f=x^2+1\) and \(g=y^3+2y\). The needed derivatives are \(f_x=2x\), \(f_{xx}=2\), \(g_x=0\), \(g_{xx}=0\), \(f_y=0\), \(f_{yy}=0\), \(g_y=3y^2+2\), and \(g_{yy}=6y\).

For the \(x\)-partial, the terms involving \(g_x\) or \(g_{xx}\) vanish because \(g\) has no \(x\)-dependence:

$$ \begin{aligned} h_{xx} &=f_{xx}g+2f_xg_x+fg_{xx}\\ &=2(y^3+2y)+2(2x)(0)+(x^2+1)(0)\\ &=2y^3+4y. \end{aligned} $$

For the \(y\)-partial, \(f_y=f_{yy}=0\), so only the final term remains:

$$ \begin{aligned} h_{yy} &=f_{yy}g+2f_yg_y+fg_{yy}\\ &=0(y^3+2y)+2(0)(3y^2+2)+(x^2+1)(6y)\\ &=6y(x^2+1). \end{aligned} $$

Check by differentiating the original product: \(h_x=2x(y^3+2y)\), so differentiating again in \(x\) gives \(h_{xx}=2(y^3+2y)=2y^3+4y\). Also, \(h_y=(x^2+1)(3y^2+2)\), and differentiating in \(y\) gives \(h_{yy}=6y(x^2+1)\). Both results agree.

Worked Example: A Repeated Factor

Let \(h(x,y)=q(x,y)^2\), where \(q=x^2+xy+y^2\). Find \(h_{xx}\), \(h_{yy}\), and \(h_{xy}\). Treat the square as a product \(q\cdot q\), not as a single factor whose derivative can be counted only once. First compute

$$ q_x=2x+y,\qquad q_y=x+2y,\qquad q_{xx}=2,\qquad q_{yy}=2,\qquad q_{xy}=1. $$

For the pure \(x\)-partial, the product formula gives two copies of \(q_xq_x\) and one second derivative of each copy of \(q\):

$$ \begin{aligned} h_{xx} &=q_{xx}q+2q_xq_x+qq_{xx}\\ &=4q+2(2x+y)^2\\ &=4(x^2+xy+y^2)+2(4x^2+4xy+y^2)\\ &=12x^2+12xy+6y^2. \end{aligned} $$

Likewise, the pure \(y\)-partial is

$$ \begin{aligned} h_{yy} &=q_{yy}q+2q_yq_y+qq_{yy}\\ &=4q+2(x+2y)^2\\ &=4(x^2+xy+y^2)+2(x^2+4xy+4y^2)\\ &=6x^2+12xy+12y^2. \end{aligned} $$

For the mixed partial, retain all four contributions. The first and last terms are both \(q_{xy}q\):

$$ \begin{aligned} h_{xy} &=q_{xy}q+q_xq_y+q_yq_x+qq_{xy}\\ &=2q+2(2x+y)(x+2y)\\ &=2(x^2+xy+y^2)+2(2x^2+5xy+2y^2)\\ &=6x^2+12xy+6y^2. \end{aligned} $$

Check by differentiating \(h=q^2\) directly. First, \(h_x=2qq_x\). Differentiating this with respect to \(x\) gives \(h_{xx}=2q_x^2+2qq_{xx}\), which is the expression above. Differentiating \(h_x\) with respect to \(y\) gives \(h_{xy}=2q_yq_x+2qq_{xy}\), also the expression above. At \((1,0)\), \(q=1\), \(q_x=2\), \(q_y=1\), and \(q_{xy}=1\), so \(h_{xy}=2(1)(1)+2(2)(1)=6\). The expanded result gives \(6(1)^2+12(1)(0)+6(0)^2=6\), as required.

Worked Example: Four Terms in a Mixed Partial

Let \(h(x,y)=(x^2+y)(xy+1)\). Set \(f=x^2+y\) and \(g=xy+1\). Their relevant derivatives are \(f_x=2x\), \(f_y=1\), \(f_{xy}=0\), \(g_x=y\), \(g_y=x\), and \(g_{xy}=1\). The mixed-product formula gives

$$ \begin{aligned} h_{xy} &=f_{xy}g+f_xg_y+f_yg_x+fg_{xy}\\ &=0(xy+1)+(2x)(x)+(1)(y)+(x^2+y)(1)\\ &=2x^2+y+x^2+y\\ &=3x^2+2y. \end{aligned} $$

For comparison, the pure partials are found from the same factor derivatives. Since \(f_{xx}=2\), \(g_{xx}=0\), \(f_{yy}=g_{yy}=0\), and \(g_x=y,\ g_y=x\),

$$ \begin{aligned} h_{xx} &=f_{xx}g+2f_xg_x+fg_{xx}\\ &=2(xy+1)+2(2x)(y)+(x^2+y)(0)\\ &=6xy+2,\\ h_{yy} &=f_{yy}g+2f_yg_y+fg_{yy}\\ &=0(xy+1)+2(1)(x)+(x^2+y)(0)\\ &=2x. \end{aligned} $$

Check by expanding the original product: \(h=x^3y+x^2+xy^2+y\). Then \(h_x=3x^2y+2x+y^2\), so \(h_{xx}=6xy+2\) and \(h_{xy}=3x^2+2y\). Also, \(h_y=x^3+2xy+1\), so \(h_{yy}=2x\). These match the product-rule calculations. At \((1,2)\), the results are \(h_{xx}=14\), \(h_{yy}=2\), and \(h_{xy}=7\).

A Common Error: Losing a Contribution

A frequent mistake is to keep only one copy of a term that arises twice. For a square \(h=q^2\), one might incorrectly write \(h_{xy}=q_{xy}q+q_xq_y\), as though differentiating the first factor were the only source of each contribution. But differentiating \(q_xq\) with respect to \(y\) produces both \(q_{xy}q\) and \(q_xq_y\); differentiating \(qq_x\) produces \(q_yq_x\) and \(qq_{xy}\).

$$ \begin{aligned} \text{Incorrect:}\quad h_{xy}&=q_{xy}q+q_xq_y,\\ \text{Correct:}\quad h_{xy}&=q_{xy}q+q_xq_y+q_yq_x+qq_{xy}. \end{aligned} $$

For \(q=x^2+xy+y^2\) at \((1,0)\), the incorrect expression gives \(1+2=3\). The full expression gives \(1+2+2+1=6\). The missing terms are not optional: they come from differentiating the other summand in the first partial derivative.

A practical safeguard is to write the unsimplified result before combining terms. For a pure partial, check that the middle term appears twice. For a mixed partial, check for four terms before substituting derivatives or simplifying.

Using the Formulas Reliably

When computing a second partial of a product, name the factors \(f\) and \(g\), list the derivatives each formula needs, and then substitute into the complete formula. Only after every term is present should you use facts such as \(f_y=0\) for a factor independent of \(y\).

1
Identify the factors.
Write the product as \(h=fg\), even when it is a repeated factor such as \(q^2=q\cdot q\).
2
Choose the second partial.
For \(h_{xx}\) or \(h_{yy}\), use the pure formula; for \(h_{xy}\), use the four-term mixed formula in the stated order.
3
List the needed derivatives.
Compute each factor’s first and second partial derivatives required by that formula.
4
Substitute, simplify, and check.
Retain every term, use zero derivatives only when justified, and compare with direct differentiation or an expansion when practical.

These formulas organize computation; they do not by themselves assert that \(h_{xy}=h_{yx}\). That equality is not needed to compute a specified mixed partial. Keeping the order explicit prevents a calculation from relying on an unproved interchange of derivatives.

Check Your Understanding

For each question, write down the relevant product-rule terms before simplifying.

  1. If \(h=fg\), what are the three terms in \(h_{xx}\), and why does the middle contribution have coefficient \(2\)?
  2. Write the four-term formula for \(h_{xy}\) when differentiation is performed first in \(x\), then in \(y\).
  3. For \(h=q^2\), why must the mixed-partial formula include two terms involving \(q_{xy}q\)?
  4. Find \(h_{xx}\) for \(h=(x^2+1)(y^2+3)\), and identify which factor derivatives vanish.
  5. For \(h=(x+y)(x^2+y)\), list all four terms needed for \(h_{xy}\) before evaluating them.