Operations on sets

Just as numbers can be added, subtracted, or combined, sets can be combined too — using union, intersection, and difference, the three basic operations that build new sets out of old ones. A gym roster and a swim roster overlap in exactly the people who do both sports; the "or" list and the "and" list are different sets, built by different rules, and mixing them up is the most common mistake in this topic. Once the three operations and a handful of algebraic properties are fixed, a single counting formula — n(A∪B)=n(A)+n(B)−n(A∩B)n(A \cup B) = n(A) + n(B) - n(A \cap B) — turns messy "how many students play at least one game" word problems into a two-line calculation. This section builds the operations from their definitions, proves why the counting formula must subtract the overlap, and works through both a roster-form example and a survey word problem end to end.

The core insight

Union collects every element in AA or BB, intersection keeps only elements in both, difference A−BA-B keeps elements of AA that are not in BB, and for finite sets n(A∪B)=n(A)+n(B)−n(A∩B)n(A \cup B) = n(A) + n(B) - n(A \cap B) corrects for double-counting the overlap.

The core idea

For sets AA and BB, both subsets of some universal set UU, three operations combine them into new sets.

Union. A∪BA \cup B collects every element that belongs to AA or BB (or both) — think of it as the merged, "either list" set:

A∪B={x:x∈A or x∈B}A \cup B = \{x : x \in A \text{ or } x \in B\}

where: xx ranges over the universal set UU, and "or" is inclusive — an element that is in both sets still belongs to the union only once, since a set never lists a member twice.

Intersection. A∩BA \cap B keeps only elements that belong to both AA and BB — the "shared, and list" set:

A∩B={x:x∈A and x∈B}A \cap B = \{x : x \in A \text{ and } x \in B\}

If A∩B=∅A \cap B = \varnothing (the empty set), AA and BB have nothing in common and are called disjoint.

Difference. A−BA - B (also written A∖BA \setminus B) keeps elements that are in AA but not in BB — everything left after removing the overlap from AA:

A−B={x:x∈A and x∉B}A - B = \{x : x \in A \text{ and } x \notin B\}

Crucially, A−B≠B−AA - B \neq B - A in general: removing BB's elements from AA is not the same operation as removing AA's elements from BB, so each must be computed separately from its own definition. These three operations obey algebraic properties that follow directly from the definitions and are easy to check by shading a Venn diagram: union and intersection are commutative (A∪B=B∪AA \cup B = B \cup A, A∩B=B∩AA \cap B = B \cap A); combining with the empty set gives A∪∅=AA \cup \varnothing = A and A∩∅=∅A \cap \varnothing = \varnothing; combining with the universal set gives A∪U=UA \cup U = U and A∩U=AA \cap U = A; both operations are idempotent, A∪A=AA \cup A = A and A∩A=AA \cap A = A; and if A⊆BA \subseteq B, then A∪B=BA \cup B = B and A∩B=AA \cap B = A, since BB already contains everything AA has to offer.

Figure
Two overlapping circles A and B inside a rectangle U with the union intersection and difference regions shaded separately
Union, intersection and difference of two sets A and B A union B A B everything in A or B A intersection B A B only the shared part A minus B A B A with B removed

Worked example

Let A={2,4,6,8,10}A = \{2, 4, 6, 8, 10\} and B={4,8,12,16}B = \{4, 8, 12, 16\}. Find A∪BA \cup B, A∩BA \cap B, A−BA - B, and B−AB - A, and confirm that A−B≠B−AA - B \neq B - A.

Step 1 — Union. Combine all elements from both sets, listing each only once: A∪B={2,4,6,8,10,12,16}A \cup B = \{2, 4, 6, 8, 10, 12, 16\}.

Step 2 — Intersection. Scan for elements appearing in both lists: 44 and 88 appear in both, so A∩B={4,8}A \cap B = \{4, 8\}.

Step 3 — Difference A−BA - B. Remove from AA any element also in BB: from A={2,4,6,8,10}A = \{2,4,6,8,10\}, drop 44 and 88, leaving A−B={2,6,10}A - B = \{2, 6, 10\}.

Step 4 — Difference B−AB - A. Remove from BB any element also in AA: from B={4,8,12,16}B = \{4,8,12,16\}, drop 44 and 88, leaving B−A={12,16}B - A = \{12, 16\}.

Result: A−B={2,6,10}A - B = \{2, 6, 10\} while B−A={12,16}B - A = \{12, 16\} — the two sets are completely different, confirming set difference is not commutative.

Competitive stretch

The same two sets can also verify the union-cardinality formula developed below: n(A)=5n(A) = 5, n(B)=4n(B) = 4, n(A∩B)=2n(A \cap B) = 2, so n(A∪B)n(A \cup B) should equal 5+4−2=75 + 4 - 2 = 7. Counting A∪B={2,4,6,8,10,12,16}A \cup B = \{2, 4, 6, 8, 10, 12, 16\} directly gives exactly 77 elements — the formula and the direct listing agree, which is a fast way to self-check any union computation.

Derivation AWhy the union count must subtract the intersection count

The goal is to show, by carefully tracking how each element of A∪BA \cup B gets counted when the sizes n(A)n(A) and n(B)n(B) are simply added together, that subtracting n(A∩B)n(A \cap B) is not an arbitrary correction but the exact fix needed to count every element of A∪BA \cup B precisely once.

Step 1. Split A∪BA \cup B into three disjoint pieces that together account for every element exactly once: elements only in AA (that is, A−BA - B), elements only in BB (that is, B−AB - A), and elements in both (that is, A∩BA \cap B). Since these three pieces share no elements with each other, n(A∪B)=n(A−B)+n(B−A)+n(A∩B)n(A \cup B) = n(A - B) + n(B - A) + n(A \cap B).

Step 2. Now look at n(A)n(A) alone. Every element of AA is either only in AA or also in BB, so AA itself splits into A−BA - B and A∩BA \cap B, giving n(A)=n(A−B)+n(A∩B)n(A) = n(A - B) + n(A \cap B). Similarly, n(B)=n(B−A)+n(A∩B)n(B) = n(B - A) + n(A \cap B).

Step 3. Add these two equations: n(A)+n(B)=n(A−B)+n(A∩B)+n(B−A)+n(A∩B)=[n(A−B)+n(B−A)+n(A∩B)]+n(A∩B)n(A) + n(B) = n(A-B) + n(A \cap B) + n(B-A) + n(A \cap B) = \big[n(A-B) + n(B-A) + n(A \cap B)\big] + n(A \cap B).

Step 4. The bracketed term is exactly n(A∪B)n(A \cup B) from Step 1, so n(A)+n(B)=n(A∪B)+n(A∩B)n(A) + n(B) = n(A \cup B) + n(A \cap B). Rearranging gives the counting formula:

n(A∪B)=n(A)+n(B)−n(A∩B)n(A \cup B) = n(A) + n(B) - n(A \cap B)

where: n(A)n(A) and n(B)n(B) are the number of elements in AA and BB, and n(A∩B)n(A \cap B) is the number of elements common to both — subtracted because simply adding n(A)+n(B)n(A) + n(B) counts every shared element twice, once inside each set. When A∩B=∅A \cap B = \varnothing (disjoint sets), n(A∩B)=0n(A \cap B) = 0 and the formula reduces to the plain sum n(A∪B)=n(A)+n(B)n(A \cup B) = n(A) + n(B).

Worked example (word problem)

In a class of 50 students, 30 play cricket, 20 play football, and 10 play both. Using set notation, find how many students play at least one of the two games, and how many play neither.

Step 1. Let CC = students who play cricket and FF = students who play football, with n(C)=30n(C) = 30, n(F)=20n(F) = 20, n(C∩F)=10n(C \cap F) = 10, and universal set UU = all students in the class, so n(U)=50n(U) = 50.

Step 2. "At least one of the two games" is exactly the set C∪FC \cup F. Apply the union-cardinality formula proved above:

n(C∪F)=n(C)+n(F)−n(C∩F)=30+20−10=40n(C \cup F) = n(C) + n(F) - n(C \cap F) = 30 + 20 - 10 = 40

Step 3. Students playing neither game are those in UU but outside C∪FC \cup F, i.e. U−(C∪F)U - (C \cup F): n(U)−n(C∪F)=50−40=10n(U) - n(C \cup F) = 50 - 40 = 10.

40 students play at least one game, and 10 students play neither.

Common traps

  • Adding n(A)+n(B)n(A) + n(B) directly for a union without subtracting n(A∩B)n(A \cap B) — this double-counts every element common to both sets.
  • Assuming A−B=B−AA - B = B - A — set difference is not symmetric; compute each one separately from its own definition, as the worked example shows.
  • Confusing union ("or", combine everything) with intersection ("and", keep only what's shared) when translating a word problem into set notation.
  • Forgetting to check disjointness before applying the union formula — if A∩B=∅A \cap B = \varnothing the formula still works but simplifies to a plain sum, and skipping this check can lead to needlessly subtracting a nonzero overlap that was never verified.

Ask the tutor: if a survey word problem (like hobbies or subjects students take) feels confusing to translate into set operations, ask the AI tutor to work through it step by step with you.

Why is A minus B not the same as the complement of B?

A−BA - B only removes BB's elements from within AA — it never contains anything outside AA to begin with. The complement of BB (everything in the universal set UU that is not in BB) can include elements that are not in AA at all. In fact A−B=A∩B′A - B = A \cap B', where B′B' is the complement of BB: you are intersecting AA with "everything not in BB," which happens to stay inside AA automatically.

How do I know when a word problem wants union versus intersection?

Look for the connecting word in the question. "At least one," "either," or "any of these" point to a union, since you want everyone who qualifies under any listed condition. "Both," "all of these," or "every one of the following" point to an intersection, since you want only the people who satisfy every condition simultaneously. Rewriting the question in your own words with "or" versus "and" usually makes the correct operation obvious before you touch any numbers.

Do I always need to draw a Venn diagram to solve these problems?

No, but it helps catch errors. The union-cardinality formula n(A∪B)=n(A)+n(B)−n(A∩B)n(A \cup B) = n(A) + n(B) - n(A \cap B) can be applied directly once you have identified n(A)n(A), n(B)n(B), and n(A∩B)n(A \cap B) from the problem statement, as in the cricket-football example. A quick Venn sketch is most useful when the problem gives you n(A∪B)n(A \cup B) or "neither" counts and asks you to work backwards for an unknown intersection or individual set size — the diagram makes it obvious which region each given number refers to.

Before this

Where this leads