Functions
Functions
Definition
Let X, Y be sets, and let P (x, y) be a property pertaining to an object x ∈ X and an object y ∈ Y , such that for every x ∈ X, there is exactly one
y ∈ Y for which P (x, y) is true. Then we define the function/map/transformation f : X → Y defined by P on the domain X and range Y to be the
object which, given any input x ∈ X, assigns an output f (x) ∈ Y , defined to be the unique object f (x) for which P (x, f (x)) is true. Thus for any
x ∈ X and y ∈ Y we have:
Functions can be defined explicitly and implicitly. Explicitly defining a function would be giving a domain, range and how to "generate" the output
f (x) from each input. But we can also define a function implicitly by specifying what property links the input x with the output f (x). For example:
2
f : R → R : x ↦ x (explicit)
+ + 2
g : R → R : P (x, g(x)) is true with P (x, y) : y = x (implicit)
Note that an implicit definition is only valid if we know that every input has exactly one output. We also note that functions obey the axiom of
substitution, which we will prove later in the note.
Strictly speaking functions are not sets, but it is not uncommon to consider the set of ordered pairs that satisfy our property P and denote it as
. For example one could then state that (4, 2) is an element of the set that satisfies the property P of g, specified a few lines above. But
(x, y) ∈ f
again we must emphasize that functions are in fact not sets but depending on definition we may denote them as if they were.
We also define two functions f , g : X → Y with the same domain and range to be equal if and only if ∀x ∈ X . This equality obeys the
: f (x) = g(x)
In order for the axiom of substitution to hold we must have x = x ⟹ f (x) = f (x ) . This must be true by definition of a function, since x = x it
′ ′ ′
must map to the same object to otherwise it simply wouldn't be a function by definition.
Q.E.D.
equality we get f (x) = g(x) ∧ g(x) = h(x) which according to normal equality means f (x) = h(x) for all x meaning that by the definition once again
we have f = h. This closes the proof.
Q.E.D.
We also note a special case of a function, namely the empty function, which is defined as follows:
f∅ : ∅ → X
There is not need to specify a property as the function doesn't actually map any elements into X. We also note that for every set X the
corresponding empty function is unique.
Suppose that for an arbitrary set X there were more than one distinct empty set functions. We know that according to function equality 2 functions
are equal if all the elements of the domains get mapped to the same elements in the range. But since both functions map no elements at all since
their domain is the empty set we can conclude that they thus both map the domains elements to the same elements in the range. Meaning that
effectively the two functions are equal and that the empty set function associated to a set X is unique.
Q.E.D.
Function composition
Let f : X → Y and g : Y → Z be two functions such that the range of f is de domain of g . We then define their composition g ∘ f : X → Z as such:
If range and domain don't match up then we leave the composition undefined. Composition also obeys the axiom of substitution.
Composition is an operation that is not commutative (easily proven by an arbitrary example) but is still associative.
elements of the domain of g to the same elements in the range of g so we can write g(f (x)) = g (f (x)). But according to the definition of
′ ′
composition we get g ∘ f = g ∘ f . ′ ′
Q.E.D.
Suppose we have f : Z → W , g : Y → Z , h : X → Y
Since g ∘ h is a function from X to Z , f ∘ (g ∘ h) is a function from X to W . Similarly f ∘ g is a function from Y to W , and hence (f ∘ g) ∘ h is a function
from X to W . Thus f ∘ (g ∘ h) and (f ∘ g) ∘ h have the same domain and range. In order to check that they are equal, we see from the definition of
function equality that we have to verify that (f ∘ (g ∘ h))(x) = ((f ∘ g) ∘ h)(x) for all x ∈ X. But by definition of composition
(f ∘ (g ∘ h))(x) = f ((g ∘ h)(x)) = f (g(h(x)) = (f ∘ g)(h(x)) = ((f ∘ g) ∘ h)(x) as desired.
Q.E.D.
Classification of functions
We now distinguish 3 particular types of functions, namely injection, surjections and bijections.
One-to-one or injective
And equivalently:
′ ′
f (x) = f (x ) ⟹ x = x
Onto or surjective
∀y ∈ Y : ∃x ∈ X : f (x) = y
Invertible or bijective
A function f is said to be bijective if it is surjective and injective. We also call this a perfect matching and change how we denote the mapping as
such x ↔ f (x). If f is bijective then their exits exactly one x such that f (x) = y. We denote this x as follows: f (y). Thus f is a function from Y to
−1 −1