Union and intersection are the two fundamental operations in set theory. They show up in probability, logic, database queries, and computer science.
Calculate the union, intersection, difference, and symmetric difference of two sets with clear step-by-step results.
Enter numbers, words, or other values separated by commas or new lines.
Values are compared as exact text; duplicate values are removed.
Calculation Results
Union: A ∪ B
Intersection: A ∩ B
Difference: A − B
Difference: B − A
Symmetric Difference: A △ B
Step-by-Step Solution
Symmetric difference: (A − B) ∪ (B − A)
The union and intersection calculator takes two or more sets and returns their combined or overlapping elements instantly.
This guide covers what union and intersection mean, the symbols and notation, how to use a union and intersection calculator step by step, the inclusion-exclusion principle, Venn diagram connections, common mistakes, and practical applications. For related math tools, you may also find our complex root calculator and Descartes’ rule of signs calculator useful.
What Are Union and Intersection?
Union (∪)
The union of two sets A and B is the set of all elements that are in A, in B, or in both.
A ∪ B = {x : x ∈ A or x ∈ B}
Intersection (∩)
The intersection of two sets A and B is the set of all elements that are in both A and B.
A ∩ B = {x : x ∈ A and x ∈ B}
Why They Matter
Union and intersection model “or” and “and” logic. They are the foundation of probability, Boolean algebra, and database queries.
The Symbols
| Symbol | Name | Meaning |
|---|---|---|
| ∪ | Union | In A or B (or both) |
| ∩ | Intersection | In A and B |
| ∈ | Element of | Belongs to |
| ∉ | Not element of | Does not belong |
Union and Intersection Calculator: What It Computes
A union and intersection calculator handles several tasks:
- Union — combine all elements
- Intersection — find common elements
- Difference — elements in A but not B
- Symmetric difference — elements in exactly one set
- Complement — elements not in the set
- Cardinality — count elements in each result
Input Options
Most calculators accept:
- Two or more sets — entered as lists
- A universal set — for complement operations
- Set notation — for symbolic input
Output Format
Quality calculators display:
- The result set
- The cardinality
- Venn diagram representation
- Step-by-step element comparison
Quick Reference: Inputs and Outputs
| A | B | A ∪ B | A ∩ B |
|---|---|---|---|
| {1, 2, 3} | {3, 4, 5} | {1, 2, 3, 4, 5} | {3} |
| {a, b} | {c, d} | {a, b, c, d} | ∅ |
| {1, 2} | {1, 2} | {1, 2} | {1, 2} |
| {1, 2, 3} | {4, 5} | {1, 2, 3, 4, 5} | ∅ |
The Formulas Behind the Union and Intersection Calculator
Cardinality of Union
For two sets:
|A ∪ B| = |A| + |B| − |A ∩ B|
This is the inclusion-exclusion principle. Subtracting |A ∩ B| corrects for double-counting.
Cardinality of Intersection
There is no simple formula for |A ∩ B| in terms of |A| and |B| alone. You must identify the common elements.
For Three Sets
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|
Difference
A − B = {x : x ∈ A and x ∉ B}
Symmetric Difference
A △ B = (A − B) ∪ (B − A)
Complement
A’ = {x : x ∈ U and x ∉ A}
Formula Reference Table
| Operation | Notation | Definition |
|---|---|---|
| Union | A ∪ B | In A or B |
| Intersection | A ∩ B | In A and B |
| Difference | A − B | In A, not B |
| Symmetric difference | A △ B | In exactly one |
| Complement | A’ | Not in A |
Step-by-Step: Using a Union and Intersection Calculator
Step 1: Enter the Sets
List the elements of each set. Order does not matter, and duplicates should be removed.
Step 2: Choose the Operation
Select union, intersection, difference, or another operation.
Step 3: Compare Elements
The calculator compares each element across sets.
Step 4: Read the Result
The result set is displayed, often with a count.
Step 5: Verify Manually
Check a few elements to confirm the result.
Step 6: Visualize with a Venn Diagram
A Venn diagram makes the relationship clear.
Union and Intersection Calculator: Special Cases
Disjoint Sets
If A ∩ B = ∅, the sets are disjoint. Their union is just the combination of all elements.
Subset Relationship
If A ⊆ B, then A ∪ B = B and A ∩ B = A.
Equal Sets
If A = B, then A ∪ B = A and A ∩ B = A.
Empty Set
A ∪ ∅ = A and A ∩ ∅ = ∅.
Summary Table
| Case | Union | Intersection |
|---|---|---|
| Disjoint | All elements | ∅ |
| A ⊆ B | B | A |
| A = B | A | A |
| With ∅ | A | ∅ |
The Inclusion-Exclusion Principle
The inclusion-exclusion principle is the key formula for counting union cardinality.
For Two Sets
|A ∪ B| = |A| + |B| − |A ∩ B|
For Three Sets
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|
Why It Works
Adding |A| + |B| double-counts the intersection. Subtracting |A ∩ B| corrects this. For three sets, the triple intersection is subtracted three times and must be added back once.
Example
|A| = 10, |B| = 8, |A ∩ B| = 3
|A ∪ B| = 10 + 8 − 3 = 15
Venn Diagram Connection
Venn diagrams visualize union and intersection.
Two-Set Venn Diagram
- Left circle: A
- Right circle: B
- Overlap: A ∩ B
- Entire shaded area: A ∪ B
Three-Set Venn Diagram
- Three overlapping circles
- Seven regions (excluding the outside)
- Each region corresponds to a specific combination of membership
Why It Matters
Venn diagrams make abstract set operations concrete and are widely used in probability and logic.
Practical Applications
Probability
P(A ∪ B) = P(A) + P(B) − P(A ∩ B).
Database Queries
SQL JOIN operations correspond to intersections. UNION combines result sets.
Computer Science
Set operations are used in algorithms for search, filtering, and matching.
Logic
Union corresponds to OR. Intersection corresponds to AND.
Data Analysis
Finding common customers, overlapping interests, or shared attributes uses set operations.
Common Mistakes and How to Avoid Them
Mistake 1: Double-Counting in Union
Adding |A| + |B| without subtracting |A ∩ B| overcounts.
Solution: Use the inclusion-exclusion formula.
Mistake 2: Confusing Union and Intersection
Union is “or.” Intersection is “and.”
Solution: Remember: union combines, intersection overlaps.
Mistake 3: Forgetting the Empty Set
If there are no common elements, A ∩ B = ∅.
Solution: Check each element carefully.
Mistake 4: Ignoring Duplicates
Sets do not have duplicates.
Solution: Remove duplicates before computing.
Mistake 5: Misapplying Complement
Complement requires a universal set.
Solution: Define U before computing complements.
Union and Intersection Calculator with Steps: What to Expect
Quality step-by-step tools show:
- The input sets
- The operation selected
- Element-by-element comparison
- The result set
- Cardinality
- Venn diagram
Related Calculators on Our Site
- Complex Root Calculator — for solving characteristic equations with complex roots
- Descartes’ Rule of Signs Calculator — for analyzing polynomial root patterns
- Bessel Function Calculator — for advanced engineering applications
- Pythagorean Theorem Equation Calculator — for basic geometry checks
- Average Percentage Calculator — for statistical analysis
- Relative Change Calculator — for measuring change between values
- Percentage Decrease Calculator — for calculating reductions
- Percentage Point Calculator — for difference between percentages
- Time Percentage Calculator — for time-based percentage calculations
- Percent to Goal Calculator — for tracking progress toward targets
- Doubling Time Calculator — for exponential growth problems
- Free Online Calculator Tools — for a full suite of math tools
Frequently Asked Questions
1. What is a union and intersection calculator used for?
It computes the union, intersection, and related operations on two or more sets.
2. What is the union of two sets?
The union is the set of all elements in either set.
3. What is the intersection of two sets?
The intersection is the set of elements common to both sets.
4. What is the difference between union and intersection?
Union is “or” (all elements). Intersection is “and” (common elements).
5. What is the inclusion-exclusion principle?
|A ∪ B| = |A| + |B| − |A ∩ B|. It corrects for double-counting.
6. What are disjoint sets?
Sets with no common elements. A ∩ B = ∅.
7. What is the complement of a set?
Elements in the universal set but not in the given set.
8. What is the symmetric difference?
Elements in exactly one of the two sets: (A − B) ∪ (B − A).
9. Can a union be empty?
Only if both sets are empty.
10. Can an intersection be empty?
Yes, if the sets are disjoint.
11. How do I use a Venn diagram for union and intersection?
The overlap is the intersection. The entire shaded area is the union.
12. What is the cardinality of a union?
|A ∪ B| = |A| + |B| − |A ∩ B|.
13. How accurate are union and intersection calculators?
They are exact. Set operations involve no approximation.
14. Can the calculator handle more than two sets?
Yes. Many calculators support three or more sets.
15. What tools can I use besides an online calculator?
Python’s set operations, MATLAB, and database query languages all handle union and intersection.
Call to Action
Ready to compute any union or intersection instantly? Try our free Union and Intersection Calculator to combine sets, find common elements, and visualize results with Venn diagrams. Whether you are studying probability or writing a database query, our tool makes set operations clear.
Launch the Union and Intersection Calculator →
You May Also Like
- Complex Root Calculator: The Complete Guide for Students and Engineers
- Descartes’ Rule of Signs Calculator: Find Positive and Negative Real Roots Fast
- Bessel Function Calculator: The Complete Guide for Engineers and Scientists