# Functions

Before we look at certain functions, it is important to first appropriately define exactly what a function $f$ is (alongside terms relating to functions).

Definition: A function $f$ is a rule that assigns every element in a set $A$ (the domain) to exactly one element in a set $B$ (the codomain). All possible values for $f$ as $a$ varies over $A$ is a subset of $B$ known as the range. If $a \in A$ and $b \in B$ and $f$ assigns the element $a$ to $b$, we write $f(a) = b$ where we call $b$ the image of $a$ under the function $f$. |

The following image illustrates the basics of the definition of a function. Notice that every element in $A$ is associated with exactly **one** element in $B$.

Now let's consider some real functions, for example, $f(x) = 2x^2 + 1$. We can say this function is from $\mathbb{R}$ to $\mathbb{R}$ as we insert some $x \in \mathbb{R}$ and our output $(2x^2 + 1) \in \mathbb{R}$. Another example is the function $f(x, y, z) = x^2 + xy - z^4$ for which we input some $x, y, z \in \mathbb{R}$ and our output is a single value $(x^2 + xy - z^4) \in \mathbb{R}$, thus we say this function is from $\mathbb{R}^3$ to $\mathbb{R}$.

In general a real-valued functions $f(x_1, x_2, ..., x_n) = C$, where $C$ is some combintation of the real variables $x_1, x_2, ..., x_n$ is said to be a function from $\mathbb{R}^n$ to $\mathbb{R}$.

Now suppose that the domain of $f$ is $\mathbb{R}^n$ and the codomain is $\mathbb{R}^m$. We say that $f$ is a map or transformation from $\mathbb{R}^n$ to $\mathbb{R}^m$ and we use the notation $\: f: \mathbb{R}^n \to \mathbb{R}^m$. Furthermore, we call a transformation $f$ an **operator** if $f: \mathbb{R}^n \to \mathbb{R}^n$.

In the linear algebra section, we will often look at functions involving vectors, that is we will have a function $f$ that might take a vector in $\mathbb{R}^n$ and map it as a vector in $\mathbb{R}^m$.