COMPOSITE GEOMETRY WORKSHEETS

Checking the union area of overlapping rectangles

Two overlapping rectangles cover less ground than the sum of their areas. This guide shows the single subtraction that fixes the double count.

The double count in a plain sum

Place two rectangles on a floor so that they cover a common patch. Add their areas and the patch is included twice, once for each rectangle, even though the floor under it is covered only once. The area you want for a question like how much carpet, paint or paving is needed is the union, the set of points lying in at least one rectangle. The plain sum is a different quantity, a total of memberships, where a point in both shapes scores two. The two numbers agree only when the rectangles do not overlap at all, and the gap between them is exactly the overlap area.

The supplied numbers

The worked case uses a rectangle 3 by 2 and a rectangle 4 by 2. The rectangle calculator gives areas 6 and 8. The overlap is given as a region of area 2, for instance a 1-by-2 strip where the ends of the two rectangles lie on top of each other. The sum of areas is 6 + 8 = 14. The union is 14 − 2 = 12, which the basic calculator confirms. If the overlap were not given, you would have to work it out from the placement, since the two areas alone say nothing about where the shapes sit.

Why one subtraction is enough

Split the plane into three kinds of region: points only in the first rectangle, points only in the second, and points in both. The first area equals only-first plus both, and the second equals only-second plus both. Adding them gives only-first plus only-second plus two copies of both. The union is only-first plus only-second plus one copy of both, so removing a single copy of the overlap leaves the right figure. That reasoning is the rule for two sets, written as area(A ∪ B) = area(A) + area(B) − area(A ∩ B). The subtraction happens once, not twice, because the overlap should remain in the union a single time.

A worked example that checks itself

Suppose a 6-by-4 rectangle and a 5-by-3 rectangle overlap in a 2-by-3 region. The areas are 24 and 15, which add to 39. The union is 39 − 6 = 33. To verify, split the second rectangle into the overlapping 2-by-3 part and the remaining 3-by-3 part, which has area 9. The first rectangle is whole at 24, and 24 + 9 = 33. The two routes agree, which is a good habit whenever the overlap geometry is simple enough to cut up. If they disagree, the overlap value or one of the dimensions is wrong.

Where the overlap comes from

The subtraction needs the overlap area, and that is often the hardest piece. For two rectangles whose sides are parallel to the same axes, the overlap is itself a rectangle: its width is the length of the shared interval along one axis, and its height is the shared interval along the other. If either interval is empty, the rectangles do not overlap and the overlap area is zero. If one rectangle sits fully inside the other, the overlap equals the smaller area. Tilted rectangles produce overlaps that are polygons with more sides, and then the area needs its own calculation before the rule can be applied.

Edge cases at the extremes

Two rectangles that touch along an edge have an overlap of zero area, because a line has no area, so the union is the plain sum. A rectangle contained in another gives a union equal to the larger one: with areas 24 and 6 and an overlap of 6, the union is 24 + 6 − 6 = 24. Identical rectangles overlap fully, and the union is just one of them. These cases are a quick test of any formula or spreadsheet you build, because the answer is known in advance. If a result exceeds the sum of the areas, or falls below the larger of the two, the overlap value is inconsistent. Building these sanity checks into a worksheet is cheap. The union is never smaller than the larger rectangle and never larger than the sum, and both limits are visible before any detailed geometry is done.

Using the calculators in sequence

Run the rectangle calculator once per rectangle to get the areas, enter the overlap area you have established, and use the basic calculator to add and subtract. Keep each value labeled so that the roles are clear: first area, second area, overlap. All three must share one unit, and the overlap cannot exceed the smaller of the two areas. A larger value signals an error in the overlap measurement. Do not round the areas before subtracting if the dimensions have decimals, because the overlap is often a small difference of larger numbers and rounding error would show up in the result. When the dimensions are whole numbers or simple decimals, exact arithmetic is easy, and keeping every digit costs nothing. Round only the final union, to the precision the dimensions justify, and state the unit next to it so a reader does not mistake square meters for square feet.

What the area totals cannot tell you

The three numbers 6, 8 and 2 are consistent with many layouts, and nothing in them proves that the overlap is correctly placed. The area of the union is only as good as the overlap figure, which has to come from the same arrangement as the two rectangles. The method also describes flat regions and says nothing about the perimeter of the union, which needs a boundary calculation of its own, or about thickness, stacking order and material. For ideal planar shapes it gives the covered area directly, in the same square units as the inputs.

Three rectangles need a longer rule

With three overlapping rectangles, subtracting each pairwise overlap once removes the triple-overlap region too many times. The full rule is: add the three areas, subtract the three pairwise overlaps, then add back the area common to all three. As an example, take areas 6, 8 and 5, pairwise overlaps of 2, 1 and 1, and a triple overlap of 1. The union is 19 − 4 + 1 = 16. Skipping the final addition would give 15, which undercounts a patch that does belong to the union. This is the inclusion-exclusion principle, and the two-rectangle case on this page is its shortest form. For more than three shapes it is usually easier to split the figure into non-overlapping pieces and add those.

Reproduce the checks

First area

Open the Rectangle calculator and enter:

Length
3
Width
2

Expected output:

Area

6

The common region is part of this area.

Second area

Open the Rectangle calculator and enter:

Length
4
Width
2

Expected output:

Area

8

The common region appears a second time.

Union from the stated overlap

Open the Basic calculator and enter:

First number
14
Operation
subtract
Second number
2

Expected output:

Result

12

Remove one duplicate contribution.

References and implementation scope

The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.

Sources

Related tasks