Maths Formulae Statistics Operations On Sets

Operations On Sets – Union, Intersection, Difference

Understand key set operations including union, intersection, complement, and difference. Visualize with Venn diagrams.
🔑

Definition of Set Operations

Set operations are fundamental mathematical tools that allow us to combine, compare, and manipulate sets to create new sets. These operations, such as union, intersection, and complement, follow several identities and laws that govern how sets behave. These laws are foundational in mathematics, computer science, and logic, forming the algebraic foundation of set theory.

SymbolNameDescription
\[ A \cup B \]UnionAll elements in A or B or both
\[ A \cap B \]IntersectionElements common to both A and B
\[ A - B \]DifferenceElements in A but not in B
\[ A \triangle B \]Symmetric DifferenceElements in A or B but not both
\[ A^c \]ComplementElements in the universal set U but not in A
\[ A \times B \]Cartesian ProductAll ordered pairs (a, b) where a is in A and b is in B
\[ |A| \]CardinalityThe number of elements in set A
\[ \emptyset \]Empty SetA set with no elements
\[ U \]Universal SetThe set of all elements under consideration
🔢

Key Formulas and Operations

\[ A \cup B = \{x : x \in A \text{ or } x \in B\} \]
Union
\[ A \cap B = \{x : x \in A \text{ and } x \in B\} \]
Intersection
\[ A - B = \{x : x \in A \text{ and } x \notin B\} \]
Difference
\[ A \triangle B = (A \cup B) - (A \cap B) \]
Symmetric Difference
\[ A^c = U - A = \{x : x \in U \text{ and } x \notin A\} \]
Complement
\[ (A \cup B)^c = A^c \cap B^c \]
De Morgan's Law (Union)
\[ (A \cap B)^c = A^c \cup B^c \]
De Morgan's Law (Intersection)
\[ |A \cup B| = |A| + |B| - |A \cap B| \]
Principle of Inclusion-Exclusion
🎨

Venn Diagram

A ∪ B A ∩ B A \ B Aᶜ
Set Operations: Union (A∪B), Intersection (A∩B), Difference (A\B), and Complement (Aᶜ) — the four fundamental operations

A Venn diagram visually represents set operations. It consists of a rectangle representing the universal set (U), with circles inside representing individual sets (e.g., A and B). The overlapping region of the circles shows the intersection (A ∩ B), the total area of both circles represents the union (A ∪ B), the part of circle A not overlapping with B is the difference (A - B), and the area outside the circles but inside the rectangle is the complement of their union.

⚙️

Properties of Set Operations

Set operations follow specific algebraic laws that are similar to the laws of arithmetic.

\[ A \cup B = B \cup A \quad \text{and} \quad A \cap B = B \cap A \]
Commutative Laws
\[ (A \cup B) \cup C = A \cup (B \cup C) \]
Associative Law for Union
\[ (A \cap B) \cap C = A \cap (B \cap C) \]
Associative Law for Intersection
\[ A \cup (B \cap C) = (A \cup B) \cap (A \cup C) \]
Distributive Law (Union over Intersection)
\[ A \cap (B \cup C) = (A \cap B) \cup (A \cap C) \]
Distributive Law (Intersection over Union)
\[ A \cup \emptyset = A \quad \text{and} \quad A \cap U = A \]
Identity Laws
\[ A \cup A^c = U \quad \text{and} \quad A \cap A^c = \emptyset \]
Complement Laws
\[ (A^c)^c = A \]
Double Complement Law
🔬

Proof of De Morgan's Law

We will prove one of De Morgan's Laws: (A ∪ B)ᶜ = Aᶜ ∩ Bᶜ. To do this, we must show that any element in the set on the left is also in the set on the right, and vice-versa.

Part 1: Show that (A ∪ B)ᶜ ⊆ Aᶜ ∩ Bᶜ

Let x be an arbitrary element of (A ∪ B)ᶜ. By the definition of complement, this means x is not in A ∪ B.

\[ x \in (A \cup B)^c \implies x \notin (A \cup B) \]

If x is not in the union of A and B, then x cannot be in A, and x cannot be in B.

\[ x \notin A \quad \text{and} \quad x \notin B \]

By the definition of complement, if x is not in A, then x must be in Aᶜ. Similarly, if x is not in B, it must be in Bᶜ.

\[ x \in A^c \quad \text{and} \quad x \in B^c \]

Since x is in both Aᶜ and Bᶜ, it must be in their intersection. Thus, (A ∪ B)ᶜ is a subset of Aᶜ ∩ Bᶜ.

Part 2: Show that Aᶜ ∩ Bᶜ ⊆ (A ∪ B)ᶜ

Now, let y be an arbitrary element of Aᶜ ∩ Bᶜ. By definition of intersection, y is in Aᶜ and y is in Bᶜ.

\[ y \in A^c \cap B^c \implies y \in A^c \text{ and } y \in B^c \]

This means y is not in A, and y is not in B. Therefore, y cannot be in the union of A and B.

\[ y \notin A \cup B \]

If y is not in A ∪ B, then by the definition of complement, y must be in (A ∪ B)ᶜ. Thus, Aᶜ ∩ Bᶜ is a subset of (A ∪ B)ᶜ.

Since each set is a subset of the other, the two sets are equal.

✍️

Worked Example

Given the universal set U = {1, 2, 3, 4, 5, 6, 7, 8}, and the sets A = {1, 2, 4, 5} and B = {2, 5, 6, 8}, find A ∪ B, A ∩ B, A - B, and Aᶜ.
  1. <b>Union (A ∪ B):</b> Combine all unique elements from both sets. A ∪ B = {1, 2, 4, 5} ∪ {2, 5, 6, 8} = {1, 2, 4, 5, 6, 8}.
  2. <b>Intersection (A ∩ B):</b> Find the elements that are common to both sets. A ∩ B = {1, 2, 4, 5} ∩ {2, 5, 6, 8} = {2, 5}.
  3. <b>Difference (A - B):</b> Start with set A and remove any elements that are also in set B. A - B = {1, 2, 4, 5} - {2, 5, 6, 8} = {1, 4}.
  4. <b>Complement (Aᶜ):</b> Find all elements in the universal set U that are not in set A. Aᶜ = U - A = {1, 2, 3, 4, 5, 6, 7, 8} - {1, 2, 4, 5} = {3, 6, 7, 8}.
A ∪ B = {1, 2, 4, 5, 6, 8}, A ∩ B = {2, 5}, A - B = {1, 4}, Aᶜ = {3, 6, 7, 8}
🧮

Try It

🚀

Applications of Set Operations

💾 Database Operations & SQL: SQL JOIN operations, WHERE clauses, and UNION queries directly implement set operations for database management. For example, an `INNER JOIN` is an intersection, a `FULL OUTER JOIN` is a union, and a `WHERE ... NOT IN` clause is a set difference.

🔍 Search Engines & Information Retrieval: Boolean search queries use set logic. Searching for "cats AND dogs" performs an intersection on web pages containing those words, while "cats OR dogs" performs a union, providing a broader set of results.

🎯 Marketing & Customer Segmentation: Companies define customer groups (sets) based on demographics or behavior. Finding customers who are 'high-spenders' AND 'new customers' is an intersection used for targeted campaigns.

🔐 Computer Science & Programming: Set-based data structures are used in algorithms to efficiently check for membership, find unique elements, and perform logical operations. Network access control lists use set logic to determine which users can access which resources.

🌍

Real-World Examples

A coffee shop surveys 100 customers. 60 customers like espresso (Set E), and 50 customers like lattes (Set L). 20 customers like both. How many customers like at least one of the two drinks?
  1. We need to find the cardinality of the union, |E ∪ L|.
  2. Use the Principle of Inclusion-Exclusion: |E ∪ L| = |E| + |L| - |E ∩ L|.
  3. Substitute the given values: |E ∪ L| = 60 + 50 - 20.
  4. Calculate the result: 110 - 20 = 90.
90 customers like either espresso or lattes (or both).
A streaming service has two subscription plans: Movies (M) and TV Shows (T). Let M be the set of users subscribed to movies and T be the set of users subscribed to TV shows. A marketing email needs to be sent to users who are subscribed to TV shows but NOT movies. Which set operation represents this target audience?
  1. The problem asks for users who are in set T but not in set M.
  2. This is the definition of the set difference operation.
  3. The required set is T - M.
The target audience is represented by the set difference T - M.
🏙️

Real-World Scenarios

INNER LEFT A UNION XOR SQL JOIN Types All JOINs = set operations
SQL Database JOINs
Every SQL JOIN type maps to a set operation: INNER JOIN = ∩, LEFT JOIN = A, FULL OUTER = ∪, and EXCEPT = A\B. Set theory IS the relational algebra behind every database query.
Email Social Search all 3 Marketing Channels Overlap = multi-channel users
Marketing Analytics
Three-set Venn diagrams show which customers arrived via email, social media, or search — and crucially, which multi-channel users convert best, revealing attribution.
Admin: read,write,delete,exec Editor: read,write Viewer: read Role Permissions Viewer ⊂ Editor ⊂ Admin
Access Control
Role-based access control (RBAC) is pure set theory: Viewer ⊂ Editor ⊂ Admin is a chain of subset relationships. "Can user do X?" becomes a set membership test: x ∈ permissions(role).

Social Media Analytics

Analysts use set operations to understand user engagement. They can find the intersection of users who 'liked' a post and users who 'shared' it to identify highly engaged followers. The union of these two sets gives the total number of users who interacted with the post in any way.

Genetics and Biology

Biologists compare sets of genes between different species. The intersection reveals shared (conserved) genes, which can indicate a common evolutionary ancestor. The symmetric difference highlights genes unique to each species, which may be responsible for their distinct traits.

Airline Route Planning

Airlines manage sets of destinations served by different hubs. To find all cities reachable from either Hub A or Hub B, they calculate the union of the two destination sets. To find cities served by both hubs (potential connection points), they find the intersection.

📚

Types and Classifications

Sets can be classified based on their properties and their relationships with other sets.

Type / RelationshipDescription
Disjoint SetsTwo sets are disjoint if their intersection is the empty set (A ∩ B = ∅). They have no elements in common.
Subset (⊆)Set A is a subset of set B if all elements of A are also in B. Every set is a subset of itself.
Proper Subset (⊂)Set A is a proper subset of set B if A is a subset of B, but A is not equal to B (there is at least one element in B that is not in A).
Power Set (P(A))The set of all possible subsets of a given set A, including the empty set and the set itself.
Partition of a SetA collection of non-empty, disjoint subsets whose union is the original set. It's a way of breaking a set into non-overlapping pieces.
⚠️

Common Mistakes

⚠️ Confusing Union (∪) and Intersection (∩): Union means 'OR' (elements in either set), while Intersection means 'AND' (elements must be in both sets). A common mistake is to use one when the other is required.
⚠️ Incorrectly Calculating Difference: The set difference A - B is not the same as B - A. A - B contains elements in A but not in B, while B - A contains elements in B but not in A. The operation is not commutative.
💡 Forgetting to Subtract the Intersection for Cardinality: When calculating the size of a union |A ∪ B|, simply adding |A| + |B| will double-count the elements in the intersection. Always remember to subtract |A ∩ B|.
🚀

Study Strategy

1 📖 Build Your Foundation
  • Master the core concepts of Union (∪), Intersection (∩), Complement (A'), and Difference (A-B).
  • Use the 'Venn Diagram' section to visualize how each operation groups or separates elements.
  • Clearly define the Universal Set (U) and the Empty Set (∅) for every problem you approach.
  • Distinguish between an element belonging to a set (∈) and one set being a subset of another (⊆).
2 🧠 Memorize Key Formulas
  • Commit the Principle of Inclusion-Exclusion to memory: n(A ∪ B) = n(A) + n(B) - n(A ∩ B).
  • Internalize De Morgan's Laws: (A ∪ B)' = A' ∩ B' and (A ∩ B)' = A' ∪ B'.
  • Use flashcards to learn the Commutative, Associative, and Distributive properties of sets.
  • Practice recalling the identity laws, such as A ∪ ∅ = A and A ∩ U = A.
3 ✍️ Practice with Worked Examples
  • Replicate the solutions in the 'Worked Example' section without looking at the steps.
  • Draw a Venn diagram for every practice problem to visually verify your calculations.
  • Focus on problems involving three sets to master the extended inclusion-exclusion formula.
  • Review the 'Common Mistakes' section and actively try to avoid them in your practice.
4 📊 Apply to Real-World Scenarios
  • Translate word problems from the 'Real-World Scenarios' section into formal set notation.
  • Apply set operations to analyze survey results, like finding how many people like coffee or tea.
  • Connect set theory to 'Related Concepts' like probability by calculating P(A ∪ B).
  • Analyze data from the 'Applications' section, such as market research or database queries, using set formulas.
By systematically building from concepts to application, you can confidently master set operations.

Frequently Asked Questions

×

×