Inclusion Exclusion Calculator - Union of Sets Size

Count each member once, even when sets overlap

Enter set sizes and inclusive intersection counts. Every pair includes members in its triple and four-way overlaps. Use whole numbers from 0 to 1 trillion; enter 0 for a known empty intersection.

Changing the number of sets loads a complete example for that mode.

Set sizes
Pair intersections
Triple intersections

Total distinct members surveyed, including those in none of the sets. Leave blank if unknown.

At least one set (union)

92

Distinct members in A ∪ B ∪ C

Exactly one set
69
At least two sets
23
None of the sets
28

How the union divides by membership

  • Exactly 1 set: 69
  • Exactly 2 sets: 18
  • Exactly 3 sets: 5

Each member appears in exactly one segment. Segment widths show proportions of the union. The union is 76.6667% of the universe.

Inclusion–exclusion steps

  1. Add set sizes: 120.
  2. Subtract pair intersections: 33.
  3. Add triple intersections: 5.

120 − 33 + 5 = 92

Adding the set sizes alone gives 120 memberships. Removing 28 repeated counts leaves 92 distinct members. Repeated counts and people in multiple sets are different quantities.

View all 7 exclusive regions
Each row excludes every set not named.
Membership only inCount
A30
B22
C17
A and B10
A and C5
B and C3
A and B and C5

How to Use This Calculator

  1. Choose Number of sets, then replace the example Set sizes with your counts.
  2. Fill Pair intersections and any Triple or Four-way intersections. Include members shared with additional sets.
  3. Optionally enter Universe size |U| to find the number in none of the sets.
  4. Read the union, membership breakdown, and alternating sum. Open the exclusive regions table to check each separate group.
average • 0 ratings
Your rating
Tap a star to rate

Your rating helps improve Inclusion Exclusion Calculator - Union of Sets Size. We store only an anonymized vote (no personal data).

Share this calculator

Help others solve their calculations

Found this calculator helpful? Share it with your friends, students, or colleagues who might need it!

Who Gets Counted Twice? An Inclusion Exclusion Calculator Guide

About the Author

Marko Šinko - Co-Founder & Lead Developer

Marko Šinko

Co-Founder & Lead Developer, AI Math Calculator

Lepoglava, Croatia
Advanced Algorithm Expert

Croatian developer with a Computer Science degree from University of Zagreb and expertise in advanced algorithms. Co-founder of award-winning projects, ensuring precise mathematical computations and reliable calculator tools.

📅 Published:
Inclusion Exclusion Calculator illustration with three overlapping circles and shaded intersections for counting distinct members

This Inclusion Exclusion Calculator answers “how many are in at least one group?” without counting a shared member twice. It takes the sizes of two, three, or four sets and their intersections, then reports the union and the number in exactly each possible number of sets. The questions below explain the alternating signs, distinguish “both” from “both only,” and show how to spot overlap data that cannot be true.

What Does an Inclusion Exclusion Calculator Add and Subtract?

For two sets, add their sizes and subtract their shared members: |A ∪ B| = |A| + |B| − |A ∩ B|. The vertical bars mean the number of distinct elements. The union symbol ∪ means “in either set, including both”; the intersection symbol ∩ means “in both.”

Suppose 60 people attended a morning workshop, 45 attended an afternoon workshop, and 20 attended both. Adding attendance gives 105, but those 20 people appear on both lists. Subtract their second appearances: 60 + 45 − 20 = 85 different people. Of those, 40 attended only the morning, 25 only the afternoon, and 20 both.

The inputs here are counts. If you have actual lists of names or numbers, the set calculator can perform operations on those elements. A repeated name inside one list must first be treated as one set member; inclusion–exclusion corrects overlap between sets, not unclean records within a set.

Why Add the Triple Intersection Back?

Follow one person who belongs to A, B, and C. Adding the three set sizes counts that person three times. Subtracting A ∩ B, A ∩ C, and B ∩ C removes the same person three times. Their running total is now zero. Adding A ∩ B ∩ C brings it back to one.

The three-set formula is |A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|. Someone in exactly two sets contributes 2 − 1 = 1; someone in just one contributes 1. Every membership pattern therefore receives the same final weight.

For four sets, a member shared by all four contributes 4 − 6 + 4 − 1 = 1. There are six pairs and four triples among four sets. The combination calculator gives those coefficients as C(4, 2) and C(4, 3). This also explains why the four-way intersection is subtracted rather than added. The MIT-hosted inclusion–exclusion handout states the two-set, three-set, and general rules.

How Many Join Exactly Two of Three Clubs?

Take three clubs with 50, 40, and 30 members. The inclusive pair counts are 15 for A and B, 10 for A and C, and 8 for B and C. Five people belong to all three. The union is 120 − 33 + 5 = 92 members.

Now ask a different question: exactly two clubs. Remove the five triple members from each pair. The exclusive pair regions are 15 − 5 = 10, 10 − 5 = 5, and 8 − 5 = 3. Their total is 18. Simply adding the pairs would give 33, overcounting by 15 because each of the five triple members appears three times.

For exactly one club, calculate each outer region separately. A only is 50 − 15 − 10 + 5 = 30. B only is 40 − 15 − 8 + 5 = 22. C only is 30 − 10 − 8 + 5 = 17. Together they give 69 people. Check the partition: 69 in one club + 18 in two + 5 in three = 92.

Two similar questions with different answers

“At least two clubs” includes the triple group: 18 + 5 = 23. “Extra memberships beyond one per person” counts each triple member twice: 18 + 2 × 5 = 28. That second number also equals 120 total memberships minus 92 distinct people.

A Venn diagram calculator is useful when you want to place those exclusive counts in separate regions. Keep the labels precise: a pairwise intersection includes the central triple region, while a pair-only region excludes it.

What Changes When There Are Four Sets?

Four sets require 15 counts: four singles, six pairs, four triples, and one four-way intersection. Write their totals as S₁, S₂, S₃, and S₄. Then the union is S₁ − S₂ + S₃ − S₄. The alternating pattern stays simple even though the input list gets longer.

For a concrete example, let every set have 40 members, every pair intersection 10, every triple intersection 4, and the four-way intersection 2. The union is 4 × 40 − 6 × 10 + 4 × 4 − 2 = 114. Subtracting the pairs and stopping would incorrectly give 100.

Check this by building the exclusive regions from the center outward. Exactly four sets contain 2 people. Each triple-only region has 4 − 2 = 2, giving 8 across the four triples. Each pair-only region has 10 − 4 − 4 + 2 = 4, giving 24 across six pairs. Each single-only region has 40 − 3 × 10 + 3 × 4 − 2 = 20, giving 80. Finally, 80 + 24 + 8 + 2 = 114.

A three-circle sketch cannot show all 15 regions for four arbitrary sets. A region table is easier to audit. For broader counting problems involving arrangements, selections, or restrictions, use the combinatorics calculator to distinguish the underlying counting methods.

Can You Find “None” Without a Survey Total?

No. The same three clubs with 92 distinct members could belong to a school of 120 or a school of 500. Their overlap counts do not identify the number outside all three. You need a universe U containing every person under consideration.

If 120 students were surveyed, none = 120 − 92 = 28. If all 120 students are equally likely to be selected, the probability of selecting a club member is 92/120 = 23/30, about 76.6667%. The probability of selecting someone in none is 28/120, about 23.3333%. These percentages sum to 100% because the two groups partition that survey.

The probability calculator covers event probabilities as a separate task. Do not divide by the total memberships, 120 in this club example, merely because it happens to equal the survey size. With a survey of 150, the correct denominator becomes 150 while total club memberships remain 120.

An empty universe is possible only when every set is empty. Its union and outside count are both zero, but a percentage would require 0/0 and is undefined. Showing 0% in that case would suggest a probability that has no defined sampling population.

Can a Positive Union Still Hide Impossible Data?

Yes. Suppose A, B, and C each contain 10 people, every pair contains 8, and nobody belongs to all three. The alternating sum gives 30 − 24 = 6, a positive number. Yet A alone contains 10 people, so the union cannot contain only 6.

The deeper contradiction appears inside A: eight members also belong to B and another eight belong to C. With no triple overlap, those are 16 different members inside a set of size 10. The A-only region becomes 10 − 8 − 8 = −6. Negative people reveal an impossible input combination.

For two sets, a quick check is 0 ≤ |A ∩ B| ≤ min(|A|, |B|). If the universe is known, the intersection must also be at least |A| + |B| − |U| whenever that number is positive. With 60 and 45 attendees inside a universe of 100, at least 5 must overlap.

For three and four sets, check every exclusive region, not just whether each intersection is smaller than its parent sets. The calculator works backward through the intersections and withholds a union when a region would be negative. Missing data is different from contradictory data: leaving a triple count blank does not establish that it is zero. Ask for the missing overlap or derive it from another known total before claiming an exact answer.

Frequently Asked Questions

How do I find a missing intersection if I know the union?

For two sets, rearrange the rule to get |A ∩ B| = |A| + |B| − |A ∪ B|. If the set sizes are 35 and 28 and the union is 50, the intersection is 13. Enter the derived intersection with the set sizes to check the complete breakdown.

Does an intersection include people who belong to other sets too?

Yes, an inclusive intersection counts everyone in the named sets, even if they also belong to additional sets. If 12 people belong to A and B only and 3 belong to all three sets, enter 15 for |A ∩ B|. Enter 3 separately for |A ∩ B ∩ C|.

Is inclusion–exclusion the same as the multiplication principle?

No, inclusion–exclusion counts the union of overlapping groups, while the multiplication principle counts choices made in stages. Choosing one of 4 shirts and one of 3 hats gives 4 × 3 = 12 outfits. Counting people who own a shirt or a hat requires set sizes and their overlap instead.

Can I add customer counts from different mailing lists?

You can add them directly only when no customer appears in more than one list. Lists of 800 and 600 customers with 250 shared customers reach 1,150 distinct customers. Use the same customer identifier and reporting date across lists before calculating intersections.

What happens if one set is entirely inside another?

The union of the two sets is the larger set. If A has 70 members and B has 25, all inside A, their intersection is 25 and the union is 70 + 25 − 25 = 70. The B-only region is zero, which is a valid result.

Can I assume a missing triple intersection is zero?

No, a missing triple count is unknown unless the problem explicitly rules out members in all three sets. Three sets of size 10 with each pair intersection equal to 5 can have a triple intersection of either 0 or 5; their unions would be 15 and 20 respectively. Pair counts alone do not always determine a three-set union.

Can I enter percentages instead of whole-number counts?

This calculator accepts integer set sizes from 0 to 1 trillion, not decimal probabilities or percentages. If 37.5% of a 200-person survey belongs to A, enter 75 for A and 200 for the universe. Every intersection must refer to that same survey population.

How many intersection counts do I need for four sets?

Four sets need 6 pair counts, 4 triple counts, and 1 four-way count, in addition to the 4 individual set sizes. That makes 15 required inputs. Enter zero only for intersections known to be empty; the calculator does not infer missing overlaps.