̽̽

Sets and notation

Author

Clayton Cafiero

Published

2025-01-05

Sets and elements

A set is an unordered collection of objects.

Typically, we use upper-case letters to denote sets, and lower-case letters to denote objects belonging to a set (though not always). We use \in to indicate that some object is a member of a set.

a \in X.

That is, a is an element of, or member of, the set X. We use \not \in to indicate that some object is not an an element of a set.

b \not \in X.

That is, b is not an element of the set X.

Sets don’t contain multiple instances of the same object.

Inclusion / containment / subsets

We say that set A is a subset of set B if every element of A is also an element of B, and we write

A \subseteq B.

We say A is a proper (or strict) subset of B if all elements of A are also elements of B, and A \neq B.

There is sometimes confusion over symbols, \subset, \subseteq, \subsetneq, because some authors use \subset to mean proper (strict) subset and others use \subsetneq to mean proper (strict) subset. So A \subseteq B means “all elements of A are also elements of B and possibly A = B,” whereas A \subsetneq B means “all elements of A are also elements of B and A \neq B.” However, the meaning of \subset will vary by author.

If B \subseteq A, then we say A contains B, or B is included in A.

Identity of sets

We write A = B to signify that the sets A and B are identical—they contain exactly the same elements. In the simplest, limited cases we can compare directly the elements in two sets to determine their identity. For example, given A = \{\text{red}, \text{green}, \text{blue}\} and B = \{\text{red}, \text{green}, \text{blue}\}, we can see at a glance that A and B are identical.

The general approach to demonstrating identity is to show that each set includes the other. That is, if A is a subset of B and B is a subset of A, then A and B are identical.

We write A \neq B to signify that the sets A and B are not identical—that is, either A contains at least one element not in B, or B contains at least one element not in A, or both.

Note that we’ve used the term identity here, and not equivalence. Strictly speaking, if A and B contain exactly the same elements, then A and B are the same set. In common parlance, we tend to use “identity” and “equivalence” interchangeably, but saying A and B are equivalent isn’t quite correct.

Defining or specifying a set

We can specify certain sets by enumerating the objects contained in a set. For example,

A = \{x, y, z\}

denotes the set containing the elements x, y, z.

Sometimes, when it’s very clear, we can use an ellipsis (\ldots) to indicate continuation of a sequence. For example,

A = \{1, 3, 5, 7, 9, \ldots \}

means A is the set of all odd natural numbers. However, this kind of thing won’t work:

A = \{\text{Votey Building}, 17, \text{pumpkins}, \text{May 5},...\}

because we have no idea how to continue!

Set builder notation

More often than not, enumerating all the elements of a set is cumbersome or impossible. Thankfully, there’s another way to specify sets by using set builder notation. With set builder notation, we specify some property (or properties) that an object may or may not possess (we call this a predicate), and the set contains all those objects for which the predicate holds true. For example,

R = \{x \: | \: x \text{ is an automobile and } x \text{ is red} \}

is the set of all red automobiles. You can read this as R is the set of all x such that x is an automobile and x is red. (We read the single vertical bar | in this context as “such that.”)

B = \{n \: | \: n \text{ is an odd integer} \}

is the set of all odd integers. We could define B a little more formally:

B = \{n \: | \: n = 2k + 1\text{ for some integer } k\}.

Sets are unordered

Sets are unordered collections of objects, so \{1, 2, 3\}, \{1, 3, 2\}, \{2, 1, 3\}, \{2, 3, 1\}, \{3, 1, 2\}, and \{3, 2, 1\} are all the same set!

Cardinality

The cardinality of a set is the number of elements in the set. A set can contain zero or more elements. We use vertical bars to denote cardinality, thus,

\lvert A \rvert.

So if A contains 42 (distinct) elements,

\lvert A \rvert = 42.

Note that the cardinality of a set refers to the number of elements in the set. It’s important to keep this straight in your mind when considering sets that contain elements which are themselves sets. Let’s say we have the set B = \{1, 2, \{3, 4, 5\}, 6\}. This set has four elements (not six). The elements of this set are 1, 2, 6, and the set containing 3, 4, and 5.

We refer to any set having a finite number of elements as a finite set. Some sets have an infinite number of elements—for example, the set of all integers. We refer to such sets as infinite sets.

It is quite possible for a finite set to contain another set with an infinite number of elements. For example, let P be the set of all prime numbers. This set is infinite—there are infinitely many primes. Now consider the set D = \{0, 42, P, 99\}. D contains the infinite set P, but the cardinality of D is four. D contains only four elements. P is infinite, but D (which includes P) is finite. (tl;dr Cardinality is not recursive.)

The empty set

A set may be empty—it contains no elements whatsoever. That is,

\lvert B \rvert = 0.

In this case, we often use a special symbol, \emptyset, to denote the empty set. Notice we say, the empty set, because there is exactly one such instance. The empty set is unique.

The empty set is a subset of every set

The empty set, \emptyset, is a subset of every set. That is, for any set A,

\emptyset \subseteq A.

This does not mean that the empty set is an element of every set! That’s very different!

So, why is the empty set a subset of every set? Consider the definition of subset. We say that B is a subset of A if every element in B is also an element of A. Now what about the empty set? Consider any arbitrary set, A. Are all the elements of the empty set elements of A? Since the empty set contains no elements, this is vacuously true—all elements of \emptyset are elements of A, because there aren’t any! (Now ask yourself: is the empty set a subset of itself?)

Notation for certain sets of numbers

We use “blackboard” letters for certain special sets of numbers.

Natural numbers

\mathbb{N} = \{1, 2, 3, 4, \ldots\} is the set of all natural numbers. Note: Some authors include 0 among the natural numbers, others do not. Either way, this is an infinite set.

Integers

\mathbb{Z} = \{\ldots, −3, −2, −1, 0, 1, 2, 3, \ldots\} is the set of all integers. (Where’d we get \mathbb{Z}? This is from the German zahlen meaning “number,” presumably by way of mathematician David Hilbert.) This is an infinite set.

Rational numbers

\mathbb{Q} is the set of all rational numbers. We can define this using set builder notation:

\mathbb{Q} = \bigg\{\frac{a}{b} \: \bigg | \: a, b \in \mathbb{Z}; b \neq 0\bigg\}.

In other words, the set of all numbers that can be expressed as a fraction, in which the numerator and denominator are both integers, and the denominator is not zero. (Where’d we get the \mathbb{Q}? From the word “quotient.”) This is an infinite set.

Real numbers

\mathbb{R} is the set of all real numbers. Real numbers fill the number line. This is an infinite set. Don’t ask me for a formal definition. ;)



Copyright © 2024–2025 Clayton Cafiero

Reuse