A nice example of setting up integrals in cylindrical coordinates:
Find the mass of a 2 meter diameter, 4 meter long cylinder with rounded out ends, if the ends are rounded out in the shape of spheres of diameter 2 meters and the density of the cylinder is equal to 5 minus the distance along its length (in kg/m3).
Let's think about the cylinder on end, as shown in figure 1 to the right. This is reproduced in figure 2 below that, with the sides of the cylinder rendered only as wireframes so that the spherical missing parts at either end are easier to see.
How can we describe this region? The outside of the cylinder is obviously given by a circle of radius one, or
The top and bottom of the region are given by spheres of radius one centered at the origin (0,0,0) and a point 4 meters up the z axis, (0,0,4). But this isn't that hard -- we know the equation of a sphere of radius r centered at the point (x0,y0,z0) is just
So the spheres at the top and bottom of the cylinder are just
respectively. Solving for z in either case, and noticing that the for the top sphere we need the bottom half of the sphere, and so take the negative sign when taking the square root, we get
Now, setting up the integral is straightforward. Let's pick our outer variables in the triple integral to be r and theta. To determine the limits on these variables, we look at the projection of the figure into the xy-plane, which is just a circle of radius one. So the limits on r and theta are just 0 <= r <= 1 and 0 <= theta <= 2 pi.
Then to determine the limits for the innermost integral, z, we look at each point (r, theta) and determine what range of values for z we are interested in. In this case, for any (r, theta) the smallest value of z that we want to consider is one that is on the bottom sphere. Then we want to consider all values of z between this and the top sphere. So the limits on z are
where x2 + y2 is of course equal to r2. Then the full integral is, filling in the density d = 5 - z,
Evaluating this, we get 8 pi (in kg).
Why did we use cylindrical coordinates here? (Other than because the title was "cylindrical coordinates", of course.) The region in the xy-plane over which we're integrating is nicely defined with polar coordinates, and the limits on the domain in the remaining (z) direction are nice (at least, relatively nice) functions of r and theta. So cylindrical coordinates are a good choice. Note that spherical coordinates would not be as nice for this problem. Check that you can see why not (what boundary(ies) isn't (aren't) nicely described by spherical coordinates?).
(How were the figures here generated? In Maple, with this maple worksheet.)