home

# Functions

Functions map a set of inputs to a set of outputs.

Each input maps to exactly one output, however an output value may have multiple possible inputs.

If an input associates with more than one element in the set of outputs, this is not a function but a relation.

## Terms

Term Description
domain The set of inputs
co-domain The set of outputs
range A subset of the co-domain with mapped values only
image A specific value in the co-domain that is the output for value in the domain
pre-image The value or values in the domain that map to a specific output

## Notation

The expression $f: A \to B$ declares a function $$f$$ that maps from the domain $$A$$ to the domain $$B$$.

When applied as $f: x \mapsto f(x) = y$ $$x \in X$$ is the pre-image and $$y \in Y$$ is the image.

In the case of \begin{align} g: \mathbb R &\to \mathbb R \\ x &\mapsto x^2 + 1 \end{align} The function $$g$$ accepts a real number as input, provides a real number as output and covers the range $$[1, +\infty)$$.

## Common structures

The following are common structures for $$f : \mathbb R \to \mathbb R$$.

Name Structure Conditions
linear $$f(x) = ax + b$$
quadratic $$f(x) = ax^2 + bx + c$$ $$a \neq 0$$
exponential $$f(x) = b^x$$ $$b > 0, b \neq 1$$

## Properties

### Injection

A function $$f:X \to Y$$ is injective if and only if every element of the codomain $$Y$$ is the image of at most one element of the domain $$X$$.

Symbolically: $f:X \rightarrowtail Y \iff \forall a,b \in X,\; f(a) = f(b) \implies a = b$ And conversely: $f:X \rightarrowtail Y \iff \forall a,b \in X,\; a \neq b \implies f(a) \neq f(b)$

If an output is reachable from more than one input then a function is not injective.

For example, given $$g: \mathbb R \to \mathbb R$$ then $$g(x) = x^2$$ is not injective as $$g(5) = (5)^2 = (-5)^2 = g(-5)$$. If however this is constrained as $$g: \mathbb R^+ \to \mathbb R$$ then this function becomes injective.

### Surjection

Surjective functions are functions with a range that is equivalent to the co-domain.

$f:X \twoheadrightarrow Y \iff \forall y \in Y,\; \exists x \in X,\; y = f(x)$ Alternatively expressed: every element of the co-domain of $$f$$, $$Y$$, has at least one pre-image in the domain of $$f$$, $$X$$.

### Bijection

A function is bijective if it is both injective and surjective.

Symbolically this is expressed as: $f: X \leftrightarrow Y \iff \forall y \in Y,\; \exists! x \in X,\; y = f(x)$ Where $$\exists!$$ means “there exists only one”.