Sets, sequences and functions

Introduction to sets

A set is a collection of objects. Sets are written in curly brackets. For example, the set of integers:

$$ \mathbb{Z} = \{0,1,-1, 2, -2, ...\} $$ To say an item belongs to a set you use $\in$, which means "belongs to" or "is a member of". For example, $12\in\mathbb{Z}$ because 12 is an integer.

The ordering of sets is not important. $\{1,0\}$ is the same as $\{0,1\}$.
Sets with different numbers of the same item are the same. $\{1,1,1,2\}$ is the same as $\{1,2,2\}$ is the same as $\{1,2\}$.

To show one set is a subset of another, you can use $\subseteq$. For example, $\{1,2,3,4\}\subseteq\mathbb{Z}$ as every item in $\{1,2,3,4\}$ is also in $\mathbb{Z}$.
Note that $\mathbb{N}\subseteq\mathbb{Z}\subseteq\mathbb{Q}\subseteq\mathbb{R}$.
Also note that $\mathbb{Z}$ includes 0.

The number of items in a set (it's cardinality) $A$ is expressed as $|A|$. For example, $|\{1,2,3,4,5\}|=5$.

Specifying sets

You can specify a set using set builder notation. For example, the set of integers greater than 7 can be expressed as $\{n\in\mathbb{Z}:n>7\}$, or the set of integers such that $n > 7$.
The set of square integers can be expressed as $\{n^2:n\in\mathbb{Z}\}$. This means the set of $n^2$ such that $n$ is an integer.

The set $\{(-1)^k:k\in\mathbb{Z}\}$ is the set of $(-1)^k$, such that $k$ is an integer. For $k = 0$, $(-1)^0 = 1$, for $k = 1$, $(-1)^1 = -1$, for $k = 2$, $(-1)^2 = 1$.
This pattern will repeat, so $\{(-1)^k:k\in\mathbb{Z}\}=\{1,-1\}$.

An empty set can be shown using $\emptyset$ or $\{\:\}$.

Sets with only one element ($|$set$| = 1$) are called singletons.

Finite sequences

Let $A = \{a, b, c\}$. $A^2 = \{(a,a),(a,b),(a,c),...,(c,c)\}$.
($(a,a)$ is a tuple that represents a sequence)
This can be generalised to $A^n =$ the set of all sequences of length $n$ of elements of $A$.
If $A$ is finite, $|A^n| = |A|^n$.
The general form of $A^n$ is

$$ A^n = \{(a_1,...,a_n):a_1\in A, a_2\in A, ..., a_n\in A\} $$ This means the set of sequences from $a_1$ to $a_n$ such that $a_1$ to $a_n$ belong to $A$. For example, the set $\mathbb{Z}^2$ can be expressed as

$$ \mathbb{Z}^2 = \{(x,y):x\in \mathbb{Z}, y \in \mathbb{Z}\} $$

Introduction to functions

If there is a rule that assigns to each element $x\in X$ an unambiguously determined element of the set Y, then it is a function from X to Y.
This can be denoted as $f: X \to Y$.
$X$ is called the domain and $Y$ is called the co-domain.

Take $f(x) = x^2 - 3$ for example. For each value of $x$, $x\mapsto x^2-3$. ($\mapsto$ means maps to).
This can then be expressed as $f:\mathbb{R}\to \mathbb{R}$, as each real number is mapped to another real number.

Another example is $f(x) = \sqrt{x}$. This will map any positive real number to a positive real number, so $f:\mathbb{R}\geq 0 \to \mathbb{R} \geq 0$.

The left set, $X$, is the domain, and each item in the set ($x\in X$) is shown to map to a value in the right set, $Y$, which is the co-domain. It is possible for two items from $X$ to map to one item in $Y$.
This shows clearly how the function maps every item in set $X$ to set $Y$.
It can be said that $f(x)$ is the image of $x$ under $f$ and that $f$ maps $X$ to $Y$.

More examples of functions

Consider the following functions

  1. $f_1(x)=\frac{1}{x}$

  2. $f_2(x)=\sqrt{x}$

  3. $f_3(x) = \pm \sqrt{x^2+1}$

Which of these are functions from $\mathbb{R}$ to $\mathbb{R}$?

  1. This is not a function from $\mathbb{R}$ to $\mathbb{R}$ as $f(0)$ is undefined, so there is not a mapping of every $x$ to some $f(x)$.

  2. This is not a function from $\mathbb{R}$ to $\mathbb{R}$ as negative numbers map to complex numbers, which are not in the set $\mathbb{R}$.

  3. This is not a function from $\mathbb{R}$ to $\mathbb{R}$, as it maps to two values, not one.