Calculus · Functions of several variables

Partial Derivatives, Differentials and the Chain Rule

The temperature in a room depends on where you stand: \(T = f(x, y, z)\). How fast does it change if you step east? If you step north? What if you move diagonally while time passes? Partial derivatives answer the first questions, the differential combines them, and the chain rule handles variables that themselves depend on other variables. This post builds all three from one simple idea: change one variable at a time, then add up the effects.

1. Partial and total increments

Let \( f(\xi_1, \xi_2, \dots, \xi_n) \) be a function of \(n\) variables. There are two natural ways to change its arguments.

Increments The partial increment with respect to \(\xi_i\) changes only that one variable: \[ \Delta_{\xi_i}f = f(\xi_1, \dots, \xi_i + \Delta\xi_i, \dots, \xi_n) - f(\xi_1, \dots, \xi_i, \dots, \xi_n). \] The total increment changes all of them at once: \[ \Delta f = f(\xi_1 + \Delta\xi_1, \xi_2 + \Delta\xi_2, \dots, \xi_n + \Delta\xi_n) - f(\xi_1, \xi_2, \dots, \xi_n). \]

In general, the total increment is not the sum of the partial increments. For \( f(x, y) = xy \):

\[ \Delta_xf = y\,\Delta x, \qquad \Delta_yf = x\,\Delta y, \qquad \Delta f = (x + \Delta x)(y + \Delta y) - xy = y\,\Delta x + x\,\Delta y + \Delta x\,\Delta y. \]

There is an extra term \( \Delta x\,\Delta y \): the effect of both changes acting together. The point of the differential (Section 4) is that this "interaction" is negligibly small for small increments.

x · y y Δx x Δy ΔxΔy x Δx y Δy
Figure 1. The area \(f = xy\) grows by two strips, \(y\,\Delta x + x\,\Delta y\) (the differential, green), plus a small corner \(\Delta x\,\Delta y\) (red), which is of second order.

2. Partial derivatives

Definition The (first) partial derivative of \(f\) with respect to \(\xi_i\) is the limit \[ \frac{\partial f}{\partial\xi_i} = \lim_{\Delta\xi_i\to 0}\frac{f(\xi_1, \dots, \xi_i + \Delta\xi_i, \dots, \xi_n) - f(\xi_1, \dots, \xi_i, \dots, \xi_n)}{\Delta\xi_i} = \lim_{\Delta\xi_i\to 0}\frac{\Delta_{\xi_i}f}{\Delta\xi_i}. \]

How to compute it: treat all the other variables as constants and differentiate as usual. Nothing new is needed: all the rules for functions of one variable apply.

Geometric meaning (for \(z = f(x, y)\)): fix \(y = y_0\). The plane \(y = y_0\) cuts the surface along a curve, and \( \frac{\partial f}{\partial x}(x_0, y_0) \) is the slope of that curve, the steepness of the surface "in the \(x\)-direction". Similarly \( \frac{\partial f}{\partial y} \) is the slope in the \(y\)-direction.

Example 1 \( f(x, y) = x^2y + \sin(xy) \): \[ \frac{\partial f}{\partial x} = 2xy + y\cos(xy), \qquad \frac{\partial f}{\partial y} = x^2 + x\cos(xy). \] For \(\partial f/\partial x\), the factor \(y\) behaved like a constant coefficient; for \(\partial f/\partial y\), \(x^2\) did.

Common notations: \( \frac{\partial f}{\partial x} = f_x = f'_x = \partial_xf \).

3. Higher partial derivatives and their order

Partial derivatives are again functions of all the variables, so they can be differentiated again. The \(k\)-th partial derivative with respect to \(\xi_i\) is the first partial derivative, with respect to \(\xi_i\), of the \((k-1)\)-th one. We may also switch variables along the way, which gives mixed derivatives:

\[ \frac{\partial^2 f}{\partial x^2} = \frac{\partial}{\partial x}\Big(\frac{\partial f}{\partial x}\Big), \qquad \frac{\partial^2 f}{\partial y\,\partial x} = \frac{\partial}{\partial y}\Big(\frac{\partial f}{\partial x}\Big), \qquad \frac{\partial^2 f}{\partial x\,\partial y} = \frac{\partial}{\partial x}\Big(\frac{\partial f}{\partial y}\Big). \]
Schwarz's theorem If the mixed partial derivatives are continuous, the result of successive differentiation does not depend on the order: \[ \frac{\partial^2 f}{\partial x\,\partial y} = \frac{\partial^2 f}{\partial y\,\partial x}. \] The same holds for higher derivatives: only how many times we differentiate with respect to each variable matters.
Example 2 · Checking the theorem For \( f = x^2y + \sin(xy) \) from Example 1: \[ \frac{\partial}{\partial y}\big(2xy + y\cos xy\big) = 2x + \cos xy - xy\sin xy, \qquad \frac{\partial}{\partial x}\big(x^2 + x\cos xy\big) = 2x + \cos xy - xy\sin xy. \] Equal, as promised. This is a handy check of your own calculations.
The condition matters For \( f(x, y) = \frac{xy(x^2 - y^2)}{x^2 + y^2} \), \( f(0, 0) = 0 \), both mixed derivatives exist at the origin, but \( \frac{\partial^2 f}{\partial y\,\partial x}(0, 0) = -1 \) while \( \frac{\partial^2 f}{\partial x\,\partial y}(0, 0) = 1 \). (Indeed \( f_x(0, y) = -y \) and \( f_y(x, 0) = x \).) The mixed derivatives are not continuous at \((0, 0)\), so the theorem does not apply. Such functions are rare in practice, but they show the hypothesis is not decoration.

4. Differentiability and the differential

For one variable, \( \Delta f = f'(x)\,\Delta x + o(\Delta x) \): near a point, the function is almost linear. Differentiability in several variables asks for the same thing, with all variables moving at once.

Definition If the total increment can be written as \[ \Delta f = \sum_{i=1}^n a_i\,\Delta\xi_i + o(\rho), \qquad \rho = \sqrt{(\Delta\xi_1)^2 + (\Delta\xi_2)^2 + \cdots + (\Delta\xi_n)^2}, \] where the \(a_i\) do not depend on the \(\Delta\xi_i\), and \( o(\rho) \) is a quantity with \( \frac{o(\rho)}{\rho} \to 0 \) as \( \rho \to 0 \), then \(f\) is differentiable at the point \((\xi_1, \dots, \xi_n)\). The principal linear part of the increment is the differential \[ df = \sum_{i=1}^n\frac{\partial f}{\partial\xi_i}\,d\xi_i, \qquad d\xi_i = \Delta\xi_i. \tag{1} \]

Two things are worth unpacking.

In the example \(f = xy\) above: \( df = y\,dx + x\,dy \), and the remainder \( \Delta x\,\Delta y \) satisfies \( |\Delta x\,\Delta y| \le \frac12\rho^2 \), so it is indeed \(o(\rho)\).

Geometrically, for \(z = f(x, y)\), the differential is the increment along the tangent plane: differentiability means the surface looks like a plane when you zoom in.

Partial derivatives are not enough Unlike in one variable, the mere existence of partial derivatives does not make a function differentiable. Take \( f(x, y) = \frac{xy}{x^2 + y^2} \), \( f(0, 0) = 0 \). On both axes \(f = 0\), so \( f_x(0, 0) = f_y(0, 0) = 0 \). But along the line \(y = x\), \(f = \frac12\), so \(f\) is not even continuous at the origin (see the post on limits in several variables).

Sufficient condition: if all partial derivatives exist near the point and are continuous at it, then \(f\) is differentiable there. For the usual formula-defined functions this is how differentiability is checked.

5. Using the differential: approximation and errors

For small increments,

\[ \Delta f \approx df, \qquad\text{that is}\qquad f(\xi_1 + \Delta\xi_1, \dots, \xi_n + \Delta\xi_n) \approx f(\xi_1, \dots, \xi_n) + \sum_{i=1}^n\frac{\partial f}{\partial\xi_i}\,\Delta\xi_i. \tag{2} \]
Example 3 · Approximate computation Estimate \( \sqrt{3.02^2 + 3.97^2} \). Take \( f(x, y) = \sqrt{x^2 + y^2} \) at \((3, 4)\), where \(f = 5\), with \( \Delta x = 0.02 \), \( \Delta y = -0.03 \): \[ f_x = \frac{x}{\sqrt{x^2 + y^2}} = \frac35, \qquad f_y = \frac45, \qquad df = \frac35(0.02) + \frac45(-0.03) = -0.012. \] So the value is \( \approx 4.988 \). The exact value is \(4.98812\dots\)
Example 4 · Propagation of measurement errors The volume of a cylinder is \( V = \pi r^2h \). Then \( dV = 2\pi rh\,dr + \pi r^2\,dh \), and dividing by \(V\): \[ \frac{dV}{V} = 2\frac{dr}{r} + \frac{dh}{h}. \] If \(r\) is measured with relative error at most 1% and \(h\) with at most 2%, the relative error of \(V\) is at most \( 2\cdot 1\% + 2\% = 4\% \). The radius enters squared, so its error counts twice.

6. Higher-order differentials

When \(\xi_1, \dots, \xi_n\) are independent variables, their increments \(d\xi_i\) are constants, and differentiating \(df\) again gives the second differential. For two variables:

\[ d^2f = \frac{\partial^2 f}{\partial x^2}dx^2 + 2\frac{\partial^2 f}{\partial x\,\partial y}dx\,dy + \frac{\partial^2 f}{\partial y^2}dy^2. \]

This looks like \( (a + b)^2 \), and that is no accident. In general the \(k\)-th differential can be written symbolically as

\[ d^kf = \Big(\sum_{i=1}^n d\xi_i\,\frac{\partial}{\partial\xi_i}\Big)^{(k)}f, \]

meaning: expand the \(k\)-th power formally as a polynomial, then read each "product" \( \frac{\partial}{\partial\xi_i}\frac{\partial}{\partial\xi_j}\cdots \) as the corresponding partial derivative of \(f\). (Schwarz's theorem is what allows us to treat the operators as commuting, like ordinary numbers.)

Example 5 For \( f = x^3y \): \( f_{xx} = 6xy \), \( f_{xy} = 3x^2 \), \( f_{yy} = 0 \), so \( d^2f = 6xy\,dx^2 + 6x^2\,dx\,dy \).

7. The chain rule

Often the variables are not independent: the position \((x, y)\) of a moving object depends on time, or we switch to polar coordinates. Then \(u = f(\xi_1, \dots, \xi_n)\) becomes a function of the new variables, and we want its derivatives with respect to them.

Derivative of a composite function If \( u = f(\xi_1, \dots, \xi_n) \) is differentiable and \(\xi_i\) (\(i = 1, \dots, n\)) are differentiable functions of independent variables \(\eta_k\) (\(k = 1, \dots, m\)), then \[ \frac{\partial u}{\partial\eta_k} = \sum_{i=1}^n\frac{\partial u}{\partial\xi_i}\,\frac{\partial\xi_i}{\partial\eta_k} \qquad (k = 1, 2, \dots, m). \]

How to read it: \(\eta_k\) influences \(u\) through every intermediate variable \(\xi_i\). Along each path, the rates multiply ("how much \(\xi_i\) moves per unit \(\eta_k\)" times "how much \(u\) moves per unit \(\xi_i\)"), and the contributions of all paths add up.

Why it holds: by differentiability, \( \Delta u = \sum\frac{\partial u}{\partial\xi_i}\Delta\xi_i + o(\rho) \). Change only \(\eta_k\), divide by \(\Delta\eta_k\), and let it tend to zero: each \( \frac{\Delta\xi_i}{\Delta\eta_k} \to \frac{\partial\xi_i}{\partial\eta_k} \), and the remainder vanishes. This is exactly where differentiability of \(f\) (not just existence of partial derivatives) is needed.

Example 6 · One parameter: the total derivative If \( u = x^2y \) with \( x = \cos t \), \( y = \sin t \) (a point moving around a circle): \[ \frac{du}{dt} = \frac{\partial u}{\partial x}\frac{dx}{dt} + \frac{\partial u}{\partial y}\frac{dy}{dt} = 2xy(-\sin t) + x^2\cos t = -2\cos t\sin^2 t + \cos^3 t. \] Check: \( u = \cos^2 t\sin t \) directly gives the same derivative.
Example 7 · Polar coordinates For \( u = f(x, y) \) with \( x = r\cos\theta \), \( y = r\sin\theta \): \[ \frac{\partial u}{\partial r} = f_x\cos\theta + f_y\sin\theta, \qquad \frac{\partial u}{\partial\theta} = -f_x\,r\sin\theta + f_y\,r\cos\theta. \] For \( u = x^2 + y^2 \): \( \frac{\partial u}{\partial r} = 2x\cos\theta + 2y\sin\theta = 2r \), and \( \frac{\partial u}{\partial\theta} = -2xr\sin\theta + 2yr\cos\theta = 0 \). That fits: \(u = r^2\) does not depend on the angle.

Invariance of the first differential

A beautiful consequence: formula (1), \( df = \sum\frac{\partial f}{\partial\xi_i}d\xi_i \), remains valid even when the \(\xi_i\) are differentiable functions of new variables, as long as \(d\xi_i\) is then understood as the differential of \(\xi_i\). You can write the differential without caring whether the variables are independent.

Only the first differential This invariance does not extend to \(d^2f\) and higher. If the \(\xi_i\) are not independent, \(d\xi_i\) is no longer constant, and \(d^2f\) gets extra terms \( \sum\frac{\partial f}{\partial\xi_i}\,d^2\xi_i \). The symbolic formula for \(d^kf\) holds only for independent variables (or variables that depend linearly on independent ones).

8. Summary

ConceptFormula / statement
Partial derivative\( \frac{\partial f}{\partial\xi_i} = \lim\frac{\Delta_{\xi_i}f}{\Delta\xi_i} \): other variables held constant
Mixed derivatives\( f_{xy} = f_{yx} \) if they are continuous (Schwarz)
Differentiability\( \Delta f = \sum a_i\Delta\xi_i + o(\rho) \); guaranteed by continuous partials
Differential\( df = \sum\frac{\partial f}{\partial\xi_i}d\xi_i \), \( \Delta f \approx df \)
\(k\)-th differential\( d^kf = \big(\sum d\xi_i\frac{\partial}{\partial\xi_i}\big)^{(k)}f \) (independent variables)
Chain rule\( \frac{\partial u}{\partial\eta_k} = \sum_i\frac{\partial u}{\partial\xi_i}\frac{\partial\xi_i}{\partial\eta_k} \)
Invariance\(df\) has the same form for dependent variables; \(d^2f\) does not

9. Practice problems

Try each one before opening the solution. More solved problems from this topic are in Limits.

Problem 1: Find the first partial derivatives of \( f = e^{x/y} \).

\( f_x = \frac1y e^{x/y} \), \( f_y = -\frac{x}{y^2}e^{x/y} \).

Problem 2: Show that \( u = \ln(x^2 + y^2) \) satisfies \( u_{xx} + u_{yy} = 0 \).

\( u_x = \frac{2x}{x^2 + y^2} \), \( u_{xx} = \frac{2(y^2 - x^2)}{(x^2 + y^2)^2} \); by symmetry \( u_{yy} = \frac{2(x^2 - y^2)}{(x^2 + y^2)^2} \). The sum is \(0\). (This is Laplace's equation; its solutions are called harmonic functions.)

Problem 3: Estimate \( 1.02^{3.01} \) with the differential.

\( f = x^y \) at \((1, 3)\): \( f = 1 \), \( f_x = yx^{y-1} = 3 \), \( f_y = x^y\ln x = 0 \). So \( df = 3\cdot 0.02 + 0\cdot 0.01 = 0.06 \) and the estimate is \(1.06\). Exact: \(1.0614\).

Problem 4: Find \( d^2f \) for \( f = xy \).

\( f_{xx} = f_{yy} = 0 \), \( f_{xy} = 1 \), so \( d^2f = 2\,dx\,dy \). This is twice the corner term \( \Delta x\,\Delta y \) from Figure 1.

Problem 5: (Euler's theorem) If \( f(tx, ty) = t^kf(x, y) \) for all \(t > 0\), show that \( xf_x + yf_y = kf \).

Differentiate both sides with respect to \(t\), using the chain rule on the left: \( xf_x(tx, ty) + yf_y(tx, ty) = kt^{k-1}f(x, y) \). Now put \(t = 1\). Check with \( f = x^2 + xy \) (\(k = 2\)): \( x(2x + y) + y\cdot x = 2x^2 + 2xy = 2f \).

Problem 6: The sides of a rectangle, \(x = 6\) and \(y = 8\), increase by \(0.1\) and decrease by \(0.05\). Estimate the change in its diagonal.

\( d = \sqrt{x^2 + y^2} = 10 \), \( \Delta d \approx \frac{x\,\Delta x + y\,\Delta y}{d} = \frac{0.6 - 0.4}{10} = 0.02 \).

Final thoughts

Everything in this post grows from a single habit: change one variable at a time. Doing it once gives a partial derivative; doing it repeatedly gives higher derivatives, whose order doesn't matter when they are continuous. Adding the one-variable effects gives the differential, which is accurate exactly when the function is differentiable, so the joint effect of simultaneous changes is negligible. Following the effects through intermediate variables gives the chain rule. Together they are the toolkit for every later topic in several variables: tangent planes, extrema, and changes of variables in multiple integrals.

Related posts: limits and continuity in several variables, and the differential of a function of one variable.