Change of Variables in Multiple Integrals
Nancy K. Stanton
based on original versions © 2000-2005 by Paul Green and Jonathan Rosenberg, modified with permission
Contents
Changing Variables in Double Integrals
In this lesson, we will learn to evaluate integrals using a suitable change of variables. For our first example, we will consider
where R is the region in the first quadrant bounded by the circles and , and the parabolae and . Let's begin by drawing a picture of the region R.
syms x y ezplot(x^2+y^2-1, [0, 2, 0, 2]); hold on; ezplot(x^2+y^2-4, [0, 2, 0, 2]); ezplot(x^2,[0,2]); ezplot(3*x^2,[0,2]); axis equal; axis([0,2,0,2]); title('region bounded by two circles and two parabolae'); hold off
While the region R is clearly visible in the problem, we also see why it's so difficult to do the integration in rectangular coordinates: regardless of what order of integration we choose, we will have to split the region into pieces, and the limits of integration will look quite different in each. This suggests that a much better approach is to change variables. We convert the region of integration to a rectangle in the -plane, by setting and . (This is not the only reasonable choice of a new coordinate system, but it's one that is easily suggested by the equations of the bounding curves.) In order to formulate the integral, we must first solve for and in terms of and .
syms u v [xfun,yfun]=solve(x^2+y^2-u, y-x^2*v,x,y); [xfun,yfun]
ans = [ (((4*u*v^2 + 1)^(1/2) - 1)/(2*v^2))^(1/2), ((4*u*v^2 + 1)^(1/2) - 1)/(2*v)] [ (-((4*u*v^2 + 1)^(1/2) + 1)/(2*v^2))^(1/2), -((4*u*v^2 + 1)^(1/2) + 1)/(2*v)] [ -(-1/2/v^2*((4*u*v^2 + 1)^(1/2) + 1))^(1/2), -((4*u*v^2 + 1)^(1/2) + 1)/(2*v)] [ -(1/2/v^2*((4*u*v^2 + 1)^(1/2) - 1))^(1/2), ((4*u*v^2 + 1)^(1/2) - 1)/(2*v)]
We are given our choice of four solutions. To choose the correct one, we observe that since is going to run from 1 to 4, and from 1 to 3, we should obtain values of and in the first quadrant when, for instance, .
subs([xfun,yfun],[u,v],[2,2])
ans = 0.7701 1.1861 0.0000 + 0.9182i -1.6861 -0.0000 - 0.9182i -1.6861 -0.7701 1.1861
Only the first solution satisfies our requirement. Accordingly, we set
changevar=[xfun(1),yfun(1)]
changevar = [ (((4*u*v^2 + 1)^(1/2) - 1)/(2*v^2))^(1/2), ((4*u*v^2 + 1)^(1/2) - 1)/(2*v)]
Next, we must compute the determinant that is called the Jacobian in your text. Unfortunately, there is a clash of notation between MATLAB and Stewart. The jacobian function in MATLAB returns the actual matrix of partial derivatives. The integrating factor we want is the absolute value of the determinant of that matrix. Since MATLAB sometimes has trouble simplifying expressions involving absolute values, we suggest that you first compute just the determinant, and then change the sign if necessary (if the determinant turns out to be negative). To figure out whether the factor goes in the numerator or denominator, it's convenient to remember what happens with functions of one variable, where gets transformed to
Similarly, in converting from to , we can either multiply by the absolute value of the determinant of the matrix of partials of and with respect to and , or else by the reciprocal of the absolute value of the determinant of the matrix of partials of and with respect to and .
intfactor=det(jacobian(changevar))
intfactor = ((4*u*v^2 + 1)^(1/2) - 1)/(4*v^2*(4*u*v^2 + 1)^(1/2)*(((4*u*v^2 + 1)^(1/2) - 1)/(2*v^2))^(1/2))
As a test of the sign:
subs(intfactor,[u,v],[2,2])
ans = 0.0670
Since this is positive, we don't need to insert a minus sign. We can now proceed to evaluate the integral, in this case either symbolically or numerically. We shall do both and compare the answers.
symbans=symint2(changevar(1)*changevar(2)*intfactor,u,1,4,v,1,3) numans=numint2(changevar(1)*changevar(2)*intfactor,u,1,4,v,1,3) double(symbans-numans)
Warning: Explicit integral could not be found. symbans = (17*17^(1/2))/48 - (5*5^(1/2))/48 + (37*37^(1/2))/3888 - (145*145^(1/2))/3888 - 1/3 numans = 0.5028 ans = 2.0071e-08
We see that the answers agree to seven decimal places.
Here is another way to do this problem: we can change to polar coordinates. This changes the equations of the circles and to the much simpler forms , . Thus we should be able to do the integration in polar coordinates with the -integral on the outside. We still have to solve for theta in the equations of the parabolae.
syms r theta firstparab = solve(subs(y-x^2,[x,y],[r*cos(theta),r*sin(theta)]),theta)
firstparab = pi + asin(((4*r^2 + 1)^(1/2) + 1)/(2*r)) -asin(1/2/r*((4*r^2 + 1)^(1/2) + 1)) pi - asin(1/2/r*((4*r^2 + 1)^(1/2) - 1)) asin(((4*r^2 + 1)^(1/2) - 1)/(2*r))
Again, we can see which solution is correct by evaluating at, say, .
double(subs(firstparab,r,1.5))
ans = 4.7124 - 0.8541i -1.5708 + 0.8541i 2.3367 0.8049
Since we want to be in the first quadrant (where theta runs from 0 to ), the last solution is the correct one.
Now we do the same with the second parabola.
secparab = solve(subs(y-3*x^2,[x,y], ...
[r*cos(theta),r*sin(theta)]),theta)
double(subs(secparab,r,1.5))
secparab = pi + asin(((36*r^2 + 1)^(1/2) + 1)/(6*r)) -asin(1/6/r*((36*r^2 + 1)^(1/2) + 1)) pi - asin(1/6/r*((36*r^2 + 1)^(1/2) - 1)) asin(((36*r^2 + 1)^(1/2) - 1)/(6*r)) ans = 4.7124 - 0.4797i -1.5708 + 0.4797i 2.0331 1.1085
Again we want the last solution.
Also we see that the first parabola gives the lower limit of integration. Since there is an extra factor of when we integrate in polar coordinates, the integral becomes:
symint2(r*cos(theta)*r*sin(theta)*r,...
theta,firstparab(4),secparab(4),r,1,2)
double(ans)
ans = (17*17^(1/2))/48 - (5*5^(1/2))/48 + (37*37^(1/2))/3888 - (145*145^(1/2))/3888 - 1/3 ans = 0.5028
This is the same answer we obtained before in the coordinate system.
Problem 1
Use a suitable change of variables to evaluate the integral
where R is the region in the first quadrant bounded by the ellipses and , and the hyperbolae and .
Changing Variables in Triple Integrals
We will now illustrate a three dimensional change of variables by integrating over a portion of the region inside the hyperboloid of one sheet . We will compute the volume of the region inside the hyperboloid for between -4 and 4. We begin by recalling that the hyperboloid itself can be parametrized by
syms s t z hyp=[cosh(s)*cos(t)*sqrt(6),cosh(s)*sin(t)*sqrt(3),sinh(s)*sqrt(2)]
hyp = [ 6^(1/2)*cosh(s)*cos(t), 3^(1/2)*cosh(s)*sin(t), 2^(1/2)*sinh(s)]
Just as a check that we've done this right:
simplify(subs(x^2+2*y^2-3*z^2,[x,y,z],hyp))
ans = 6
Next, to parametrize the solid region inside the hyperboloid, we introduce a factor, which we call r, into the x and y coordinates. (Caution: this is not the same as the r in cylindrical coordinates, though it plays a similar role.) If we let r run from 0 to 1, this parametrizes the solid region.
syms r
hypsol = [r,r,1].*hyp
hypsol = [ 6^(1/2)*r*cosh(s)*cos(t), 3^(1/2)*r*cosh(s)*sin(t), 2^(1/2)*sinh(s)]
Note the convenient use here of MATLAB's vector routines: .* computes the element-by-element product of two vectors. Now we have to compute the integrating factor, determine the limits of integration, and evaluate the volume of the solid.
intfac=simplify(det(jacobian(hypsol)))
intfac = (-6)*r*cosh(s)^3
Since this came out negative, we will have to cancel out the minus sign. The limits for , as we have already observed, are 0 and 1. The limits for are 0 and , and since the limits for are 4 and -4, the limits for are:
slim1=solve(hyp(3)+4); slim2=solve(hyp(3)-4); [slim1,slim2] hypvol=int(int(int(-intfac,s,slim1,slim2),t,0,2*pi),r,0,1)
ans = [ -asinh(2*2^(1/2)), asinh(2*2^(1/2))] hypvol = 88*pi*2^(1/2)
The numerical value is:
double(hypvol)
ans = 390.9737
If instead of the volume, which is equivalent to the integral of the function 1, we wished to compute the integral of a function such as over the same solid region, we must express it in terms of the new variables and include it as a factor in the integrand.
zsqfun=subs(z^2,[x,y,z],hypsol)
double(int(int(int(-intfac*zsqfun,s,slim1,slim2),...
t,0,2*pi),r,0,1))
zsqfun = 2*sinh(s)^2 ans = 3.2984e+03
Simplification
Sometime simplify doesn't work well. If that happens, you can also try the more elaborate simplification command simple. If that doesn't work well, you can try using expand first, followed by simplify or simple.
Problem 2
Use a suitable three-dimensional change of variables to integrate the function
over the solid region between the upper sheet of the hyperboloid
and the plane .
Additional Problems
1. Use a suitable change of variables to evaluate
where R is the region in the first quadrant bounded by the lines , , and the hyperbolae and .
2. In parametrizing the solid region inside a hyperboloid of one sheet, we started with a parametrization of the hyperboloid and introduced , with limits of 0 and 1, as a factor of the first two coordinates, in order to parametrize the solid region.
(a) Verify that we would obtain the same answer for both the volume and the integral of if we made r a factor only of the first coordinate.
(b) Determine what would happen if we made a factor of the third coordinate.
(c) Explain geometrically what you have demonstrated in parts (a) and (b).
3. Parametrize the tube of radius .5 around the trefoil parametrized by the input cell below. Refer to the MATLAB assignment on curves for details. Extend your parametrization to a solid tube by multiplying the terms involving the normal and binormal by a radial parameter.
trefoil=[(2+cos(3*t))*cos(2*t),(2+cos(3*t))*sin(2*t),cos(3*t)]
trefoil = [ cos(2*t)*(cos(3*t) + 2), sin(2*t)*(cos(3*t) + 2), cos(3*t)]
(a) Compute the volume of the tube. Compare your answer with the product of the length of the trefoil with the area of a typical normal disk. Do you think that what you observe is a coincidence? Explain.
(b) Integrate the square of the radial coordinate over the tube.
4. For the change of variables , , , compute the determinant of the Jacobian matrix of and with respect to and and also the inverse transformation and the determinant of the Jacobian matrix of and with respect to and . Verify that the determinants of the Jacobian matrices are inverses of one another. (Recall: The determinant of the Jacobian matrix is what Stewart calls the Jacobian.)
5. (just for fun) This problem comes from the article "Sums of generalized harmonic series and volumes" by F. Beukers, J. Kolk, and E. Calabi, Nieuw Arch. Wisk. (4) 11 (1993), no. 3, 217-224. Show that the change of variables , , maps the triangle R bounded by the and axes and the line to the square bounded by the and axes and the lines and . Compute the Jacobian of the transformation and deduce that