Writing sets [0065]
- February 16, 2026
There are two basic ways to write down a set.
Literal set notation [0068]
- February 16, 2026
We can write a (finite) set by listing its elements, separated by commans, within curly braces.
Example [0066]
- February 16, 2026
S = \{1,3,5,7,9\}.
We can also sometimes abbreviate using an ellipsis (three dots), which generally means "fill in the obvious pattern". One must be careful, however, since what counts as "obvious" depends a lot on context and audience. When in doubt, and in very formal situations, it's best to avoid the use of ellipsis; but it can be convenient in an informal setting.
Example [0067]
- February 16, 2026
S = \{1,2,3, \dots , 100\}.
Example [006E]
- February 18, 2026
We can have sets with things other than numbers, such as \{\text {cow}, \text {horse}, \text {dog}\}.
Example [006F]
- February 18, 2026
\{53\} is a set with one element.
Definition Empty set [006G]
- February 18, 2026
The empty set, written \varnothing or \{\}, is the set with no elements.
Remark [006H]
- February 18, 2026
The definition of sets technically allows for sets with a mix of different kinds of elements, like \{2, \mathsf {T}, \text {cow}, \text {``hello''}\}, but we will never do this; our sets will always be collections of elements of the same type.
Set builder notation [0069]
- February 16, 2026
We can also use set builder (or set comprehension) notation, whose basic form is \{ \text {expression} \mid \text {variable definition}, \text {conditions} \}
This means that for each value of the variable(s) defined on the right side of the vertical bar which satisfy all the conditions, the set will contain the value of the expression on the left side of the vertical bar.
Note that the expression on the left of the \mid must evaluate to the value of the set; the conditions on the right of the \mid must be propositions.
Example [006B]
- February 16, 2026
This is the set of all positive integers which are less than 5, that is, the set \{1,2,3,4\}.
Example [006C]
- February 16, 2026
We can stack multiple conditions; for a given x, all the conditions must be true for it to be considered. This is the set of all odd integers between 0 and 100.
Example [006D]
- February 16, 2026
The expression to the left of the vertical bar does not have to be just a variable; it can be any expression. For each value of x that satisfies the conditions on the right side, we put that value of x into the expression to compute a value that will be in the set.
In this example, when x = 0, we get 2x+5 = 2 \cdot 0 + 5 = 5; when x = 1, we get 2x+5 = 7, and so on. All told, this defines the set \{5, 7, 9, \dots , 25\}.
Example [006I]
- February 18, 2026
This is the (infinite) set of all possible ordered pairs of integers which sum to 6. That is, \{(2,4), (3,3), (-10, 16), \dots \}.