4. Sets, Functions, and Relations

Set Operations

Set Operations in Discrete Mathematics

Introduction: Why Set Operations Matter

students, set operations are the tools we use to combine, compare, and describe groups of objects. In Discrete Mathematics, sets are everywhere: students in a club, numbers that are even, passwords that meet certain rules, or webpages that share features. When we work with sets, we often need to ask questions like: What do two sets have in common? What belongs to one set but not the other? What is everything inside a bigger group? πŸ“˜

By the end of this lesson, you should be able to:

  • explain the main ideas and vocabulary of set operations,
  • use set operations to solve problems,
  • connect set operations to the larger study of sets, functions, and relations,
  • and recognize how these ideas appear in real situations.

Set operations are important because they help us organize information clearly and reason accurately. They are also a foundation for later topics such as function domains and ranges, relational structures, and probability.

What Is a Set?

A set is a collection of distinct objects called elements. We usually write a set using braces. For example, the set of vowels in English can be written as $V = \{a, e, i, o, u\}$. If an object belongs to a set, we write $\in$. If it does not belong, we write $\notin$.

For example:

  • $a \in V$ means $a$ is an element of $V$,
  • $b \notin V$ means $b$ is not an element of $V$.

The order of elements does not matter in a set, and repeated elements are not listed twice. So $\{1, 2, 2, 3\}$ is the same set as $\{1, 2, 3\}$. This matters because set operations depend on membership, not on order or repetition.

A common idea in set theory is the universal set, often written as $U$. This is the larger set containing all elements being considered in a problem. The universal set depends on the context. For example, if we are studying students in one school, $U$ might be the set of all students in that school. If we are studying integers from $1$ to $20$, then $U = \{1,2,3,\dots,20\}$.

Union, Intersection, and Difference

Three of the most important set operations are union, intersection, and difference. These operations let us combine or compare sets in precise ways. ✨

Union

The union of two sets $A$ and $B$ is the set of all elements that are in $A$, in $B$, or in both. It is written as $A \cup B$.

Formally,

$$A \cup B = \{x \mid x \in A \text{ or } x \in B\}.$$

Example: If $A = \{1,2,3\}$ and $B = \{3,4,5\}$, then

$$A \cup B = \{1,2,3,4,5\}.$$

A real-world example: suppose $A$ is the set of students who play basketball and $B$ is the set of students who play soccer. Then $A \cup B$ is the set of students who play at least one of the two sports.

Intersection

The intersection of two sets $A$ and $B$ is the set of all elements that are in both sets. It is written as $A \cap B$.

Formally,

$$A \cap B = \{x \mid x \in A \text{ and } x \in B\}.$$

Example: If $A = \{1,2,3\}$ and $B = \{3,4,5\}$, then

$$A \cap B = \{3\}.$$

Real-world example: if $A$ is the set of students taking art and $B$ is the set of students taking music, then $A \cap B$ is the set of students taking both art and music.

Difference

The difference of two sets $A$ and $B$ is the set of elements in $A$ that are not in $B$. It is written as $A - B$ or sometimes $A \setminus B$.

Formally,

$$A - B = \{x \mid x \in A \text{ and } x \notin B\}.$$

Example: If $A = \{1,2,3\}$ and $B = \{3,4,5\}$, then

$$A - B = \{1,2\}.$$

Notice that set difference is not symmetric. In this example,

$$B - A = \{4,5\},$$

which is different from $A - B$.

A common application is comparing lists. If $A$ is the set of students who submitted homework and $B$ is the set of students enrolled in the class, then $B - A$ is the set of enrolled students who did not submit homework.

Complement and the Role of the Universal Set

The complement of a set gives the elements outside the set, but only within the universal set. If $A$ is a subset of $U$, then the complement of $A$ is written as $A^c$ or $\overline{A}$.

Formally,

$$A^c = \{x \in U \mid x \notin A\}.$$

For example, let $U = \{1,2,3,4,5,6,7,8,9,10\}$ and $A = \{2,4,6,8,10\}$. Then

$$A^c = \{1,3,5,7,9\}.$$

The complement is useful when answering questions like β€œwho did not attend?” or β€œwhich items do not satisfy the rule?” In data analysis, this can help identify missing groups or exceptions. πŸ“Š

A very important fact is that the complement depends on $U$. If the universal set changes, the complement can change too. That is why always defining $U$ clearly is part of good mathematical reasoning.

Subsets and Visualizing Set Operations

A set $A$ is a subset of a set $B$ if every element of $A$ is also in $B$. We write $A \subseteq B$.

Formally,

$$A \subseteq B \text{ if and only if } \forall x,\, x \in A \rightarrow x \in B.$$

If $A \subseteq B$ and $A \neq B$, then $A$ is a proper subset of $B$, written $A \subset B$.

Subsets are important because many set operations create new sets that are related to the original ones. For example:

  • $A \cap B$ is always a subset of $A$ and of $B$,
  • $A \cup B$ contains both $A$ and $B$,
  • $A - B$ is always a subset of $A$.

A powerful way to understand these relationships is with Venn diagrams. A Venn diagram uses overlapping circles inside a rectangle representing the universal set. The overlapping region shows intersection, the combined region shows union, and the non-overlapping part shows difference or complement.

Example: If $A$ and $B$ are two overlapping sets, then the region in the overlap is $A \cap B$, the entire area covered by both circles is $A \cup B$, and the part of $A$ outside $B$ is $A - B$.

Venn diagrams are not just pictures; they help you check whether your answer makes sense. If you say $A \cap B$ includes an element that is only in one set, the diagram will show the mistake immediately.

Useful Set Laws and Why They Help

Set operations follow rules called laws. These laws make it easier to simplify expressions and prove results. In discrete mathematics, laws are especially useful because they let us move from a complicated expression to a simpler one without changing meaning.

Here are some important laws:

  • Commutative laws:

$$A \cup B = B \cup A$$

$$A \cap B = B \cap A$$

  • Associative laws:

$$(A \cup B) \cup C = A \cup (B \cup C)$$

$$(A \cap B) \cap C = A \cap (B \cap C)$$

  • Distributive laws:

$$A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$$

$$A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$$

  • Identity laws:

$$A \cup \varnothing = A$$

$$A \cap U = A$$

  • Domination laws:

$$A \cup U = U$$

$$A \cap \varnothing = \varnothing$$

  • Complement laws:

$$A \cup A^c = U$$

$$A \cap A^c = \varnothing$$

These laws are useful in computing and logic. For example, in database queries, union and intersection can represent combining search results. In digital circuits, similar rules appear in Boolean algebra. That is one reason set operations are such an important bridge between mathematics and computer science πŸ’».

A Worked Example

Suppose a school survey gives these sets:

$$A = \{\text{students who like chess}\}$$

$$B = \{\text{students who like coding}\}$$

$$C = \{\text{students who like music}\}$$

If we know that students belongs to $A$ and $B$ but not to $C$, then students is in

$$A \cap B$$

and also in

$$A \cup B \cup C,$$

but not in

$$C$$

or in

$$A \cap C.$$

Now imagine the school wants to form a special club of students who like chess or coding, but not music. That club can be written as

$$(A \cup B) - C.$$

This expression first combines the students who like chess or coding, then removes anyone who likes music. If a student likes all three, they are removed because they belong to $C$. This is a good example of how set operations model real rules precisely.

How Set Operations Connect to Functions and Relations

Set operations are not isolated ideas. They connect directly to later topics in Discrete Mathematics.

For functions, the domain and codomain are sets. If a function maps students to test scores, the input set and output set matter. When we restrict a function to a subset of its domain, we are using set ideas. When we talk about the image of a set under a function, we are describing how a set changes through a rule.

For relations, a relation is a set of ordered pairs. That means set language is built into the topic itself. If $R$ is a relation from $A$ to $B$, then $R \subseteq A \times B$, where $A \times B$ is a Cartesian product, another set-based construction. Equivalence relations, which appear later in the course, divide a set into equivalence classes. Those classes are subsets that partition the original set. So even when the lesson moves beyond basic set operations, the same ideas keep working.

In short, set operations are the starting language of the whole unit on sets, functions, and relations. If you understand unions, intersections, differences, complements, and subsets, you will find later topics much easier to read and use.

Conclusion

Set operations help us organize information, compare groups, and reason clearly. The main operations are union $\cup$, intersection $\cap$, difference $-$, and complement $^c$. These operations depend on the universal set $U$ and are often visualized with Venn diagrams. They also follow important laws that make expressions easier to simplify.

students, mastering set operations gives you a strong foundation for functions, relations, logic, and many computer science ideas. Every time you combine groups, find overlaps, or exclude items, you are using the language of discrete mathematics. βœ…

Study Notes

  • A set is a collection of distinct elements.
  • $x \in A$ means $x$ is in set $A$; $x \notin A$ means it is not.
  • The union $A \cup B$ contains elements in $A$, in $B$, or in both.
  • The intersection $A \cap B$ contains elements in both $A$ and $B$.
  • The difference $A - B$ contains elements in $A$ that are not in $B$.
  • The complement $A^c$ contains elements in the universal set $U$ that are not in $A$.
  • Subset notation $A \subseteq B$ means every element of $A$ is also in $B$.
  • Venn diagrams help visualize union, intersection, difference, and complement.
  • Important laws include commutative, associative, distributive, identity, domination, and complement laws.
  • Set operations are foundational for functions, relations, and equivalence classes.
  • Always define the universal set before finding a complement.
  • Set operations are widely used in real-life tasks such as surveys, databases, and scheduling.

Practice Quiz

5 questions to test your understanding

Set Operations β€” Discrete Mathematics | A-Warded