Functions and sets
A function can be regarded as a mapping between sets. Functions are a central concept in mathematics because they describe how each element in one set corresponds to exactly one element in another set.
Functions as mappings
A function \( \large f\) from a set \( \large A\) to a set \( \large B\) is a rule that assigns to each element in \( \large A\) exactly one element in \( \large B\). It is written as:
$$ \large f : A \to B $$
If \( \large a \in A\), then the image of \( \large a\) under \( \large f\) is written as \( \large f(a)\).
Domain and codomain
For a function \( \large f : A \to B\):
- \( \large A\) is called the domain.
- \( \large B\) is called the codomain.
- The set of all actual function values \( \large f(a)\) is called the range (or image).
Example: If \( \large f(x) = x^2\) with domain \( \large \mathbb{R}\), then the range is \( \large [0,\infty [\).
Applications
Functions play a central role in both mathematics and computer science.
- In mathematics, they are used to describe relationships between variables, to set up models, and to perform calculations.
- In computer science, functions serve as building blocks in programming languages, algorithms, and databases. Many computations can be seen as functions translating input into output.
- In cryptography and information security, functions with special properties (e.g. bijective functions and hash functions) are fundamental.
Understanding functions is therefore necessary both to master mathematics and to work with technology.