# Line Integrals Around Closed Curves, and the Theorems of Green and Stokes

## Line Integrals Around Closed Curves

In the previous lesson, we evaluated line integrals of vector fields F along curves. We continue the study of such integrals, with particular attention to the case in which the curve is closed.

## Example 1

We begin with the planar case. That means (if we think of F as being 3-dimensional) that the last component of F is 0, and the first two components only depend on x and y, not z). Let us consider

where C is the unit circle, and F is as defined in the input cell below.

syms x y
F = [-y,x]


F =

[ -y, x]



Before we evaluate the integral, let us plot the vector field F together with the unit circle. In order to get an intelligible plot, the step size in quiver must be taken relatively large.

syms t
circ = [cos(t), sin(t)];
ezplot(circ(1), circ(2), [0, 2*pi]), hold on
[xx, yy] = meshgrid(-1.1:.2:1.1, -1.1:.2:1.1);
quiver(xx, yy, -yy, xx), axis equal; hold off


It is evident from the plot that the vector field F is, in this case, everywhere tangent to the circle in the counterclockwise direction, so that the line integral should be positive. Now let us proceed to the evaluation.

realdot = @(u, v) u*transpose(v);
int(realdot(subs(F,[x,y],circ),diff(circ,t)),t,0,2*pi)


ans =

2*pi



## Problem 1

Keeping C as the unit circle directed counterclockwise, let F2 and F3 be as defined below. Make a simultaneous plot of C with each of F2 and F3, and use it to predict what you can about

Then evaluate the integrals.

F2 = [x,y]
F3 = [ x+y, y-x]


F2 =

[ x, y]

F3 =

[ x + y, y - x]



## Green's Theorem

Green's Theorem states that if R is a plane region with boundary curve C directed counterclockwise and F = [M, N] is a vector field differentiable throughout R, then

## Example 2

With F as in Example 1, we can recover M and N as F(1) and F(2) respectively and verify Green's Theorem. We will, of course, use polar coordinates in the double integral.

syms r
integrand=diff(F(2),x)-diff(F(1),y)
polarint=r*subs(integrand,[x,y],[r*cos(t),r*sin(t)])
symint2(polarint,r,0,1,t,0,2*pi)


integrand =

2

polarint =

2*r

ans =

2*pi



## Problem 2

Verify Green's Theorem for vector fields F2 and F3 of Problem 1.

## Stokes' Theorem

Stokes' Theorem states that if S is an oriented surface with boundary curve C, and F is a vector field differentiable throughout S, then

where n (the unit normal to S) and T (the unit tangent vector to C) are chosen so that points inwards from C along S.

## Example 3

Let us perform a calculation that illustrates Stokes' Theorem. We will choose S to be the portion of the hyperbolic paraboloid z = x*y that is contained in the cylinder x^2 + y^2 = 4, oriented by the upward normal n, and we will take F4 as defined below.

syms z
F4 = [z,x,y]


F4 =

[ z, x, y]



We can parametrize S conveniently using polar coordinates.

syms r
sigma = [r*cos(t),r*sin(t),r^2*cos(t)*sin(t)]


sigma =

[ r*cos(t), r*sin(t), r^2*cos(t)*sin(t)]



This has the great advantage that we can parametrize the boundary curve by setting r to 2.

boundary=subs(sigma,r,2)


boundary =

[ 2*cos(t), 2*sin(t), 4*cos(t)*sin(t)]



Let us now evaluate both sides of Stokes' theorem in this case.

int(realdot(subs(F4,[x,y,z],boundary),diff(boundary,t)),t,0,2*pi)
ndS=simplify(cross(diff(sigma,r),diff(sigma,t)))
curlF4=curl(F4,[x,y,z])
symint2(realdot(curlF4,ndS),r,0,2,t,0,2*pi)


ans =

4*pi

ndS =

[ -r^2*sin(t), -r^2*cos(t), r]

curlF4 =

[ 1, 1, 1]

ans =

4*pi



## Problem 3

Verify Stokes' theorem for the case in which S is the portion of the upper sheet of the hyperbolic paraboloid

that lies below the plane z = 5, and F5 is as the following input cell.

F5=[-z*y,z*x,x^2+y^2]


F5 =

[ -y*z, x*z, x^2 + y^2]



## More on Green's Theorem

Let's go back to the plane case. Green's Theorem can also be interpreted in terms of two-dimensional flux integrals and the two-dimensional divergence. We recall that if C is a closed plane curve parametrized by in the counterclockwise direction then

and

where n here denotes the outward normal to C in the xy-plane. Then if F is a vector field, we have

while

It now follows from Green's Theorem that

where the divergence has essentially the same meaning in two dimensions as in three.

## Example 4

We will now take C to be the ellipse

so that R is the region inside the ellipse. We will compute

two different ways, where F5 is as defined below.

F5 = [4*x, 5*y]


F5 =

[ 4*x, 5*y]



Let us begin by plotting the ellipse and the vector field. We will use modified polar coordinates for the ellipse.

ellipse=[2*cos(t),3*sin(t)]
ezplot(ellipse(1), ellipse(2), [0, 2*pi])
hold on
[xx, yy] = meshgrid(-2.1:.3:2.1,-3.15:.3:3.15);
quiver(xx, yy, 4*xx, 5*yy)
axis equal, axis([-2.5,2.5,-3.5,3.5]), hold off


ellipse =

[ 2*cos(t), 3*sin(t)]



From the fact that all the arrows point outward across the ellipse, we expect a positive answer to our computation.

F5ell=subs(F5,[x,y],ellipse)
int(realdot([-F5ell(2),F5ell(1)],diff(ellipse,t)),t,0,2*pi)


F5ell =

[ 8*cos(t), 15*sin(t)]

ans =

54*pi



We now parametrize the region inside the ellipse by introducing a factor of r, which will run from 0 to 1. Since we are not using standard polar coordinates, we will need to compute the scale factor for integrating in this coordinate system.

region=r*ellipse
scale=det(jacobian(region,[r,t]))


region =

[ 2*r*cos(t), 3*r*sin(t)]

scale =

6*r*cos(t)^2 + 6*r*sin(t)^2



We compute the divergence of F5 exactly as though it were a three-dimensional vector field, except that we do not need to specify a third variable.

divF5=div(F5,[x,y])


divF5 =

9



Since the divergence of F5 is constant, we do not need to carry out a coordinate substitution, but can proceed with the integration.

symint2(divF5*scale,r,0,1,t,0,2*pi)


ans =

54*pi



## Problem 4

Based on your plots from Problem 1, make what predictions you can about the sign of the flux of F2 and F3 through the unit circle. Then verify Green's Theorem by computing the flux two different ways.

## The Connection with Area

A curious consequence of Green's Theorem is that the area of the region R enclosed by a simple closed curve C in the plane can be computed directly from a line integral over the curve itself, without direct reference to the interior. The reason is that if we take F = [M, N] and choose M and N so that

then

is just the area of R,

## Example 5

Let's find the area enclosed by the astroid C:

We could of course solve for y in terms of x and integrate, but that would give us a messy function that MATLAB can't integrate symbolically. So there's a better way. First we parametrize the curve, using the fact that the change of variables u = x^(1/3), |v = y^(1/3) converts the curve to a circle u^2 + v^2 = 1, which has a parametrization u = cos(t), v = sin(t), t going from 0 to 2*pi. So we can take

astroid=[cos(t)^3,sin(t)^3]


astroid =

[ cos(t)^3, sin(t)^3]



If we take F = [0, x], then so the line integral of F will be precisely the area enclosed by C. The line integral is just

So
astroidarea=int(astroid(1)*diff(astroid(2)),t,0,2*pi)


astroidarea =

(3*pi)/8



That's 3/8 of the area of a circular disk of radius 1. Here is the picture:

ezplot(astroid(1),astroid(2), [0, 2*pi]); axis equal; axis([-1,1,-1,1])


Similarly, if F is a vector field such that curl F . n = 1 on a surface S with boundary curve C, then Stokes' Theorem says that

computes the surface area of S.

## Problem 5

Let S be the spherical cap x^2 + y^2 + z^2 = 1, with z >= 1/2, so that the bounding curve of S is the circle x^2 + y^2 = 3/4, z = 1/2. Show that if

F6=[0,atan(x/sqrt(1-x^2-y^2)),0]


F6 =

[ 0, atan(x/(- x^2 - y^2 + 1)^(1/2)), 0]



then curl F . n = 1 on S, and confirm that

is equal to the surface area of S, which you can compute independently in spherical coordinates.