Discrete Structures

§1 Sets

Sets, subsets, set-builder notation, set equality, and Russell's paradox.

A set is a group of objects. The objects inside it are called elements.

A={1,2,3}A=\{1,2,3\}

Here, 11, 22, and 33 are elements of AA.

1A4A1\in A \qquad 4\notin A
  • xAx\in A means “xx is in AA.”
  • xAx\notin A means “xx is not in AA.”

The empty set

The empty set has nothing in it. We write it as

or{}.\varnothing \qquad\text{or}\qquad \{\}.

Since it has no elements,

xx\notin\varnothing

no matter what xx is. Even the empty set is not inside itself:

.\varnothing\notin\varnothing.

But {}\{\varnothing\} is different. It is a set with one element, and that element happens to be the empty set:

{}.\varnothing\in\{\varnothing\}.

Number sets

These symbols show up often:

SymbolNumbers it contains
N\mathbb N0,1,2,3,0,1,2,3,\ldots
N+\mathbb N^+1,2,3,1,2,3,\ldots
Z\mathbb Z,2,1,0,1,2,\ldots,-2,-1,0,1,2,\ldots
Q\mathbb Qfractions such as 12\frac12, 23-\frac23, and 55
R\mathbb Revery number on the real number line

In these notes, 00 is included in N\mathbb N. Some books start N\mathbb N at 11, so it is always worth checking which convention is being used.

Each set fits inside the next one:

N+NZQR.\mathbb N^+\subseteq\mathbb N\subseteq\mathbb Z\subseteq\mathbb Q\subseteq\mathbb R.

N\mathbb N and Z\mathbb Z are discrete: their values come in separate steps. R\mathbb R is continuous: there are always more real numbers between any two different real numbers.

Elements and subsets are not the same thing

The symbols \in and \subseteq describe two different relationships.

  • xAx\in A asks whether one object is inside AA.
  • BAB\subseteq A asks whether every element of BB is also in AA.

For example,

{1,2,3}N.\{1,2,3\}\subseteq\mathbb N.

This is true because 11, 22, and 33 are all natural numbers.

More generally,

ABA\subseteq B

means that anything in AA must also be in BB.

The empty set is a subset of every set:

A.\varnothing\subseteq A.

Why? For this to be false, we would need to find something in \varnothing that is missing from AA. There is nothing in \varnothing, so there can be no counterexample.

That does not mean \varnothing is an element of every set:

Ais always true, butAmay be false.\varnothing\subseteq A \quad\text{is always true, but}\quad \varnothing\in A \quad\text{may be false.}

Sometimes both relationships can be true. If

A={1,2,{1,2}},A=\{1,2,\{1,2\}\},

then

{1,2}A\{1,2\}\in A

because {1,2}\{1,2\} appears as one element of AA. We also have

{1,2}A\{1,2\}\subseteq A

because both 11 and 22 are elements of AA.

Two ways to write a set

List the elements

The simplest way is to list everything inside braces:

A={1,2,3}.A=\{1,2,3\}.

Order does not matter, and writing something twice does not add a new element:

{1,2,3}={3,2,1}={1,1,2,3}.\{1,2,3\} = \{3,2,1\} = \{1,1,2,3\}.

A set only remembers whether an element is there. It does not remember its position or how many times it was written.

Describe a rule

For a large or infinite set, listing everything is not practical. Instead, we can describe which values belong:

A={xUx follows a certain rule}.A=\{x\in U\mid x\text{ follows a certain rule}\}.

Read the vertical bar as “such that.” The set UU tells us where xx is allowed to come from.

For example,

N={xZx0}.\mathbb N=\{x\in\mathbb Z\mid x\ge0\}.

This says: take the integers, then keep the ones that are at least zero.

The odd natural numbers can be written as

O={1,3,5,7,}O=\{1,3,5,7,\ldots\}

or

O={2k+1kN}.O=\{2k+1\mid k\in\mathbb N\}.

As kk runs through 0,1,2,3,0,1,2,3,\ldots, the expression 2k+12k+1 gives 1,3,5,7,1,3,5,7,\ldots.

Rational numbers

A rational number is any number that can be written as a fraction of two integers:

Q={ab  |  a,bZ,b0}.\mathbb Q= \left\{ \frac ab \;\middle|\; a,b\in\mathbb Z, b\neq0 \right\}.

The same number can have many fraction forms:

12=24=36.\frac12=\frac24=\frac{-3}{-6}.

We usually clean this up by reducing the fraction and keeping the denominator positive. That is why

23\frac{2}{-3}

is normally written as

23.-\frac23.

When are two sets equal?

Two sets are equal when they contain exactly the same elements. The way they are written does not matter.

A common way to prove that A=BA=B is to prove both directions:

ABandBA.A\subseteq B \qquad\text{and}\qquad B\subseteq A.

This works because the first direction says AA has nothing extra, while the second says BB has nothing extra.

Example: two forms of the odd integers

Consider

O={2k+1kZ}O=\{2k+1\mid k\in\mathbb Z\}

and

A={21Z}.A=\{2\ell-1\mid \ell\in\mathbb Z\}.

They look different, but both produce every odd integer.

First, take any xOx\in O. Then x=2k+1x=2k+1 for some integer kk. We can rewrite it as

x=2k+1=2(k+1)1.x=2k+1=2(k+1)-1.

Since k+1k+1 is still an integer, xx has the form used in AA. Therefore,

OA.O\subseteq A.

Now go the other way. Take any xAx\in A. Then x=21x=2\ell-1 for some integer \ell. Rewrite it as

x=21=2(1)+1.x=2\ell-1=2(\ell-1)+1.

Since 1\ell-1 is an integer, xx has the form used in OO. Therefore,

AO.A\subseteq O.

Both directions are true, so

O=A.O=A.

The only real difference is where the integer counter starts. Shifting an integer by 11 still gives an integer, so neither description misses any odd numbers.

Why a rule does not always create a valid set

It is tempting to think that any rule can define a set. Russell's paradox shows why that causes trouble.

Imagine trying to define

R={xx is a set and xx}.R=\{x\mid x\text{ is a set and }x\notin x\}.

In words, RR contains every set that does not contain itself.

Now ask: does RR contain itself?

  • Suppose RRR\in R. Then RR should satisfy its own rule, which says RRR\notin R.
  • Suppose RRR\notin R. Then RR does satisfy the rule, so RRR\in R.

Either answer gives the opposite answer:

RR    RR.R\in R\iff R\notin R.

That contradiction is Russell's paradox.

The safe approach is to start with a set that already exists, then choose some of its elements:

{xUx follows a certain rule}.\{x\in U\mid x\text{ follows a certain rule}\}.

This builds a subset of UU. It does not try to create a giant “set of everything.”

Keep these straight

  • xAx\in A: xx is one element of AA.
  • BAB\subseteq A: every element of BB is also in AA.
  • A\varnothing\subseteq A is always true.
  • A\varnothing\in A is only true if AA actually contains the empty set.
  • Sets ignore order and repeated entries.
  • To prove A=BA=B, prove both ABA\subseteq B and BAB\subseteq A.
  • In set-builder notation, start with a set UU and select elements from it.
Back to Discrete Structures