Chapter 6 	Applications of the Integral

Evaluating integrals can be tedious and difficult.  Mathematica makes this work relatively easy.  For example, when computing the area of a region the corresponding integral can be difficult to set up because the limits of integration are not known.  Mathematica, with its powerful plotting capability, can turn this job into a very doable one.  We will examine several applications that demonstrate this.

6.1  Area Between Curves

Students should read Section 6.1 of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

Let us consider the problem of finding the area between two curves.

Example 6.1. Determine the area of the region bounded between the curves f(x)=sin x and g(x)=(csc^2)x on [π/4,3π/4].

Solution: To find the area here, we first plot the graphs of f and g.

Clear[f, g]

f[x_] := Sin[x]  
 g[x_] := Csc[x]^2

Plot[{f[x],g[x]}, {x, π/4, 3π/4},
PlotStyle -> {Red, Blue}, PlotRange -> {-.5, 2.5},
Filling -> {1 ->{ 2}}]

Looking at the plot above and recalling that csc x is always greater than or equal to 1 on this interval, it follows that (csc^2) x is always greater than or equal to sin x, which is less than or equal to 1 on the same interval.  Hence, calculating the area between these two curves between x=π/4 and x=3π/4 is straightforward:

(∫_(π/4)^(3π/4))(g[x] - f[x])\[DifferentialD]x

N[%]

Example 6.2. Determine the area of the region enclosed between the curves f(x)=x((x^2)-3x+3) and g(x)=(x^2).

Solution: To find the area between these two curves, we will need to see if they intersect and if so where by plotting their graphs.

Clear[f,g, x]

f[x_] := x ((x^2) - 3 x + 3)

g[x_] := (x^2)

Plot[{f[x],g[x]}, {x, -2, 4},
PlotStyle -> {Red, Blue}, PlotRange -> {-2, 11},
Filling -> {1 ->{ 2}}]

Notice that f(x) is graphed in red, while g(x) is graphed in blue.  Also, the "Filling" option in the Plot command fills in the region between the two graphs (functions 1 and 2 in the Filling command) in gray.  The bounded region between the two curves seems to lie between x=0 and x=3.  To ascertain this, we solve for the intersection points:

Solve[ f[x] == g[x], x]

Hence, the intersection points are at x =0,1, and 3.  Noting that f(x) is greater than g(x) on [0, 1] and g(x) is greater than f(x) on [1, 3], we need two integrals to calculate the (physical) area between the two curves since areas are always calculated by subtracting the smaller function from the larger one.  In particular, on [0,1] the area is given by (∫_0^1)[f(x)-g(x)]dx and on [1,3] the area is given by (∫_1^3)[g(x)-f(x)]dx.

(∫_0^1)(f[x] - g[x])\[DifferentialD]x  +  (∫_1^3)(g[x] -f[x])\[DifferentialD]x

N[%]

Example 6.3. Determine the area of the region bounded between the curves f(x)=|x| and g(x)=cos x on [-π/2,π/2].

Solution: To find the area here, we first plot the graphs of f and g.

Clear[f, g]

f[x_] := Abs[x]
g[x_] := Cos[x]

Plot[{f[x],g[x]}, {x, -π/2, π/2},
PlotStyle -> {Red, Blue}, PlotRange -> {-1, 2},
Filling -> {1 ->{ 2}}]

From the picture above, we will need to consider the total area as a sum of three separate regions.  To this end, we first find the intersection points of these two curves in order to obtain the limits of integration. Make note of the fact that the Solve command does not work here because it is only able to solve algebraic equations. Instead, we use the FindRoot command to solve the equation f(x)-g(x)=0 using an initial guess of x=0.75 (based on the plot above):

FindRoot[f[x]-g[x], {x, 0.75}]

Thus our root is approximately x=0.739085.  By symmetry we see there is another root at x=-0.739085.  Hence, the area between these two curves is the sum of the three integrals:

(∫_(-π/2)^(-0.739085))(f[x] - g[x])\[DifferentialD]x+(∫_(-0.739085)^0.739085)(g[x] - f[x])\[DifferentialD]x +(∫_0.739085^(π/2))(f[x] - g[x])\[DifferentialD]x

Hence the area of our bounded region is 2.06936.

NOTE: Observe that our region is symmetric about the y-axis and thus the same answer could have been found by computing the area of only half the region (the right half, say) and doubling the result.

Exercises

1.  Find the area between the curves y = sin x and y = sin(2x) between x=0 and x=π.

2.  Find the area between the graphs of x = sin y and x = 1 - cos y between y=0 and y=π/2.

3.  Find the area above y = 1 - x/π and below y = sin x.

6.2  Average Value

Students should read Sections 6.2 and 6.3 of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

Remember that the average value of a function f(x) on [a,b] is defined as

(Subscript[f, ave])=(1/(b-a))(∫_a^b)f(x)dx.

Related to this notion is the Mean Value Theorem for Integrals (MVTI), which states that for any continuous function f(x) on [a,b] there exists a value c∈[a,b] such that

f(c)=(Subscript[f, ave]).

Example 6.4. Let f(x)=2cos x-x.
a) Find the only positive root α of f.
b) Calculate the average value of f on [0,α].
c) Determine a value c that satisfies the Mean Value Theorem for Integrals on [0,α].

Solution: 
a) To calculate α, we first plot the graph of f and then use the FindRoot command with x=1 as our initial guess:

Clear[f]

f[x_] := 2 Cos[x] -x

Plot[f[x], {x, -π, π}]

root=FindRoot[f[x], {x, 1}]

Therefore,  α = 1.02987 accurate to 5 decimal places.

b) We next calculate the average value of f on [0,α]:

α = root[[1,2]]

fave = (1/(α-0)) (∫_0^α)f[x]\[DifferentialD]x

Thus, the average value is approximately (Subscript[f, ave])=1.14981.

c) By MVTI, there exists a value c∈[0,α] such that f(c)=(Subscript[f, ave]).  To find c, we solve this equation for c, or equivalently,

f(c)-(Subscript[f, ave])=0.

FindRoot[f[c]-fave, {c, .5}]

Exercises

1.  Which of f(x)= x (sin^2)x and g(x) = (x^2) (sin^2)x has a larger average value over [0,2]?  Over [2,4]?

2.  Let (Subscript[f, ave]) denote the average value of f(x)= (x^3) + (x^2)+ 5 on [0,4].  Find a value for c inside [0,4] such that f(c) = (Subscript[f, ave]).

6.3  Volume of Solids of Revolution

Students should read Sections 6.2-6.4 of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

We recall that a definite integral can be evaluated by employing the definition

(∫_a^b)f(x)dx=(Underscript[lim , n->+∞])[(∑_(i=1)^n)f((Subscript[x, i]^( * )))Δ (Subscript[x, i])].

Another application of the definite integral involves finding the volume of a solid of revolution, that is, a solid obtained by revolving a region in the plane about one of the coordinate axes.

6.3.1  The Method of Discs

Let S be a solid of revolution obtained by revolving the region bounded by the graphs of y=f(x), y=0, and the vertical lines x = a and x = b, about the x-axis.  To obtain the volume of S, we can approximate S by discs, i.e., cylinders obtained by revolving each rectangle, constructed by a Riemann sum of f relative to a partition P={(Subscript[x, 0]), (Subscript[x, 1]), (Subscript[x, 2]), .... , (Subscript[x, n])} of [a,b], about the x-axis.   Using the fact that the volume of a cylinder with radius R and height h is given by

V=π (R^2) h,

it follows that the volume of the ith cylinder (corresponding to the ith rectangle) is (Subscript[V, i])=((π[f((Subscript[x, i]^( * )))])^2)Δ x.  Hence, an approximation to the volume of S is given by the Riemann sum

Vol(S)≈(∑_(i=1)^n)(Subscript[V, i])=π(∑_(i=1)^n)(([f((Subscript[x, i]^( * )))])^2)Δ x.

In the limit as n->∞, we obtain the exact volume of S:

Vol(S)=π (lim_(n->∞))(∑_(i=1)^n)(([f((Subscript[x, i]^( * )))])^2)Δ x=π(∫_a^b)(([f(x)])^2)dx.

NOTE: If the region is revolved about the y-axis, then the volume of S is given by

Vol(S)=π(∫_c^d)(([f(y)])^2)dy.

Example 6.5. Find the volume of the solid of revolution obtained by rotating the region bounded by the graph of f(x)=(Sqrt[x]), the x-axis, and the vertical line x=3.

Solution: We define f(x) in Mathematica and illustrate both the region and rectangles that are rotated to obtain the solid and discs, respectively.  For this, we recall our program from Chapter 5 of this manual that was used to draw these rectangles.

LEPT[f_,{a_,b_,n_}]:=Module[
{dx, k, xstar, lrect, plot},
dx=N[(b-a)/n];
xstar=Table[a+i* dx, {i,0,n}]; 
lrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[xstar[[i]]] }, {xstar[[i+1]],f[xstar[[i]]] }, {xstar[[i+1]],0}}],{i,1,n}];
plot=Plot[f[x],{x,a,b},Filling ->Axis];
Show[plot,Graphics[{Green,lrect}]]
]

f[x_]:=(Sqrt[x])
plot=LEPT[f,{0,3,20}]

The plot above shows our region shaded in gray and our rectangles outlined in green.  We now rotate this shaded region about the x-axis to obtain a solid of revolution called a paraboloid.  This is achieved in Mathematica using the RevolutionPlot3D[{f,x},{x,a,b}] command, which generates a surface of revolution having radius f at height x.  This means that the vertical axis shown in the plot below is actually the x-axis.

S=RevolutionPlot3D[{(Sqrt[x]),x},{x,0,3}]

The exact volume of the paraboloid is then given by

V=π(∫_0^3)(((f[x]))^2)\[DifferentialD]x

6.3.2  The Method of Washers

For a solid of revolution S generated by revolving a region bounded between two curves f(x) and g(x) on [a,b] about the x-axis, we employ washers (rings) instead of discs.  Refer to your calculus textbook for a detailed treatment.  The corresponding volume of S is given by (let's assume g(x)≥f(x))

Vol(S)=π(∫_a^b){(([g(x)])^2)-(([f(x)])^2)}dx.

Example 6.6. Find the volume of the solid generated by revolving about the x-axis the region enclosed by the parabola y=(x^2)+1 and the straight line y=x+3.

Solution:   Our initial goal is to find the points of intersection and secure the limits of integration.

Clear[f,g,x]
f[x_]:=(x^2)+1
g[x_]:=x+3

Plot[{f[x],g[x]},{x,-2,4},PlotStyle->{Red,Blue},PlotRange->{-2,8},Filling->{1->{2}}]

We notice that f(x) is graphed in red, while g(x)  is graphed in blue.  The following command solves for their intersection points:

Solve[f[x]==g[x],x]

One can easily verify that the intersection points are (-1, 2) and (2, 5).  Thus, our limits of integration are x=-1 and x=2.

Let P and Q denote the solids of revolution by revolving each of the regions lying under f and g, respectively, along the interval [-1,2].  Our solid S, obtained by rotating the region between f and g on [-1,2] about the x-axis, can then be viewed as the difference of Q and P, i.e., the solid Q with the solid P removed from it.  Following are surface plots of the three solids P, Q, and S. Again, note that the vertical axis shown in each of the plots below is actually the x-axis.

P=RevolutionPlot3D[{f[x],x},{x,-1,2},AspectRatio->Automatic]
Q=RevolutionPlot3D[{g[x],x},{x,-1,2},AspectRatio->Automatic]

S=Show[P,Q]

Since the curve  y=f(x)=x+3 is lower than the curve  y=g(x)=(x^2)+1, it follows that the volume of S is given by

V=π(∫_(-1)^2)((((g[x]))^2)-(((f[x]))^2))\[DifferentialD]x

Observe that in the above discussion, the methods for calculating volumes of solids of revolution were via discs and washers.  In other words, the element of volume is obtained by taking the rectangular element of area whose height is perpendicular to the axis of revolution and revolving it to construct a disc or washer.

6.3.3  The Method of Cylindrical Shells

Students should read Section 6.4 of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

Another approach to finding the volume of a solid of revolution is to approximate it using cylindrical shells in contrast to discs (or washers).  Recall that a cylindrical shell element is one that is obtained by revolving a rectangular element of area whose height is parallel to the axis of revolution.

A cylindrical shell is by definition a solid contained between two concentric cylinders having the same axis of rotation.  Suppose a cylindrical shell has inner radius (Subscript[r, 1]), outer radius (Subscript[r, 2]), and altitude h, then its volume V is given by

V=π  (Subscript[r, 2]^( 2))h-π  (Subscript[r, 1]^( 2))h=2π h((((Subscript[r, 2])+(Subscript[r, 1]))/2))((Subscript[r, 2])-(Subscript[r, 1]))=2π (OverBar[r]) h Δ x,

where (OverBar[r])=((Subscript[r, 2])+(Subscript[r, 1]))/2 is the average radius and Δ x=(Subscript[r, 2])-(Subscript[r, 1]).

Let S denote denote the solid obtained by revolving the region bounded between a function f(x), the x-axis, x=a, and x=b, about the y-axis.  The volume of the ith shell corresponding to the ith rectangle is defined to be (Subscript[V, i])=2π (Subscript[x, i]^( * ))f((Subscript[x, i]^( * )))Δ x, where (Subscript[x, i]^( * ))=((Subscript[x, i])+(Subscript[x, i-1]))/2.  Hence, an approximation to the volume of S is given by the Riemann sum

Vol(S)≈(∑_(i=1)^n)(Subscript[V, i])=2π(∑_(i=1)^n)(Subscript[x, i]^( * ))f((Subscript[x, i]^( * )))Δ x.

In the limit as n->∞, we obtain the exact volume of S:

Vol(S)=2π (lim_(n->∞))(∑_(i=1)^n)(Subscript[x, i]^( * ))f((Subscript[x, i]^( * )))Δ x=2π(∫_a^b)x f(x)dx.

NOTE: If the region is revolved about the x-axis using cylindrical shells, then the volume of S is given by

Vol(S)=2π(∫_c^d)y f(y)dy.

Example 6.7.  Consider the region bounded by the curve y=(x^2), the x-axis, and the line x = 2.  Find the volume of the solid generated by revolving this region about the y-axis using the method of cylindrical shells.

Solution: Let us first plot the region bounded by the given curves (shaded in the plot below):

f[x_]=x^2;
Plot[f[x],{x,0,2},Filling ->Axis]

We then revolve this shaded region about the y-axis to obtain our solid S (parabolic bowl).  This can be seen in the three plots following, which illustrate S as the difference of the solids Q (cylinder) and P (paraboloid), that is, Q with P removed from it.

P=RevolutionPlot3D[{f[x]} ,{x,0,2}]
Q=RevolutionPlot3D[{{2,y}} ,{y,0,4}]

S=Show[P,Q]

The volume of S is given by

V= 2π(∫_0^2)x*f[x]\[DifferentialD]x

NOTE: The volume in this example can also be calculated using the washer method.  However, one would first have to solve the equation y=(x^2) for x, yielding  x=(Sqrt[y]).  Moreover, the limits of integration (with respect to y) would have to be determined, which in this case would be y = 0 and y = 4 corresponding to x = 0 and x = 2, respectively.  Hence,

V= π(∫_0^4)((2^2)-((((Sqrt[y])))^2))\[DifferentialD]y

The two answers from both methods agree as they should.

Example 6.8.  Sketch the ellipse  ((x^2)/(a^2))+((y^2)/(b^2))=1 and find the volume of the solid obtained by revolving the region enclosed by the ellipse about the x-axis.

Solution: We will use the ContourPlot command to plot the ellipse for a=2 and b=3.  The reader should experiment with other values of a and b.

a=2;
b=3;
ContourPlot[((x^2)/(a^2))+((y^2)/(b^2))==1, {x,-a-1,a+1}, {y, -b-1,b+1},AspectRatio->Automatic, Axes->True,Frame->False]

To plot the corresponding solid of revolution (ellipsoid), we first solve ((x^2)/(a^2))+((y^2)/(b^2))=1 for y.

Clear[a,b]
 sol=Solve[((x^2)/(a^2))+((y^2)/(b^2))==1,y]

The positive and negative solutions above correspond to the upper half and lower half, respectively, of the ellipse.  We shall consider the upper half in plotting the ellipsoid and computing its volume by defining

f(x)=(Sqrt[(b^2)-(((b^2) (x^2))/(a^2))])=b(Sqrt[1-(( (x^2))/(a^2))]).

f[x_]=sol[[2,1,2]]

Here is a plot of S (rotated 90 degrees about the x-axis).

a=2;
b=3;
RevolutionPlot3D[{f[x],x} ,{x,-a,a}]

To find the volume of the ellipsoid, we can employ either method, disc or shell, but in this case the disc method is preferable from a computational standard.  This is because the disc formula for volume contains the square term (([f(x)])^2), which lets us avoid having to deal with radical terms if the shell method were used.  Since the ellipsoid is defined along the integral [-a,a], its volume based on the disc method is therefore

V= π(∫_(-a)^a)(((f[x]))^2)\[DifferentialD]x

More generally, the volume of the ellipsoid for arbitrary positive values of a and b is given by

Clear[a,b]
V= π(∫_(-a)^a)(((f[x]))^2)\[DifferentialD]x

Thus, V=(4/3)π a (b^2).

NOTE: If we let a=b, then the ellipsoid becomes a sphere and the formula above reduces to the classic formula V=(4/3)π (a^3), where a is the radius of the sphere.

Exercises

1.  Plot the solid of revolution obtained by rotating the region enclosed by the graphs about the given axis and calculate its volume.
a)  y=(9/(x^2)), y=10-(x^2) about the x-axis
b) y=16-(x^4), y=0, x=2, x=3 about the y-axis

2.  Plot the hypocycloid (x^(2/3))+(y^(2/3))=1 and find the volume of the solid obtained by revolving the region enclosed by the hypocycloid about the y-axis. Is the volume of the solid obtained by revolving the same region about the x-axis the same?  Justify your answer.  (Hint: Use the ContourPlot command.)

3. Use the Shell Method to find the volume of the solid obtained by rotating the region enclosed by the graphs in each part below about the y-axis.
a)   y=(x^2), y=8-(x^2), and x=0
b) y=(1/2)(x^2)and y=sin((x^2))

4. The solid generated by revolving the region between the two branches of the hyperbola (y^2)-(x^2)=1 from x=-a to x=a about the x-axis is called a hyperboloid.  Find the volume of the hyperboloid for a=2 and then for any arbitrary value of a.