Set Operations: Union, Intersection, Difference, Symmetric Difference and Complement with Worked Examples
Use one fixed Venn partition to compute five set operations, verify De Morgan's laws, solve an 80-student survey, and repair common exam mistakes.
KnowledgeGate Team
Exam prep & CS education

Set-operation symbols are short, but small reading errors change the answer. You may reverse A - B, confuse symmetric difference with intersection, or take a complement before fixing the universe. Union, intersection, difference, symmetric difference, and complement follow from the fixed sets, with numerical results, cardinality identities, and membership checks; see GATE CS Exam Preparation for the wider subject path. Throughout, fix U = {1,2,3,4,5,6,7,8,9,10}, A = {1,2,3,5,8}, and B = {2,4,5,6,8,9}.
Set operations begin with membership and a fixed universe
A set contains distinct elements. Order and repetition do not change it, so {1,2,2,3} = {3,2,1}. The notation x ∈ A means x belongs to A, while x ∉ A means it does not. A subset has no element outside its parent set, the empty set ∅ has no elements, and the universal set U fixes the discussion.
Our universe separates into four disjoint regions:
A only:
{1,3}A and B:
{2,5,8}B only:
{4,6,9}Neither:
{7,10}
Their sizes give the whole-universe check 2 + 3 + 3 + 2 = 10 = |U|. For subsets, power sets, three-set inclusion-exclusion and Cartesian products, use Set Theory in Discrete Mathematics: Laws & Worked Examples. Return to the fixed A/B partition when the question asks which elements survive a two-set operator.
Union and intersection mean inclusive OR and shared membership
The union is A ∪ B = {x : x ∈ A or x ∈ B}. Mathematical OR is inclusive, so an element may be in A, B, or both. Listing each element once gives:
A ∪ B = {1,2,3,4,5,6,8,9}.
The overlap has three elements, so inclusion-exclusion confirms the size:
|A ∪ B| = |A| + |B| - |A ∩ B| = 5 + 6 - 3 = 8.
The intersection is A ∩ B = {x : x ∈ A and x ∈ B} = {2,5,8}. Element checks make the distinction concrete: 3 is in the union but not the intersection, 2 is in both, and 7 is in neither.
Union and intersection are commutative, associative and idempotent. Reversing A and B still gives the same eight-element union and {2,5,8} as the intersection. Combining A with itself checks A ∪ A = A and A ∩ A = A.

Set difference is directional
Set difference means A - B = {x : x ∈ A and x ∉ B}. Start with A and remove the common elements {2,5,8}:
A - B = {1,2,3,5,8} - {2,5,8} = {1,3}.
Reversing direction starts from B, so B - A = {4,6,9}. Difference is not commutative. The minus sign removes elements; it does not subtract their values.
Once the universe is fixed, difference can also be written as A - B = A ∩ B^c and B - A = B ∩ A^c. Check individual elements before accepting an answer: 1 is in A - B, 4 is in B - A, and 2 is in neither difference because it belongs to both sets.
Symmetric difference means exactly one set
The symmetric difference A Δ B keeps elements that occur in exactly one set. Two equivalent forms are:
A Δ B = (A - B) ∪ (B - A) = (A ∪ B) - (A ∩ B).
The first form gives {1,3} ∪ {4,6,9} = {1,3,4,6,9}. For the second, remove {2,5,8} from {1,2,3,4,5,6,8,9} to obtain the same set. Its size checks the result:
|A Δ B| = |A| + |B| - 2|A ∩ B| = 5 + 6 - 2(3) = 5.
Union includes the overlap. Intersection keeps only the overlap. Symmetric difference excludes it. Symmetric difference is commutative, but ordinary set difference is not.
Complement depends on the universe
The complement of A contains everything in U that is not in A. With the fixed universe, A^c = U - A = {4,6,7,9,10} and B^c = U - B = {1,3,7,10}.
With U' = {1,2,3,4,5,6,7,8,9,10,11,12} and the same A, its complement becomes {4,6,7,9,10,11,12}. A complement is incomplete until U is known.
De Morgan's laws can be checked directly from the regions. First, (A ∪ B)^c = {7,10}, while A^c ∩ B^c = {7,10}. Second, (A ∩ B)^c = {1,3,4,6,7,9,10}, and A^c ∪ B^c produces exactly that set.
The boundary checks are just as useful: (A^c)^c = A, U^c = ∅, and ∅^c = U. Each says that complement switches membership relative to the same fixed universe.
Set operations worked example: at least one, exactly one and neither
Suppose a class has 80 students. Of these, 48 study C, 35 study Java, and 20 study both. Inclusion-exclusion gives the number studying at least one language:
|C ∪ J| = 48 + 35 - 20 = 63.
Now calculate every disjoint region:
C only:
48 - 20 = 28Java only:
35 - 20 = 15Exactly one:
28 + 15 = 43Neither:
80 - 63 = 17
The partition check closes the calculation: 28 + 20 + 15 + 17 = 80. In question language, "at least one" means union, "both" means intersection, "C but not Java" means difference, "exactly one" means symmetric difference, and "neither" means the complement of the union.

Set-operation patterns and traps to check before answering
Typical tasks ask you to list a result, evaluate a nested expression, simplify an identity, or recover Venn-region counts. Here, (A Δ B) ∩ A = {1,3} because only the A-only region survives. Also, (A ∪ B) - (A ∩ B) = {1,3,4,6,9} = A Δ B.
Trap | Wrong move | Repair |
|---|---|---|
Reversing | Starting from B | Start from A, then remove the overlap |
Reading OR as exactly one | Dropping the overlap from the union | Include all three circle regions |
Miscounting a union | Adding | Subtract the overlap once |
Writing a complement alone | Assuming its outside region | State U before taking the complement |
Confusing | Keeping common elements | Keep the two only-regions and exclude the overlap |
For practice, use Set Theory and Relations MCQs: 12 Solved (GATE); the practice bank has over 100 Set Operations questions. Then move from membership logic to formal operators with Propositional and Predicate Logic: Truth Tables to Proofs.
Set operations in one short checklist and the next step
Union means at least one.
Intersection means both.
A - Bmeans in A but not in B.Symmetric difference means exactly one.
Complement means outside the set but inside the stated universe.
For a 30-second answer check, write U, partition the Venn regions, compute only the requested regions, remove duplicate elements, and confirm that disjoint counts recover the universe total. Here, 2 + 3 + 3 + 2 = 10 and 28 + 20 + 15 + 17 = 80 both pass.
For a structured next step across the wider foundation, use Engineering Mathematics for GATE. In every problem, fix the universe, translate words into regions, and run membership and cardinality checks.
Keep learning

Onto (Surjective) Functions: Definition, Counting Formula and Properties
Learn how to test whether a function is onto, count finite surjections, handle boundary cases and apply the main properties through one consistent worked example.

One-to-One (Injective) Function: Definition, Counting Formula, Properties and Worked Examples
Learn how to identify and count injective functions, handle common restrictions, and prove their key composition and inverse properties with clear examples.

Graphical Method in Linear Programming: Feasible Region, Corner Points and Optimality with a Worked Example
Learn the two-variable graphical method in the right order, then solve and audit a complete maximisation model without trusting the sketch alone.

Duality in LP: Construct the Dual, Solve a Worked Example, and Apply Key Properties
Learn a reliable matrix-first method to form an LP dual, solve both programs to value 21, and use duality properties to check optimality and avoid sign errors.