**Definition (function)**: Given 2 sets X and Y. A function $f: X \rightarrow Y$ is the set of ordered pairs $(x,y)$ such that:

1) $(x,y) \in X \times Y$. This means: $x \in X$ and $y \in Y$. (*)

2) The $x$ in $(x,y)$ occurs only once as first component of the ordered pair $(x,y)$

We call A the **domain** of f and B the **codomain** of f (***)

__________________________________________________________________________

Remarks:

1) (*) In fact, this means that a function $f: X \rightarrow Y$ is actually defined as a subset of $X \times Y$. So, we can write that $f = \{(x,f(x))|x \in X\}$

2) (**) Simply stated, this means that we can only have one $y$ for every $x$ in $(x,y)$.

3) (***) When you would compute f(x) for all x in the domain of f, you would get a set of values. This set is called the

**range** of f. Now, it's very important to notice that

__the range of f is not necessarily equal to the codomain of f__! Define, for example, a function g in the following way.

$g: \mathbb{R}\rightarrow \mathbb{R}: x \mapsto f(x) = x^2$.

Then, the codomain of f is the set of the real numbers $\mathbb{R}$ while the range of f is the set of all positive real numbers $\mathbb{R^{+}}$

__Examples:__

1) Consider the function f:

$f: \mathbb{R}\rightarrow \mathbb{R}: x \mapsto x^2 - x -2$.

- The domain of f is $\mathbb{R}$

- The codomain of f is $\mathbb{R}$

- The range of f is $[\frac{-9}{4},\infty)$

2) The Sign function is defined in the following way:

$ Sign(x) :=

\begin{cases}

-1 & \quad x<0\\

0 & \quad x= 0\\

1 & \quad x>0 \\

\end{cases}

$

**Theorem: **Let $f: A \to B$ be a function. Then the following statements are equivalent:

(1) $f$ bijective

(2) There is a function $g: B \to A$ such that $g \circ f = 1_A$ and $f \circ g = 1_B$

**Proof**: $\boxed{(1) \Rightarrow (2)}$

Since $f$ is bijective, for every $b \in B$, there exists a unique $a \in A$ such that $f(a) = b$. Then, define $g: B \to A$ by letting $g(b) := a$. Because $f$ is bijective, $g$ is well defined.

Now, we have that $g \circ f (a) = g(f(a)) = g(b) : a$ and $f \circ g(b) = f(g(b)) = f(a) = b$

$\boxed{(1) \Leftarrow (2)}$