# Total derivatives explanation

If you have a function with multiple variables, lets say $f(x,y)$, then the total derivative for small changes would be $$\Delta f = f_x\Delta x + f_y \Delta y$$ And because of that we can assume that change is linear. But if I imagine a point in space and then move a small amout from that point in x direction and then a small ammount in y direction, wouldn't the correct $\Delta f$ be: $$\Delta f = \sqrt{(f_x \Delta x)^2+(f_y \Delta y)^2}$$

It is important to realise that the result of $f$ is a number, not a point in the plane. Each point $(x,y)$ in the plane has associated with it a number called $f(x,y)$. When we talk about $\Delta f$ we are talking about how this number changes. That is, moving from one point to another will change the value of this number and we want to know how much it changes.

If you move from $(x,y)$ to $(x+\Delta x, y + \Delta y)$ you can do it in two steps: from $(x,y)$ to $(x+\Delta x, y)$ and then from $(x+\Delta x,y)$ to $(x+\Delta x,y+\Delta y)$. The change in $f$ associated with the first step is $f_x \Delta x$. This is because $f_x$ represents how much $f$ changes relative to $x$ when $y$ remains constant. Similarly the change in $f$ associated with the second step is $f_y \Delta y$. So the total change in $f$ is $f_x \Delta x + f_y \Delta y$.

If you think about moving directly from $(x,y)$ to $(x+\Delta x, y + \Delta y)$ then the distance you have moved is $\sqrt{(\Delta x)^2 + (\Delta y)^2}$, so you would expect that $\Delta f$ would be equal to $\text{(something)}\times \sqrt{(\Delta x)^2 + (\Delta y)^2}$. This "something" would be the directional derivative in that specific direction, which is not nearly so simple!

The reason we do the two-step version is that we imagine the function to be approximately linear very close to the point $(x,y)$ so it's ok to do it one step at a time.

$f$ itself is a function $\mathbb{R}^2 \rightarrow \mathbb{R}$, not $X \rightarrow \mathbb{R}^2$. So linear addition of the differentials is the logical procedure. In other words, $f_x\Delta x$ and $f_y\Delta y$ are not changes in orthogonal directions, but moves along the same direction.

Your first displayed equation is (almost) the increment of $z$: $$\Delta z = f_x\,\Delta x + f_y\,\Delta y + \varepsilon_1\,\Delta x + \varepsilon_2 \,\Delta y$$ where $\varepsilon_1\to 0$ as $\Delta x\to 0$ and $\varepsilon_2\to 0$ as $\Delta y \to 0$. The total differential of $z$ is $$dz = f_x\,dx + f_y\,dy$$ which approximates the actual change in $z$ by adding the changes in $f$ that occured by changing $x$ and $y$ and scaling these changes by $f_x$ and $f_y$, respectively. Again, this is an approximation to $\Delta z$, the actual change in $z$ by changing $x$ and $y$.

As a counterexample to your claim, consider $f(x,y) = x^3+y^3$ at $(0,0)$. Note that $f(0,0) = 0$ and $f(0.1,0.1) = 0.002$ so that $\Delta f = 0.002$. Now compute $\sqrt{[f_x(0,0)(0.1)]^2 + [f_y(0,0)(0.1)]^2}$.

Another look at this:

The vector $\nabla f = (f_x,f_y)$ (the gradient) is a vector that, when dotted with a direction, tells you the rate of change of the function in that direction. In other words,

$$f_\vec{e}=(\nabla f)\cdot\vec{e}$$

So, if you move perpendicular to the gradient, the change is zero, and if you move along the gradient, you get the maximum possible change. The above can be written with a differential move along some direction: $$df=(f_x,f_y)\cdot(dx,dy)$$

As others pointed out, you move in two dimensions, but the function is a scalar and has a scalar change. However, if you want to extract the maximum derivative (the magnitude of the gradient), you set $$\vec{e}=\frac{\nabla f}{|\nabla f|}$$ and of course you get $$(\nabla f)\cdot\frac{\nabla f}{|\nabla f |}=$$ $$\frac{(\nabla f)\cdot(\nabla f)}{\sqrt{(\nabla f)\cdot(\nabla f)}}=\sqrt{f_x^2+f_y^2}$$

The gradient is a vector and its magnitude follows the pythagorean theorem. The total differential is a scalar product of this vector with the displacement.