✖

Sets

A set can be thought of as a collection of elements. Every set therefore contains a certain number of elements, which may be finite or infinite. It may also contain no elements at all, in which case we speak of the empty set. We usually denote a set by a capital letter, for example M, and the elements of the set by a lower-case letter such as m.

What a set is

The set is one of the basic ideas in maths, and a great many other things are defined through it. So it is a good idea to be clear from the start about what a set is, so that you don’t get lost later on.

A set is a collection of any elements whatsoever. In maths we most often work with sets of numbers, that is, sets whose elements are numbers. The usual way to write a set is this:

M={1,2,3}

This describes a set called “M” that contains three elements: one, two and three. We always write sets inside curly brackets, and in practice whenever you see curly brackets, there is a set involved.

What can we use sets for? Sets often tell us which elements we are allowed to choose from. In everyday life, for example, you might say something like “Amelia, let’s play a game. Think of a number from one to five.” You have just given Amelia a range of numbers to choose from. In maths you would use a set:

L={1,2,3,4,5}

And then you could say “Amelia, let’s play a game. Think of any number that is in the set L.” The game would certainly be more fun straight away. To say that an element belongs to a set we use the symbol ∈, and when it does not belong we use ∉. So if we want to say that one belongs to the set L but seven does not, we write: 1 ∈ L and 7 ∉ L.

A set can of course be empty. We write this either as P = {} or, more simply, as P = ∅. Be careful: both notations mean “the empty set”, but if you write P = {∅}, you have written a set that contains the empty set as an element. That is not the same as the empty set.

Order and repeated elements

We don’t say that the elements of a set are arranged in any particular order. A set is an unordered collection of elements. If we have two sets A = {1, 2, 3} and B = {3, 2, 1}, we say that they are the same. The order of the elements simply doesn’t matter.

Repeated elements don’t interest us either. If a set contains several copies of the same element (the same number several times), we count only one occurrence of it. Again, if we have the two sets A = {1, 1, 2, 2, 2} and B = {2, 1}, we regard them as the same. It doesn’t matter that A seems to contain “more” elements because it has doubled or tripled ones. When working with sets we simply filter the repeats out.

Size and equality

We can define the size of a set, which is the number of elements in it. From the previous example, A = {1, 1, 2, 2, 2} and B = {2, 1}, the size of A is two, but the size of B is also two, because even when counting the elements of a set we ignore repeats. We write the size of a set between vertical bars: |A| = |B| = 2.

As you have probably worked out, two sets are equal if they have the same elements. A few examples:

{1,2,3}={1,2,3}{1,2,3}={1,2,3,2,3,1}{a,h,o,j}={o,o,h,j,a,o}{1,3,5,9}≠{1,3,9}∅≠{x}

An important property is that a set can contain another set as one of its elements. For example: C = {1, 2, {3, 4, 5, 6}}. Note that the set C has three elements, not six. It contains one, two and a set. The elements 3, 4, 5 and 6 belong to the inner set, not to the set C. So |C| = 3. Here is a more complicated example:

D={0,{1,{2,3}},{4}}

How many elements does the set D have? It has three elements, namely:

D1=0,D2={1,{2,3}},D3={4}

A set can be finite or infinite. All the sets we have met so far are finite. An example of an infinite set is the set of all numbers.

Subsets

Take two sets A = {1, 2} and B = {1, 2, 3}. These sets are different, because they don’t have the same elements: the set B is bigger. However, you will have noticed that B contains exactly the same elements as A, plus the extra element 3. We can now say that A is a subset of B.

If A is a subset of B, then every element of A must also be an element of B. Being a subset is a relation, and we write it with the symbol ⊆. The formal definition is:

A⊆B⇔∀x∈A:x∈B

It is usually assumed that the sets A and B may be the same, and A ⊆ B still holds. If we want to express the strict version of a subset, we use a different symbol: ⊊. Then if A ⊊ B, the set B must be bigger (if it is finite): it must contain an element that A does not. We then call A a “proper subset” of B. So if A ⊊ B, then A is a proper subset of B. The definition of a proper subset is:

A⊊B⇔(A⊆B∧A≠B)

The definition is the same as for an ordinary subset, except that the two sets must not be equal. Some examples:

{a,h,o}⊆{a,h,o,j}{a,h,o}⊊{a,h,o,j}{2,4,6}⊆{2,4,6,8,…}{2,4,6}⊊{2,4,6,8,…}{1,2,3}⊈{1,3}{1,2,3}⊊̸{1,3}{0,1}⊆{0,1}{0,1}⊊̸{0,1}∅⊆{π}∅⊊{π}∅⊆{∅}∅⊊{∅}{0}⊈∅{0}⊊̸∅{⋄,△,⊙,‡,≀}⊆{⋄,△,⊙,‡,≀,⋆,∙,∓}{⋄,△,⊙,‡,≀}⊊{⋄,△,⊙,‡,≀,⋆,∙,∓}

Properties of subsets:

  • A ⊆ A: a set is always a subset of itself.
  • A ⊄ neq A: a set is never a proper subset of itself.
  • ∅ ⊆ A: the empty set is a subset of every set.
  • A ⊄ neq ∅: the empty set has no proper subset.

We can use subsets to write the equality of sets:

A=B⇔A⊆B∧B⊆A

If the two sets are the same, then each is a subset of the other.

A subset is also sometimes called an “inclusion”.

Power set

The power set is the set of all subsets of a given set. It is usually written either P(M) or 2M.

Example: M = {1, 2, 3}. What are all its subsets? Certainly the empty set and M itself. Then: {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}. All of these sets together make up the power set of M. We write: P(M) = {∅, M, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}}.

Since the empty set is a subset of every set and M is always a subset of M, we always have ∅ ∈ P(M) and M ∈ P(M).

How to write a set

We have already seen one way: simply list the elements, using curly brackets. M = {1, 2, 3} or N = {a, b, c, d} and so on. If we are writing an infinite set, we can use three dots, provided it is clear how the sequence of elements continues: M = {1, 2, 3, …}

The main way to write a set is by its defining property (set-builder notation). In general it looks like this: {x ∈ X | P(x)}, where X is the set we choose elements from and P(x) is some formula that specifies the elements of the set. The formula can be written purely in symbols or in words. Instead of “|” a colon “:” is also used.

For example, “let the set M contain all the numbers that are a day of the month”. A month has at most 31 days, so such a set would have 31 elements, from 1 to 31. We could write it with dots like this: M = {1, 2, 3, …, 30, 31}. Another way of writing the same set would be: {x ∈ ℤ | x is a day of the month}, where ℤ stands for the set of integers.

A more mathematical example might be “let the set P contain all the positive numbers that are divisible by five”. Then the set would look like this: P = {5, 10, 15, 20, 25,…}

Let’s try to write down the set T of positive integers that are less than ten: T = {x ∈ ℤ+ | x<10}. This notation tells us that the set T consists of elements x that we take from the set of positive integers and that satisfy the condition that they are less than 10. So we look at the positive integers and keep only those that are less than ten: {1, 2, 3, 4, 5, 6, 7, 8, 9}. And that’s all there is to it.

Another example: Y = {x ∈ ℤ | x ≠ 0}. We have defined a set Y that contains the elements x taken from the integers, and the only condition x must satisfy is that it must not be zero. So the set Y contains all the integers except zero.

Another example: G = {x ∈ ℝ | x · x = x}. The set G contains the elements x that we take from the real numbers, and for every such element x, multiplying it by itself must give x again. For example, we can try the number 5. By the definition this equality should hold: 5 · 5 = 5. That is clearly false, so 5 is not an element of G. Let’s try one: 1 · 1 = 1. This is obviously true, so one is an element of G. The second and last element is zero. It won’t hold for any other number. So we can write: G = {0, 1}.

And a final example. I’ll write something more complicated so that you can see that the defining property can be complicated too:

X={x∈R|(x2=2x)∨(sin⁡(x)=π∧cos⁡(x)=π)}

In practice a set is most often defined by a defining property, and it is fair to say that a large part of the ideas in maths are defined using sets. Take an interval, for example: the interval (a, b) is the set I for which:

I={x∈R|(x>a)∧(x<b)}

These are all the elements of the set of real numbers that are greater than a and less than b, which is exactly what the interval expresses.

More sources

Chapters: Sets, Union, intersection, difference and complement of sets, Countable sets, Paradoxes of set theory