You are on page 1of 10

RECONSTRUCTING A FUNCTION FROM ITS GRADIENT 1

RECONSTRUCTING A FUNCTION FROM ITS


GRADIENT
This section has three parts. In Part 1 we show how to find f (x, y) given its gradient

∂f ∂f
∇f (x, y) = (x, y)i + (x, y)j.
∂x ∂y

In Part 2 we show that, although all gradients ∇f (x, y) are expressions of the form

P (x, y)i + Q(x, y)j

(set P = ∂f
∂x
and Q = ∂f∂y
), not all such expressions are gradients. In Part 3 we tackle
the problem of recognizing which expressions P (x, y)i+Q(x, y)j are actually gradients.

Part 1
Problem1. Find f given that

∇f (x, y) = y 2 i + (2xy − 1)j.

Solution. Since
∂f ∂f
∇f (x, y) = (x, y)i + (x, y)j.
∂x ∂y
we have
∂f ∂f
(x, y) = y 2 , (x, y) = 2xy − 1.
∂x ∂y
Integrating ∂f /∂x with respect to x, we have

f (x, y) = xy 2 + φ(y)

where φ(y) is independent of x but may depend on y. Differentiation with respect to


y gives
∂f
(x, y) = 2xy + φ0 (y).
∂y
The two equations for ∂f /∂y can be reconciled only by having

φ0 (y) = −1 and thus φ(y) = −y + C.

This means that


f (x, y) = x2 y − y + C.
We could have started by integrating ∂f /∂y with respect to y and then differenti-
ating with respect to x. This procedure would have yielded the same result.
Problem 2. Find f given that
  !   !
√ y x √
∇f (x, y) = y − √ + 2x i + √ − x + 1 j.
2 x 2 y

March 17, 2001


RECONSTRUCTING A FUNCTION FROM ITS GRADIENT 2

Solution. Here we have


∂f √ y ∂f x √
(x, y) = y − √ + 2x, (x, y) = √ − x + 1.
∂x 2 x ∂y 2 y
We will proceed as in the first problem. Integrating ∂f /∂x with respect to x, we have
√ √
f (x, y) = x y − xy + x2 + φ(y)
with φ(y) independent of x. Differentiation with respect to y gives
∂f x √
(x, y) = √ − x + φ0 (y).
∂y 2 y
The two equations for ∂f /∂y can be reconciled only by having
φ0 (y) = 1 and thus φ(y) = y + C.
This means that √ √
f (x, y) = x y − y x + x2 + y + C.
The function √ √
f (x, y) = x y − y x + x2 + y + C.
is the general solution of the vector differential equation
  !   !
√ y x √
∇f (x, y) = y − √ + 2x i + √ − x + 1 j.
2 x 2 y
Each particular solution can be obtained by assigning a particular value to the constant
of integration C.

Part 2
The next problem shows that not all linear combinations P (x, y)i + Q(x, y)j are gra-
dients.
Problem 3. Show that yi − xj is not a gradient.
Solution. Suppose on the contrary that it is a gradient. Then there exists a function
f such that
∇f (x, y) = yi − xj.
Obviously
∂f ∂f
(x, y) = y, (x, y) = −x
∂x ∂y
∂ 2f ∂f
(x, y) = 1, (x, y) = −1
∂y∂x ∂x∂y
and thus
∂ 2f ∂f
(x, y) 6= (x, y).
∂y∂x ∂x∂y
This contradicts the mixed partial derivative theorem: the four partial derivatives
under consideration are everywhere continuous and thus, according to the mixed partial
derivative theorem, we must have
∂ 2f ∂f
(x, y) = (x, y).
∂y∂x ∂x∂y
This contradiction shows that yi − xj is not a gradient.

Part 2 March 17, 2001


RECONSTRUCTING A FUNCTION FROM ITS GRADIENT 3

Part 3
We come now to the problem of recognizing which linear combinations

P (x, y)i + Q(x, y)j

are actually gradients. But first we need to review some ideas and establish some new
terminology.
An open set (in the plane or in three-space) is said to be connected if any two points
of the set can be joined by a polygonal path that lies entirely within the set. An open
connected set is called an open region. A curve

C : r = r(t), t ∈ [a, b]

is said to be closed if it begins and ends at the same point:

r(a) = r(b).

It is said to be simple if it does not intersect itself:

a < t1 < t2 < b implies r(t1 ) 6= r(t2 ).

As is intuitively clear, a simple closed curve in the plane separates the plane into two
disjoint open connected sets: a bounded inner region consisting of all points surrounded
by the curve and an unbounded outer region consisting of all points not surrounded by
the curve. (Jordan Curve Theorem.)
Finally, we come to the notion we need in our work with gradients:
Let Ω be an open region of the plane, and let C be an arbitrary simple closed curve.
Ω is said to be simply connected if C is in Ω implies the inner region of C is in Ω.
THEOREM Let P and Q be functions of two variables, each continuously differen-
tiable on a simply connected open region Ω. The linear combination P (x, y)i+Q(x, y)j
is a gradient on Ω if and only if
∂P ∂Q
(x, y) = (x, y)
∂y ∂x

for all (x, y) ∈ Ω.


Proof. A complete proof of this theorem is given in an advanced calculus course. We
will prove the result under the additional assumption that Ω has the form of an open
rectangle with sides parallel to the coordinate axes. Suppose that P (x, y)i + Q(x, y)j
is a gradient on this open rectangle Ω, say

∇f (x, y) = P (x, y)i + Q(x, y)j.

Since
∂f ∂f
∇f (x, y) = (x, y)i + (x, y)j.
∂x ∂y
we have
∂f ∂f
P = and Q = .
∂x ∂y

Part 3 March 17, 2001


RECONSTRUCTING A FUNCTION FROM ITS GRADIENT 4

Since P and Q have continuous first partials, f has continuous second partials. Thus,
according to the mixed partials theorem we have
∂P ∂ 2f ∂ 2f ∂Q
= = = .
∂y ∂y∂x ∂x∂y ∂x
Conversely, suppose that
∂P ∂Q
(x, y) = (x, y) for all (x, y) ∈ Ω.
∂y ∂x
We must show that P (x, y)i + Q(x, y)j is a gradient on Ω. To do this, we choose a
point (x0 , y0 ) from Ω and form the function
Z x Z y
f (x, y) = P (u, y0 ) du + Q(x, v) dv, (x, y) ∈ Ω.
x0 y0

The first integral is independent of y. Hence it follows from the fundamental theo-
rem of calculus that
’Z y “
∂f ∂
(x, y) = Q(x, v) dv = Q(x, y).
∂y ∂y y0

Differentiating f with respect to x we have


’Z x “ ’Z y “
∂f ∂ ∂
(x, y) = P (u, y0 ) du + Q(x, v) dv .
∂x ∂x x0 ∂x y0

The first term is P (x, y0 ) since once again we are differentiating with respect to the
upper limit. In the second term the variable x appears under the sign of integration.
It can be shown that, since Q and ∂Q/∂x are continuous,
’Z y “ Z y
∂ ∂
Q(x, v) dv = Q(x, v) dv.
∂x y0 y0 ∂x
Anticipating this result, we have
 Z !
∂f y ∂
(x, y) = P (x, y0 ) + Q(x, v) dv
∂x y0 ∂x
 Z !
y ∂
= P (x, y0 ) + P (x, v) dv
y0 ∂y
= P (x, y0 ) + P (x, y) − P (x, y0 ) = P (x, y).
We have now shown that
∂f ∂f
P (x, y) = (x, y) and Q(x, y) = (x, y) for all (x, y) ∈ Ω.
∂x ∂y
It follows that P (x, y)i + Q(x, y)j is the gradient of f on Ω.
Example 4. The vector functions

F (x, y) = 2x sin y i + x2 cos y j and F (x, y) = xyi + 21 (x + 1)2 y 2 j

Part 3 March 17, 2001


Double Integral over a Rectangle 5

are both everywhere defined. The first vector function is the gradient of a function
everywhere defined:
∂P ∂Q
(x, y) = 2x cos y = (x, y) for all (x, y).
∂y ∂x
The second is not a gradient:
∂P ∂Q
(x, y) = x, (x, y) = (x + 1)y 2
∂y ∂x
and so
∂P ∂Q
(x, y) =
6 (x, y).
∂y ∂x
Example 5. The vector function defined on the punctured disc 0 < x2 + y 2 < 1 by
setting
y x
F (x, y) = 2 i − j
x + y2 x2 + y 2
satisfying
∂P ∂Q
(x, y) = (x, y) on that punctured disk.
∂y ∂x
We will see later that F is not a gradient on that set. The set is not simply connected
so the theorem does not apply.

Double Integral over a Rectangle


Let f be a function continuous on the rectangle

R = [a, b] × [c, d] = {(x, y) : a ≤ x ≤ b, c ≤ y ≤ d}.

Our object is to define the double integral


ZZ
f (x, y) dxdy.
R

Recall that to define the integral Z b


f (x) dx
a

we first introduced some auxiliary notions: partition P , upper sum Uf (P ), and lower
sum Lf (P ). We were then able to define
Z b
f (x) dx
a

as the unique number I that satisfies the inequality

Lf (P ) ≤ I ≤ Uf (P ) for all partitions P of [a, b].

March 17, 2001


Double Integral over a Rectangle 6

We will follow exactly the same procedure to define the double integral
ZZ
f (x, y) dxdy.
R

First we explain what we mean by a partition of the rectangle R. To do this, we


begin with a partition
P1 : a = x0 < x1 < x2 < · · · < xm = b of [a, b]
and a partition
P2 : c = y0 < y1 < y2 < · · · < yn = d of [c, d].
The set
P = P1 × P2 = {(xi , yj ) : 0 ≤ i ≤ m, 0 ≤ j ≤ n}
is called a partition of R. P consists of all the grid points (xi , yj ).
The partition P breaks up R into m × n nonoverlapping rectangles Rij , 0 ≤ i ≤
m, 0 ≤ j ≤ n, where for each fixed i, j,
Rij = {(x, y) : xi−1 ≤ x ≤ xi , yj−1 ≤ y ≤ yj }.
On each rectangle Rij , the function f takes on a maximum value Mij , and a minimum
value mij . The sum of all the products
Mij (area of Rij ) = Mij (xi − xi−1 )(yj − yj−1 )
is called the P upper sum for f :
m X
X n m X
X n
Uf (P ) = Mij (area of Rij ) = Mij (xi − xi−1 )(yj − yj−1 ).
i=1 j=1 i=1 j=1

The sum of all the products


mij (area of Rij ) = mij (xi − xi−1 )(yj − yj−1 )
is called the P lower sum for f :
m X
X n m X
X n
Lf (P ) = mij (area of Rij ) = mij (xi − xi−1 )(yj − yj−1 ).
i=1 j=1 i=1 j=1

Example 1. Consider the function


f (x, y) = x + y − 2
on the rectangle
R = [1, 4] × [1, 3].
As a partition of [1, 4] take
P1 : 1 < 2 < 3 < 4,
and as a partition of [1, 3] take
3
P2 : 1 << 3.
2
The partition P = P1 × P2 then breaks up the initial rectangle into the six rectangles.
On each rectangle Rij , the function f takes on its maximum value Mij at the point
(xi , yj ), the corner farthest from the origin:
Mij = f (xi , yj ) = xi + yj − 2.
Thus

March 17, 2001


The Double Integral as a Volume 7

Uf (P ) = M11 (area of R11 ) +M12 (area of R12 ) + M21 (area of R21 )

+ M22 (area of R22 ) + M31 (area of R31 ) + M32 (area of R32 )


3 1 3 5 1 3 7 1 3 87
= ( ) + 3( ) + ( ) + 4( ) + ( ) + 5( ) = .
2 2 2 2 2 2 2 2 2 4
On each rectangle Rij , f takes on its minimum value mij at the point (xi−1 , yj−1 ), the
corner closest to the origin:

mij = f (xi−1 , yj−1 ) = xi−1 + yj−1 − 2.

Thus

Lf (P ) = m11 (area of R11 ) +m12 (area of R12 ) + m21 (area of R21 )


+ m22 (area of R22 ) + m31 (area of R31 ) + m32 (area of R32 )
1 1 3 1 3 3 1 5 3 33
= 0( ) + ( ) + 1( ) + ( ) + 2( ) + ( ) = .
2 2 2 2 2 2 2 2 2 4
We return now to the general situation. As in the one-variable case, it can be shown
that, if f is continuous, then there exists one and only one number I that satisfies the
inequality
Lf (P ) ≤ I ≤ Uf (P ) for all partitions P of R.
Definition of the double integral over a rectangle R
The unique number I that satisfies the inequality

Lf (P ) ≤ I ≤ Uf (P ) for all partitions P of R

is called the double integral of f over R and is denoted by


ZZ
f (x, y) dxdy.
R

The Double Integral as a Volume


If f is nonnegative on the rectangle R, the equation

z = f (x, y)

represents a surface that lies above R. In this case the double integral
ZZ
f (x, y) dxdy.
R

gives the volume of the solid that is bounded below by R and bounded above by the
surface z = f (x, y).
To see this, consider a partition P of R. P breaks up R into subrectangles Rij ; and
thus the entire solid T into parts Tij . Since Tij contains a rectangular solid with base
Rij and height mij , we must have

March 17, 2001


Some Computations 8

mij (area of Rij ) ≤ volume of Tij .

Since Tij is contained in a rectangular solid with base Rij and height Mij , we must
have

volume of Tij ≤ Mij (area of Rij ).

In short, for each pair of indices i and j, we must have

mij (area of Rij ) ≤ volume of Tij ≤ Mij (area of Rij ).

Adding up these inequalities, we are forced to conclude that

Lf (P ) ≤ volume of T ≤ Uf (P ).

Since P is arbitrary, the volume of T must be the double integral:


RR
volume of T = R f (x, y) dxdy.

The double integral ZZ ZZ


1 dxdy = dxdy
R R

gives the volume of a solid of constant height 1 erected over R. In square units this is
just the area of R: ZZ
area of R = dxdy.
R

Some Computations
Double integrals are generally computed by techniques that we will take up later. It is
possible, however, to evaluate simple double integrals directly from the definition.
Problem 2. Evaluate ZZ
α dxdy
R

where R is the rectangle [a, b] × [c, d].


Solution. Here
f (x, y) = α for all (x, y) ∈ R.
We begin with a partition

P1 : a = x0 < x1 < x2 < · · · < xm = b of [a, b]

and a partition
P2 : c = y0 < y1 < y2 < · · · < yn = d of [c, d].
This gives
P = P1 × P2 = {(xi , yj ) : 0 ≤ i ≤ m, 0 ≤ j ≤ n}

March 17, 2001


Some Computations 9

as an arbitrary partition of R. On each rectangle Rij , f has constant value α. This


gives Mij = α and mij = α throughout. Thus
X n
m X m
X n
X
Uf (P ) = α(xi − xi−1 )(yj − yj−1 ) = α (xi − xi−1 ) (yj − yj−1 )
i=1 j=1 i=1 j=1

= α(b − a)(d − c)
Similarly
Lf (P ) = α(b − a)(d − c).
Since
Lf (P ) ≤ α(b − a)(d − c) ≤ Uf (P )
and P was chosen arbitrarily, the inequality must hold for all partitions P of R. This
means that ZZ
f (x, y) dxdy = α(b − a)(d − c).
R

Remark. If α > 0, ZZ
α dxdy = α(b − a)(d − c).
R

gives the volume of the rectangular solid of constant height α erected over the rectangle
R.
Problem 3. Evaluate ZZ
(y − 2x) dxdy
R

where R = [1, 2] × [3, 5].


Solution. With with a partition

P1 : a = x0 < x1 < x2 < · · · < xm = b of [1, 2]

and a partition
P2 : c = y0 < y1 < y2 < · · · < yn = d of [3, 5]
we have
P = P1 × P2 = {(xi , yj ) : 0 ≤ i ≤ m, 0 ≤ j ≤ n}
as an arbitrary partition of R. On each rectangle Rij the function

f (x, y) = y − 2x

has a maximum

Mij = yj − 2xi−1 (x minimizes and y maximizes)

and a minimum

mij = yj−1 − 2xi . (y minimizes and x maximizes)

Thus m X
n
X
Uf (P ) = (yj − 2xi−1 )(xi − xi−1 )(yj − yj−1 )
i=1 j=1

March 17, 2001


Some Computations 10

and m X
n
X
Lf (P ) = (yj−1 − 2xi )(xi − xi−1 )(yj − yj−1 ).
i=1 j=1

For each pair of indices i and j,


1
yj−1 − 2xi ≤ (yj + yj−1 ) − (xi + xi−1 ) ≤ yj − 2xi−1 .
2
This means that for arbitrary P we have
n ”
m X
X •
1
Lf (P ) ≤ (yj + yj−1 ) − (xi + xi−1 ) (xi − xi−1 )(yj − yj−1 ) ≤ Uf (P ).
i=1 j=1 2

The middle term can be written


m X
X n Xm X n
1
(yj + yj−1 )(xi − xi−1 )(yj − yj−1 ) + −(xi + xi−1 )(xi − xi−1 )(yj − yj−1 )
i=1 j=1 2 i=1 j=1

The first double sum reduces to


m X
X n m n
1 1X X
2
(xi − xi−1 )(yj2 − yj−1
2
)= (xi − xi−1 ) (yj2 − yj−1 )
i=1 j=1 2 2 i=1 j=1

1
= (2 − 1)(25 − 9) = 8.
2
The second double sum reduces to
m X
X n m
X n
X
− (xi2 − x2i−1 )(yj − yj−1 ) = − (x2i − x2i−1 ) (yj − yj−1 )
i=1 j=1 i=1 j=1

= −(4 − 1)(5 − 3) = −6.


The sum of these two numbers
I=2
satisfies the inequality

Lf (p) ≤ 2 ≤ Uf (P ) for arbitrary P.

The integral is therefore 2: ZZ


(y − 2x) dxdy = 2.
R

Remark. This last integral should not be interpreted as a volume. The expression
y − 2x does not keep a constant sign on R = [1, 2] × [3, 5].

March 17, 2001

You might also like