Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 39 · Partial Derivatives

Partial Derivatives

Learn partial derivatives of functions of two and three variables: the limit definition, geometric meaning as slopes, computation rules and Python checks.

If f(x, y) describes the altitude of a hillside, how steep is the hill? That depends on which way you face. The simplest answer is to choose one of the coordinate directions and hold the other variable fixed. The resulting rate of change is a partial derivative.

Definition

The partial derivative of f(x, y) with respect to x at (a, b) is

Text
f_x(a, b) = lim (h→0) [f(a + h, b) - f(a, b)] / h

Only x changes; y stays frozen at b. Similarly,

Text
f_y(a, b) = lim (h→0) [f(a, b + h) - f(a, b)] / h

Common notations: f_x, ∂f/∂x, ∂ₓf. The symbol ∂ (a curly "d") signals that other variables are held constant.

Practical rule: to find ∂f/∂x, treat every other variable as a constant and differentiate as usual.

Worked example 1: f(x, y) = x³y + 2y².

Text
f_x = 3x² y        (y is a constant; 2y² has derivative 0)
f_y = x³ + 4y

Worked example 2: f(x, y) = sin(xy) + e^(x+y).

Text
f_x = y cos(xy) + e^(x+y)
f_y = x cos(xy) + e^(x+y)

Worked example 3 (three variables): f(x, y, z) = x y z + z²/x.

Text
f_x = yz - z²/x²,   f_y = xz,   f_z = xy + 2z/x
Python Partial derivatives with sympy

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Geometric meaning

At the point (a, b) on the surface z = f(x, y), slice the surface with the vertical plane y = b. You get a curve z = f(x, b). The number f_x(a, b) is the slope of the tangent line to this curve. Likewise f_y(a, b) is the slope of the curve cut by the plane x = a.

Worked example: f(x, y) = 9 - x² - y² at (1, 2). Then f_x = -2x, so f_x(1, 2) = -2; and f_y = -2y gives f_y(1, 2) = -4. Walking east from (1, 2) the height falls at rate 2; walking north, at rate 4.

Interpretation as a rate of change

Partial derivatives answer "what happens if I change only this input?"

  • If T(x, y) is temperature on a plate (°C) and x, y are in meters, T_x is in °C per meter.
  • If C(L, K) is cost from labor L and capital K, then C_L is the marginal cost of one more unit of labor with capital fixed.
Python Check a partial derivative numerically

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The central difference [f(a + h) - f(a - h)] / 2h is usually far more accurate than the forward difference.

Tips for computing

  • Product, quotient and chain rules work exactly as before, with the other variables as constants.
  • For f = x^y: f_x = y x^(y-1) (power rule), but f_y = x^y ln x (exponential rule). Which rule you use depends on which variable moves.
  • Check by plugging numbers: compute with h = 0.001, and compare.

A function can have both partial derivatives at a point and still fail to be continuous there. For example f(x, y) = xy/(x² + y²) with f(0, 0) = 0 has f_x(0, 0) = f_y(0, 0) = 0 (along the axes it is identically 0), yet the limit at the origin does not exist. Partial derivatives alone do not guarantee a good tangent plane; we need continuity of the partials, which the lesson on tangent planes explains.

Partial derivative recipe

Pick a variable
Freeze the others Treat them as constants
Differentiate Usual rules
1 / 2

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. If f(x, y) = x²y³, what is ∂f/∂y?

    Treat x as a constant: the derivative of y³ is 3y², giving 3x²y².
  2. 2. For f(x, y) = sin(xy), f_x equals

    By the chain rule, d/dx sin(xy) = cos(xy) · y.
  3. 3. For f(x, y) = 9 - x² - y², what is f_x(1, 2)?

    f_x = -2x, so f_x(1, 2) = -2.
  4. 4. Geometrically, f_y(a, b) is the slope of the curve obtained by slicing the surface with the plane

    To differentiate in y, x is held fixed at a, so the slice is the plane x = a.

Summary

  • ∂f/∂x is the derivative with respect to x holding all other variables constant.
  • It is the slope of the surface in the x direction, and the rate of change of f per unit x.
  • Use ordinary rules with other variables treated as constants; verify with finite differences or sympy.

Next: Higher-Order Partial Derivatives