Tutorials › Calculus III › Product Rules with Two-Variable Factors

Computing Partial Derivatives · Tutorial 306 of 999

Product Rules with Two-Variable Factors

Apply the product rule separately to each partial derivative, keeping track of which factors depend on the chosen variable.

Beginner 9 min read

What You'll Learn

  • Apply the product rule to products of two-variable functions.
  • Distinguish factors that vary with respect to x from those that vary with respect to y.
  • Compute both first partial derivatives of products involving powers, trigonometric functions, and exponentials.
  • Justify the rule by fixing one variable and using the ordinary product rule.
  • Check partial derivative calculations by treating the other variable as constant or expanding a product.

Why Products Require Attention to the Chosen Variable

A product of two functions of \(x\) and \(y\) can change when either variable changes. But a partial derivative asks about change in only one direction at a time: for \(\frac{\partial}{\partial x}\), hold \(y\) fixed; for \(\frac{\partial}{\partial y}\), hold \(x\) fixed. Consequently, a factor that varies in one partial derivative may be constant in the other.

The product rule still applies, but it must be applied separately for each chosen variable. The key is to identify how each factor changes while the other variable is held fixed.

Product rule for partial derivatives: If \(f\) and \(g\) have the required partial derivatives, then \[ \frac{\partial}{\partial x}(fg)=f_xg+fg_x, \qquad \frac{\partial}{\partial y}(fg)=f_yg+fg_y. \] Here \(f_x\) and \(g_x\) denote partial derivatives with respect to \(x\), and \(f_y\) and \(g_y\) denote partial derivatives with respect to \(y\). The other variable is held fixed in each derivative.

Why the Rule Works

Fix a value of \(y\). As a function of \(x\), the product \(f(x,y)g(x,y)\) is an ordinary product of two one-variable functions. The ordinary product rule therefore gives its derivative with respect to \(x\). The same reasoning, fixing \(x\), gives the rule for the partial derivative with respect to \(y\).

The difference quotient makes the \(x\)-case explicit. Add and subtract \(f(x,y)g(x+h,y)\) in the numerator. For \(h\ne 0\), this gives:

$$ \begin{aligned} &\frac{f(x+h,y)g(x+h,y)-f(x,y)g(x,y)}{h}\\ &\quad = f(x+h,y)\frac{g(x+h,y)-g(x,y)}{h} + g(x,y)\frac{f(x+h,y)-f(x,y)}{h}. \end{aligned} $$

If \(f_x\) and \(g_x\) exist at \((x,y)\), then the corresponding difference quotients tend to \(f_x(x,y)\) and \(g_x(x,y)\). Also, existence of \(f_x(x,y)\) implies \(f(x+h,y)\) tends to \(f(x,y)\) as \(h\) tends to zero. Taking the limit thus gives:

$$ \frac{\partial}{\partial x}(fg)(x,y) = f(x,y)g_x(x,y)+g(x,y)f_x(x,y). $$

For the \(y\)-partial, fix \(x\) and let \(y\) vary in the same argument. The result is \(f_yg+fg_y\). This reasoning requires the relevant partial derivatives to exist; it does not assume that both factors vary with respect to both variables.

A Reliable Calculation Method

For a product \(F(x,y)=f(x,y)g(x,y)\), write down the rule for the particular variable before simplifying. Then compute the two partial derivatives of the factors with that variable held in mind. A factor independent of the chosen variable has partial derivative zero, but it remains in the other term of the product rule.

1
Choose the variable.
For an \(x\)-partial, hold \(y\) constant; for a \(y\)-partial, hold \(x\) constant.
2
Differentiate each factor.
Find both factor derivatives with respect to the chosen variable.
3
Apply the product rule.
Use the derivative of the first factor times the second, plus the first factor times the derivative of the second.
4
Simplify and check.
Confirm that the factors held constant were treated as constants, and verify by viewing the expression as a one-variable product.

Worked Examples

Worked Example: Differentiate \(x^2y\sin x\)

Let \(F(x,y)=x^2y\sin x\). Regard it as the product \(f(x,y)g(x,y)\), where \(f(x,y)=x^2y\) and \(g(x,y)=\sin x\).

For the \(x\)-partial, \(y\) is constant. Therefore \(f_x=2xy\) and \(g_x=\cos x\). Applying the product rule gives:

$$ \begin{aligned} F_x &=f_xg+fg_x\\ &=(2xy)(\sin x)+(x^2y)(\cos x)\\ &=2xy\sin x+x^2y\cos x. \end{aligned} $$

For the \(y\)-partial, \(x\) is constant. Thus \(f_y=x^2\) and \(g_y=0\), since \(\sin x\) does not change as \(y\) changes. Hence:

$$ \begin{aligned} F_y &=f_yg+fg_y\\ &=(x^2)(\sin x)+(x^2y)(0)\\ &=x^2\sin x. \end{aligned} $$

To check, fix \(y=2\) and differentiate the one-variable function \(2x^2\sin x\). Its derivative is \(4x\sin x+2x^2\cos x\), which agrees with \(F_x\) after setting \(y=2\). Fixing \(x\) instead, the original expression is \(x^2\sin x\) times \(y\), whose derivative with respect to \(y\) is \(x^2\sin x\), as found above.

Worked Example: Differentiate \((x+y)e^y\)

Let \(G(x,y)=(x+y)e^y\), with factors \(f(x,y)=x+y\) and \(g(x,y)=e^y\).

For the \(x\)-partial, \(y\) is fixed. The derivatives of the factors are \(f_x=1\) and \(g_x=0\), because \(e^y\) is constant with respect to \(x\). Therefore:

$$ \begin{aligned} G_x &=f_xg+fg_x\\ &=(1)e^y+(x+y)(0)\\ &=e^y. \end{aligned} $$

For the \(y\)-partial, both factors vary: \(f_y=1\) and \(g_y=e^y\). Applying the rule gives:

$$ \begin{aligned} G_y &=f_yg+fg_y\\ &=(1)e^y+(x+y)e^y\\ &=(x+y+1)e^y. \end{aligned} $$

For a check, fix \(x=1\). The expression becomes \((1+y)e^y\). Its ordinary derivative is \(e^y+(1+y)e^y=(y+2)e^y\). Setting \(x=1\) in the formula for \(G_y\) also gives \((y+2)e^y\). For the \(x\)-partial, fixing \(y\) makes \(e^y\) constant, so differentiating \((x+y)e^y\) with respect to \(x\) gives \(e^y\), as required.

Worked Example: Differentiate a Product of Two Polynomials

Let \(H(x,y)=(x^2+3y)(2x-y)\). Both factors depend on the variables, but their derivatives differ depending on which variable is chosen. Set \(f=x^2+3y\) and \(g=2x-y\).

For \(x\), with \(y\) fixed, \(f_x=2x\) and \(g_x=2\). Thus:

$$ \begin{aligned} H_x &=f_xg+fg_x\\ &=(2x)(2x-y)+(x^2+3y)(2)\\ &=4x^2-2xy+2x^2+6y\\ &=6x^2-2xy+6y. \end{aligned} $$

For \(y\), with \(x\) fixed, \(f_y=3\) and \(g_y=-1\). Therefore:

$$ \begin{aligned} H_y &=f_yg+fg_y\\ &=3(2x-y)+(x^2+3y)(-1)\\ &=6x-3y-x^2-3y\\ &=6x-x^2-6y. \end{aligned} $$

Check by expanding the original product: \(H=2x^3-x^2y+6xy-3y^2\). Differentiating this expanded expression with respect to \(x\), holding \(y\) fixed, gives \(6x^2-2xy+6y\). Differentiating with respect to \(y\), holding \(x\) fixed, gives \(-x^2+6x-6y\). Both agree with the product-rule results.

Common Mistake: Differentiating the Wrong Factor

A frequent error is to differentiate a factor with respect to a variable that is being held constant, or to use the derivative of the wrong factor. For instance, for \(x^2y\sin x\), an incorrect attempt at the \(x\)-partial might be:

$$ \frac{\partial}{\partial x}(x^2y\sin x) \ \overset{\text{wrong}}{=}\ 2xy\sin x+x^2\sin x. $$

The first term comes from differentiating \(x^2\), but the second term incorrectly differentiates \(y\) as if it changed with \(x\), and also omits the derivative of \(\sin x\). In an \(x\)-partial, \(y\) is fixed, so the factor \(y\) stays in the term arising from differentiating \(x^2\). The sine factor also varies with \(x\). The correct calculation is:

$$ \frac{\partial}{\partial x}(x^2y\sin x) = 2xy\sin x+x^2y\cos x. $$

Grouping the expression into two factors does not change this principle. You may choose convenient factors, but the product rule must account for the derivative of each chosen factor with respect to the same variable.

Why This Skill Matters

Products of functions of several variables appear whenever an expression combines quantities that may depend on more than one coordinate. The product rule provides a systematic way to track how the whole expression changes in each coordinate direction. It also makes clear that the two partial derivatives of the same product need not have parallel calculations: one factor may be constant in the \(x\)-direction but variable in the \(y\)-direction.

Before simplifying a result, it is useful to inspect each product-rule term. In \(f_xg+fg_x\), the first term records the change in \(f\) while \(g\) remains as a factor; the second records the change in \(g\) while \(f\) remains as a factor. The \(y\)-partial has the same structure, with \(y\)-derivatives in place of \(x\)-derivatives. Keeping that structure visible reduces errors and makes the result easier to check.

Takeaway: For each partial derivative, hold the other variable fixed, differentiate each factor with respect to the chosen variable, and then apply the product rule. A factor's derivative may be zero for one partial and nonzero for another.

Check Your Understanding

For each question, identify which factors vary with the chosen variable before applying the product rule.

  1. For \(P(x,y)=xy^2\cos x\), find \(P_x\) and \(P_y\).
  2. For \(Q(x,y)=(2x-y)e^x\), find \(Q_x\). Which factor has zero \(y\)-partial?
  3. For \(R(x,y)=(x+y)(x-y)\), find both first partial derivatives using the product rule.
  4. Explain why \(e^y\) has zero partial derivative with respect to \(x\), even though it is not a constant function of both variables.
  5. Expand \((x+2y)(3x-y)\), then use the expanded form to check its \(y\)-partial obtained by the product rule.