Welcome to our third lesson. In our last session, you mastered algebraic techniques for solving systems of linear equations. We noted that the solution to such a system is formally called a "solution set." Today, we will explore the fundamental concepts of set theory, the mathematical language used to define and work with collections of objects like these solution sets.
This lesson is your entry point into the formal language that underpins nearly all topics in mathematics for machine learning, from defining the domains of functions to describing event spaces in probability. You will learn what sets are, how to represent them using various notations, and how to manipulate them using fundamental operations like union, intersection, and complement.
What is a Set?
At its core, a set is a well-defined collection of distinct objects, which we call elements or members. The key characteristics of a mathematical set are:
- Unordered: The order in which elements are listed does not matter. The set is identical to the set .
- Distinct Elements: A set does not contain duplicate elements. Even if an element is listed multiple times, it is considered to be in the set only once. The set is identical to .
To get a quick overview of these foundational ideas, please watch the first few minutes of the following video.
INTRODUCTION to SET THEORY - DISCRETE MATHEMATICS
This video from TrevTutor provides a clear, concise introduction to the basic definition of a set.
Watch the segment from the beginning until the end of the discussion on order. Focus on how sets are defined as unordered collections of unique elements.
An element is either in a set or it is not. We use the symbol to denote that an element belongs to a set, and to denote that it does not. For example, if , then but .
Representing Sets: From Lists to Rules
To work with sets, we need precise ways to describe them. There are a few standard methods, each useful in different contexts.
A comprehensive resource for this topic is the text "Sets and Set Theory" from the University of Western Ontario's Discrete Structures course. We will refer to it multiple times.
2.1. Sets and Set Theory — Discrete Structures for ...
This resource provides a detailed look at the different ways to construct and represent sets.
Please read the section on Set Construction. Pay close attention to the following subsections: Roster Method: Read this definition and the subsequent examples. This is the most direct way to define a set. Set Builder Notation: Study the definition and examples under this heading. This notation is extremely powerful as it allows us to define sets by the properties of their elements, which is essential for infinite sets or sets defined by complex rules. Notice the structure: \{\text{variable} \mid \text{condition}\}. Interval Notation: Review the section on Interval Notation. This is a convenient shorthand you've likely seen before for representing continuous ranges of real numbers.
To summarize the key methods:
- Roster Method: Explicitly listing all elements, e.g., .
- Set-Builder Notation: Defining a set by a rule, e.g., , which reads "the set of all elements in the integers such that is even."
- Interval Notation: A compact way to denote sets of real numbers, e.g., represents the set .
Fundamental Set Properties and Relationships
Now that we know how to represent sets, let's explore their fundamental properties and the relationships between them.
These lecture notes from the University at Buffalo offer concise definitions for core set theory concepts.
Please read the following sections: On page 6, the definition of Equal sets. On page 7, the definitions of Subset and Proper Subset. On page 8, the definition of Cardinality. On page 10, the definition of the Power set.
Let's consolidate these important concepts:
- Equality (): Two sets are equal if and only if they contain the exact same elements. As we'll see, this is formally proven by showing that and .
- Subset (): Set is a subset of set if every element of is also an element of . If is a subset of but not equal to , it is a proper subset ().
- Empty Set (): The unique set that contains no elements. By definition, the empty set is a subset of every set. Its cardinality is 0: .
- Universal Set (): The set of all possible elements under consideration in a given context.
- Cardinality (): The number of distinct elements in a finite set. For instance, if , then .
- Power Set (): The set of all possible subsets of . If , then . For example, if , its subsets are . Therefore, .
Operations on Sets
Much like we perform arithmetic operations on numbers, we can perform operations on sets to create new sets. Venn diagrams are an excellent way to visualize these operations.

The four fundamental operations are union, intersection, difference, and complement.
This "All-in-One" video by Dr. Will Wood provides a great walkthrough of these operations.
Please watch the following two segments: Union and Intersection. Pay attention to the formal definitions using "or" for union and "and" for intersection. Difference and Complement. Note how the complement is defined with respect to a universal set.
Here is a formal summary of these operations:
-
Union (): The set of all elements that are in set , or in set , or in both.
Example: If and , then .
-
Intersection (): The set of all elements that are in both set and set .
Example: If and , then . If the intersection is the empty set (), the sets are called disjoint.
-
Difference (): The set of all elements that are in set but not in set .
Example: If and , then .
-
Complement ( or ): The set of all elements in the universal set that are not in set .
Example: If and , then .
Set Identities and Proofs
As you become more familiar with these operations, you will encounter set identities, which are statements of equality that are always true. For example, the distributive laws and De Morgan's laws are fundamental.
- Distributive Law:
- De Morgan's Law:
Because you are interested in building a rigorous foundation, it's valuable to see how such identities are proven. The standard method is to show that the set on the left is a subset of the set on the right, and vice-versa, which establishes their equality.
The video you just referred to contains an excellent, step-by-step proof of a distributive law. Watching this will connect the abstract definitions to the formal practice of mathematical proof.
This segment demonstrates how to formally prove a set identity.
Watch the proof of the distributive property, from the start of the proof until its conclusion. Notice how it uses the core strategy of showing that each side is a subset of the other.
Conclusion
In this lesson, we have built a solid foundation in the language of set theory. You've learned how to define and represent sets using roster, set-builder, and interval notations. We explored fundamental properties like cardinality and subsets, and you now know how to manipulate sets using the core operations of union, intersection, difference, and complement.
Key Takeaways:
- A set is an unordered collection of unique elements.
- Sets can be represented by listing elements (roster method) or by defining a property (set-builder notation).
- Key concepts include subsets (), cardinality (), the empty set (), and the power set ().
- The main set operations are union (), intersection (), difference (), and complement ().
- Set identities, like the distributive and De Morgan's laws, can be proven formally by showing mutual subset relationships.
In our next lesson, we will shift gears to another essential topic: logarithms and exponentials. The concepts from today will reappear when we formally define the domain and range of these functions, reinforcing the idea that set theory is the bedrock upon which other mathematical structures are built.