1.3 Venn Diagrams and Operations on Sets
Combine sets into new ones — $A\cup B$, $A\cap B$, $A-B$ and $A'$ — see each as a shaded region of a Venn diagram, and calculate with the laws that link them, including De Morgan's laws.
A class teacher surveys the $40$ students of Class 11-B: who plays cricket, and who plays football? Her questions sound simple, but each one asks for a different set. "Who plays at least one of the two games?" "Who plays both?" "Who plays cricket but not football?" "Who plays neither?" Each answer is built from the set $C$ of cricketers and the set $F$ of footballers by an operation — just as $3+5$ and $3\times5$ are built from two numbers.
In this section we define the four operations on sets — union, intersection, difference and complement — and draw each one as a shaded region of a Venn diagram. Then we collect the laws these operations obey. Some look exactly like the laws of arithmetic (commutative, associative, distributive); others, such as De Morgan's laws, are new and are used again in probability (Chapter 14) and in logic and computer science.
Venn Diagrams, Union and Intersection
A Venn diagram (named after the English logician John Venn) draws the universal set $U$ as a rectangle and each set under discussion as a closed region — usually a circle — inside it. Elements may be written in the regions where they belong. Two overlapping circles cut the rectangle into four regions: only in $A$, in both $A$ and $B$, only in $B$, and in neither. Every operation in this section is a choice of some of these regions.
The union of sets $A$ and $B$ is the set of all elements that are in $A$ or in $B$ (or in both): $$A\cup B=\{x : x\in A \text{ or } x\in B\}.$$ In a Venn diagram, $A\cup B$ is the whole of both circles. The word "or" in mathematics is inclusive: an element lying in both sets belongs to the union, and it is written only once.
For any subsets $A$, $B$, $C$ of a universal set $U$:
- $A\cup B=B\cup A$ (commutative law);
- $(A\cup B)\cup C=A\cup(B\cup C)$ (associative law);
- $A\cup\phi=A$ ($\phi$ is the identity for union);
- $A\cup A=A$ (idempotent law);
- $U\cup A=U$;
- $A\subset A\cup B$ and $B\subset A\cup B$.
Proof. (1) "$x\in A$ or $x\in B$" says the same as "$x\in B$ or $x\in A$". (2) Both sides are the set of elements lying in at least one of $A$, $B$, $C$. (3) $\phi$ contributes no elements. (4) "$x\in A$ or $x\in A$" just says $x\in A$. (5) $A\subset U$, so adding the elements of $A$ to $U$ adds nothing new. (6) If $x\in A$ then "$x\in A$ or $x\in B$" is true. $\blacksquare$
The intersection of sets $A$ and $B$ is the set of all elements that are in both $A$ and $B$: $$A\cap B=\{x : x\in A \text{ and } x\in B\}.$$ In a Venn diagram, $A\cap B$ is the lens-shaped overlap of the two circles. If $A\cap B=\phi$, the sets $A$ and $B$ are called disjoint sets; they are drawn as circles that do not overlap.
For any subsets $A$, $B$, $C$ of a universal set $U$:
- $A\cap B=B\cap A$ (commutative law);
- $(A\cap B)\cap C=A\cap(B\cap C)$ (associative law);
- $A\cap\phi=\phi$ and $A\cap U=A$ ($U$ is the identity for intersection);
- $A\cap A=A$ (idempotent law);
- $A\cap B\subset A$ and $A\cap B\subset B$;
- $A\cap(B\cup C)=(A\cap B)\cup(A\cap C)$ and $A\cup(B\cap C)=(A\cup B)\cap(A\cup C)$ (distributive laws).
Proof of the first distributive law. For any element $x$, $$\begin{aligned}x\in A\cap(B\cup C)&\iff x\in A \text{ and } (x\in B \text{ or } x\in C)\\&\iff (x\in A \text{ and } x\in B) \text{ or } (x\in A \text{ and } x\in C)\\&\iff x\in(A\cap B)\cup(A\cap C).\end{aligned}$$ Since the two sets have exactly the same elements, they are equal. Parts (1)–(5) follow directly from the meaning of "and"; the second distributive law is proved in the same way with "and" and "or" exchanged (Exercise III). $\blacksquare$
Difference and Complement
"Cricket but not football" removes the footballers from the cricketers. That is a difference of sets. When the set we remove from is the whole universal set, the result gets a special name — the complement.
The difference of sets $A$ and $B$, in this order, is the set of elements of $A$ that are not in $B$: $$A-B=\{x : x\in A \text{ and } x\notin B\}.$$ In a Venn diagram, $A-B$ is the part of circle $A$ outside circle $B$ ("only $A$"). In general $A-B\ne B-A$.
(b) Find $[0,5]-(1,3)$ and $\mathbb{R}-\mathbb{Q}$.
(c) Describe $\mathbb{N}-\{x : x\in\mathbb{N},\ x \text{ is even}\}$.
Let $U$ be the universal set and $A\subset U$. The complement of $A$ is the set of all elements of $U$ that are not in $A$: $$A'=U-A=\{x : x\in U \text{ and } x\notin A\}.$$ In a Venn diagram, $A'$ is everything inside the rectangle but outside circle $A$. The complement depends on $U$: change the universal set and the complement changes too.
For subsets $A$, $B$ of a universal set $U$:
- $A\cup A'=U$ and $A\cap A'=\phi$ (complement laws);
- $(A')'=A$ (law of double complementation);
- $U'=\phi$ and $\phi'=U$;
- $A-B=A\cap B'$;
- $(A\cup B)'=A'\cap B'$ and $(A\cap B)'=A'\cup B'$ (De Morgan's laws).
Proof of the first De Morgan law. For any $x\in U$, $$\begin{aligned}x\in(A\cup B)'&\iff x\notin A\cup B\\&\iff x\notin A \text{ and } x\notin B\\&\iff x\in A' \text{ and } x\in B'\\&\iff x\in A'\cap B'.\end{aligned}$$ The middle step is the heart of it: an element fails to be in "$A$ or $B$" exactly when it is in neither. The second law is proved the same way (Exercise III), and (1)–(4) follow directly from Definitions 1.12 and 1.13. $\blacksquare$
(b) Prove that if $A\cup B=A\cap B$, then $A=B$.
1. "Or" includes "both". $A\cup B$ contains the elements common to $A$ and $B$ — once each.
2. Order matters in a difference. $A-B$ and $B-A$ are different sets (they are even disjoint). Read $A-B$ as "in $A$, not in $B$".
3. The complement of a union is not the union of complements. $(A\cup B)'=A'\cap B'$: the operation flips as the dash moves inside. Writing $(A\cup B)'=A'\cup B'$ is the commonest error in this chapter — Interactive 2, claim 7, shows the regions where it fails.
4. A complement needs a universal set. With $U=\{1,2,\dots,10\}$, $\{2,4\}'$ has eight elements; with $U=\mathbb{N}$ it is infinite.
5. With intervals, watch the end points. $[0,5]-(1,3)$ keeps $1$ and $3$; $[0,5]-[1,3]$ does not, and equals $[0,1)\cup(3,5]$.
Practical problems on union and intersection are taught and tested in school, but not in the year-end board exam. JEE Main and JEE Advanced both list the operations on sets, and JEE Advanced names practical problems based on them.
For finite sets $A$ and $B$, adding $n(A)$ and $n(B)$ counts the elements of $A\cap B$ twice, so $$n(A\cup B)=n(A)+n(B)-n(A\cap B).$$ If $A$ and $B$ are disjoint this is just $n(A\cup B)=n(A)+n(B)$. (For three sets: $n(A\cup B\cup C)=\sum n(A)-\sum n(A\cap B)+n(A\cap B\cap C)$.)
Worked example. Each of the $120$ students of a junior college uses at least one of two UPI apps, P and Q; $72$ use P and $65$ use Q. How many use both, and how many use P only?
Solution. Every student uses at least one app, so $n(P\cup Q)=120$. Then $120=72+65-n(P\cap Q)$ gives $n(P\cap Q)=17$. P only: $n(P-Q)=72-17=55$.
Exercises
- 1 $A=\{1,3,5\}$, $B=\{1,2,3\}$. Find $A\cup B$ and $A\cap B$.
- 2 $A=\{a,b\}$, $B=\{a,b,c\}$. Find $A\cup B$ and $A\cap B$. What do you notice?
- 3 $A=\{x : x\in\mathbb{N},\ 1\lt x\le6\}$, $B=\{x : x\in\mathbb{N},\ 6\lt x\lt10\}$. Find $A\cup B$ and $A\cap B$.
- 4 $A$ = the set of primes less than $20$, $B$ = the set of odd natural numbers less than $20$. Find $A\cap B$ and $A\cup B$.
- 5 Find $(-3,2]\cup[0,6)$ and $(-3,2]\cap[0,6)$.
- 6 Find $[1,4]\cup(4,7)$ and $[1,4]\cap(4,7)$.
- 7 If $A\subset B$, write $A\cup B$ and $A\cap B$ more simply.
- 8 Which pairs are disjoint? (a) $\{1,2,3,4\}$ and $\{x : x\in\mathbb{N},\ 4\le x\le6\}$ (b) $\{a,e,i,o,u\}$ and $\{c,d,e,f\}$ (c) the even integers and the odd integers
- 9 Transport. In a city's metro, $B$ is the set of stations on the Blue Line and $Y$ the set of stations on the Yellow Line. Describe $B\cap Y$ and $B\cup Y$ in words. What would $B\cap Y=\phi$ mean for a passenger?
- 1 $A'$
- 2 $B'$
- 3 $(A\cup C)'$
- 4 $(A')'$
- 5 $(B-C)'$
- 6 $A-B$ and $B-A$
- 7 $A-C$ and $C-A$
- 8 $A'\cap B'$, and check that it equals $(A\cup B)'$.
- 9 Take $U=\mathbb{N}$. Find the complements of (a) $\{x : x \text{ is an even natural number}\}$ (b) $\{x : x\in\mathbb{N},\ x\gt6\}$.
- 10 Take $U=\mathbb{R}$. Find the complement of $[2,5)$, and find $[-2,4]-[0,1)$.
- 1 Verify $A\cup(B\cap C)=(A\cup B)\cap(A\cup C)$ for $A=\{1,2\}$, $B=\{2,3,4\}$, $C=\{4,5\}$.
- 2 Prove that $A\cap B\subset A\subset A\cup B$.
- 3 Prove that $A-B=A\cap B'$.
- 4 Prove the second De Morgan law, $(A\cap B)'=A'\cup B'$.
- 5 Prove the second distributive law, $A\cup(B\cap C)=(A\cup B)\cap(A\cup C)$.
- 6 Show that $A\cap B=A$ if and only if $A\subset B$.
- 7 Is it true that $A\cup B=A\cup C$ always implies $B=C$? Prove it or give a counterexample.
- 8 Prove that $(A-B)\cup(A\cap B)=A$.
- 1 Simplify $(A\cup B)\cap(A\cup B')$.
- 2 Simplify $(A'\cup B')'$.
- 3 Simplify $A\cap(A'\cup B)$.
- 4 If $A$ and $B$ are disjoint, find $A-B$ and $A\cap B'$.
- 5 School clubs. $U$ is the set of students of a school, $M$ the set of members of the maths club and $S$ the set of members of the sports team. Write in symbols: (a) students in neither (b) maths-club members who are not in the sports team (c) students in exactly one of the two.
How this is examined: Board papers ask for unions, differences and complements of listed sets (1–2 marks) and short proofs or verifications of De Morgan's and the distributive laws (2–3 marks); JEE tests the laws through "which statements are always true" questions and uses $n(A\cup B)$ (see the 📘 box) for counting.
E1. Board · 1 mark If $A=\{1,2,3,4\}$ and $B=\{3,4,5,6\}$, then $A-B$ is (A) $\{1,2\}$ (B) $\{5,6\}$ (C) $\{3,4\}$ (D) $\{1,2,5,6\}$
E2. Board · 2 marks Let $U=\{1,2,3,4,5,6,7,8\}$, $A=\{1,2,5,6\}$ and $B=\{2,3,6,7\}$. Verify that $(A\cap B)'=A'\cup B'$.
E3. Board · 3 marks For any sets $A$, $B$, $C$ prove that $A\cap(B-C)=(A\cap B)-(A\cap C)$.
E4. JEE Main Let $A$, $B$, $C$ be sets such that $A\cup B=A\cup C$ and $A\cap B=A\cap C$. Then (A) $A=B$ (B) $B=C$ (C) $A=C$ (D) $A=B=C$
E5. JEE Main Numerical value. Each of the $95$ students of a language school studies at least one of French and German; $58$ study French and $49$ study German. Find the number who study German but not French.
E6. JEE Advanced One or more options correct. For all subsets $A$, $B$ of a universal set $U$, which of the following are always true? (A) $A-B=A\cap B'$ (B) $(A-B)\cup B=A\cup B$ (C) $(A\cup B)-B=A$ (D) $A\cap(A'\cup B)=A\cap B$
Research question. Do the filters of a real search tool — a library catalogue, a shopping app, a job portal — behave exactly like union, intersection and complement?
Why it matters. Search engines and databases are built on set operations: AND is $\cap$, OR is $\cup$, NOT is a difference. When a filter is labelled ambiguously, users get results they did not ask for. Checking a real system against the laws of this section is a small piece of genuine software testing.
What to do.
- Choose a site that lets you combine two filters (for example "author = X" and "published after 2015", or "brand = Y" and "rating 4★ and above").
- Record the number of results for filter $A$ alone, filter $B$ alone, and both together. Decide whether "both together" is $A\cap B$ or $A\cup B$ on that site.
- If the site offers OR or "exclude", record those counts too and check that $n(A\cup B)=n(A)+n(B)-n(A\cap B)$ and $n(A-B)=n(A)-n(A\cap B)$ (the counting rule from the 🚀 box).
- Draw a Venn diagram of your two filters with the four region counts written in.
Tools: Phone browser; notebook or spreadsheet
Hand in: Your table of counts, the labelled Venn diagram, and two sentences on whether the site's filters obey the laws of sets.
Going further. Some sites combine values within one filter by OR (two brands) but across filters by AND (brand and price). Write a typical query as an expression such as $(B_1\cup B_2)\cap P$ and simplify it with the distributive law.
🧪 Self-check quiz
Q1. If $A=\{1,2,3\}$ and $B=\{2,3,4\}$, then $A\cap B$ is
Q2. $(A\cup B)'$ is always equal to
Q3. With $U=\{1,2,3,4,5,6\}$ and $A=\{1,2,3\}$, the complement $A'$ is
Q4. If $A=\{a,b,c,d\}$ and $B=\{c,d,e\}$, then $A-B$ is
Q5. If $A\subset B$, then $A\cap B$ equals