# Clairaut's Theorem: Equality of Mixed Partial Derivatives

> Clairaut's theorem: if the mixed partials f_xy and f_yx are continuous, they are equal. Statement, a classic counterexample, a graph and worked examples.

Source: https://practicecalculus.com/theorems/clairauts-theorem
Updated: 2026-11-03

$$ f_{xy}(a, b) = f_{yx}(a, b) $$

## At a glance

- **Also called:** Schwarz's theorem, symmetry of second derivatives
- **Hypotheses:** $f$ is defined on a disk around $(a, b)$, and $f_{xy}$ and $f_{yx}$ are both continuous on that disk
- **Conclusion:** $f_{xy}(a, b) = f_{yx}(a, b)$
- **In practice:** Differentiate in whichever order is easier
- **Used for:** Testing whether a vector field is conservative, the Hessian matrix
- **Course:** Calculus 3

## Key takeaways

- If both mixed partials are continuous near a point, the order of differentiation does not matter there.
- Polynomials, exponentials, sines and cosines and their combinations satisfy the hypotheses wherever they are defined.
- Without continuity, the mixed partials can disagree, as the classic counterexample at the origin shows.
- Clairaut gives a quick test: a field $\langle P, Q \rangle$ with $P_y \ne Q_x$ cannot be a gradient.

**Clairaut's theorem** says that for a well-behaved function of two variables, the order in which you take mixed partial derivatives does not matter: differentiating in $x$ then $y$ gives the same result as $y$ then $x$. It is the reason a function has one Hessian matrix, not two.

## Statement of Clairaut's theorem

Suppose $f(x, y)$ is defined on an open disk $D$ that contains the point $(a, b)$. If the mixed partial derivatives $f_{xy}$ and $f_{yx}$ are both **continuous** on $D$, then

$$f_{xy}(a, b) = f_{yx}(a, b)$$

Notation: $f_{xy} = (f_x)_y$ means differentiate with respect to $x$ first, then $y$. In Leibniz form, $f_{xy} = \frac{\partial^2 f}{\partial y\,\partial x}$. The theorem extends to more variables and higher orders: with continuous partials, only the count of each variable matters.

## What Clairaut's theorem means

$f_{xy}$ measures how the $x$-slope of the surface changes as you move in the $y$ direction. $f_{yx}$ measures how the $y$-slope changes as you move in the $x$ direction. Clairaut says these two "twists" of the surface are the same number.

Take $f(x, y) = x^2 y$. Slicing the surface at fixed $y$ gives the curves $y = 1$: $x^2$, $y = 2$: $2x^2$, $y = 3$: $3x^2$.

```graph
title: 'Clairaut''s theorem: slices of f(x, y) = x²y at y = 1, 2, 3'
caption: 'At $x = 1$ the slices have $x$-slopes $2$, $4$ and $6$, so $f_x$ grows by $2$ per unit of $y$: $f_{xy}(1, y) = 2$. Computing $f_y = x^2$ first and then $f_{yx} = 2x = 2$ gives the same number.'
x: [-2, 2]
y: [-0.5, 8]
functions:
  - expr: x^2
    label: slice y = 1
  - expr: 2x^2
    label: slice y = 2
  - expr: 3x^2
    label: slice y = 3
points:
  - [1, 1, 'slope 2']
  - [1, 2, 'slope 4']
  - [1, 3, 'slope 6']
vertical:
  - {x: 1, label: 'x = 1'}
```

## Why continuity matters: the classic counterexample

Define

$$f(x, y) = \begin{cases} \dfrac{xy(x^2 - y^2)}{x^2 + y^2} & (x, y) \ne (0, 0) \\ 0 & (x, y) = (0, 0) \end{cases}$$

Along the axes, a direct computation from the limit definition gives $f_x(0, y) = -y$ and $f_y(x, 0) = x$. Therefore

$$f_{xy}(0, 0) = \frac{\partial}{\partial y}(-y) = -1, \qquad f_{yx}(0, 0) = \frac{\partial}{\partial x}(x) = 1$$

The mixed partials disagree. Clairaut's theorem is not contradicted: $f_{xy}$ and $f_{yx}$ are not continuous at the origin, so the hypothesis fails.

## Worked examples

**Example 1: verify Clairaut for $f(x, y) = x^3 y^2 + \sin(xy)$.**

**Step 1.** First partials:

$$f_x = 3x^2 y^2 + y\cos(xy), \qquad f_y = 2x^3 y + x\cos(xy)$$

**Step 2.** Differentiate $f_x$ with respect to $y$ (product rule on $y\cos(xy)$):

$$f_{xy} = 6x^2 y + \cos(xy) - xy\sin(xy)$$

**Step 3.** Differentiate $f_y$ with respect to $x$ (product rule on $x\cos(xy)$):

$$f_{yx} = 6x^2 y + \cos(xy) - xy\sin(xy)$$

They match, as Clairaut predicts for a function built from polynomials and sines.

**Example 2: choose the easier order.** Find $f_{xy}$ for $f(x, y) = y e^{x^2} + x\ln(1 + y^4)$, for any $(x, y)$.

Differentiating in $x$ first means working through the chain rule on $e^{x^2}$ and then on $\ln(1 + y^4)$. Instead use $f_{xy} = f_{yx}$:

$$f_y = e^{x^2} + \frac{4xy^3}{1 + y^4}, \qquad f_{yx} = 2xe^{x^2} + \frac{4y^3}{1 + y^4}$$

All partials are continuous everywhere, so $f_{xy} = 2xe^{x^2} + \frac{4y^3}{1 + y^4}$.

**Example 3: a conservative field test.** If $\mathbf{F} = \langle P, Q \rangle = \nabla f$, then $P = f_x$ and $Q = f_y$, so Clairaut forces $P_y = f_{xy} = f_{yx} = Q_x$.

- $\mathbf{F} = \langle 2xy,\; x^2 + 3y^2 \rangle$: $P_y = 2x = Q_x$, consistent with a gradient, and indeed $\mathbf{F} = \nabla(x^2 y + y^3)$.
- $\mathbf{F} = \langle y,\; -x \rangle$: $P_y = 1$ but $Q_x = -1$, so $\mathbf{F}$ is not the gradient of any function.

## Common mistakes

1. **Reading Leibniz notation in the wrong order.** $\frac{\partial^2 f}{\partial y\,\partial x}$ means $x$ first. When Clairaut applies the order does not matter, but in the counterexample it does.
2. **Assuming equality without continuity.** Piecewise functions defined separately at a point are where Clairaut can fail.
3. **Thinking $P_y = Q_x$ alone proves a field is conservative.** It is necessary; it is sufficient only on a simply connected region, a subtlety tied to [Green's theorem](/theorems/greens-theorem).

## Related theorems and guides

For computing partial derivatives, see [partial derivatives](/blog/partial-derivatives). Clairaut's theorem underlies the curl test for conservative fields used with [Green's theorem](/theorems/greens-theorem) and [Stokes' theorem](/theorems/stokes-theorem), and it makes the multivariable [Taylor expansion](/theorems/taylors-theorem) symmetric.

## Frequently asked questions

### What does Clairaut's theorem say?

If $f(x, y)$ is defined on a disk containing $(a, b)$ and the mixed partial derivatives $f_{xy}$ and $f_{yx}$ are both continuous on that disk, then $f_{xy}(a, b) = f_{yx}(a, b)$.

### Are mixed partial derivatives always equal?

No. They are equal when they are continuous, which covers almost every function you meet in a course. The function $f = \frac{xy(x^2 - y^2)}{x^2 + y^2}$ with $f(0, 0) = 0$ has $f_{xy}(0, 0) = -1$ but $f_{yx}(0, 0) = 1$.

### What does f_xy mean?

It means differentiate with respect to $x$ first, then with respect to $y$: $f_{xy} = (f_x)_y$. In Leibniz notation this is $\frac{\partial^2 f}{\partial y\,\partial x}$, with the variables read right to left.

### Does Clairaut's theorem work for third derivatives?

Yes. If all the partial derivatives involved are continuous, any mixed partial depends only on how many times you differentiate with respect to each variable, not the order. For example $f_{xyy} = f_{yxy} = f_{yyx}$.
