# MATH 251: Calculus 3, SET8

## 15: Multiple Integrals

### 15.8: Triple Integrals [in Spherical Coordinates]

These problems are done with the CAS. See Hand Solutions for details.

#### 1. [1049/4]

rectangular to spherical conversion for points
syms x y z phi rho theta
% (a)
s = sym(sqrt(3)), Px = sym(1), Py = sym(0), Pz = s
s =
Px = 1
Py = 0
Pz =
rho = norm([Px Py Pz]), phi = acos(sym(Pz/rho))
rho = 2
phi =
P_rec = [Px Py Pz], theta = atan2(Py,Px), P_sph = [rho theta phi]
P_rec =
theta = 0
P_sph =
% (b)
Px = s, Py = sym(-1), Pz = 2*s
Px =
Py =
Pz =
rho = norm([Px Py Pz]), theta = atan2(Py,Px), phi = acos(sym(Pz/rho))
rho = 4
theta =
phi =
P_rec = [Px Py Pz], P_sph = [rho theta phi]
P_rec =
P_sph =

#### 2. [1050/10]

rectangular to spherical conversion for equations
syms x y z phi rho theta
a = z == x^2 + y^2
a =
a_sph = subs(a, [x y z], [rho*sin(phi)*cos(theta) rho*sin(phi)*sin(theta) rho*cos(phi)])
a_sph =
a_sph_alt1 = simplify(a_sph)
a_sph_alt1 =
a_sph_alt2 = rho == cot(phi)*csc(phi)
a_sph_alt2 =
%
b = z == x^2 - y^2
b =
b_sph = subs(b, [x y z], [rho*sin(phi)*cos(theta) rho*sin(phi)*sin(theta) rho*cos(phi)])
b_sph =
expr_rho = simplify( solve(b_sph, rho) )
expr_rho =
non_degen_rho = rho == expr_rho(2)
non_degen_rho =

#### 3. [1050/14]

Points comprising the solid must satisfy both inequalities simultaneously. The first implies the points lie on or inside the sphere of radius 2 centered at the origin. The second implies the points must also lie inside the circular cylinder of radius 1 with axis of symmetry the z-axis. Here is a plot of this solid depicting its three boundary pieces.
syms r z phi rho theta; s = sqrt(3)
s = 1.7321
xs = 2*sin(phi)*cos(theta), ys = 2*sin(phi)*sin(theta), zs = 2*cos(phi) % sphere
xs =
ys =
zs =
xc = 1*cos(theta), yc = 1*sin(theta), zc = z % circular cylinder
xc =
yc =
zc = z
figure
fsurf(xs,ys,zs, [0 pi/6 0 2*pi], 'r', 'MeshDensity', 10); hold on
fsurf(xc,yc,zc, [0 2*pi -s s], 'y', 'MeshDensity', 14)
fsurf(xs,ys,zs, [5*pi/6 pi 0 2*pi], 'b', 'MeshDensity', 10)
axis equal; axis([-1 1 -1 1 -2 2])
xticks(-1:1); yticks(-1:1); zticks(-2:2)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1050/14'); alpha 0.4

#### 4. [1050/22]

syms r z phi rho theta
xs = 1*sin(phi)*cos(theta), ys = 1*sin(phi)*sin(theta), zs = 1*cos(phi) % sphere
xs =
ys =
zs =
xk = rho*sin(pi/3)*cos(theta), yk = rho*sin(pi/3)*sin(theta), zk = rho*cos(pi/3) % circular cone
xk =
yk =
zk =
figure
fsurf(xs,ys,zs, [0 pi/3 0 2*pi], 'r', 'MeshDensity', 14); hold on
fsurf(xk,yk,zk, [0 1 0 2*pi], 'g', 'MeshDensity', 14)
axis equal; axis([-1 1 -1 1 0 1])
xticks(-1:1); yticks(-1:1); zticks(0:1)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1050/22'); view(-40, 10)
%
y = rho*sin(phi)*sin(theta), z = rho*cos(phi), J = rho^2 * sin(phi) % y_sph, z_sph, JacFac
y =
z =
J =
% J is the spherical Jacobian factor, as we shall come to know it in 15.9.
I = int(int(int(y^2 * z^2 * J, rho, 0, 1), phi, 0, pi/3), theta, 0, 2*pi)
I =
I_appx = double(I)
I_appx = 0.0439

#### 5. [1050/26]

syms r z phi rho theta; rho1 = sym(1), rho2 = sym(2), r1 = sym(1), s = sqrt(3)
rho1 = 1
rho2 = 2
r1 = 1
s = 1.7321
xs1 = 1*sin(phi)*cos(theta), ys1 = 1*sin(phi)*sin(theta), zs1 = 1*cos(phi) % sphere 1
xs1 =
ys1 =
zs1 =
xs2 = 2*sin(phi)*cos(theta), ys2 = 2*sin(phi)*sin(theta), zs2 = 2*cos(phi) % sphere 2
xs2 =
ys2 =
zs2 =
xk = rho*sin(pi/4)*cos(theta), yk = rho*sin(pi/4)*sin(theta), zk = rho*cos(pi/4) % circular cone
xk =
yk =
zk =
figure
fsurf(xs2,ys2,zs2, [0 pi/4 0 2*pi], 'r', 'MeshDensity', 10); hold on
fsurf(xk,yk,zk, [1 2 0 2*pi], 'y', 'MeshDensity', 8)
fsurf(xs1,ys1,zs1, [0 pi/4 0 2*pi], 'b', 'MeshDensity', 10)
axis equal; axis([-2 2 -2 2 0 2])
xticks(-2:2); yticks(-2:2); zticks(0:2)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1050/26'); alpha 0.5; view(-52,26)
%
J = rho^2 * sin(phi) % JacFac
J =
I = expand( int(int(int(rho*J, rho, 1, 2), phi, 0, pi/4), theta, 0, 2*pi) )
I =
I_appx = double(I)
I_appx = 6.9011

#### 6. [1050/28]

The average value of f over a region R is given by .
• In Calculus 1, the region of integration was an interval. Hence the measure is the length of the interval.
• For a double integral in Calculus 3, the measure of a 2D region is its area.
• For a triple integral in Calculus 3, the measure of a 3D region is its volume.
syms a phi rho theta; J = rho^2 * sin(phi)
J =
I = int(int(int(rho*J, rho, 0, a), phi, 0, pi), theta, 0, 2*pi) % solid full sphere
I =
V = int(int(int(1*J, rho, 0, a), phi, 0, pi), theta, 0, 2*pi) % familiar geometrical formula
V =
avg_dist = I/V % average distance from a point in spherical ball to its center
avg_dist =

#### 7. [1050/32]

For a solid hemisphere centered at the origin with axis of symmetry the z-axis, we compute its mass m, center of mass CM, and moment of inertia . Here its density at a point is proportional to its distance from the center of the base.
syms a k phi rho theta; J = rho^2 * sin(phi), delta = k*rho, r = rho*sin(phi)
J =
delta =
r =
x = rho*sin(phi)*cos(theta), y = rho*sin(phi)*sin(theta), z = rho*cos(phi)
x =
y =
z =
m = int(int(int(delta*J, rho, 0, a), phi, 0, pi/2), theta, 0, 2*pi)
m =
CM = 1/m * int(int(int(delta*[x y z]*J, rho, 0, a), phi, 0, pi/2), theta, 0, 2*pi)
CM =
Iz = int(int(int(delta * r^2 * J, rho, 0, a), phi, 0, pi/2), theta, 0, 2*pi)
Iz =

#### 8. [1050/34]

This is similar to #7 (without ) with density at a point proportional to its distance z to the base.
syms a k phi rho theta; J = rho^2 * sin(phi)
J =
x = rho*sin(phi)*cos(theta), y = rho*sin(phi)*sin(theta), z = rho*cos(phi), delta = k*z
x =
y =
z =
delta =
m = int(int(int(delta*J, rho, 0, a), phi, 0, pi/2), theta, 0, 2*pi)
m =
CM = 1/m * int(int(int(delta*[x y z]*J, rho, 0, a), phi, 0, pi/2), theta, 0, 2*pi)
CM =

#### 9. [1050/35]

The volume and centroid (center of mass of a solid of constant density) are computed.
syms k delta phi rho theta
xs = 1*sin(phi)*cos(theta), ys = 1*sin(phi)*sin(theta), zs = 1*cos(phi) % sphere
xs =
ys =
zs =
xk = rho*sin(pi/4)*cos(theta), yk = rho*sin(pi/4)*sin(theta), zk = rho*cos(pi/4) % circular cone
xk =
yk =
zk =
figure
fsurf(xs,ys,zs, [0 pi/4 0 2*pi], 'r', 'EdgeColor', 'none'); hold on
fsurf(xk,yk,zk, [0 1 0 2*pi], 'g', 'EdgeColor', 'none')
axis equal; axis([-1 1 -1 1 0 1])
xticks(-1:0.5:1); yticks(-1:0.5:1); zticks(0:0.1:1)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1050/35'); view(0,0)
%
x = rho*sin(phi)*cos(theta), y = rho*sin(phi)*sin(theta), z = rho*cos(phi)
x =
y =
z =
delta = k, J = rho^2 * sin(phi)
delta = k
J =
V = expand( int(int(int(1*J, rho, 0, 1), phi, 0, pi/4), theta, 0, 2*pi) )
V =
m = expand( int(int(int(delta*J, rho, 0, 1), phi, 0, pi/4), theta, 0, 2*pi) )
m =
CM = simplify(1/m * int(int(int(delta * [x y z] * J, rho, 0, 1), phi, 0, pi/4), theta, 0, 2*pi))
CM =
CM_appx = double(CM)
CM_appx = 1Ã—3
0 0 0.6402
plot3(0, 0, 0.6402, 'b+', 'MarkerSize', 14); alpha 0.3

#### 10. [1051/43]

An integral is evaluated by switching to spherical coordinates. The sphere is .
Note that the sphere's center is , NOT the origin .
syms a phi rho theta
x = rho*sin(phi)*cos(theta), y = rho*sin(phi)*sin(theta), z = rho*cos(phi)
x =
y =
z =
eq = simplify(x^2 + y^2 + (z-2)^2 == 4), rhos = 4*cos(phi) % the offset sphere
eq =
rhos =
xs = rhos*sin(phi)*cos(theta), ys = rhos*sin(phi)*sin(theta), zs = rhos*cos(phi)
xs =
ys =
zs =
figure
fsurf(xs,ys,zs, [0 pi/2 0 2*pi], 'm', 'MeshDensity', 16)
axis equal; axis([-2 2 -2 2 0 4])
xticks(-2:2); yticks(-2:2); zticks(0:2:4)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1050/43')
%
f = rho^3, J = rho^2 * sin(phi)
f =
J =
I = int(int(int(f*J, rho, 0, 4*cos(phi)), phi, 0, pi/2), theta, 0, 2*pi)
I =
I_appx = double(I)
I_appx = 612.7602
%