Tutorials › Calculus III › Piecewise Integrands on Rectangular Domains

Double Integrals on Rectangles · Tutorial 519 of 999

Piecewise Integrands on Rectangular Domains

Split a rectangular domain into the correct pieces, integrate each formula over its own rectangle, and combine the results.

Beginner 9 min read

What You'll Learn

  • Identify the vertical and horizontal break lines in a piecewise definition.
  • Partition a rectangle into smaller rectangular pieces without gaps or overlaps of positive area.
  • Set up an iterated integral for each piece using that piece’s formula.
  • Add the piece integrals to obtain the integral over the full rectangle.
  • Understand why bounded values on the break lines do not change the integral.
  • Detect the error of using one branch’s formula over the entire domain.

Why a Piecewise Integrand Must Be Split

A double integral on a rectangle accumulates the values of a function across the entire domain. If the formula for the function changes at a vertical or horizontal line, the calculation must account for those changes. Using one formula over the whole rectangle generally gives the wrong result, because that formula may not describe the function on every part of the domain.

The basic method is to divide the original rectangle along the stated break lines. Each resulting piece is itself a rectangle, and on each piece we use the formula assigned to that part of the domain. We then add the individual integrals. The procedure is a direct application of additivity across rectangular subdivisions.

Key idea: When a function is defined by different formulas on rectangular pieces, integrate each formula over its corresponding piece, then add the piece integrals.

Rectangular Pieces and the Integral

Let \(R=[a,b]\times[c,d]\) be a rectangle. Suppose the piecewise definition changes at vertical lines \(x=r_1,\ldots,x=r_m\) and horizontal lines \(y=s_1,\ldots,y=s_n\), all lying within \(R\). Sort the break coordinates and include the outer edges \(a,b,c,d\). These coordinates divide \(R\) into smaller rectangles.

For example, one cell of this division has the form \([r_{i-1},r_i]\times[s_{j-1},s_j]\). On that cell, use the formula assigned to the corresponding region of the piecewise definition. If each formula is continuous on its cell and the function remains bounded on the break lines, the resulting function is Riemann integrable on \(R\). The integral is the sum of the integrals over the cells.

$$ \iint_R f(x,y)\,dA = \sum_{i=1}^{m+1}\sum_{j=1}^{n+1} \iint_{[r_{i-1},r_i]\times[s_{j-1},s_j]} f(x,y)\,dA. $$

Here the notation for the cell edges is understood to include the outer edges of the original rectangle, so each cell uses its own left and right \(x\)-coordinates and lower and upper \(y\)-coordinates. If a break occurs in only one coordinate, the division produces strips instead of a full grid. In either case, every interior point belongs to exactly one piece, except for points on shared edges.

A shared edge does not contribute area to the double integral. Thus the way the function assigns values exactly on a break line does not affect the integral, provided those values are bounded. This fact permits us to integrate over closed rectangles that share edges, even though the original definition may assign a break-line point to only one branch.

Why Adding the Piece Integrals Works

The justification is the additivity of the double integral across rectangular subdivisions. For a division by one vertical line \(x=r\), additivity gives the integral over the whole rectangle as the sum of the integrals over the left and right rectangles. Dividing again by a horizontal line splits each of those integrals into a lower and upper part. Repeating this process gives the sum over all cells.

Justification: For an integrable function on a rectangle, dividing the rectangle into finitely many rectangles gives an integral over the whole equal to the sum of the integrals over the pieces. A finite collection of shared edges has area zero, so counting an edge as part of both adjacent closed pieces does not change that sum.

On each cell, the applicable formula can be integrated as an iterated integral. When the formula is continuous there, Fubini’s theorem for continuous functions allows us to evaluate the double integral by integrating first with respect to one coordinate and then the other. The important bookkeeping requirement is that the limits describe the cell, and the formula inside the integral is the one valid on that cell.

1
Mark the break lines.
Record each vertical and horizontal coordinate where the formula changes.
2
Form the rectangles.
Use the break lines and the outer edges to partition the full domain.
3
Integrate each branch on its own piece.
Use the piece’s bounds and its assigned formula.
4
Add and check.
Combine the signed integral values and verify that all pieces together cover the original rectangle.

Worked Example: One Vertical Break Line

Worked Example: One Vertical Break Line

Evaluate \(\iint_R f(x,y)\,dA\) on \(R=[0,2]\times[0,1]\), where \(f(x,y)=x+y\) for \(0\le x<1\), and \(f(x,y)=2x-y\) for \(1\le x\le2\).

The vertical break line is \(x=1\). It divides \(R\) into \([0,1]\times[0,1]\) and \([1,2]\times[0,1]\). Integrate each formula on its own rectangle.

$$ \begin{aligned} \iint_R f(x,y)\,dA &=\int_0^1\int_0^1(x+y)\,dy\,dx +\int_1^2\int_0^1(2x-y)\,dy\,dx\\ &=\int_0^1\left[xy+\frac{y^2}{2}\right]_{0}^{1}\,dx +\int_1^2\left[2xy-\frac{y^2}{2}\right]_{0}^{1}\,dx\\ &=\int_0^1\left(x+\frac12\right)\,dx +\int_1^2\left(2x-\frac12\right)\,dx\\ &=\left[\frac{x^2}{2}+\frac{x}{2}\right]_{0}^{1} +\left[x^2-\frac{x}{2}\right]_{1}^{2}\\ &=1+\left(3-\frac12\right)\\ &=\frac72. \end{aligned} $$

For the second rectangle, the evaluated endpoint at \(x=2\) is \(4-1=3\), and at \(x=1\) it is \(1-\frac12=\frac12\), so its contribution is \(\frac52\). The first contributes \(1\). Their sum is \(\frac72\), as stated.

Worked Example: Break Lines in Both Coordinates

Worked Example: Break Lines in Both Coordinates

On \(R=[0,2]\times[0,2]\), define \(f\) by \(x+y\) when \(0\le x<1\) and \(0\le y<1\); by \(2\) when \(1\le x\le2\) and \(0\le y<1\); by \(3y\) when \(0\le x<1\) and \(1\le y\le2\); and by \(xy\) when \(1\le x\le2\) and \(1\le y\le2\). Find the integral.

The break lines \(x=1\) and \(y=1\) form four unit squares. Evaluate the four integrals separately:

$$ \begin{aligned} \iint_R f(x,y)\,dA ={}&\int_0^1\int_0^1(x+y)\,dy\,dx +\int_1^2\int_0^1 2\,dy\,dx\\ &+\int_0^1\int_1^2 3y\,dy\,dx +\int_1^2\int_1^2 xy\,dy\,dx. \end{aligned} $$

The lower-left contribution is

$$ \int_0^1\left[xy+\frac{y^2}{2}\right]_0^1\,dx =\int_0^1\left(x+\frac12\right)\,dx =1. $$

The lower-right contribution is

$$ \int_1^2\int_0^1 2\,dy\,dx =\int_1^2 2\,dx =2. $$

The upper-left contribution is

$$ \int_0^1\left[\frac{3y^2}{2}\right]_1^2\,dx =\int_0^1\frac{9}{2}\,dx =\frac92. $$

The upper-right contribution is

$$ \int_1^2 x\left[\frac{y^2}{2}\right]_1^2\,dx =\int_1^2\frac{3x}{2}\,dx =\frac32\left[\frac{x^2}{2}\right]_1^2 =\frac94. $$

Adding the four contributions gives

$$ 1+2+\frac92+\frac94 =\frac{4}{4}+\frac{8}{4}+\frac{18}{4}+\frac{9}{4} =\frac{39}{4}. $$

As a check, the four pieces have areas \(1,1,1,1\), so together they cover the area \(4\) of the original rectangle. The integral is \(\frac{39}{4}\), the sum of the four computed contributions.

Worked Example: Negative Contributions

Worked Example: Negative Contributions

Evaluate the integral over \(R=[-1,1]\times[0,2]\) for the function \(f(x,y)=x+y\) when \(-1\le x<0\), and \(f(x,y)=x^2-y\) when \(0\le x\le1\).

The line \(x=0\) divides the domain into two rectangles. The first contribution is

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

The second contribution is

$$ \begin{aligned} \int_0^1\int_0^2(x^2-y)\,dy\,dx &=\int_0^1\left[x^2y-\frac{y^2}{2}\right]_0^2\,dx\\ &=\int_0^1(2x^2-2)\,dx\\ &=\left[\frac{2x^3}{3}-2x\right]_0^1\\ &=\frac23-2=-\frac43. \end{aligned} $$

Therefore,

$$ \iint_R f(x,y)\,dA =1-\frac43=-\frac13. $$

The negative contribution is valid: a double integral is signed, so regions where the function is negative subtract from regions where it is positive. The final result checks as the sum \(1+(-\frac43)=-\frac13\).

Common Mistake: Using One Branch Everywhere

In the first example, the formula \(x+y\) applies only to the left-hand rectangle. A tempting but incorrect calculation is to use it across all of \(R\):

$$ \int_0^2\int_0^1(x+y)\,dy\,dx =\int_0^2\left(x+\frac12\right)\,dx =\left[\frac{x^2}{2}+\frac{x}{2}\right]_0^2 =3. $$

This value is not the required integral. On the right-hand rectangle, the function is \(2x-y\), not \(x+y\). The correct calculation uses both pieces and gives \(\frac72\). The error is not in evaluating the displayed integral; it is in applying the wrong branch on part of the domain.

Practical check: Before integrating, match every formula to its exact rectangular bounds. Confirm that the pieces cover the full original rectangle and that no formula has been used outside its assigned piece.

When This Method Applies

This method applies directly when the break lines are vertical or horizontal, so that the pieces are rectangles. The formula on each piece should be integrable there; a common sufficient condition is that it is continuous on that piece. Bounded assignments on the finitely many break lines do not alter the integral.

If a stated change occurs along a slanted line or a curved boundary, splitting only along vertical and horizontal lines may not produce rectangular pieces. The rectangular subdivision method described here is intended for rectangular break lines; a different description of the region may then be needed. For the present setting, the reliable habits are simple: draw the breaks, label each cell with its formula, integrate cell by cell, and add the signed results.

Check Your Understanding

For each question, identify the pieces before attempting any integration.

  1. A function changes formula at \(x=2\) on \([0,4]\times[0,3]\). How many rectangular strips result?
  2. What four rectangles result when the break lines are \(x=1\) and \(y=2\) inside \([0,3]\times[0,4]\)?
  3. Why may a shared edge be included in both adjacent closed rectangles when writing the piece integrals?
  4. On \([0,2]\times[0,1]\), a formula \(x\) applies for \(x<1\), and \(2x\) applies for \(x\ge1\). What integrals should be added?
  5. Can a negative integral over one piece be added to a positive integral over another? Explain what the sign represents.