# Functions (Their Properties and Importance)

Hasn’t everyone has heard of what a function is? In this article, I define what a function is and discuss the domain and codomain in detail. I also cover the image and preimage of a function. I do not assume anything other than basic elementary set theory.

Let $X$ and $Y$ be sets, we say $f$ is a function from $X$ to $Y$ if $f$ is a subset of $X\times Y$ such that the domain of $f$ is $X$ and $f$ has the property:  if $(x,y)\in f$ and $(x,z)\in f$ then $x=z$. For each $x\in X$, the unique $y\in Y$ such that $(x,y)\in f$ is denoted by $f(x)$.  The element $y$ is called the value of $f$ at the argument $x$.

The importance of functions in mathematics is discussed here.

## Domain and Codomain

If we do not specify a function with the notation $f:X\to Y$ we will use $D(f)$ and $R(f)$ to denote the domain and range of $f$, respectively.

## Image

Definition. Let $X$ and $Y$ be sets. The image of $A\subseteq X$ is the set $$f(A)=\{y\in Y : \exists x\in A, y=f(x)\}.$$

Theorem. Let $f:X\to Y$ be a function. If $A_1, A_2\subseteq X$, then  $$f(A_1)\cup f(A_2)=f(A_1\cup A_2).$$

Proof. \begin{align*} & y\in f(A_1)\cup f(A_2)  \Longleftrightarrow y\in f(A_1) \lor y\in f(A_2)  \\& \qquad  \Longleftrightarrow \exists x_1\in A_1, y=f(x_1) \lor \exists x_2\in A_2, y=f(x_2)  \\& \qquad  \Longleftrightarrow \exists x\in X, (x\in A_1 \lor x\in A_2) \land y=f(x)  \\& \qquad  \Longleftrightarrow \exists x \in A_1 \cup A_2, y=f(x)  \Longleftrightarrow y\in f(A_1\cup A_2)  \end{align*}

Theorem. Let $f:X\to Y$ be a function. If $A_1, A_2\subseteq X$, then  $$f(A_1\cap A_2) \subseteq f(A_1)\cap f(A_2).$$

Proof. \begin{align*} & y\in f(A_1 \cap  A_2)  \Longrightarrow \exists x\in A_1 \cap A_2, y=f(x) \\& \qquad  \Longrightarrow  \exists x\in A_1, y=f(x) \land \exists x\in A_2, y=f(x) \\& \qquad  \Longrightarrow  y\in f(A_1)\land y\in f(A_2)  \Longrightarrow  y\in f(A_1)\cap f(A_2) \end{align*}

Theorem. Let $f:X\to Y$ be a function. If $A_1, A_2\subseteq X$, then  $$f(A_2)\setminus f(A_1) \subseteq f(A_2\setminus A_1).$$

Proof. \begin{align*} & y\in f(A_2)\setminus f(A_1)  \Longleftrightarrow y\in f(A_2) \land y\notin f(A_1)  \\& \qquad  \Longleftrightarrow (\exists x\in A_2, y=f(x) )\land \neg (y\in f(A)) \\& \qquad  \Longleftrightarrow (\exists x\in A_2, y=f(x) )\land \neg (\exists z\in A_1, y=f(z)) \\& \qquad  \Longleftrightarrow (\exists x\in A_2, y=f(x) )\land (\forall z\in A_1, y\neq f(z)) \\& \qquad  \Longrightarrow \exists x\in A_2\setminus A_1, y=f(x) \Longleftrightarrow y\in f(A_2\setminus A_1)  \end{align*}

## Preimage

Definition. Let $X$ and $Y$ be sets. The preimage of $B\subseteq Y$ is the set $$f^{-1}(B)=\{x\in X : f(x)\in B\}.$$

Theorem. Let $f:X\to Y$ be a function. If $B_1, B_2\subseteq Y$, then  $$f^{-1}(B_1\cup B_2)=f^{-1}(B_1)\cup f^{-1}(B_2).$$

Proof. \begin{align*} & x\in f^{-1}(B_1\cup B_2)  \Longleftrightarrow   f(x)\in B_1 \cup B_2  \\ & \qquad  \Longleftrightarrow   f(x) \in B_1 \lor f(x)\in B_2  \\ & \qquad  \Longleftrightarrow  x\in f^{-1}(B_1) \lor x\in f^{-1}(B_2)  \\ & \qquad  \Longleftrightarrow   x\in f^{-1}(B_1)\cup f^{-1}(B_2) \end{align*}

Theorem. Let $f:X\to Y$ be a function. If $B_1, B_2\subseteq Y$, then  $$f^{-1}(B_1\cap B_2)=f^{-1}(B_1)\cap f^{-1}(B_2).$$

Proof. \begin{align*} & x\in f^{-1}(B_1\cup B_2)  \Longleftrightarrow   f(x)\in B_1\cup B_2  \\ & \qquad  \Longleftrightarrow  f(x)\in B_1 \land f(x)\in B_2 \\ & \qquad  \Longleftrightarrow  f(x)\in B_1 \land f(x)\in B_2   \\ & \qquad  \Longleftrightarrow   x\in f^{-1}(B_1) \land x\in f^{-1}(B_2) \\ & \qquad  \Longleftrightarrow   x\in f^{-1}(B_1)\cap f^{-1}(B_2) \end{align*}

Theorem. Let $f:X\to Y$ be a function. If $B_1, B_2\subseteq Y$, then  $$f^{-1}(B_2\setminus B_1)=f^{-1}(B_2)\setminus f^{-1}(B_1).$$

Proof. \begin{align*} & x\in f^{-1}(B_2\setminus B_1) \Longleftrightarrow   f(x)\in B_2\setminus B_1  \\ & \qquad  \Longleftrightarrow  f(x)\in B_2 \land \neg(f(x)\in B_1) \\ & \qquad  \Longleftrightarrow   x\in f^{-1}(B_2) \land \neg (x\in f^{-1}(B_1)) \\ & \qquad  \Longleftrightarrow   x\in f^{-1}(B_2) \land x\not\in f^{-1}(B_1) \\ & \qquad  \Longleftrightarrow   x\in f^{-1}(B_2) \setminus f^{-1}(B_1) \end{align*}

Theorem. Let $f:X\to Y$ be a function. Then  $$A_1\subseteq A_2\subseteq X\implies f(A_1)\subseteq f(A_2).$$

Proof. \begin{align*} & y\in f(A_1) \Longleftrightarrow \exists x\in A_1, y=f(x)  \\ & \qquad  \implies \exists x\in A_2, y=f(x) \implies y\in f(A_2)  \end{align*}

Theorem. Let $f:X\to Y$ be a function. Then  $$A_1\subseteq A_2\subseteq X\implies f(A_1)\subseteq f(A_2).$$

Proof. \begin{align*} x\in f^{-1}(B_1)  \Longleftrightarrow   f(x)\in B_1 \Longrightarrow   f(x)\in B_2 \Longleftrightarrow   x\in f^{-1}(B_2) \end{align*}

Theorem. Let $f:X\to Y$ be a function. Then  $$B\subseteq Y \implies f(f^{-1}(B))\subseteq B$$

Proof. \begin{align*} & y\in f(f^{-1}(B)) \Longleftrightarrow   \exists x\in f^{-1}(B), y=f(x)  \\ & \qquad  \Longrightarrow   \exists x\in X, f(x)\in B \land y=f(x) \Longrightarrow  y\in B  \end{align*}

Theorem. Let $f:X\to Y$ be a function. Then  $$A\subseteq X \implies A\subseteq f^{-1}(f(A)).$$

Proof. \begin{align*} x\in A \implies \exists y\in Y, y=f(x) \Longleftrightarrow y\in f(A) \implies x\in f^{-1}(f(A)) \end{align*}