How fast does $f(x, y)$ change? It depends on which way you move. The simplest choice is to move in the $x$-direction only, keeping $y$ fixed, or in the $y$-direction only. Each choice turns $f$ into a function of one variable, and you already know how to differentiate those, including with the chain rule.
🔑 Key idea
$$f_x(a, b) = \lim_{h \to 0} \frac{f(a + h, b) - f(a, b)}{h}, \qquad f_y(a, b) = \lim_{h \to 0} \frac{f(a, b + h) - f(a, b)}{h}.$$
To compute $f_x$, treat $y$ as a constant and differentiate with respect to $x$; for $f_y$, treat $x$ as a constant. Other notations: $\frac{\partial f}{\partial x}$, $\frac{\partial z}{\partial x}$.
💡 Why it works
Fix $y = b$. Then $g(x) = f(x, b)$ is an ordinary function, and its graph is the curve where the vertical plane $y = b$ cuts the surface (the trace). The definition of $f_x(a, b)$ is exactly the definition of $g'(a)$. So $f_x(a, b)$ is the slope of that trace, rise in $z$ per unit step in $x$. Every rule from one-variable calculus applies, because during the computation $y$ really is just a number.
The orange curve is the trace in the plane $y = b$; its tangent line has slope $f_x$. The purple trace lies in $x = a$, with slope $f_y$. Move the point with the sliders and watch both slopes in the readout.
Worked examples
✏️ Worked example: A polynomial
Find $f_x$ and $f_y$ for $f(x, y) = x^3y^2 + 4xy - 5y$.
$f_x$: $y$ is a constant. $\frac{\partial}{\partial x}(x^3y^2) = 3x^2y^2$, $\frac{\partial}{\partial x}(4xy) = 4y$, and $-5y$ has no $x$, so its derivative is ${}0$.
$f_y$: $x$ is a constant. $\frac{\partial}{\partial y}(x^3y^2) = 2x^3y$, $\frac{\partial}{\partial y}(4xy) = 4x$, $\frac{\partial}{\partial y}(-5y) = -5$.
Find $f_x$ and $f_y$ for $f(x, y) = e^{xy} + x\sin y$.
$f_x$: the derivative of $e^{xy}$ with respect to $x$ is $e^{xy} \cdot y$ (the inside $xy$ has $x$-derivative $y$). $\frac{\partial}{\partial x}(x\sin y) = \sin y$.
For $f(x, y) = 4 - x^2 - 2y^2$, find the slopes of the surface at $(1, 1)$ in the $x$- and $y$-directions.
$f_x = -2x$, so $f_x(1, 1) = -2$: stepping east, the surface drops 2 units per unit.
$f_y = -4y$, so $f_y(1, 1) = -4$: stepping north, it drops twice as fast.
Answer: $-2$ and $-4$
Three variables work the same way: for $f(x, y, z) = xy^2z^3$, $f_z = 3xy^2z^2$, holding both $x$ and $y$ constant.
⚠️ Common mistake
Differentiating the other variable too. When computing $\frac{\partial}{\partial x}(x^2y^3)$, the factor $y^3$ is a constant multiplier, so the answer is ${}2xy^3$, not ${}2x \cdot 3y^2$. And a term with no $x$ at all, like $-5y$, is a constant whose $x$-derivative is ${}0$. Check: replace $y$ by a number like ${}2$ in the original, differentiate the one-variable function, and compare.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 1 XP.