Total differential (source code)

= Total differential
{title2=$df$}

The <total differential> is the <linear map> that combines the first-order responses to simultaneous changes in all coordinates. For a <differentiable> real-valued <function> at $a$, it can be written
$$
df_a(h)=\sum_{j=1}^n\partial_j f(a)\,h_j
=\nabla f(a)\cdot h,\qquad
df=\sum_{j=1}^n\frac{\partial f}{\partial x_j}\,dx_j.
$$
Here $h$ is an input <vector>; $dx_j$ denotes the coordinate <linear functional> $h\mapsto h_j$. The coordinate formula and the <Fréchet derivative> describe the same <linear map>. The defining approximation is
$$
f(a+h)-f(a)=df_a(h)+o(\|h\|)\qquad(h\to0).
$$
The <little o notation> says the remaining <approximation error> becomes small relative to the input <norm>, across every direction of approach.<Calculus Volume 3 by Gilbert Strang and others/4.4 Tangent Planes and Linear Approximations>[Calculus Volume 3, §4.4, differentiability definition (4.26) and total differential (4.27)]{ref}

For $f=x^2+xy+2y^2$ at $a=(1,1)$, \b[$df_a(h,k)=3h+5k$]. A simultaneous change $(h,k)=(0.02,-0.01)$ gives the <linear approximation>
$$
\Delta f\approx3(0.02)+5(-0.01)=\boxed{0.01}.
$$
The exact algebra is
$$
f(1+h,1+k)-4=3h+5k+h^2+hk+2k^2.
$$
Consequently the exact change is $0.0104$, and the <approximation error> is $0.0004$. If both input changes are halved, the linear prediction becomes $0.005$ and the error becomes $0.0001$: the first-order response halves, while the quadratic error falls by a factor of four. The right panel under <directional derivative> displays this comparison as the displacement is scaled.

For a quick check of <differentiability>, $|hk|\leq(h^2+k^2)/2$ gives
$$
|h^2+hk+2k^2|\leq\frac52(h^2+k^2).
$$
Dividing by $\sqrt{h^2+k^2}$ makes this bound tend to zero. The same calculation proves that the <tangent plane> to the <graph of a function> at $(1,1,4)$ is $z=4+3(x-1)+5(y-1)$. It approximates the entire local surface, rather than only two coordinate slices.

The <total differential> is useful for estimating the combined effect of small input changes without reevaluating a complicated <function>. For example, if $|h|\leq0.02$ and $|k|\leq0.01$, then $|df_a(h,k)|\leq0.11$. The exact remainder bound from the displayed <polynomial> is at most $0.0008$, so this example has $|\Delta f|\leq0.1108$ throughout that input <rectangle>. These are deterministic bounds; a <variance> calculation additionally needs a <joint probability distribution> and its <covariances>. A first-order estimate is also local: large changes require control of the remainder, not merely knowledge of the <partial derivatives> at one point.