# Differentiate function with respect to multiple variables?

So for functions with two or more variables, we can calculate partial derivatives and from what I know, this can only be done for one variable at a time. So for instead, if we have a function $$f(x,y) = 2x+y^3$$, we can calculate the partial derivatives $$f_x(x,y)$$ and $$f_y(x,y)$$. But is it possible to calculate the derivate of functions of multiple variables, like $$f$$, with respect to multiple variables - so for example to differentiate $$f$$ with respect to both $$x$$ and $$y$$ at once?

There are two different notions that might be like what you are looking for, but neither is really simultaneously differentiating with respect to multiple variables.

The first is that we may take the partial derivative of $$f$$ with respect to one variable, say $$x$$, and then differentiate that partial derivative with respect to another variable, say $$y$$. This is denoted $$f_{xy}$$ or $$\frac{\partial f^2}{\partial y\partial x}$$. Similarly we can have $$f_{yx}$$, $$f_{xx}$$, $$f_{yy}$$, $$f_{xyx}$$, $$\dots$$. These are known as higher order partial derivatives. The second-order partial derivatives (e.g., $$f_{xy}$$) measure how the slope of $$f$$ in a given direction changes with respect to the direction we move our base point.

Another notion is that of the total derivative of a function. This can be thought of as the best linear approximation to $$f$$ at any given point. If $$f:\mathbb{R}^n \to \mathbb{R}$$ is a function of $$n$$ real variables, then the total derivative of $$f$$ at $$\mathbf{a}$$ is given by $$\nabla f \cdot (\mathbf{x}-\mathbf{a})$$, where $$\nabla f = \langle f_{x_1},\dots,f_{x_n}\rangle$$ is the gradient of $$f$$, i.e., the vector of partial derivatives with respect to each input. This gradient records the slope of $$f$$ in all coordinate directions.

• I'd like to add some generality to this answer: A function $g:\Bbb R^n\to\Bbb R^m$ can be decomposed into $m$ "component functions" $g^1, g^2,\ldots, g^m:\Bbb R^n\to \Bbb R$. The total derivative at a point $x$ becomes a matrix containing the different partial derivatives of the different component functions called the Jacobian of $g$ at $x$. It corresponds to the linear map that best approximates $u\mapsto g(x+u) - g(x)$ for small $u$. The gradient is a special case, and the regular derivative of parametrised curves $\Bbb R\to \Bbb R^m$ is a special case too. – Arthur Sep 14 '19 at 15:32
• Thanks for the input!! But "neither is really simultaneously differentiating with respect to multiple variables" - so what would you do if you had a function f(x,y) and you wanted to find the slope of f(x,y) as x and y change? Or a function g(x,y,z) and wanted to find the slope, or the change of g, as x and z change? – That Guy Sep 14 '19 at 15:41
• @ThatGuy I would use the total derivative. This gives the best local approximation to how $f(x,y)$ changes as $x$ and $y$ both change by small amounts. – kccu Sep 14 '19 at 16:09
• Nice! And the final thing: "Or a function g(x,y,z) and wanted to find the slope, or the change of g, as x and z change?" - what about that one? You have then answered all my questions and there are no reasons not to accept your answer :)) – That Guy Sep 14 '19 at 20:21
• @ThatGuy As only $x$ and $z$ change, not $y$? Presumably then you are looking at a fixed value $y=y_0$, and you can view $g(x,y,z)$ as a function of two variables $\tilde{g}(x,z)=g(x,y_0,z)$, and apply the same techniques as for a function of two variables. – kccu Sep 15 '19 at 14:35

I think what you need is the idea of directional derivative. It includes the special cases of the partials with respect to single independent variables at one extreme, to the idea of gradient or total differential at the other extreme.

In particular, though, the type of directional derivatives you need specifically are those which always have at least one of their coordinates equal to zero -- in other words, derivatives in a direction parallel or perpendicular to a coordinate axes, plane, etc.

In general, when we take directional derivatives, these are given by a linear combination of the partials with respect to each independent variable, where the coefficients form a vector of unit length. That is, given a vector $$(a,b,c,\dots)$$ with $$\sqrt{a^2+b^2+c^2+\cdots}=1,$$ we call the combination $$af_x+bf_y+cf_z+\cdots,$$ with $$f$$ being a function of the independent variables $$(x,y,z,\dots)$$ a derivative in the direction $$(a,b,c,\dots).$$ The types you are talking about here are those for which at least one of the coordinates $$a,b,c,\dots$$ vanishes.