Finding Volumes with Definite Integrals

You have seen how slicing up a region of the plane bound by functions into thin strips can be used to find the area of that region by taking the limit of the sum of rectangular areas that approximate those strips. However, this strategy can be extended to more things than just finding areas. For example, we can do something remarkably similar for solids whose volume we seek. This time however, we start by slicing up the solid into thin cross-sectional volumes.

A Motivating Example: The Sphere

Suppose we wish to find the volume of a sphere. Perhaps we have forgotten what our geometry teachers told us many moons ago, or (even better) perhaps we wanted to know why the formula they told us actually works. Either way, follow the suggestion above and slice up a spherical solid into thin cross-sectional volumes. This is shown below -- although the image drawn exaggerates the space between the resulting "slices" (which should actually be zero), so that we can better grasp the three dimensional nature of the image.

The cross-sectional volumes almost appear to be cylinders laying on their sides, but not quite. To see this, notice that while their circular sides are all parallel, the top and bottom of each cross-sectional volume are not. As another indication of this, consider both the left-most and right-most cross-sectional volume, which only have a single circular side a piece.

It would certainly have been nice if they had been perfect cylinders, as then we could have simply used the formula for the volume of a cylinder on each, summing the results to get the exact volume of the sphere -- but again, the volumes resulting from our slicing are not perfect cylinders.

However, we ran into similar difficulties when finding areas by slicing them into thin strips. The strips that resulted were not perfect rectangles, but the area they contributed to the total area could be well-approximated by rectangles, with this approximation generally better for thinner strips.

We can play the same game here. For a given set of cross-sectional volumes resulting from (equally spaced) slices of a sphere, suppose we consider approximating these with cylinders laid on their sides. As a matter of verbiage, we typically refer to such cylinderical cross-sectional volumes as disks, with each having some given thickness and radius*.

*Note, this helps avoid any confusion over the dimensions. In particular, the height of a cylinder standing on its circular base is clear -- but when the cylinder is on its side, the word "height" doesn't seem to fit that dimension very well. Perhaps we call this "length" now? However, we will eventually need (as we compute volumes of other kinds of solids) to consider such cylinders in both orientations, so it would be nice to have a consistent name. By describing each cylinder as a "disk of a given radius and thickness", there is no ambiguity. What was sometimes a height and at other times a length, is now simply a "thickness" of the related disk.

Below, we can see the volume of a sphere approximated by $3, 7, 14, 29$, and $39$ disks. It should be clear from the images that we seem to do a better job approximating the volume with thinner disks.

Let us presume the radius of the sphere is $R$. If this is the case, how much volume does each disk of the approximated sphere actually contribute? Their volumes of course depend on their dimensions. To help us find these dimensions, let us position our sphere on a set of axes in a way that will make our lives as simple as possible.

Following our normal habit up to this point, let us draw our axes so that the positive $x$ axis points right, and the positive $y$ axis points up. Of course, being a three dimensional shape, we require a third axis (i.e., the $z$-axis) perpendicular to both the $x$ and $y$-axes. The positive $z$-axis would then necessarily point either directly towards or directly away from the reader. Let us assume it points towards the reader for the moment.

With the orientation of the axes settled, we can then focus on positioning our sphere. Since the sphere's volume doesn't depend on its position, we may place it wherever we like. Keeping the sphere's center at the origin will keep things quite nice, as you will see. Our choices for the orientation of our axes and positioning of our sphere are reflected in the image at left below.

You can see that we have highlighted one randomly selected disk in magenta. In the middle image, we cut away a section of the approximated sphere so that we can better see the dimensions of that disk. Notice that doing so reveals various rectangles inside. Let us focus exclusively on those rectangles lying in the $xy$-plane. Note that one can interpret the magenta disk as the volume swept out upon rotating the corresponding magenta rectangle about the $x$-axis. This is true for each disk and its corresponding rectangle, of course.

Given this relationship, the thickness of each disk equals the width of its corresponding rectangle, and the radius of each disk equals the height of its corresponding rectangle.

As such, each disk's thickness can be calculated in the same way as the width of the corresponding rectangle. Noting that the (short) sides of the rectangles whose lengths this width measures are all parallel to the $x$-axis, we can calculate these widths -- and by extension, the thicknesses of the corresponding disks -- as a small difference of $x$-coordinates, $\Delta x$.

Let us denote the radius of the $i^{th}$ disk by $r_i$. Each $r_i$ also then gives the length of the longer side of the $i^{th}$ rectangle. As these sides are all parallel to the $y$-axis, their lengths are thus diffferences of $y$-coordinates. To determine which $y$-coordinates we must subtract, notice how the bottom of each rectangle happens at $y=0$ while the top of each rectangle approximates the height of the semi-circular curve $y=\sqrt{R^2 - x^2}$, as shown in blue in the rightmost image below.

In case there is any confusion as to where that equation for the semi-circular curve came from, note that the blue semi-circle is what we call a "great circle" of the sphere, meaning it has a radius equal to the radius of the sphere, $R$. As such, all points $(x,y)$ on the blue curve are at distance $R$ from the origin. The distance formula allows us to express the same using an equation, namely $\sqrt{x^2 + y^2} = R$. Solving this equation for $y$, we find $y = \sqrt{R^2-x^2}$.

As such, the radius $r_i$ is given by the difference of the two $y$-coordinates just found (larger minus smaller, of course, as we seek a distance, which must always be positive), $$r_i = \sqrt{R^2-(x_i^*)^2} - 0 \quad \textrm{ for some } x_i^* \textrm{ in the $i^{th}$ sub-interval along the $x$-axis}$$

Recalling the volume of a cylinder is given by $$\textrm{Volume } = \textrm{base area } \times \textrm{ height } = (\pi r^2) \cdot h$$ and remembering that the thickness $\Delta x$ is now playing the role of the height $h$ above, and the radius of the $i^{th}$ disk is given by $r_i = \sqrt{R^2-(x_i^*)^2}$, upon substituting these we see the contribution to the approximated volume of the sphere made by the $i^{th}$ disk is $$\begin{array}{rcl} i^{th} \textrm{ disk volume } &=& \pi r_i^2 \cdot \Delta x\\ &=& \displaystyle{\pi \left(\sqrt{R^2-(x_i^*)^2}\right)^2\cdot \Delta x} \end{array}$$ Summing all the disk volumes together then tells us that the approximated volume of the sphere is given by $$\sum_{i=1}^n \pi \left(\sqrt{R^2-(x_i^*)^2}\right)^2 \Delta x$$ However, we aren't really interested in approximating the volume of the sphere -- we want the exact volume. Remember, thinner disks generally provided a better approximation than thicker ones. Also, when the number of disks and/or sub-intervals grows without bounds (at least for regular partitions, like the one involved here), the individual thicknesses shrink and the norm of the partition approaches zero. As such, the exact area will be given by the following limit of a Rieman sum $$\lim_{n \rightarrow \infty} \sum_{i=1}^n \pi \left(\sqrt{R^2-(x_i^*)^2}\right)^2 \Delta x$$ Recognizing that the interval in which our $x_i^*$ values fall is from $-R$ to $R$ on the $x$-axis since the radius of the sphere is $R$ (note the two coordinates given in the earlier image on the right), we can interpret the above limit of a Riemann sum as the following definite integral $$\int_{-R}^{R} \pi \left(\sqrt{R^2 - x^2}\right)^2\,dx$$ From there, we can easily evaluate the definite integral to find the volume of the sphere. Just remember that $R$, the radius of the sphere in question, is a constant here -- the variable of integration is the $x$: $$\begin{array}{rcl} \displaystyle{\int_{-R}^{R} \pi \left(\sqrt{R^2 - x^2}\right)^2\,dx} &=& \displaystyle{\int_{-R}^{R} \pi (R^2 - x^2)\,dx}\\ &=& \displaystyle{\pi \int_{-R}^{R} (R^2 - x^2)\,dx}\\ &=& \displaystyle{\pi \left.\left(R^2 x - \frac{x^3}{3}\right)\right|_{-R}^{R}}\\ &=& \displaystyle{\pi \left[\left(R^3 - \frac{R^3}{3}\right) - \left(-R^3 + \frac{R^3}{3}\right)\right]}\\ &=& \displaystyle{\frac{4}{3}\pi R^3} \end{array}$$

In this way, we prove the formula for the volume of a sphere of radius $R$ is $\frac{4}{3}\pi R^3$. We don't just need to take at face-value the truth of this formula as likely told to us long ago by our geometry teachers!

Volumes of Extruded Areas

Following up on that last comment, the very careful among you might justifiably ask "If I shouldn't just believe geometry teachers when they say $V = \frac{4}{3}\pi r^3$ is the volume of a sphere with radius $r$, then why should I believe them when they say $V = \pi r^2 \cdot h$ is the volume of a cylinder, and thus feel comfortable using this formula when we set up the definite integral in our discussion above?!"

The answer is simple -- you should absolutely not feel comfortable doing this -- we need to prove this too! The good news is that we can prove the volume formula for a cylinder is $V = \pi r^2 \cdot h$ with a very similar technique!

Cylinders belong to a large class of volumes which we might call volumes of extruded areas after the manufacturing process called extrusion. The below image shows several parts made from this process, which involves the injection of heated metal or plastic through a die. To see beautiful animations of this process, check out the following gifs created by V.Ryan: injection of material, and closeup of die and volume formed

.

Let us consider the cylinder, formed by extruding material through a circular die of radius $r$ units, perpendicular to the plane in which that circle exists, until its length (or height, here) was $h$ units. In the picture below, we have positioned the cylinder on a set of axes so that the origin is hidden at its center.

Also, and as an important difference from what we did in the earlier example involving a sphere, notice that we have changed the orientation of our axes so that the positive $z$-axis points upwards, while the positive $x$-axis and positive $y$-axis point roughly towards the reader and to the right, respectively. This will be our default orientation for all solids considered from this point forward.

The position of a few points that will become important in a moment have also been marked above. Additionally, notice the points at the edge of the top circular face are all at height $z=\frac{h}{2}$ and -- because the "area extruded" here was a circle of radius $r$ -- the relationship between the $x$ and $y$ coordinates for points along that edge is given by $x^2 + y^2 = r^2$.

We can of course slice this cylinder up in multiple ways. Importantly, we should avoid slicing it up with cuts parallel to the $xy$-plane, as this would produce a bunch of cylindrical cross-sectional volumes and adding the volumes they each contribute would require the very volume formula we seek to prove!

Instead, let us use cuts parallel to the $yz$-plane and consider the now-box-shaped approximating cross-sectional volumes that result, as shown.

Since each cross-sectional volume is now a cuboid (i.e., a fancy name for a "box"), the volume each contributes is without question the product of its length, width, and height.

As before, the sum of the volumes of these cuboids approximates the volume of the cylinder -- with that approximation becoming as close to the exact volume as desired by choosing the spacing of our cuts so that the slices are sufficiently "thin".

Note that the "thin dimension" here, given the cuts made parallel to the $yz$-plane, is one parallel to the $x$-axis, and thus can be expressed as a small difference of $x$-coordinates. Assuming as we have before that the cuts are uniformly spaced apart, let us denote the common tiny "width" that results by $\Delta x$, to set the stage for the construction of a Riemann sum.

As each cuboid spans from $z=-\frac{h}{2}$ to $z=\frac{h}{2}$ in terms of the $z$-coordinates, the dimension of each cuboid parallel to that axis -- in this case, the "height" -- is the difference between these two $z$-coordinates (upper minus lower, so as to keep this dimension positive). As expected, the height of each cuboid is then $\frac{h}{2} - (-\frac{h}{2}) = h$.

Let us refer to the dimension of each cuboid measured parallel to the $y$-axis as that cuboid's "length". Since this is expressable as a difference of two $y$-coordinates (rightmost minus leftmost, so as to keep this dimension positive), and remembering that a $\Delta x$ is already on track to appear in our Riemann sum, we solve for $y$ in terms of $x$. We use the aforementioned equation $x^2 + y^2 = r^2$ towards this end, as the points $(x,y)$ involved lie on this circle. Doing so results in two solutions: $y_{right} = \sqrt{r^2-x^2}$ and $y_{left} = -\sqrt{r^2-x^2}$.

Thus, the "length" of the $i^{th}$ cuboid along the $y$-axis can be expressed in terms of some chosen $x_i^*$ in the $i^{th}$ sub-interval as $$y_{right} - y_{left} = \sqrt{r^2-(x_i^*)^2} - \left(-\sqrt{r^2-(x_i^*)^2}\right) = 2\sqrt{r^2-(x_i^*)^2}$$

With the width, length, and height of the $i^{th}$ cuboid established, the volume of the $i^{th}$ cuboid must then be given by $$\textrm{Volume of the } i^{th} \textrm{ cuboid} = h \cdot 2\sqrt{r^2-(x_i^*)^2}\,\Delta x$$ Summing the volumes of all the cuboids, we can then express an approximation for the volume of the cylinder as a Riemann sum: $$\textrm{Approximate Cylindrical Volume } = \sum_{i=1}^{n} h \cdot 2\sqrt{r^2-(x_i^*)^2}\,\Delta x$$ To get the exact area, we simply find the limit of the above Riemann sum as the number of rectangles, $n \rightarrow \infty$ (and thus, the limit as $\Delta x \rightarrow 0$). As our $x$ values ranged from $x=-r$ to $x=r$ in the formation of these approximating cuboids, we can express this limit with the definite integral, $$\int_{-r}^{r} h \cdot 2\sqrt{r^2-x^2}\,dx$$ Doing the integration quickly however requires a special technique called trigonometric substitution, that we have not yet discussed. Currently without this technique (don't worry, we'll pick it up soon), and not wanting to just blindly believe this definite integral equals the desired formula for the volume of a cylinder, $V=\pi r^2 \cdot h$, let us take a step back and pick apart the structure of the above work to prove a broader result that will give us this volume and many others as quick corollaries.

Looking back at the picture of our approximated cylinder, notice that the "lengths" (parallel to the $y$-axis) of our cuboid slices can also be interpreted as "lengths" for the rectangular strip areas whose sum approximates the circular base area which was extruded to create the volume. Further, the tiny "width" associated with each cuboid serves also as the tiny "width" associated with each such strip. This actually provides the key to understanding how to find the volume of any extruded volume!

Consider the following cuboid approximation to the strange looking base area outlined in blue that has been extruded vertically to a height of $h$. Before continuing, note the top (yellow) area is an area bound between curves. We can approximate this area by first making cuts parallel to the $y$-axis, which results in strips that can be approximated by rectangles. If we make the cuts through the same places on the $x$-axis as we did to make the cuboids (as shown), then these approximating rectangular strips will have the same width and length as their corresponding cuboids. Of course, all the cuboids have three dimensions whereas the rectangular strips only have two. The cuboids all have constant height, $h$.

Indeed, assuming the cuboids all have width $\Delta x$ and length $f(x_i^*)$, for some appropriate function $f$ relative to the bounding curves of the base area extruded, then the sum of the cuboid volumes gives us an approximate volume $$\textrm{Approximate volume } = \sum_{i=1}^n h \cdot f(x_i^*) \Delta x$$ while the sum of the rectangular areas approximates the base area $$\textrm{Approximate base area } = \sum_{i=1}^n f(x_i^*) \Delta x$$

‡ : Just to connect this back to the cylinder whose base area was bound by two semicircular curves, notice there we had $f(x) = 2\sqrt{r^2-x^2}$.

Now recall that just as $ab_1 + ab_2 + ab_3 = a(b_1 + b_2 + b_3)$, we can pull the constant factor "$a$" out of the summation $\sum_{i=1}^n ab_i$ to obtain the product, $a \sum_{i=1}^n b_i$. Pulling out the factor of $h$ from the first Riemann sum above, we can clearly see that $$\underbrace{\sum_{i=1}^n h \cdot f(x_i^*) \Delta x}_{\textrm{approx. volume}} = \underbrace{h}_{\textrm{height}} \cdot \underbrace{\left[\sum_{i=1}^n f(x_i^*) \Delta x\right]}_{\textrm{approx. base area}}$$ We know that the expression on the left is the approximated volume -- but look at the expression on the right! The part inside the brackets is precisely the corresponding approximation to the area of the base shape that was extruded to make the volume in question!

Assuming these two approximating Riemann sums involved strips and cuboids spanning over the interval from $x=a$ to $x=b$, then taking a limit as $n \rightarrow \infty$, we can express things in terms of definite integrals: $$\underbrace{\int_{a}^{b} h \cdot f(x)\,dx}_{\textrm{exact volume}} = \underbrace{h}_{\textrm{height}} \cdot \underbrace{\int_{a}^{b} f(x)\,dx}_{\textrm{exact base area}}$$

In this way, we know that if we take pretty much any base shape bound by curves that has area $A$ and extrude it vertically so the resulting solid has a height/extrusion length of $h$, then the volume of that solid is $V = A \cdot h$.

Knowing that the area of a circle of radius $r$ is $\pi r^2$, then the volume of a cylinder formed by extruding such a circle vertically by a height $h$ is trivially then $V = \pi r^2 \cdot h$. Whew! Our geometry teacher was right all along! 😁

Using Extruded Volumes to Approximate Cross-sectional Slices of Other Volumes

Being able to argue the validity of the volume formula for a cylinder is important, now doubt. However, knowing that $V = A \cdot h$, which was the key to that argument as seen in the last section, is much more powerful than that!

Suppose we take some area and extrude it only by some purposefully small length. Perhaps this extrusion is done vertically. Below we do this for several different such areas.

Imagine now, if you will -- what if when we sliced up some solid and saw thin cross-sectional volumes that weren't easily approximated by by cuboids, or cylinders, but by one of the other shapes above instead?

Expressing this idea somewhat in reverse, by specifying the shape of cross sections taken perpendicular to some understood base shape, we can define new types of solids -- ones not previously discussed in our geometry classes! Further, if we can find the volume each slice contributes, then we may be able to find the overall volume of the solid as well, by evaluating a related definite integral.

As an example, suppose we wish to find the volume of a solid whose cross-sections, when taken in a given way, are all equilateral triangles. To make our example more concrete, let us suppose the solid in question has a circular base of unit radius, with its equilateral triangle cross-sections all perpendicular to this base.

Let us position this solid on a set of axes in our standard orientation (i.e., positive $z$-axis pointing up). Let us place its circular base in the $xy$-plane, centered at the origin, and rotate the solid about the $z$ axis as needed until the cross sections are parallel to the $xz$-plane.

The above images build up from left to right what this solid must look like. First, on the left we draw the circular base (in blue) and erect a few equilateral triangles upon it to serve as representative cross-sections. Then, in the middle image, we increase the number of cross-sections and extrude each to a triangular prism until it meets the next. When these prisms' extrusion lengths are small, they will well-approximate the true cross-sectional volumes (of the same width and in the same positions) for the overall solid we are building, just like the cylinders in our example at the beginning of this section well-approximated the true corresponding cross-sectional volumes for the sphere. Taking things a step further, this middle image also shows us that an approximation to the the volume of the overall solid described can be found through summing the volumes of these triangular prisms. On the far right, we see the limit of this process as each triangular prism becomes arbitrarily thin, with their union ultimately forming the solid sought.

(Note that this is not a solid for which we have a familiar name -- one might say it looks roughly cone-shaped, but this solid is definitely not a cone, given the sharp curved edge across its top formed by the top vertices of those triangular cross-sections.)

With the solid initially described better visualized now, let us attempt to find its volume...

First, notice that if we look at the base of our solid from below the $xy$-plane, the bottoms of the triangular prisms show up as familiar-looking rectangles in our circular base. In the image below, we draw the base, and show one of these triangle prism bottoms in green. Wanting to focus on a single representative rectangle, we omit drawing the rest, although it should be clear they would align nicely with the horizontal strips shown. (As the image suggests, we assume a regular partition to keep things nice.) In case one wonders why we drew horizontal strips instead of vertical ones, note how in the images of our solid above the faces of our triangular prisms are all perpendicular to the $y$-axis.

The tiny "height" of the rectangle in the picture above, of course, equals the extrustion length of our triangular prisms in the corresponding approximated volume, while the rectangle's length above gives us the length of the edges for the corresponding triangular prism. Note that this height is a small difference of $y$ coordinates, which we can denote with $\Delta y$, while this length is a difference of $x$-coordinates.

Ultimately wanting a Riemann sum that approximates our desired volume and seeing we already have a $\Delta y$, we will want to find this difference in $x$-coordinates in terms of an appropriate $y_i^*$ for the rectangle in question.

As such, we solve for $x$ in the equation of the unit circle centered at the origin (i.e., $x^2 + y^2 = 1$) to find $x = \pm\sqrt{1-y^2}$. The negative $x$ value tells us where the left side of our rectangle is, while the positive $x$ value gives us the right side. Subtracting the smaller from the larger (to ensure the distance found is positive), we have the length of the longer side of the $i^{th}$ rectangle, and thus the length of the triangular sides of our approximating cross-sectional volumes, both equal to $2\sqrt{1-(y_i^*)^2}$.

Recalling that the area of an equalateral triangle of side length $s$ is given by $$\textrm{Area } = \frac{s^2\sqrt{3}}{4}$$ we can then exploit the volume formula for extruded volumes (i.e., base area $\times$ extrusion length) to find the volume contributed by the $i^{th}$ triangular prism, $V_{i}$ $$\begin{array}{rcl} V_i &=& \displaystyle{\frac{\left(2\sqrt{1-(y_i^*)^2}\right)^2\sqrt{3}}{4}}\,\Delta y\\\\ &=& \sqrt{3}\left[1-(y_i^*)^2\right]\,\Delta y \end{array}$$ Summing the volumes of all the prisms (let us suppose there are $n$ of them) gives us a Riemann sum that approximates the volume sought, $V_{approx}$, $$V_{approx} = \sum_{i=1}^n \sqrt{3}\left[1-(y_i^*)^2\right]\,\Delta y$$ Of course, now all we need to do is take a limit as $\Delta y \rightarrow 0$ (or equivalently as $n \rightarrow \infty$) to produce a definite integral that gives us the exact volume. Recall that we created equilateral triangular prism cross-sections from $y=-1$ to $y=1$ (spanning the entire unit circle) -- these become the limits of integration on that definite integral: $$V_{exact} = \int_{-1}^{1} \sqrt{3}(1-y^2)\,dy$$ From here, things are routine. We simply evaluate the integral to find $$\begin{array}{rcl} V_{exact} &=& \displaystyle{\sqrt{3}\int_{-1}^{1} (1-y^2)\,dy}\\ &=& \displaystyle{\sqrt{3} \cdot \left.\left(y -\frac{y^3}{3}\right)\right|_{-1}^1}\\ &=& \displaystyle{\frac{4\sqrt{3}}{3}} \end{array}$$


As another example, suppose we try to deduce the volume of a square pyramid of height $h$ where the sides of the square base are $s$ units long.

First we position the pyramid on a set of axes. Perhaps we again center the base on the origin in the $xy$-plane, as shown on the left below. (Note, other than having a nice symmetry and pointing "to the sky" like the pyramids in Egypt, there is nothing special about the position we have chosen. Any position will work here -- although admittedly, those that keep the square base parallel to either the $xy$, $yz$, or $xz$-planes will be much easier to work with!).

Nicely, if we slice the volume with cuts parallel to the $xy$-plane, we see the cross-sectional volumes can again be approximated by cuboids (specifically, extruded square areas). We draw one of these in red.

Noting first that the "thin" dimension of our representiative red cuboid is some difference of $z$ coordinates $\Delta z$, let us seek to build a Riemann sum for the approximate volume of the pyramid in terms of $z$-values.

We will consequently need to find the contributing volume of each cuboid in terms of $z$ values. The area of the square face of the cuboid (i.e., the one extruded) is of course the square of its edge length.

We can find this edge length in multiple ways. For example, if we draw the intersection of the pyramid with the $yz$-plane as shown on the right, note that the length of the thin red rectangle that results must also be the edge length we seek.

To express this edge length in terms of the $z$-value associated with the cuboid in question, we might first find the equations for the blue lines that bound it on the left and right. (To the extent it helps you understand what these blue lines represent, they are faintly drawn in the left image as well.)

After solving for $y$ in terms of $z$ for each (since we need everything in our Riemann sum in terms of $z$), we subtract the smaller from the larger to find the edge length. As the annotations in the image on the right suggest, $$\textrm{red square edge length } = s - \frac{s}{h}z$$

The volume contributed by the $i^{th}$ extruded square area is, of course, the area of its square face times its thickness: $$\textrm{volume of } i^{th} \textrm{ cuboid } = \left(s - \frac{s}{h}z_i^*\right)^2\,\Delta z$$ Summing the cuboid volumes (assuming there are $n$ of them), we have an approximation for the volume of the square pyramid given by the Riemann sum, $$V_{approx} = \sum_{i=1}^n \left(s - \frac{s}{h}z_i^*\right)^2\,\Delta z$$ Taking a limit as $n \rightarrow \infty$ to obtain the definite integral that gives the exact volume we seek should be routine by now. Just note that the $z$ values for which we have square cross-sections span from $z=0$ to $z=h$, so these become our limits of integration. The resulting integral and the value to which it evaluates are shown below. (The very-straight-forward details of the evaluation of this definite integral we leave to the reader.) $$\begin{array}{rcl} V_{exact} &=& \displaystyle{\int_0^h \left(s - \frac{s}{h}z\right)^2\,dz}\\ &=& \displaystyle{\frac{s^2 h}{3}} \end{array}$$