Total Differential and Gradient

Let f ( x , y ) be a function of two variables. Suppose the first variable x is changed by an amount d x and the second by an amount d y . The value of the function at the new point is then f ( x + d x , y + d y ) . The amount that the value of the function has changed is

f ( x + d x , y + d y ) f ( x , y )

This expression is a function of the four variables x , y , d x , d y . It is called the total differential of f ( x , y ) , and is written simply as d f :

d f = f ( x + d x , y + d y ) f ( x , y )

Often the total differential is discussed in terms of "infinitesimals", this term referring to d x and d y . However, no adequate definition of an infinitesimal is ever given. The only way we can work with d x and d y is to let these quantities be numbers, which is what we do. It is also commonly written that

d f = f x d x + f y d y ,

where f x and f y refer to f x ( x , y ) and f y ( x , y ) . We shall see that this is really only an approximate formula, and we shall obtain some idea of the error in its application. There is no objection to the use of the formula, provided one interprets it in this sense.

Now let us reconsider the total differential. To begin with, we write d f = f ( x + d x , y + d y ) f ( x , y ) as

f ( x + d x , y + d y ) f ( x + d x , y ) + f ( x + d x , y ) f ( x , y )

Then we apply the mean value theorem to get

d f = f y ( x + d x , η ) d y + f x ( ξ , y ) d x ,

where ξ is between x and x + d x and η is between y and y + d y . We assume that f x and f y are continuous. Then

f y ( x + d x , η ) f y ( x , y ) = α ( d x , d y ) ,

where α ( d x , d y ) goes to zero as d x 2 + d y 2 goes to zero (since ( x + d x , η ) is in the rectangle with vertices ( x , y ) , ( x + d x , y ) , ( x + d x , y + d y ) , ( x , y + d y ) , and so approaches ( x , y ) as d x 2 + d y 2 , the diagonal of the rectangle, approaches 0 ). Likewise,

f x ( ξ , y ) f x ( x , y ) = β ( d x , d y )

approaches 0 as d x 2 + d y 2 approaches 0 . Our formula now becomes

d f = f x ( x , y ) d x + f y ( x , y ) d y + β ( d x , d y ) d x + α ( d x , d y ) d y

Now if ϵ > 0 is any small positive number, we can choose d x and d y so that d x 2 + d y 2 is so small that | α ( d x , d y ) | < ϵ and | β ( d x , d y ) | < ϵ , for this is just the meaning of the statement that these quantities go to zero as d x 2 + d y 2 goes to zero. Then we have

\begin{aligned} |\alpha(dx, dy) dy + \beta(dx, dy) dx| &\le |\alpha(dx, dy)| |dy| + |\beta(dx, dy)| |dx| \\ &< \epsilon |dy| + \epsilon |dx| = \epsilon (|dx| + |dy|) \cdot \end{aligned}

Now | d x | + | d y | 2 d x 2 + d y 2 , so that when d x and d y are chosen small enough, the error in using f x ( x , y ) d x + f y ( x , y ) d y to approximate the total differential is such that

error d x 2 + d y 2 < 2 ϵ d x 2 + d y 2 d x 2 + d y 2 = 2 ϵ

In other words,

error d x 2 + d y 2 0 as  d x 2 + d y 2 0

This is exactly what we shall mean when we say, "The error is small when compared to d x 2 + d y 2 ". Thus our result is the following:

d f = f x ( x , y ) d x + f y ( x , y ) d y ,

with an error which is small when compared to d x 2 + d y 2 . This is then the sense in which the formula is correctly interpreted.

The expression f x d x + f y d y which occurs in the above formula can be expressed in vector notation as the scalar product

( f x , f y ) ( d x , d y )

There is little reason to do this in two dimensions. However, we can define the total differential of a function f ( x 1 , x 2 , , x n ) of n variables as the quantity

f ( x 1 + d x 1 , x 2 + d x 2 , , x n + d x n ) f ( x 1 , x 2 , , x n ) ,

a function of 2 n variables, and prove as above that

d f = ( f x 1 , f x 2 , , f x n ) ( d x 1 , d x 2 , , d x n ) + error

where the error is small compared to

d x 1 2 + d x 2 2 + + d x n 2

We denote the vector ( d x 1 , d x 2 , , d x n ) by d X , and we denote the vector ( f x 1 , f x 2 , , f x n ) by grad f (called "the gradient of 𝒇 "). In this notation, we have

d f = ( grad  f ) d X + error ,

where the error is small compared to | d X | .

Now, for a change, let f ( x , y , z ) be a function of three variables, and let each of these be a function x ( t ) , y ( t ) , z ( t ) of a single variable t . Then g ( t ) = f ( x ( t ) , y ( t ) , z ( t ) ) is a function of t , and we can investigate g'(t). To do so, we must consider

g ( t + h ) g ( t ) h = f ( x ( t + h ) , y ( t + h ) , z ( t + h ) ) f ( x ( t ) , y ( t ) , z ( t ) ) h

Now let d x = x ( t + h ) x ( t ) , d y = y ( t + h ) y ( t ) , d z = z ( t + h ) z ( t ) ; then we have

g ( t + h ) g ( t ) h = d f h = ( grad  f ) d X h + error h .

Now

1 h d X = ( x ( t + h ) x ( t ) h , y ( t + h ) y ( t ) h , z ( t + h ) z ( t ) h ) ,

so that

\lim_{h \to 0} (\text{grad } f) \cdot \frac{dX}{h} = (\text{grad } f) \cdot X'(t) \cdot

The error term is of the form α d x + β d y + γ d z , where α , β and γ go to zero as | d X | goes to zero. As h 0 , | d X | 0 , since x ( t ) , y ( t ) , z ( t ) are assumed continuous. Thus

\begin{array}{r cl c cl c cl} \dfrac{\text{error}}{h} = & \alpha & \dfrac{dx}{h} & + & \beta & \dfrac{dy}{h} & + & \gamma & \dfrac{dz}{h} \\ & \big\downarrow &\ \big\downarrow & & \big \downarrow &\ \big\downarrow & & \big\downarrow &\ \big\downarrow \\ & 0 & x'(t) & & 0 & y'(t) & & 0 & z'(t) \end{array}

as indicated by the vertical arrows.

Substituting for g ( t ) , we have the formula

\frac{d}{dt} (f(x(t), y(t), z(t))) = (\text{grad } f) \cdot X'(t) ,

which is the 3-variable case of the chain rule for functions of several variables. (In the case of f ( x ( t ) ) , it becomes simply f'(x) \cdot x'(t), as we have seen before.)

EXERCISES

Exercise 1.

Let f ( x , y ) be a function of two variables. Suppose there exists a positive number M such that in some neighborhood of ( x 0 , y 0 ) , f x and f y exist and | f x ( x , y ) | < M , | f y ( x , y ) | < M for all ( x , y ) . By considering the total differential, prove that f ( x , y ) is continuous at ( x 0 , y 0 ) . Then use this result to prove that if f x and f y are continuous at ( x 0 , y 0 ) , f ( x , y ) is also continuous there.