Tutorials › Calculus III › Triple Integrals of Piecewise-Defined Functions

Triple Integrals and Solid Regions · Tutorial 621 of 999

Triple Integrals of Piecewise-Defined Functions

Learn to partition a solid along an internal surface, choose bounds for each piece, and add the resulting triple integrals.

Intermediate 9 min read

What You'll Learn

  • Define a piecewise function on a solid using an internal surface.
  • Partition the solid into regions where the integrand has one formula.
  • Set up and evaluate triple integrals over the resulting pieces.
  • Handle planar and curved surfaces that determine different bounds.
  • Recognize why shared boundaries do not cause double-counting in a triple integral.
  • Detect the error of integrating one branch’s formula over the entire solid.

When an Integrand Changes Inside a Solid

A triple integral can have a different formula on different parts of its solid region. For instance, a material may have one density below a separating surface and another density above it. The geometry of the solid is still the region of integration, but the integrand must be evaluated according to which part contains each point.

The essential method is to partition the solid along the internal surface. On each resulting subregion, use the formula that applies there, set up a triple integral over that subregion, and add the results. The surface separating the pieces is a boundary between regions, not an additional volume to integrate over.

Key idea: When a function changes formula inside a solid, divide the solid into subregions on which each formula is valid. The integral over the whole solid is the sum of the integrals over those subregions.

Piecewise-Defined Functions on a Solid

Let \(E\) be a solid region in \(\mathbb{R}^3\). Suppose a surface divides \(E\) into two subregions \(E_1\) and \(E_2\). A function may be defined by one formula on \(E_1\) and another on \(E_2\). The surface where the formulas meet is the internal interface.

Definition: A function \(f\) is piecewise-defined on \(E\) when \(E\) is partitioned into subregions \(E_1,\ldots,E_n\) and a specified formula for \(f\) applies on each subregion. The subregions have disjoint interiors and together cover \(E\); their boundaries may be shared.

To evaluate \(\iiint_E f\,dV\), use the triple integral of the appropriate formula on each piece. For two pieces, the rule is

$$ \iiint_E f\,dV = \iiint_{E_1} f_1\,dV + \iiint_{E_2} f_2\,dV, $$

where \(f_1\) and \(f_2\) are the formulas for \(f\) on \(E_1\) and \(E_2\). This rule requires that the integrals exist and that the pieces cover \(E\) without overlapping interiors. A shared boundary is permitted: an ordinary surface has zero volume, so assigning its points to either piece does not change the triple integral for an integrable function.

Before integrating, identify the interface and determine which side of it corresponds to each formula. Then describe each piece with bounds that cover that piece exactly. Depending on the surface and the chosen integration order, the interface may become an upper or lower limit for one variable.

Why Partitioning Works

The additivity rule follows from the definition of integration over a region. A partition replaces the integral over one region by integrals over smaller regions whose volumes together make up the original. For a Riemann sum, each small volume element inside \(E_1\) contributes its function value times its volume, and each element inside \(E_2\) contributes according to the other formula. Combining those two collections of contributions gives the sum over all of \(E\).

1
Separate the interiors.
Assign every point away from the interface to the subregion where its formula applies.
2
Integrate each formula on its region.
Use bounds that describe only that subregion, so each volume element is counted once.
3
Add the contributions.
The subregions cover the original solid, so the sum gives its integral.

This reasoning also explains why a shared surface does not create a correction term. A surface has no three-dimensional volume, so it contributes no volume elements to the triple integral. If the function is bounded and the pieces have ordinary piecewise-smooth boundaries, the choice of which piece includes the interface has no effect on the value.

Worked Example: A Plane Splits a Cube

Worked Example: A Plane Splits a Cube

Let \(E=[0,1]\times[0,1]\times[0,1]\), and define \(f(x,y,z)=z\) when \(z\le x\), and \(f(x,y,z)=2z\) when \(z>x\). Find \(\iiint_E f\,dV\).

The interface is the plane \(z=x\). For fixed \(x\) and \(y\), the first piece has \(0\le z\le x\), while the second has \(x\le z\le1\). The shared boundary does not affect the integral. Thus

$$ \iiint_E f\,dV = \int_0^1\int_0^1\int_0^x z\,dz\,dx\,dy + \int_0^1\int_0^1\int_x^1 2z\,dz\,dx\,dy. $$

For the first term, integrate with respect to \(z\):

$$ \int_0^1\int_0^1 \left[\frac{z^2}{2}\right]_{0}^{x}\,dx\,dy = \int_0^1\int_0^1 \frac{x^2}{2}\,dx\,dy = \int_0^1 \frac{1}{6}\,dy = \frac{1}{6}. $$

The antiderivative check is \(\frac{d}{dz}\left(\frac{z^2}{2}\right)=z\). For the second term,

$$ \int_0^1\int_0^1 \left[z^2\right]_{x}^{1}\,dx\,dy = \int_0^1\int_0^1 (1-x^2)\,dx\,dy = \int_0^1 \frac{2}{3}\,dy = \frac{2}{3}. $$

Here \(\frac{d}{dz}(z^2)=2z\), as required. Adding the two contributions gives

$$ \iiint_E f\,dV=\frac{1}{6}+\frac{2}{3}=\frac{5}{6}. $$

As a check, reverse the roles of \(x\) and \(z\). For fixed \(z\), the range \(z\le x\le1\) uses \(f=z\), and \(0\le x<z\) uses \(f=2z\). The \(y\)-interval has length \(1\), so the same integral is

$$ \int_0^1\left(\int_z^1 z\,dx+\int_0^z 2z\,dx\right)dz = \int_0^1\bigl(z(1-z)+2z^2\bigr)\,dz = \int_0^1(z+z^2)\,dz = \frac{1}{2}+\frac{1}{3} = \frac{5}{6}. $$

Reading Bounds from a Planar Interface

A plane such as \(x+y=1\) can divide a solid into regions described by triangular cross-sections. If the solid is a cube, the plane’s equation tells us which bounds to change. For example, when integrating in the order \(dz\,dy\,dx\), the boundary can separate \(y\) into \(0\le y\le1-x\) and \(1-x\le y\le1\). The other bounds can stay the same if the plane does not restrict those variables.

Worked Example: A Vertical Plane Separates Two Formulas

On the unit cube \(E=[0,1]^3\), let \(f(x,y,z)=x+y\) when \(x+y\le1\), and \(f(x,y,z)=3\) when \(x+y>1\). Evaluate \(\iiint_E f\,dV\).

The interface is the vertical plane \(x+y=1\). For each \(x\) from \(0\) to \(1\), the first piece has \(0\le y\le1-x\), and the second has \(1-x\le y\le1\). The \(z\)-range remains \(0\le z\le1\). Therefore

$$ \iiint_E f\,dV = \int_0^1\int_0^{1-x}\int_0^1 (x+y)\,dz\,dy\,dx + \int_0^1\int_{1-x}^1\int_0^1 3\,dz\,dy\,dx. $$

Because neither formula depends on \(z\), the \(z\)-integrals contribute a factor of \(1\). The first piece becomes

$$ \int_0^1\int_0^{1-x}(x+y)\,dy\,dx = \int_0^1\left[xy+\frac{y^2}{2}\right]_{0}^{1-x}\,dx = \int_0^1\left(x(1-x)+\frac{(1-x)^2}{2}\right)\,dx. $$

The expression in parentheses simplifies as follows:

$$ x-x^2+\frac{1-2x+x^2}{2} = \frac{1}{2}-\frac{x^2}{2}. $$

Thus the first piece contributes

$$ \int_0^1\left(\frac{1}{2}-\frac{x^2}{2}\right)\,dx = \left[\frac{x}{2}-\frac{x^3}{6}\right]_0^1 = \frac{1}{3}. $$

The antiderivative checks since \(\frac{d}{dx}\left(\frac{x}{2}-\frac{x^3}{6}\right)=\frac{1}{2}-\frac{x^2}{2}\). For the second piece, the \(y\)-interval has length \(1-(1-x)=x\), so

$$ \int_0^1\int_{1-x}^1 3\,dy\,dx = \int_0^1 3x\,dx = \left[\frac{3x^2}{2}\right]_0^1 = \frac{3}{2}. $$

Since \(\frac{d}{dx}\left(\frac{3x^2}{2}\right)=3x\), this evaluation is consistent. The total is

$$ \iiint_E f\,dV=\frac{1}{3}+\frac{3}{2}=\frac{11}{6}. $$

As a geometric check, the two pieces have equal volume: the triangular regions below and above \(x+y=1\) each have area \(\frac{1}{2}\) in the \(xy\)-plane, and the cube’s height is \(1\). The constant value \(3\) on the second piece therefore contributes \(3\left(\frac{1}{2}\right)=\frac{3}{2}\), matching its computed integral.

Curved Interfaces Can Set a Variable Bound

An internal surface need not be a plane. If it is given by a graph such as \(z=g(x,y)\), and the solid lies between fixed horizontal levels, it can be natural to integrate with respect to \(z\) first. For each \((x,y)\), the graph determines where the formula changes, so it becomes the dividing value between the two \(z\)-intervals.

Worked Example: A Curved Interface in the Unit Cube

On \(E=[0,1]^3\), let \(f(x,y,z)=1\) when \(0\le z\le xy\), and \(f(x,y,z)=x+y\) when \(xy<z\le1\). Evaluate \(\iiint_E f\,dV\).

The internal surface is \(z=xy\). Since \(0\le xy\le1\) throughout the unit square, it divides each vertical segment into the intervals \(0\le z\le xy\) and \(xy\le z\le1\). Hence

$$ \iiint_E f\,dV = \int_0^1\int_0^1\int_0^{xy}1\,dz\,dy\,dx + \int_0^1\int_0^1\int_{xy}^1(x+y)\,dz\,dy\,dx. $$

The first integral is

$$ \int_0^1\int_0^1 [z]_0^{xy}\,dy\,dx = \int_0^1\int_0^1 xy\,dy\,dx = \left(\int_0^1 x\,dx\right)\left(\int_0^1 y\,dy\right) = \frac{1}{2}\cdot\frac{1}{2} = \frac{1}{4}. $$

The check for the inner antiderivative is \(\frac{d}{dz}(z)=1\). In the second integral, \(x+y\) is constant with respect to \(z\), so

$$ \int_0^1\int_0^1 (x+y)[z]_{xy}^{1}\,dy\,dx = \int_0^1\int_0^1 (x+y)(1-xy)\,dy\,dx. $$

Expand the integrand:

$$ (x+y)(1-xy)=x+y-x^2y-xy^2. $$

Integrating term by term over the unit square gives

$$ \int_0^1\int_0^1(x+y-x^2y-xy^2)\,dy\,dx = \frac{1}{2}+\frac{1}{2}-\frac{1}{6}-\frac{1}{6} = \frac{2}{3}. $$

For instance, the term \(x^2y\) integrates to \((\int_0^1x^2\,dx)(\int_0^1y\,dy)=\frac{1}{3}\cdot\frac{1}{2}=\frac{1}{6}\); the \(xy^2\) term has the same value. The inner antiderivative used above is checked by \(\frac{d}{dz}\bigl((x+y)z\bigr)=x+y\). Combining the pieces,

$$ \iiint_E f\,dV=\frac{1}{4}+\frac{2}{3}=\frac{3}{12}+\frac{8}{12}=\frac{11}{12}. $$

The calculation respects the original cube: for every \((x,y)\) in its unit-square projection, the two \(z\)-intervals meet at \(xy\), start at \(0\), and end at \(1\). No part of the vertical segment is omitted or counted with positive volume twice.

A Common Mistake: Using One Formula Everywhere

A frequent error is to notice one branch of the definition and use it over the entire solid. In the cube example with \(f=z\) for \(z\le x\) and \(f=2z\) for \(z>x\), incorrectly extending the first formula throughout \(E\) gives

$$ \int_0^1\int_0^1\int_0^1 z\,dz\,dx\,dy = \frac{1}{2}. $$

This is not the requested integral: it assigns the value \(z\) to points with \(z>x\), where the defined function is \(2z\). The correct computation partitions at \(z=x\), giving \(\frac{1}{6}+\frac{2}{3}=\frac{5}{6}\). The wrong result is smaller by \(\frac{1}{3}\), precisely the difference between using \(2z\) and \(z\) on the upper piece:

$$ \int_0^1\int_0^1\int_x^1 (2z-z)\,dz\,dx\,dy = \int_0^1\int_0^1 \frac{1-x^2}{2}\,dx\,dy = \frac{1}{3}. $$

Another way to avoid this error is to check the definition point by point: pick a test point strictly inside each piece and confirm that the formula used in that piece is the correct branch. For this example, \((x,y,z)=(\frac{1}{2},\frac{1}{2},\frac{1}{4})\) belongs to \(z<x\), while \((\frac{1}{2},\frac{1}{2},\frac{3}{4})\) belongs to \(z>x\).

A Practical Checklist

For a piecewise-defined integrand, organize the calculation before evaluating it. The following checks help ensure that the integral represents the function and the solid correctly:

  • Write down the equation of the internal interface.
  • Identify which side of the interface uses each formula.
  • Choose an integration order in which each piece has valid bounds.
  • Check that the subregions cover the solid and have no overlapping interiors.
  • Evaluate each integral using its own formula, then add the results.
  • Check an antiderivative or use a geometric or alternate-order check where practical.

Partitioning is not a new kind of integral. It is an application of additivity: each part is integrated over its own geometry, and the contributions are combined to obtain the integral over the full solid.

Check Your Understanding

Use the ideas in this tutorial to answer the following questions.

  1. What is the role of an internal interface when setting up a triple integral of a piecewise-defined function?
  2. Why can two subregions share their boundary without changing the value of the triple integral?
  3. On the unit cube, a function is \(x\) when \(z\le y\) and \(2x\) when \(z>y\). What \(z\)-bounds describe each piece for fixed \(x\) and \(y\)?
  4. For the interface \(z=g(x,y)\), what must be checked before using it as a dividing \(z\)-bound throughout a projected region?
  5. In the cube example split by \(z=x\), why does integrating \(z\) over the entire cube fail to give the correct result?