Understanding Set Operations

A set is any collection of distinct objects, called elements. Sets appear throughout mathematics, computer science, and statistics—from grouping survey respondents to defining solution spaces in algebra.

Two fundamental operations manipulate sets:

  • Union (A ∪ B) — produces every element that appears in set A, set B, or both. The result is always at least as large as the largest input set.
  • Intersection (A ∩ B) — produces only elements present in all input sets simultaneously. The result never exceeds the size of the smallest input set.

You can input sets in two ways: as individual elements (e.g., {1, 3, 5, 7}) or as intervals on the number line (e.g., [2, 10]). The calculator handles up to three sets, letting you explore operations like A ∪ B ∩ C step by step.

Set Operation Definitions

Formally, union and intersection are defined using membership notation. An element x belongs to the union if it satisfies at least one condition; it belongs to the intersection only if it satisfies all conditions.

A ∪ B = {x : x ∈ A or x ∈ B}

A ∩ B = {x : x ∈ A and x ∈ B}

  • A, B — Input sets
  • x — An element being tested for membership
  • — Symbol meaning 'is an element of'
  • — Union operator
  • — Intersection operator

Working With Intervals and Discrete Sets

When your sets consist of individual items (numbers, names, categories), list each element separately. The calculator identifies duplicates and removes them, ensuring each element appears once in the result.

For continuous intervals like [1, 5] or (0, 10), endpoints matter:

  • Closed bracket [a] — the endpoint is included
  • Open bracket (a) — the endpoint is excluded

The union of two intervals spans from the leftmost starting point to the rightmost endpoint. The intersection exists only where both intervals overlap; if they don't overlap, the intersection is empty.

Example: [1, 4] ∪ [3, 7] = [1, 7], but [1, 3] ∩ [4, 6] = ∅ (empty).

Key Properties of Union and Intersection

These operations obey important algebraic laws that simplify complex expressions:

  • Commutativity — A ∪ B = B ∪ A and A ∩ B = B ∩ A. The order of operands doesn't matter.
  • Associativity — (A ∪ B) ∪ C = A ∪ (B ∪ C). Grouping doesn't affect the result when all operations are the same type.
  • Distributivity — Union distributes over intersection: A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C), and vice versa.
  • Identity elements — Any set unioned with the empty set (∅) remains unchanged. Any set intersected with ∅ yields ∅.

These properties are essential in logic, set theory, and when simplifying database queries involving multiple filters.

Common Pitfalls and Practical Notes

Avoid these frequent mistakes when computing unions and intersections:

  1. Confusing union with intersection — Union is the 'inclusive OR'—include elements from any set. Intersection is the logical 'AND'—only elements in every set count. A quick test: is the result bigger or smaller than the input sets? Union grows (or stays equal); intersection shrinks (or stays equal).
  2. Forgetting duplicates in discrete sets — If sets A = {1, 2, 3} and B = {2, 3, 4}, the union is {1, 2, 3, 4}, not {1, 2, 3, 2, 3, 4}. Each element appears exactly once. Always remove duplicates before reporting your result.
  3. Mishandling interval endpoints — [1, 5] includes 1 and 5; (1, 5) excludes both. When combining intervals, track whether endpoints are included. [1, 3] ∩ [3, 5] = {3} (the point 3 alone), not empty, because both intervals include the endpoint 3.
  4. Assuming non-empty results — If two discrete sets share no elements, their intersection is the empty set ∅. If two intervals don't overlap (e.g., [1, 2] and [3, 4]), their intersection is empty. Always verify that the result makes sense given your input.

Frequently Asked Questions

What's the practical difference between union and intersection?

Union gathers all options from multiple choices—useful when asking 'what could be included?' Intersection identifies common ground—useful for 'what fits all criteria?' For instance, if set A lists employees who speak French and set B lists employees with a degree, then A ∩ B gives bilingual graduates, while A ∪ B gives all employees with at least one qualification.

Can the intersection of two sets be larger than their union?

No. The intersection can never exceed the union. Mathematically, A ∩ B ⊆ A ⊆ A ∪ B. The intersection contains only shared elements; the union contains shared elements plus those unique to each set. In the extreme case where the sets are identical, intersection equals union.

How do I find the union of intervals with different notations?

Convert all intervals to use consistent bracket notation first. [1, 5] ∪ (3, 7] = [1, 7] because the union spans from the leftmost point (1, included) to the rightmost (7, included). The union takes the least restrictive endpoint: if either interval includes an endpoint, the union includes it.

What happens if I apply union or intersection to more than two sets?

The operations extend naturally. A ∪ B ∪ C includes every element in at least one set. A ∩ B ∩ C includes only elements in all three. You evaluate left-to-right: first compute A ∪ B, then union that result with C. Since union and intersection are associative, the grouping doesn't affect the final answer.

Are there real-world uses for set union and intersection?

Yes, constantly. Database queries use intersection to filter records matching multiple criteria (e.g., 'customers in London AND purchased in Q3'). Search engines use union to show results matching any keyword. Marketing teams use intersection to find audiences matching all demographic filters. Software testing uses both to analyze which code paths execute under different conditions.

What if one set is entirely contained within another?

If A ⊂ B (A is a proper subset of B), then A ∪ B = B and A ∩ B = A. The union equals the larger set; the intersection equals the smaller set. This is intuitive: combining sets when one fits inside the other doesn't add elements; finding common elements when one set is fully inside the other just returns the smaller set.

More math calculators (see all)