Union And Intersection

Compute the union, intersection, and set difference of two comma-separated sets instantly. Free online set theory calculator for students and professionals.

Compute set operations

About This Calculator

The Union And Intersection Calculator computes the union (A union B), intersection (A intersect B), and set differences (A - B and B - A) of two sets entered as comma-separated values. Simply type the elements of each set, and the calculator instantly displays all four set operations. This is an essential tool for set theory, discrete mathematics, probability, and data analysis.

Set operations are fundamental in mathematics and computer science. The union combines all unique elements from both sets, the intersection finds common elements, and the set differences show elements unique to each set. These operations form the basis of relational algebra, database queries, Venn diagrams, and probability theory. The calculator handles any string values including numbers, letters, and words.

This tool is ideal for students learning set theory and discrete mathematics, teachers preparing classroom demonstrations, and professionals working with data sets who need quick set comparisons. Results are displayed with standard mathematical notation including the union symbol union , intersection symbol intersect , and the empty set symbol empty when applicable.

How Set Operations Work

The union (A union B) includes every element that appears in set A, set B, or both. For example, if A = 3 and B = 5, then A union B = 5. The union always produces a set that is at least as large as each individual set. The intersection (A intersect B) contains only elements that are common to both sets -- using the same example, A intersect B = 3. If the sets share no common elements, the intersection is the empty set empty.

Set difference A - B (also written A \ B) includes elements that belong to A but not to B, while B - A includes elements in B but not in A. These operations are non-commutative: A - B is generally different from B - A. Together, these four operations provide a complete framework for comparing any two sets and understanding their relationships. Set operations are widely used in SQL database queries, where UNION, INTERSECT, and EXCEPT clauses combine query results, and in Python programming where set methods like .union(), .intersection(), and .difference() manipulate collections of data.

Regional Notes

Set theory is a universal branch of mathematics taught in middle school and high school curricula across India, the United States, and the United Kingdom. In India, set operations are introduced in Class 11 CBSE mathematics. In the US, they appear in pre-algebra and discrete mathematics courses. In the UK, set notation is part of the GCSE and A-Level mathematics syllabus. The mathematical notation used by this calculator ( union for union, intersect for intersection, empty for empty set) follows the international standard established by the International Union of Pure and Applied Chemistry (IUPAC) and is consistent across all three countries.

Frequently Asked Questions

What is the union of two sets?

The union of two sets A and B, denoted A union B, is the set containing all elements that are in A, in B, or in both. For example, if A = 3 and B = 5, then A union B = 5. The union combines all unique elements from both sets without duplication.

What is the intersection of two sets?

The intersection of two sets A and B, denoted A intersect B, is the set containing only elements that are common to both A and B. For example, if A = 3 and B = 5, then A intersect B = 3. If the sets share no common elements, the intersection is the empty set empty.

How do I use the union intersection calculator?

Enter the elements of Set A and Set B as comma-separated values in the input fields. For example, type '1, 2, 3, 4' for Set A and '3, 4, 5, 6' for Set B. Click Compute to see the union (A union B), intersection (A intersect B), and set differences (A - B and B - A) displayed instantly.

What is set difference?

The set difference A - B (also written A \\ B) contains all elements that are in A but not in B. For example, if A = 4 and B = 6, then A - B = 2 and B - A = 6. Set difference is not commutative -- A - B is generally different from B - A.

Is this set theory calculator free?

Yes, all calculators on Calculy are completely free to use with no registration or hidden charges. You can bookmark or share your union and intersection results via the URL.

What is the empty set?

The empty set, denoted empty or , is the unique set that contains no elements. It is a subset of every set. In the calculator, if the intersection or set difference has no elements, it is displayed as empty. The empty set is a fundamental concept in set theory and forms the basis for constructing all other sets.

Can I use words or letters as set elements?

Yes, the calculator works with any string values including numbers, letters, and words. Simply separate each element with a comma. For example, Set A could be 'apple, banana, cherry' and Set B could be 'banana, cherry, date'. The calculator will find the union, intersection, and differences regardless of element type.