# Functions as Relations

## Definition of a Function

Recall that a binary relation *R* from set *A* to set *B* is defined as a subset of the Cartesian product *A* × *B*, which is the set of all possible ordered pairs (*a*, *b*), where *a* ∈ *A* and *b* ∈ *B*.

If *R* ⊆ *A* × *B* is a binary relation and (*a*, *b*) ∈ *R*, we say that *a* is related to *b* by *R*. It is denoted as *aRb*.

A function, denoted by *f*, is a special type of binary relation. A function from set *A* to set *B* is a relation *f* ⊆ *A* × *B* that satisfies the following two properties:

- Each element
*a*∈*A*is mapped to some element*b*∈*B*. - Each element
*a*∈*A*is mapped to exactly one element*b*∈*B*.

As a counterexample, consider a relation *R* that contains pairs (1, 1), (1, 2). The relation *R* is not a function, because the element 1 is mapped to two elements, which violates the second requirement.

In the next example, the second relation (on the right) is also not a function since both conditions are not met. The input element 11 has no output value, and the element 3 has two values - 6 and 7.

If \(f\) is a function from set \(A\) to set \(B,\) we write \(f : A \to B.\) The fact that a function \(f\) maps an element \(a \in A\) to an element \(b \in B\) is usually written as \(f\left( a \right) = b.\)

## Domain, Codomain, Range, Image, Preimage

We will introduce some more important notions. Consider a function \(f : A \to B.\)

The set \(A\) is called the domain of the function \(f,\) and the set \(B\) is the codomain. The domain and codomain of \(f\) are denoted, respectively, \(\text{dom}\left({f}\right)\) and \(\text{codom}\left({f}\right)\).

If \(f\left( a \right) = b,\) the element \(b\) is the image of \(a\) under \(f.\) Respectively, the element \(a\) is the preimage of \(b\) under \(f.\) The element \(a\) is also often called the argument or input of the function \(f,\) and the element \(b\) is called the value of the function \(f\) or its output.

The set of all images of elements of \(A\) is briefly referred to as the image of \(A.\) It is also known as the range of the function \(f,\) although this term may have different meanings. The range of \(f\) is denoted \(\text{rng}\left({f}\right)\). It follows from the definition that the range is a subset of the codomain.