Computing Partial Derivatives

Every ordinary rule still applies.

The ordinary rules, one variable at a time

A partial derivative needs no new rules. To find ∂f/∂x, treat every other variable as a constant, a fixed number, and differentiate in x with the power rule, the product rule, the quotient rule and the chain rule exactly as before.

Take f(x, y) = x²y + y³. In x²y, the y is a constant factor, so it stays, and x² becomes 2x by the power rule: the term gives 2xy. The term y³ has no x in it, so it is a constant and gives 0. So ∂f/∂x = 2xy, which is 4 at (1, 2).

xz

Three slices of z = x²y, each with y held at a constant value: z = x² at y = 1 and z = 3x² at y = 3, dashed, and z = 2x² at y = 2, in gold. At x = 1 their gradients are 2, 4 and 6, which is 2xy each time. The constant y multiplies the slice, and so it multiplies the slope.

Swap the roles

To find ∂f/∂y, hold x constant instead and differentiate in y. In x²y, the x² is now the constant factor and y differentiates to 1, so the term gives x². The term y³ gives 3y². So ∂f/∂y = x² + 3y², which is 1 + 12 = 13 at (1, 2).

Check it with a small step in y: f(1, 2) = 10 and f(1, 2.001) = 10.013006, so the difference quotient is 0.013006/0.001 = 13.006, close to 13. A step of 0.001 in x gives 4.002, close to the 4 found for ∂f/∂x.

A term without the variable

A term that does not contain the variable you differentiate with respect to is a constant, so its partial derivative is 0. This is the same as the derivative of a number being 0.

For f(x, y) = 3x² + 4xy − 7y², the term −7y² vanishes under ∂/∂x and 3x² vanishes under ∂/∂y. So ∂f/∂x = 6x + 4y and ∂f/∂y = 4x − 14y. At (1, 2) these are 6 + 8 = 14 and 4 − 28 = −24.

A term can be a constant to one partial derivative and not to the other. In 4xy, both variables appear, so it contributes 4y to ∂f/∂x and 4x to ∂f/∂y.

Products, quotients and the chain rule

When the variable appears in two factors, the product rule is needed. For f(x, y) = x e^(xy), x appears in both x and e^(xy). In x, the chain rule gives the derivative of e^(xy) as y e^(xy), so ∂f/∂x = e^(xy) + x y e^(xy) = (1 + xy)e^(xy). In y, x is a constant factor, so ∂f/∂y = x · x e^(xy) = x² e^(xy). At (1, 0.5) these are 1.5e^(0.5) ≈ 2.473 and e^(0.5) ≈ 1.649.

For f(x, y) = sin(x²y), the chain rule brings out the derivative of the inside, x²y, in each variable: ∂f/∂x = 2xy cos(x²y) and ∂f/∂y = x² cos(x²y). At (1, 2) these are 4 cos 2 ≈ −1.665 and cos 2 ≈ −0.416.

For f(x, y) = x/(x + y), the quotient rule in x gives the numerator (x + y) × 1 − x × 1 = y over the denominator (x + y)², so ∂f/∂x = y/(x + y)². In y the top x is a constant, so ∂f/∂y = −x/(x + y)². At (1, 2) these are 2/9 ≈ 0.222 and −1/9 ≈ −0.111. Each of these values agrees with a difference quotient at the same point.

The usual mistakes

Deleting a constant factor. Under ∂/∂x, the y in 3x²y is a constant factor and stays: the answer is 6xy, not 6x.

Differentiating a term that has no x in it. Under ∂/∂x, x² + 5y gives 2x; the 5y is a constant and gives 0, not 5.

Mixing up the two partial derivatives. For 3x²y, ∂f/∂x = 6xy and ∂f/∂y = 3x², and each answers a different question.

Leaving out the factor from the chain rule. The partial derivative of e^(xy) with respect to x is y e^(xy), not e^(xy).

Practice Computing Partial Derivatives in the app