Set operations
Two sets sitting side by side raise an obvious question: what can you build out of them together? Set operations — union, intersection, difference, and complement — are the four basic tools for combining and comparing sets, and a Venn diagram turns each one into a picture you can shade and read off directly. This article takes those four operations, works through their standard properties (especially De Morgan's laws for the complement), and shows the counting rule that turns overlapping-group word problems — "how many students study at least one subject" — into a two-line calculation. The same ideas extend cleanly to three sets, where a rectangle with three overlapping circles splits into eight distinct regions, each one a specific combination of memberships. Everything here builds directly on subsets and intervals, and feeds forward into relations and functions, where pairs of elements from two sets are combined the same way.
Union, intersection, difference, and complement combine sets in four distinct ways, and the counting rule turns Venn-diagram overlaps into exact counts.
The core idea
Let and be subsets of a universal set , the set of everything under discussion in a given problem. Each operation below takes one or two sets and produces a new set.
Union collects everything that belongs to or (or both) — the elements you get by merging the two sets:
where: ranges over , and "or" is inclusive — an element in both sets is still counted once in the union.
Intersection keeps only what is shared — elements that belong to and simultaneously:
When , the two sets share nothing, and are called disjoint. Disjoint sets simplify every counting formula below, since the overlap term vanishes.
Difference keeps what is in but strips out anything also in :
Difference is not symmetric — swapping the sets generally changes the answer, so except in special cases (for instance, when the two sets are disjoint, both differences just return the original set).
Complement flips the question around: instead of describing a set directly, it describes everything in that is left out of :
The complement always depends on which universal set you have fixed — the same set has a different complement in a larger or smaller universe. Five identities about complement are worth memorising outright, since they get quoted rather than re-derived in exams:
where: the first pair says and its complement together rebuild with no overlap; the middle says complementing twice returns you to the start; the last pair are the two boundary cases.
De Morgan's laws connect complement to union and intersection, and are the single most exam-tested identity in this topic:
where: taking the complement of a union or intersection swaps the operation — union becomes intersection and vice versa — while also complementing each set individually. In a Venn diagram, is a rectangle and each set is a circle inside it; the region you shade for a given expression is read off by combining the basic shapes for union (everything covered), intersection (only the overlap), difference (one circle minus the overlap), and complement (everything outside a circle, still inside the rectangle). With three sets , , drawn as three overlapping circles, the rectangle splits into eight distinct regions — including the region outside all three circles — and any compound expression such as or is identified by shading exactly the regions that satisfy it.
The goal is to derive from first principles, showing exactly why a plain sum overcounts, and why subtracting the intersection once — not twice — fixes it; this is the formula that turns Venn diagrams into an arithmetic tool for word problems about overlapping groups.
Step 1. Split into three non-overlapping pieces using a Venn diagram: the part of not in (call it ), the part of not in (), and the shared middle (). These three regions have no elements in common, and together they make up all of , so their counts simply add: .
Step 2. Rewrite in terms of . The set itself splits into two non-overlapping pieces, and , so , which rearranges to . By the same reasoning applied to , .
Step 3. Substitute both back into the Step 1 equation: . Two of the three terms cancel, leaving exactly one behind.
Step 4. Read off the result: . The intuition matches the arithmetic — adding and counts every element of twice, once in each set, so subtracting once removes exactly the duplicate count and leaves each element counted once. When and are disjoint, and the rule collapses to plain addition, .
Worked example
Problem. In a class of 50 students, 30 study Mathematics, 25 study Physics, and 12 study both. Using set operations, find how many students study (a) at least one of the two subjects, and (b) neither subject.
Step 1. Name the sets: let be the set of students studying Mathematics and the set studying Physics, both subsets of the universal set of all 50 students in the class. Given , , , and .
Step 2. "At least one of the two subjects" is exactly the union . Apply the counting rule derived above:
Step 3. "Neither subject" is everything outside the union, which is the complement relative to the class of 50:
Step 4. Sanity-check with a quick split: of the 43 studying at least one subject, study only Mathematics, study only Physics, and study both, giving — matching Step 2. Answer: 43 students study at least one subject, and 7 study neither.
Competitive stretch
If a third subject, Chemistry, is added with and known overlaps, the same reasoning extends to — add the three individual counts, subtract each pairwise overlap once (removing the double-count), then add back the triple overlap once (since it was subtracted three times but belongs in the union exactly once).
Common traps
- Treating as the same as — difference is not symmetric; always check which set is being subtracted from which.
- Forgetting to subtract the overlap in , which silently double-counts every element common to both sets.
- Misapplying De Morgan's laws by not swapping the operation: becomes , not — the symbol must flip along with taking the complement.
- Assuming two sets are disjoint just because a hastily drawn Venn diagram shows non-overlapping circles, when the given data actually implies elements in common.
Ask the tutor: Not sure which region of a Venn diagram to shade for a compound expression like ? Ask the AI tutor to walk through it region by region.
Why does subtracting the intersection only once fix the overcount in the union formula?
Adding and counts every element that lies in both sets twice — once as a member of , once as a member of — while every element in only one set is counted correctly, once. Subtracting removes exactly one of those two extra counts for each shared element, leaving it counted once overall, which is what a union should give. That is also exactly what the derivation above shows algebraically by splitting the union into three disjoint pieces.
How do I know whether a word problem wants union, intersection, or difference?
Look at the connecting word. "At least one," "either," or "in total" almost always means union. "Both," "common to," or "study all of" means intersection. "Only," "just," or "but not" means difference — for example "students studying Mathematics but not Physics" is . "Neither" or "none of" means the complement of a union. Underlining the key word in the question before choosing a set operation avoids most mix-ups.
Do the union and intersection counting rules only work for exactly two sets?
No, but the formula grows more intricate for more sets. For two sets it is ; for three sets you add the three individual counts, subtract every pairwise intersection once, then add back the triple intersection once, since it was removed three times by the pairwise subtractions but should appear exactly once in the final union. The underlying idea — count everything, remove duplicates, restore anything removed too many times — is the same reasoning at any number of sets, even though writing out the formula for four or more sets quickly becomes unwieldy.