Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Chapter 1: Set Theory

Mathematics is fundamentally about studying patterns, structures, quantities, and logical reasoning. In this context, set theory is a part of the foundational language of mathematics, providing an important framework for clearly describing and discussing collections of objects. Understanding sets and their notation is crucial as they form the basis for more complex mathematical structures and reasoning.

Set Basics

Definition of a Set

Definition: A Set

A diagram illustrating a set as a collection of distinct elements (, , ) within a labeled region, along with a single element () not in the set.

A set is a well-defined collection of distinct objects, called elements.

  • Notation: Sets are typically written using curly braces and denoted by capital letters from the Latin alphabet, such as .
  • Well-defined: The objects inside a set, i.e., its elements, must be well-defined, meaning it is always clear whether something belongs to the set or not.
  • Distinct Elements: A set contains only distinct elements; no duplicates are allowed.
  • Order Independence: The order of elements in a set does not matter. For example, and represent the same set.

The elements , , and are placeholders and can represent anything — numbers, symbols, objects, or even abstract concepts — as long as they are clearly identifiable.

To better solidify the concept of a set, we now present a few illustrative examples.

Example: A Set

Consider the set of vowels in the English alphabet:

This set clearly lists all the vowels, and it is easy to determine whether a given letter is a vowel or not.

Example: Well-defined

For a set to be meaningful, it must be well-defined. This means it must be clear whether any given object is an element of the set or not. For example, the set of vowels in the word "radio" is well-defined and can be written as:

Similarly, the "set of all days last year with temperatures below C" is well-defined because it is based on objective, measurable data. However, the "set of all cold days last year" is not well-defined because the term "cold" is subjective and can vary from person to person.

Example: Distinct Elements

The set of vowels in the English alphabet is:

Note that the following is not a valid set because it contains duplicate entries:

In sets, each element must be distinct, so duplicates are not allowed.

Example: Order Independence

Consider two sets containing the vowels in the English alphabet:

These two sets are identical because they contain the same elements, regardless of the order in which the elements are listed. Thus, we can write:

This example illustrates the concept of order independence in sets, where the arrangement of elements does not define the uniqueness of a set.

Definition: The Empty Set

The empty set is the unique set that contains no elements. It is denoted by or simply .

Even though it has no elements, it plays a key role in set theory, similar to how plays a key role in arithmetic.

Representing Sets

Sets can be described using various notations, each suited to different contexts. Choosing the appropriate notation depends on the nature of the set (finite vs. infinite, discrete vs. continuous) and the intended level of clarity of communication. Below, we discuss the most common methods of representing sets, along with their advantages and typical use cases.

Verbal Description

A verbal description uses ordinary language to define a set by explaining its elements or properties. This approach is particularly useful for introducing abstract or unfamiliar sets in an intuitive way or for providing context before formalizing the set with mathematical notation.

Examples: Describing Sets Verbally

  • "The set of vowels in the English alphabet."
  • "The set of whole numbers."
  • "The set of whole numbers strictly smaller than 6."

Roster Form

Roster form explicitly lists all elements of a set enclosed in curly braces . This notation is particularly useful for finite sets or infinite sets with clear, recognizable patterns.

Examples: Describing Sets in Roster Form

  • The set of vowels in the English alphabet:

  • The set of whole numbers:

  • The set of whole numbers strictly smaller than 6:

Note: The ellipsis () indicates that the pattern continues indefinitely.

Set-Builder Notation

Set-builder notation provides a precise and compact way to define a set by specifying the properties that its elements must satisfy. The notation takes one of two equivalent forms:

Both forms are read as "the set of all such that the given condition holds".

Here, the symbol represents a generic element of the set, i.e., it does not refer to any particular element but serves as a placeholder for all possible elements that satisfy the condition. The vertical bar () or colon () functions as a divider between the variable and the rule that determines which elements belong to the set.

For example, the condition might express a numerical restriction such as (meaning is strictly greater than zero), a combined relationship like (meaning lies strictly between zero and ten), or a membership rule such as (meaning is an element of the set ). In each case, the notation highlights the defining property rather than listing individual elements.

Because of this, set-builder notation is preferred when working with infinite sets, continuous intervals, or sets defined by more complex conditions.

Examples: Describing Sets Using Set-Builder Notation

  • The set of vowels in the English alphabet:

  • The set of whole numbers:

  • The set of whole numbers strictly smaller than 6:

Interval Notation

Certain sets appear so frequently in mathematics that they are assigned dedicated symbols. One of the most fundamental is the set of real numbers, denoted by . This set, also often just called the "reals", includes virtually any number we can think of, such as , , , , , , and .

Geometrically, can be visualized as an infinite line, where each point corresponds to a real number. Intervals are contiguous segments of this line, representing subsets of .

An illustration of the real number line extending from to , with the origin at the center. Positive numbers lie to the right of the origin, while negative numbers lie to the left. Every point on the line corresponds to a unique number.

To describe intervals concisely, we use interval notation, which employs brackets to indicate inclusive bounds and/or parentheses to indicate exclusive bounds.

Below is a summary of how interval notation corresponds to sets of real numbers together with their corresponding set-builder notation.

SetInterval NotationSet-Builder NotationIllustration
All real numbers
Open intervalab
Closed intervalab
Infinite to the righta
Infinite to the righta
Infinite to the leftb
Infinite to the leftb
Half-open (left open)ab
Half-open (right open)ab

Understanding how elements relate to sets is fundamental — not only when defining a single set, but also when comparing and working with multiple sets. In the next section, we explore these relationships in more detail and introduce their formal notation.

Examples: Describing Sets Using Intervals

  • Real numbers strictly between and :

  • Real numbers between and , including both endpoints:

  • Real numbers greater than :

  • Real numbers less than or equal to :

Set Membership

Set membership describes the fundamental relationship between elements and a set. This relationship is crucial for defining and understanding the contents of sets.

Definition: Set Membership

A diagram showing a set containing an element but not an element , illustrating the membership relation.

Let be an element and a set. We say that is an element (or member) of , written , if and only if belongs to the collection of elements that make up . If an element is not in , we write .

Examples: Set Membership

The following examples illustrate how we use the symbols (is an element of) and (is not an element of) to describe whether a value belongs to a particular set.

  • The element belongs to the set because it appears among its members:

  • The element does not belong to the set because it is not included among its elements:

  • The number is a real number, so it belongs to the set of all real numbers:

  • In this case, the elements of the outer set are themselves sets, so is one of its members:

  • The number alone is not a member, because the set only contains sets as elements:

  • The fraction (equal to ) is in the interval because :

  • The number is not in this interval because it is not positive:

This binary relationship, where each element either belongs to a set or does not, precisely defines a set’s contents and forms the basis for defining equality and more advanced set relations.

Definition: Equality of Sets

Two sets and are equal, denoted , if they contain exactly the same elements. This means every element of is in , and every element of is in . More formally, in predicate logic, we can write this as:

Or in plain words: Two sets and are equal if and only if every element belongs to exactly when it belongs to .

Cardinality

Definition: Cardinality

The cardinality of a set , written , indicates the number of elements in . In other words, the cardinality is the size of .

Examples: Cardinality

  • If , then . This means that is a finite set and has five distinct elements.
  • If , then . This means that is a finite set and has six distinct elements.
  • If , then (aleph-null, the cardinality of any countably infinite set). This means that is countably infinite, i.e., its elements can be listed one by one in an endless sequence (first 1, then 2, then 3, and so on).
  • If , then (the cardinality of the continuum). The set of real numbers is uncountably infinite, it is so large that it is impossible to list all elements in any sequence; between any two real numbers, there are infinitely many others.
  • If , then . The empty set contains no elements, so its cardinality is zero.

Equivalence of Sets

Definition: Equivalence of Sets

Two sets and are said to be equivalent, often written , if they have the same number of elements.

Formally, and are equivalent if there exists a one-to-one correspondence (a bijection) between their elements, i.e., each element of can be paired with exactly one element of , and every element of is matched with exactly one element of .

In terms of size, this means their cardinalities are equal:

Examples: Equivalence of Sets

Consider the two sets of numbers:

These sets are equal () because they contain exactly the same elements.

Now consider:

These sets are not equal, since their contents differ, but they are equivalent () because each element of can be matched with one element of .

Note: Equivalence in Other Areas of Mathematics

In most cases, we care about equality when we want to check whether two things are exactly the same. But sometimes we only care whether two things share a certain property, for example, having the same size, and that is where equivalence becomes useful.

The same idea appears in many areas of mathematics. Some simple examples are:

  • Two fractions such as and are equivalent because they represent the same value. Evaluating both gives , but the fractions themselves are written differently.

  • Two equations like and are equivalent because they have the same solution. The value satisfies both equations, even though their forms differ.

  • Two angles are equivalent if they have the same measure, even if they open in different directions.

Two angles with equal measure are equivalent, even if they face different directions.
  • In geometry, shapes that are the same in size and form, though placed differently, are also considered equivalent through congruence.

Congruent shapes are equivalent because they have the same size and form.

Subsets & Proper Subsets

Subsets and proper subsets describe the relationship between sets in terms of their elements.

Definition: Subset

Diagram illustrating the subset relationship , where every element of is also an element of (including the case ).

Let and be sets. We say that is a subset of if and only if every element of is an element of . We write to denote the fact that is a subset of .

Examples: Subset

  1. Let and . Since both sets contain the same elements, we have that: Therefore, and are equal sets, and each is a subset of the other.

  2. Let and . The empty set contains no elements, so it is a subset of every set:

  3. Let and . Every element of is in , so: Since has more elements, is also a proper subset, but we can first identify it as a subset.

Definition: Proper Subset

Diagram illustrating the proper subset relationship , where is contained within but .

If is a subset of , but is not equal to (, meaning contains fewer elements than ), then is called a proper subset of , which we denote by .

If a subset contains all the elements of the original set, it is still considered a subset, but not a proper one.

Examples: Proper Subsets

  1. Let and . Every element of is in , but has one additional element. Therefore: That is, is a proper subset of .

  2. Similarly, if we let and , Then all elements of are contained in , but has additional elements ( and ). Hence: That is, again, is a proper subset of .

These examples show that a proper subset is always strictly smaller, that is, a proper subset includes some, but not all, of the elements of the larger set.

The Universe and Set Complement

The universe and set complement relate to what is not contained in a given set. Before exploring complements, we must first understand the universe that defines the context for all sets.

Definition: The Universe

A diagram showing the universe as a large rectangular region containing all relevant elements, with a set represented as a subset inside it.

The universe, often denoted as , refers to a set that contains all the objects or elements relevant to a particular discussion or problem. It serves as the context within which all other sets are defined and interpreted.

Examples: The Universe

  1. Let the universe be the set of all lowercase English letters: Then we can define:

    • , the set of vowels.
    • , the set of consonants.

    Here, provides a clear context: and together cover all letters in the alphabet.

  2. Let the universe be the set of all real numbers: Then we can define:

    • . The set of all real numbers strictly between and .
    • . The set of all real numbers between 2 and 5, including the endpoints.
    • . The set of all real numbers greater than 3.

    In this case, defines the entire number line, and each of these sets represents a subset of it.

Definition: Set Difference

Diagram showing two overlapping sets and , with highlighted to indicate elements in that are not in .

The set difference of two sets and , denoted as , is the set of all elements that are in but not in .

In other words, it removes from all elements that also belong to .

Examples: Set Difference

  1. Let and . Then: These are the vowels that are not in the set .

  2. Let and . The elements in that are not in are:

  3. Let and . The fruits in that are not in are:

  4. Let and . Since and contain the same elements, we have that: That is, the difference is the empty set because there is nothing in that is not in .

  5. Let and . Then: The difference consists of the endpoints of the closed interval that are not part of the open interval .

These examples show that the set difference identifies what belongs only to the first set and not to the second.

Now that we understand how to subtract one set from another using set difference, we can define the complement of a set as a special case, subtracting from the universe.

Definition: Set Complement

Diagram illustrating the complement of a set within the universe , highlighting all elements in that are not in .

The complement of a set , denoted as , consists of all elements in the universe that are not in . In other words:

The complement provides a way to discuss what is not included in a set within the context of a given universe.

Examples: Set Complement

  1. Let and . The complement of is: Here, contains the elements of that are not in .

  2. Let be the set of vowels in the English alphabet. If the universe is the set of all lowercase letters, then the complement is: Here, the complement is expressed verbally to save space, but we could list all consonants explicitly if desired.

  3. Let be a standard deck of playing cards, and let be the set of all spades. The complement is: In this context, represents every card that is not a spade.

  4. Let and . The complement of is: This means contains all real numbers less than or equal to 10.

These examples illustrate how the complement operation identifies everything outside a given set, relative to a specified universe .

Special Number Sets

As mentioned earlier, certain sets of numbers frequently appear and are often represented by special symbols. These sets range from the most basic counting numbers to the broadest set of real numbers.

Below is a summary of some of the fundamental number sets you will encounter, along with their common notations, definitions, and examples.

Fundamental Number Sets

SymbolNameDefinition / Description
Natural numbers
The counting numbers.
Natural numbers with zero
The natural numbers including .
Integers
All whole numbers, both positive and negative.
Rational numbers
The numbers that can be written as fractions.
Irrational numbers
The real numbers that cannot be written as fractions (e.g., , , ).
Real numbersAll numbers on the continuous number line. Includes both and .
Complex numbers
Numbers with a real part and an imaginary part . Includes all real numbers as a subset.

These number sets are not isolated; rather, they form a natural hierarchy where smaller sets are contained within larger ones. The diagram below shows how these sets nest inside one another, for example, all natural numbers are integers, all integers are rational numbers, and all rational numbers are real numbers.

Although irrational numbers are not shown explicitly, they form the part of the real numbers that lies outside the rationals.

Diagram illustrating the nested hierarchy of fundamental number sets, with examples of elements in each set.

The hierarchy can also be expressed symbolically as:

Understanding this hierarchy helps clarify how different number systems extend one another, expanding the kinds of quantities we can represent and reason about.

Additional Set Operations

A few other foundational set operations are commonly used in mathematics and thus data science. While we will not cover these in detail in this course, the table below provides a brief overview. You will most likely encounter and work with these operations throughout your data science degree.

SymbolOperationDescription
Intersection of and The set of all elements that are in both and
Union of and The set of all elements that are in , in , or in both
Cartesian product of and The set of all ordered pairs where and
The power setThe set of all subsets of , including the empty set () and itself

Chapter Exercises

Exercise Set: 1

Write the following sets in roster form (if possible). If it is not possible, explain why.

  1. The set of first five positive and even whole numbers.
  2. The real numbers in the interval
  3. The set of whole numbers less than 6.
  4. The set of whole numbers that are considered very small.
  5. The set of letters in the word "banana".
  6. The set of even numbers that are typically interesting.
  7. The real numbers in the interval

Use set-builder notation to describe the following sets:

  1. , , and

Use interval notion to describe the following sets:

  1. The set of all real numbers between 2 and 5, including both endpoints.
  2. The set of all real numbers strictly greater than .
  3. The set of all real numbers less than or equal to .
  4. The set of all real numbers greater than and less than or equal to .
  5. The empty set (in terms of intervals).

Exercise Set: 2

For each pair of sets below, determine whether they are (a) equal, (b) equivalent but not equal, (c) neither equal nor equivalent.

  1. Let and
  2. Let and
  3. Let and
  4. Let and
  5. Let and

Let , , and . State whether each is true, false, or meaningless:

Exercise Set: 3

List all elements of the following sets:

Let , , and . Find each of the following sets: