WeBWorK 6.1 Areas Between Curves Problem #1

First, note that this problem can be solved entirely by hand since the sketches of the two functions are ones we can do by hand. I will use Mathematica to assist so we can see some Mathematica in action. You can evaluate the input cells by moving the curser to a cell and hitting shift-enter.

The Question

Consider the area between the graphs x+3y=21 and x+7=(y^2).This area can be computed in two different ways using integrals, the first with an integration over x, or the second with an integration over y. Determine both of these formulas for the area of the region enclosed, then evaluate the integrals.

Determine Points of Intersection

If I was doing this by hand, I would start with the sketch, but I need the points of intersection to get the sketch in Mathematica, so I am doing that first.

curve1=x+3y==21;
curve2=x+7==y^2
Solve[{curve1,curve2},{x,y}]

Sketch the Region Enclosed

p1=ContourPlot[Evaluate[curve1],{x,-7,45},{y,-15,15}];
p2=ContourPlot[Evaluate[curve2],{x,-7,45},{y,-15,15}];
region=Show[p1,p2]

Integration With Respect to x

To integrate with repsect to x, we draw a small rectange that has the small width in the x-direction (this small width you could think of as the differential dx). We will use the formula

Area=(∫_a^b)((Subscript[y, T])-(Subscript[y, B]))dx

It is easy to draw the recangle when solving by hand, here I will have Mathematica draw the rectangle so I need a command to do that.

Notice I have to choose a value for Δx, the width of the rectangle, to get the animation. The hieght of the rectangle is given by (Subscript[y, T])-(Subscript[y, B]).

yT[x_]:=(Sqrt[x+7])
yB[x_]:=-(Sqrt[x+7])
Δx=0.4;
Show[region,Graphics[Rectangle[{0,yB[0]},{0+Δx,yT[0+Δx]}]]]

Aside: An Animation of the rectangle moving across the region

yT[x_]:=(Sqrt[x+7])
yB[x_]:=-(Sqrt[x+7])
Δx=0.4;
Manipulate[
Show[region,Graphics[Rectangle[{x,yB[x]},{x+Δx,yT[x+Δx]}]]]
,{x,-7,42}]

Notice the problem--the rectangle should switch to a different (Subscript[y, T]) for x ϵ (9,42). That’s easy to fix.

yT[x_]:=Piecewise[{{(Sqrt[x+7]),x<9},{(21-x)/3,x>9}}]
yB[x_]:=-(Sqrt[x+7])
Δx=0.4;

Manipulate[
Show[region,Graphics[Rectangle[{x,yB[x]},{x+Δx,yT[x+Δx]}]]]
,{x,-7,42}]

Return to the Integration over x

Now, we just write the area enclosed by the region as an integral (which is the process of adding up the area of all the rectanges and taking the number of rectangles to infinity).

Area=(∫_a^b)((Subscript[y, T])-(Subscript[y, B]))dx
=(∫_(-7)^9)((Subscript[y, T])-(Subscript[y, B]))dx+(∫_9^42)((Subscript[y, T])-(Subscript[y, B]))dx
=(∫_(-7)^9)((Sqrt[x+7])-(-(Sqrt[x+7])))dx+(∫_9^42)((21-x)/3-(-(Sqrt[x+7])))dx

=(∫_(-7)^9)(2(Sqrt[x+7]))dx+(∫_9^42)((21-x)/3+((Sqrt[x+7])))dx
=2(∫_(-7)^9)(Sqrt[x+7])dx+(1/3)(∫_9^42)(21-x))dx+(∫_9^42)(Sqrt[x+7])dx

Let’s do the integral of the square root using u-substitution.

Let u=x+7, then du = dx
∫(Sqrt[x+7])dx = ∫(Sqrt[u])du= ((u^(3/2))/(3/2))+C=(2/3)(((x+7))^(3/2))+c

Back to the integral

Area=2(Subscript[((((2/3)(((x+7))^(3/2))))^9), -7])+(1/3)(Subscript[(((21x-((x^2)/2)))^42), 9])-(Subscript[((((2/3)(((x+7))^(3/2))))^42), 9])
=(1331/6)

Let’s use Mathematica to check our result:

Integrate[2Sqrt[x+7],{x,-7,9}]+Integrate[(21-x)/3+Sqrt[x+7],{x,9,42}]

We rock.

Integration With Respect to y

To integrate with repsect to y, we draw a small rectange that has the small width in the y-direction (this small width you could think of as the differential dy). We will use the formula

Area=(∫_c^d)((Subscript[x, R])-(Subscript[x, L]))dx

xR[y_]:=21-3y
xL[y_]:=y^2-7
Δy=0.3;
Show[region,Graphics[Rectangle[{xL[0],0},{xR[0+Δy],0+Δy}]]]

Aside: An Animation of the rectangle moving across the region

Here we don’t need to bother with a piecewise definition of (Subscript[x, R]) or (Subscript[x, L]) since they do not change over the region.

Manipulate[
Show[region,Graphics[Rectangle[{xL[y],y},{xR[y+Δy],y+Δy}]]]
,{y,-7,4}]

Return to the Integration over y

Now, we just write the area enclosed by the region as an integral (which is the process of adding up the area of all the rectanges and taking the number of rectangles to infinity).

Area=(∫_c^d)((Subscript[x, R])-(Subscript[x, L]))dx
=(∫_(-7)^4)((21-3y)-((y^2)-7))dy
=(∫_(-7)^4)(28-3y-(y^2))dy
=((Subscript[(28y-3((y^2)/2)-((y^3)/3)), -7])^4)
=(28(4)-3((((4))^2)/2)-((((4))^3)/3))-(28(-7)-3((((-7))^2)/2)-((((-7))^3)/3))
=(1331/6)

Let’s use Mathematica to check our result:

Integrate[28-3y-y^2,{y,-7,4}]