# 4.1: An Introduction to Sets

- Page ID
- 23269

## Introduction & Real Number Subsets

Note: Some information from section 1.5 is repeated here for a refresher; however, there is new material in this section as well and the exercises are different. (See the Table of Contents.)

A ** set** is a collection of objects. The objects in a set are called its

**or**

*elements***. The elements in a set can be any types of objects, including sets! The members of a set do not even have to be of the same type. For example, although it may not have any meaningful application, a set can consist of numbers and names.**

*members*We usually use capital letters such as \(A\), \(B\), \(C\), \(S\), and \(T\) to represent sets, and denote their generic elements by their corresponding lowercase letters \(a\), \(b\), \(c\), \(s\), and \(t\), respectively. To indicate that \(b\) is an element of the set \(B\), we adopt the notation \(b\in B\), which means “ \(b\) belongs to \(B\)” or “ \(b\) is an element of \(B\).

We designate these notations for some special sets of numbers: \[\begin{aligned} \mathbb{R} &=& \mbox{the set of real numbers}, \\ \mathbb{Q} &=& \mbox{the set of rational numbers}, \\ \mathbb{Z} &=& \mbox{the set of integers}, \\ \mathbb{N} &=& \mbox{the set of natural numbers (positive integers)}. \end{aligned}\] All these are infinite sets, because they all contain infinitely many elements. In contrast, finite sets contain finitely many elements.

## Roster Notation

We can use the ** roster notation **to describe a set if we can list all its elements explicitly, as in \[A = \mbox{the set of natural numbers not exceeding 7} = \{1,2,3,4,5,6,7\}.\] For sets with more elements, show the first few entries to display a pattern, and use an ellipsis to indicate “and so on.” For example, \[\{1,2,3,\ldots,20\}\] represents the set of the first 20 positive integers. The repeating pattern can be extended indefinitely, as in \[\begin{aligned} \mathbb{N} &=& \{1,2,3,\ldots\} \\ \mathbb{Z} &=& \{\ldots,-2,-1,0,1,2,\ldots\} \end{aligned}.\] The set of even integers can be described as \(\{\ldots,-4,-2,0,2,4,\ldots\}\).

## Set-Builder Notation

We can use a ** set-builder notation** to describe a set. For example, the set of natural numbers is defined as \[\mathbb{N} = \{x\in\mathbb{Z} \mid x>0 \}.\] Here, the vertical bar \(\mid\) is read as “such that” or “for which.” Hence, the right-hand side of the equation is pronounced as “the set of \(x\) belonging to the set of integers such that \(x>0\),” or simply “the set of integers \(x\) such that \(x>0\).” In general, this descriptive method appears in the format \[\{\,\mbox{membership}\;\mid\;\mbox{properties}\,\}.\] The notation \(\mid\) means “such that” or “for which” only when it is used in the set notation. It may mean something else in a different context. Therefore,

*do not*write “let \(x\) be a real number \(\mid\) \(x^2>3\)” if you want to say “ let \(x\) be a real number such that \(x^2>3\).” It is considered improper to use a mathematical notation as an abbreviation.

Example \(\PageIndex{1}\label{eg:setintro-01}\)

Write these two sets \[\{x\in\mathbb{Z} \mid x^2 \leq 1\} \quad\mbox{and}\quad \{x\in\mathbb{N} \mid x^2 \leq 1\}\] by listing their elements explicitly.

**Answer**-
The first set has three elements, and equals \(\{-1,0,1\}\). The second set is a singleton set; it is equal to \(\{1\}\).

There is a slightly different format for the set-builder notation. Before the vertical bar, we describe the form the elements assume, and after the vertical bar, we indicate from where we are going to pick these elements: \[\{\,\mbox{pattern}\;\mid\;\mbox{membership}\,\}.\] Here the vertical bar \(\mid\) means “where.” For example, \[\{ x^2 \mid x\in\mathbb{Z} \}\] is the set of \(x^2\) where \(x\in\mathbb{Z}\). It represents the set of squares: \(\{0,1,4,9,16,25,\ldots\}\).

Example \(\PageIndex{2}\label{eg:setintro-02}\)

The set \[\{ 2n \mid n\in\mathbb{Z} \}\] describes the set of even numbers. We can also write the set as \(2\mathbb{Z}\).

Note

If the membership is not specified, such as: \( \{x \; | \; x^2 \leq 5 \} \) then it is understood that \(\mathbb{R}\) is the default set that \(x\) belongs to.

## Interval Notation

An interval is a set of real numbers, all of which lie between two real numbers. Should the endpoints be included or excluded depends on whether the interval is ** open**,

**, or**

*closed***. We adopt the following**

*half-open***to describe them: \[\displaylines{ (a,b) = \{x\in\mathbb{R} \mid a < x < b \}, \cr [a,b] = \{x\in\mathbb{R} \mid a\leq x\leq b \}, \cr [a,b) = \{x\in\mathbb{R} \mid a\leq x < b \}, \cr (a,b] = \{x\in\mathbb{R} \mid a < x\leq b \}. \cr}\] It is understood that \(a\) must be less than \(b\). Hence, the notation \((5,3)\) does not make much sense. How about \([3,3]\)? This may be used in some texts to mean \({3}\) but we will only use \(a<b\) for intervals and use roster notation for a single number such as \({3}.\)**

*interval notation*An interval contains not just integers, but all real numbers between the two endpoints. For instance, \((1,5)\mathbb \neq \{2,3,4\}\) because the interval \((1,5)\) also includes real numbers such at \(1.276\), \(\sqrt{2}\), and \(\pi\).

We can use \(\pm\infty\) in the interval notation: \[\begin{aligned} (a,\infty) &=& \{ x\in\mathbb{R} \mid a<x \}, \\ (-\infty,a) &=& \{ x\in\mathbb{R} \mid x<a \}. \end{aligned}\] However, we cannot write \((a,\infty]\) or \([-\infty,a)\), because \(\pm\infty\) are *not* numbers. It is nonsense to say \(x\leq\infty\) or \(-\infty\leq x\). For the same reason, we can write \([a,\infty)\) and \((-\infty,a]\), but *not* \([a,\infty]\) or \([-\infty,a]\).

Example \(\PageIndex{3}\label{eg:setintro-03}\)

Write the intervals \((2,3)\), \([2,3]\), and \((2,3]\) in the descriptive form.

**Solution**-
According to the definition of an interval, we find \[\begin{aligned} {(2,3)} &=& \{x\in\mathbb{R} \mid 2<x<3\}, \\ {[2,3]} &=& \{x\in\mathbb{R} \mid 2\leq x\leq 3\}, \\ {(2,3]} &=& \{x\in\mathbb{R} \mid 2 < x\leq 3\}. \end{aligned}\] What would you say about \([2,3)\)?

Example \(\PageIndex{5}\label{eg:setintro-05}\)

Be sure you are using the right types of numbers. Compare these two sets \[\begin{aligned} S &=& \{x\in\mathbb{Z} \mid x^2 \leq 5 \}, \\ T &=& \{x\in\mathbb{R} \mid x^2 \leq 5 \}. \end{aligned}\] One consists of integers only, while the other contains real numbers. Thus, \(S=\{-2,-1,0,1,2\}\), and \(T=\big[-\sqrt{5},\sqrt{5}\,\big]\).

Let \(S\) be a set of numbers; we define \[\begin{aligned} S^+ &=& \{ x\in S \mid x>0 \}, \\ S^- &=& \{ x\in S \mid x<0 \}, \\ S^* &=& \{ x\in S \mid x\mathbb{N}eq0 \}. \end{aligned}\] In plain English, \(S^+\) is the subset of \(S\) containing only those elements that are positive, \(S^-\) contains only the negative elements of \(S\), and \(S^*\) contains only the nonzero elements of \(S\).

Example \(\PageIndex{6}\label{eg:setintro-06}\)

It should be obvious that \(\mathbb{N}=\mathbb{Z}^+\).

Some mathematicians also adopt these notations: \[\begin{aligned} bS &=& \{ bx \mid x\in S \}, \\ a+bS &=& \{ a+bx \mid x\in S \}. \end{aligned}\] Accordingly, we can write the set of even integers as \(2\mathbb{Z}\), and the set of odd integers can be represented by \(1+2\mathbb{Z}\).

## Empty Set

An ** empty set** is a set that does not contain any elements. \[\{x\in\mathbb{R} \mid x>0 \mbox{ and } x<0\}\] is an example of an empty set. We use an empty set as a convenient way of declaring that a problem has no solution: we say that the solution set is an empty set. We denote an empty set with the notation \(\emptyset\) or \(\{\,\}\). Notice we say "an" empty set. We will need to prove uniqueness in order to call it "the" empty set.

Example \(\PageIndex{7}\label{eg:setintro-07}\)

Determine which of these statements are true. \[\begin{aligned} \{x\in\mathbb{R} \mid (x^2+2)(x^2+3) = 0\} &=& \emptyset, \\ \{x\in\mathbb{Z} \mid (x^2-2)(x^2+3) = 0\} &=& \emptyset, \\ \{x\in\mathbb{R} \mid (x^2-2)(x^2+3) = 0\} &=& \emptyset, \\ \{x\in\mathbb{R} \mid (x^2-2)(x^2+3)\geq0\} &=& \emptyset. \end{aligned}\]

**Solution**-
The answers are: true, true, false, and false, respectively.

## Equality of Sets

Two sets \(A\) and \(B\) are said to be ** equal** if they contain the same collection of elements. More rigorously, we define \[A = B \Leftrightarrow \forall x \, (x \in A \Leftrightarrow x \in B).\] Since the elements of a set can themselves be sets, exercise caution and use proper notation when you compare the contents of two sets.

Note: We will also use subsets for another definition for equality ofsets in the next section.

Example \(\PageIndex{9}\label{eg:setintro-09}\)

Explain why \(\big\{0,\{1\}\big\} \neq \{0,1\}\).

**Solution**-
The set \(\big\{0,\{1\}\big\}\) consists of two elements: the integer \(0\) and the set \(\{1\}\). The set \(\{0,1\}\) also consists of two elements, both of them integers; namely, 0 and 1.

You may find the following analogy helpful. Imagine a set being a box. You open a box to look at its contents. The box itself can be compared to the curly braces \(\{\) and \(\}\). What it holds is exactly what we call the elements of the set it represents. The contents of the two sets \(\big\{0,\{1\}\big\}\) and \(\{0,1\}\) are depicted in the boxes shown in the Figure below (well, not yet - the correct figure will be inserted at a later time - see if you can use your imagination for now).

(200,80) (0,0)(130,0)2 ( 0, 0)( 0,50)2(1,0)50 ( 0, 0)(50, 0)2(0,1)50 ( 0,50)(50, 0)2(1,1)20 (20,70)(1,0)50 (50, 0)(1,1)20 (70,20)(0,1)50 (20,50)(0,1)20 ( 0, 0, 20,20) (20,20, 70,20) (20,20, 20,50) (15,30)(25, 0)2 (10,30)(10,15)0 (35,30)(10,15)1 (25,25) ( 0, 0)( 0,20)2(1,0)20 ( 0, 0)(20, 0)2(0,1)20 ( 0,20)(20, 0)2(0,0, 8,8) ( 8,28)(1,0)20 (20, 0)(0,0, 8,8) (28, 8)(0,1)20 ( 8,20)(0,1) 8 ( 0, 0, 8, 8) ( 8, 8, 28, 8) ( 8, 8, 8,20)

When you open the first box, you find two items. One of them is the number 0; the other is another box that contains the number 1. The second box also contains two items that are both numbers. What you find in these two boxes is not the same. Hence, the sets they represent are different.

hands-on exercise \(\PageIndex{10}\label{he:setintro-10}\)

Name some differences between the sets \(\big\{0,\{1\}\big\}\) and \(\big\{\{0\},\{1\}\big\}\).

Example \(\PageIndex{10}\label{eg:setintro-10}\)

True or false: \(\mathbb{Z}=\big\{\{\ldots,-3,-2,-1\},0,\{1,2,3,\ldots\}\big\}\)?

**Solution**-
The set on the left is \(\mathbb{Z}\), and \[\mathbb{Z} = \{\ldots,-3,-2,-1,0,1,2,3,\ldots\}.\] It is an infinite set. The set on the right consists of only three elements:

- the set \(\{\ldots,-3,-2,-1\}\), which is the set of negative integers,
- the integer 0, and
- the set \(\{1,2,3,\ldots\}\), which is the set of positive integers.

Hence, they are not equal. Notice that \[\mathbb{Z} \neq \big\{\{\ldots,-3,-2,-1\}, \{0\}, \{1,2,3,\ldots\}\big\}\] either, because the set on the right is a set of three sets, while the set on the left is a set of integers. One has three elements; the other has infinitely many elements.

To reduce confusion, instead of saying a set of sets, we could say a ** collection of sets** or a

**. For example, \[\big\{\{1,3,5,\ldots,\}, \{2,4,6,\ldots\,\}\big\}\] is a family of two sets, one of which is the set of positive odd integers; the other is the set of positive even integers.**

*family of sets*## Cardinality of Finite Sets

A set is said to be ** finite** if it has a finite number of elements. The number of elements in a finite set \(A\) is called its

**, and is denoted by \(|A|\). Hence, \(|A|\) is always nonnegative. If \(A\) is an infinite set, some authors would write \(|A|=\infty\); however, we will use more specific designations for the cardinality of infinite sets. More will be revealed in the next chapter about the cardinality of infinite sets.**

*cardinality*Example \(\PageIndex{11}\label{eg:setintro-11}\)

While it is trivial that \(|\{1,4,7,8\}| = 4\), and \(|\{0,1\}| = 2\), it may not be obvious that \[\big|\big\{0,\{1\}\big\}\big| = 2,\] and \[\big|\big\{\{\ldots,-3,-2,-1\},0,\{1,2,3,\ldots\,\}\big\}| = 3.\] What matters is the number of entries in a set, which can be compared to how many items you can find when you open a box. Here is another example: \[|\{x\in\mathbb{R} \mid x^2=9\}| = 2\] because the equation \(x^2=9\) has two real solutions. What is \(|\{x\in\mathbb{N} \mid x^2=9\}|\)?

hands-on exercise \(\PageIndex{11}\label{he:setintro-11}\)

Determine these cardinalities:

- \(|\{x\in\mathbb{Z} \mid x^2-7x-6=0\}|\)
- \(|\{x\in\mathbb{R} \mid x^2-x-12<0\}|\)
- \(|\{x\in\mathbb{Z} \mid x \mbox{ is prime and } x \mbox{ is even}\}|\)

Recall that your answers should be nonnegative.

hands-on exercise \(\PageIndex{12}\label{he:setintro-12}\)

Explain why it is incorrect to say \(|\emptyset|=\emptyset\). In fact, it is nonsense to say \(|\emptyset|=\emptyset\). Explain. What should be the value of \(|\emptyset|\)?

We close this section with an important remark about sets. It follows from the definition of equality of sets that we do not count repeated elements as separate elements. For example, suppose a small student club has three officers:

chair: | Mary, |

vice chair: | John, |

secretary: | John; |

and let \(A\) represent the set of its officers, and \(B\) the set of positions in its executive board, then \(|A|=2\) and \(|B|=3\), because \[A = \{ \mbox{Mary}, \mbox{John} \},\] and \[B = \{ \mbox{chair}, \mbox{vice chair}, \mbox{secretary}\}.\]

Example \(\PageIndex{12}\label{eg:setintro-12}\)

Find the errors in the following statement: \[|\{-2,2\}| = \{\,|-2|,|2|\} = \{2\} = 2,\] and correct them.

**Solution**-
This statement contains several errors. The first mistake is assuming that we can distribute the “absolute value” symbols \(|\quad|\) over the contents of a set: \[|\{-2,2\}| \mathbb{N}eq \{\,|-2|,|2|\}.\] After all, the two vertical bars do not mean absolute value in this case. Instead, it means the cardinality of the set \(\{-2,2\}\). Hence, \(|\{-2,2\}|=2\).

The second equality \(\{\,|-2|,|2|\} = \{2\}\) is correct. After taking absolute values, both entries become 2. However, we do not write \(\{|-2|,|2|\} = \{2,2\}\), because a set should not contain repetition. Therefore, it is correct to say \(\{\,|-2|,|2|\} = \{2\}\).

The last equality \(\{2\}=2\) is wrong. We cannot compare a set to a number. Imagine the set \(\{2\}\) as a box containing only one object, and that object is the number 2. In contrast, 2 on the right-hand side is left in the open air without any containment. It is clear that \(\{2\} \neq 2\).

The entire statement contains multiple mistakes; some of them are syntactical errors while some are conceptual. Nevertheless, we do have \(|\{-2,2\}|=2\). Although the final answer is correct, the argument used to obtain it is not.

In some situations, we do want to count repeated elements as separate elements, as in \(S=\{1,2,2,2,3,3,4,4\}\). We call such a collection a ** multiset** instead of an ordinary set. In this case, \(|S|=8\).

## Summary and Review

- A set is a collection of objects (without repetitions).
- To describe a set, either list all its elements explicitly, or use a descriptive method.
- Intervals are sets of real numbers.
- The elements in a set can be any type of object, including sets.
- We can even have a set containing dissimilar elements. In particular, we can mix elements and sets inside a set.
- An empty set is a set with no elements.
- If a set \(A\) is finite, its cardinality \(|A|\) is the number of elements it contains. Consequently, \(|A|\) is always nonnegative.

## Exercises

Exercise \(\PageIndex{1}\label{ex:setintro-01}\)

Write each of these sets by listing its elements explicitly (that is, using the roster method).

(a) \(\{n\in\mathbb{Z} \mid -6<n<4\}\)

(b) \(\{n\in\mathbb{N} \mid -6<n<4\}\)

(c) \(\{x\in\mathbb{Q} \mid x^3-x^2-6x=0\}\)

(d) \(\{x\in\mathbb{Q} \mid x^4-11x^2+18=0\}\).

**Solution**-
(a) \(\{-5,-4,-3,-2,-1,0,1,2,3\}\) (b) \(\{1,2,3\}\) (c) \(\{0,-2,3\}\) (d) \(\{-3,3\}\)

Exercise \(\PageIndex{3}\label{ex:setintro-03}\)

Write each of the following sets in the form \(\{n\in\mathbb{Z} \mid p(n)\}\) with a logical statement \(p(n)\) describing the property of \(n\).

(a) \(\{\ldots,-3,-2,-1\}\)

(b) \(\{\ldots,-27,-8,-1,0,1,8,27,\ldots\}\)

(c) \(\{0,1,4,9,16,\ldots\}\)

**Solution**-
(a) \(\{n\in\mathbb{Z} \mid n<0\}\)

(b) \(\{n\in\mathbb{Z} \mid n\mbox{ is a perfect cube}\}\)

(c) \(\{n\in\mathbb{Z} \mid n\mbox{ is a perfect square}\}\)

Exercise \(\PageIndex{5}\label{ex:setintro-05}\)

Whenever possible, express these sets in the form \(S^+\), \(S^-\), \(bS\), or \(a+bS\) for some appropriate set \(S\).

(a) \(\{\ldots,-3,-2,-1\}\)

(b) \(\{\ldots,-27,-8,-1,0,1,8,27,\ldots\}\)

(c) \(\{0,1,4,9,16,\ldots\}\)

(d) \(\{\ldots,-15,-10,-5,0,5,10,15,\ldots\}\)

(e) \(\{0,4,8,12,\ldots\}\)

(f) \(\{\ldots,-14,-8,-2,4,10,16,\ldots\}\)

**Solution**-
(a) \(\mathbb{Z}^-\) (d) \(5\mathbb{Z}\) (f) \(4+6\mathbb{Z}\)

**Remark**. We cannot write (b) as \(\mathbb{Z}^3\) and (c) as \(\mathbb{Z}^2\), because \(\mathbb{Z}^3\) and \(\mathbb{Z}^2\) mean something else. If we drop 0 from (e), then \(\{4,8,12,\ldots\}=4\mathbb{N}\). However, the inclusion of 0 makes it harder to describe (d) in the form of \(4S\).

Exercise \(\PageIndex{6}\label{ex:setintro-06}\)

Determine whether the following sets are empty, finite sets, or infinite sets:

- \(\{2n+1 \mid n\in\mathbb{N}\}\)
- \(\{x\in\mathbb{R} \mid x^2<0\}\)
- \(\{x\in\mathbb{Q} \mid x\geq0 \mbox{ and } x\leq0\}\)
- \(\{x\in\mathbb{N} \mid x<0 \mbox{ or } x>0\}\)

Exercise \(\PageIndex{7}\label{ex:setintro-07}\)

Write each of these sets in the interval notation.

(a) \(\{x\in\mathbb{R} \mid -4<x<7\}\)

(b) \(\{x\in\mathbb{R} \mid -4<x\leq7\}\)

(c) \(\{x\in\mathbb{R}^+\mid -4<x\leq7\}\)

**Solution**-
(a) \((-4,7)\) (b) \((-4,7]\) (c) \((0,7]\)

Exercise \(\PageIndex{8}\label{ex:setintro-08}\)

Is \([-\infty,\infty]\) a legitimate or correct notation? Explain.

Exercise \(\PageIndex{9}\)

Determine which of the following statements are true, and which are false.

(a) \(a\in\{a\}\)

(b) \(\{3,5\}=\{5,3\}\)

(c) \(\emptyset\in\emptyset\)

(d) \(\emptyset=\{\emptyset\}\)

(e)\(\{\;\}=\emptyset\)

(f) \(\emptyset\in\{\emptyset\}\)

**Solution**-
(a) true (b) true (c) false (d) false (e) true (f) true

Exercise \(\PageIndex{10}\)

Evaluate the following expressions.

(a) \(|\{x\in\mathbb{Z} \mid -4<x<7\}|\)

(b) \(|\{x\in\mathbb{Z} \mid -4<x\leq7\}|\)

(c)\(|\{x\in\mathbb{N} \mid -4<x\leq7\}|\)

(d) \(|\{x\in\mathbb{R} \mid x^4-2x^3-35x^2=0\}|\)

(e)\(|\{-3,-2,2,3\}|\)

(f) \(|\{x\in\mathbb{Q} \mid x^2=3\}|\)

Exercise \(\PageIndex{11}\label{ex:setintro-11}\)

Determine which of the following statements are true, and which are false.

(a) \(2\in(2,7)\)(b) \(\sqrt{2}\in(1,3)\)

(c) \(\big(\sqrt{5}\,\big)^2\in\mathbb{Q}\)

(d) \(-5\in\mathbb{N}\)

**Solution**-
(a) false (b) true (c) true (d) false

Exercise \(\PageIndex{12}\label{ex:setintro-12}\)

Give examples of sets \(A\), \(B\) and \(C\) such that:

- \(A\in B\) and \(B\in C\), and \(A\notin C\)
- \(A\in B\) and \(B\in C\), and \(A\in C\)

Exercise \(\PageIndex{13}\label{ex:setintro-13}\)

Determine whether the following statements are correct or incorrect *syntactically*. For those that are syntactically correct, determine their truth values; for those that are syntactically incorrect, suggest ways to fix them.

(b) \(\{x\in\mathbb{R}\mid x^2<0\} \equiv \emptyset\).

**Solution**-
(a) It is incorrect to write (3,7]=3<x≤7 because (3,7] is a set, but 3<x≤7 is a logical statement.

(b) No, because both {x∈R∣x2<0} and ∅ are sets, so we should use an equal sign to compare them. The notation ≡ only applies to logical statements. The correct way to say it is “{x∈R∣x2<0}=∅.”

Exercise \(\PageIndex{14}\label{ex:setintro-14}\)

Determine whether the following statements are correct or incorrect *syntactically*. For those that are syntactically correct, determine their truth values; for those that are syntactically incorrect, suggest ways to fix them.

- \(\frac{7}{4}\in[2,\sqrt{7})\).
- There does not exist \(x\) such that \(x\in\mathbb{R}^+\) and \(\mathbb{R}^-\).
- If \((0,\infty)\), then \(x\) is positive.