When we think about volume from an intuitive point of view, we typically think of it as the amount of "space" an item occupies. Unfortunately assigning a number that measures this amount of space can prove difficult for all but the simplest geometric shapes. Calculus provides a new tool that can greatly extend our ability to calculate volume. In order to understand the ideas involved it helps to think about the volume of a cylinder. The volume of a cylinder is calculated using the formula . The base of the cylinder is a circle whose area is given by . Notice that the volume of a cylinder is derived by taking the area of its base and multiplying by the height . For more complicated shapes, we could think of approximating the volume by taking the area of some cross section at some height and multiplying by some small change in height then adding up the heights of all of these approximations from the bottom to the top of the object. This would appear to be a Riemann sum. Keeping this in mind, we can develop a more general formula for the volume of solids in (3 dimensional space).
Formal Definition 
Formally the ideas above suggest that we can calculate the volume of a solid by calculating the integral of the cross-sectional area along some dimension. In the above example of a cylinder, the every cross section was given by the same circle, so the cross-sectional area is therefore a constant function, and the dimension of integration was vertical (although it could have been any one we desired). Generally, if is a solid that lies in between and , let denote the area of a cross section taken in the plane perpendicular to the x direction, and passing through the point x. If the function is continuous on , then the volume of the solid is given by:
Example 1: A right cylinder 
Now we will calculate the volume of a right cylinder using our new ideas about how to calculate volume. Since we already know the formula for the volume of a cylinder this will give us a "sanity check" that our formulas make sense. First, we choose a dimension along which to integrate. In this case, it will greatly simplify the calculations to integrate along the height of the cylinder, so this is the direction we will choose. Thus we will call the vertical direction (see Figure 1). Now we find the function, , which will describe the cross-sectional area of our cylinder at a height of . The cross-sectional area of a cylinder is simply a circle. Now simply recall that the area of a circle is , and so . Before performing the computation, we must choose our bounds of integration. In this case, we simply define to be the base of the cylinder, and so we will integrate from to , where is the height of the cylinder. Finally, we integrate:
This is exactly the familiar formula for the volume of a cylinder.
Example 2: A right circular cone 
For our next example we will look at an example where the cross sectional area is not constant. Consider a right circular cone. Once again the cross sections are simply circles. But now the radius varies from the base of the cone to the tip. Once again we choose to be the vertical direction, with the base at and the tip at , and we will let denote the radius of the base. While we know the cross sections are just circles we cannot calculate the area of the cross sections unless we find some way to determine the radius of the circle at height .
Luckily in this case it is possible to use some of what we know from geometry. We can imagine cutting the cone perpendicular to the base through some diameter of the circle all the way to the tip of the cone. If we then look at the flat side we just created, we will see simply a triangle, whose geometry we understand well. The right triangle from the tip to the base at height is similar to the right triangle from the tip to the base at height . This tells us that . So that we see that the radius of the circle at height is . Now using the familiar formula for the area of a circle we see that .
Now we are ready to integrate.
By u-substitution we may let , then and our integral becomes
Example 3: A sphere 
In a similar fashion, we can use our definition to prove the well known formula for the volume of a sphere. First, we must find our cross-sectional area function, . Consider a sphere of radius which is centered at the origin in . If we again integrate vertically then will vary from to . In order to find the area of a particular cross section it helps to draw a right triangle whose points lie at the center of the sphere, the center of the circular cross section, and at a point along the circumference of the cross section. As shown in the diagram the side lengths of this triangle will be , , and . Where is the radius of the circular cross section. Then by the Pythagorean theorem and find that . It is slightly helpful to notice that so we do not need to keep the absolute value.
So we have that
Extension to Non-trivial Solids 
Now that we have shown our definition agrees with our prior knowledge, we will see how it can help us extend our horizons to solids whose volumes are not possible to calculate using elementary geometry.