Functions

This chapter covers notes on functions.

In these materials, functions are a particular type of map. A function f:XY{f: X \to Y} is a relation from X{X} to Y,{Y,} where every element of X{X} is paired with exactly one element of Y.{Y.} We say that X{X} is the domain of f,{f,} and Y{Y} is the range of f.{f.} Here's the working definition we'll use:

function. Let X{X} and Y{Y} be sets, and fX×Y{f \subseteq X \times Y} a relation. We call f{f} a function if, and only if, for each xX,{x \in X,} there is one element yY{y \in Y} with (x,y)f.{(x,y) \in f.} We call X{X} the domain of f,{f,} denoted dom(f)=X.{\dom{f} = X.} We call Y{Y} the range of f,{f,} denoted ran(f)=Y.{\ran{f} = Y.}

A few more bits of terminology: We can expression a function f{f} in general with the expression f:XY,{f: X \to Y,} which we read as "f{f} is a function from X{X} to Y.{Y.}" Given (x,y)f{(x,y) \in f} the element y{y} is called the result of f{f} at the argument x.{x.} Given an argument x,{x,} we say that f{f} sends or maps or transforms x{x} onto y.{y.} Specifically for binary functions, given (x,y)f,{(x,y) \in f,} we call x{x} the abscissa of the tuple (x,y),{(x,y),} and y{y} the ordinate of (x,y).{(x,y).}

It's important to remember that all functions are relations. However, the converse — all relations are functions — is false. This means that, given a function f:XY{f: X \to Y} with xX{x \in X} and yY,{y \in Y,} all these expressions mean the same thing:

(1)   f(x)=y(2)   x f y(3)   x f f(x) \eqs{ (1) ~~~ & f(x) = y \\[1em] (2) ~~~ & x ~f~ y \\[1em] (3) ~~~ & x ~f~ f(x) }
(4)   (x,y)f(5)   (x, f(x))f \eqs{ (4) ~~~ & (x,y) \in f \\[1em] (5) ~~~ & (x,~f(x)) \in f }

Clearly, some notations are superior to others in terms of readability. Option (3) is clearly needlessly unclear, and options (4) and (5) are just short of being too long. We also see that f(x)f.{f(x) \neq f.} In fact, f(x){f(x)} is quite removed from f{f} — it's the ordinate of a tuple in the relation f.{f.}

A bit more terminology: Functions can be classified according to relations between their domain and range. Note that the definition below does not establish that f{f} is a function from A{A} to B{B} — it's just some function.

classification of functions. Let A{A} and B{B} be sets, and f{f} some function.

  1. If dom(f)=A,{\dom{f} = A,} then f{f} is a function on A.{A.}
  2. If fB,{f \subset B,} then f{f} is a function into B.{B.}
  3. If f=B,{f = B,} then f{f} is a function onto B.{B.}

Images

While some authors treat image and range synonymously, we distinguish the two terms. From the definition of a function, it's clear that we can have function f:XY{f : X \to Y} where X=Y.{X = Y.} In this case, we say that f{f} maps X{X} onto Y,{Y,} and we call X{X} the domain and Y{Y} the range, using the usual syntax:

dom(f)=Xran(f)=Y \dom{f} = X \\ \ran{f} = Y

If, however, it turns out that YX,{Y \subset X,} we say that Y{Y} is the image of f,{f,} and use the following syntax:

dom(f)=X(f)=Y \dom{f} = X \\ \image{(f)} = Y

We use this different notation and wording to make it clear that the codomain Y{Y} is a subset of the domain X{X} (in later sections, we'll see that for some situations, a function's range is often more important than the function itself). If it turns out that XY,{X \subset Y,} we say that f{f} is an embedding of X{X} into Y.{Y.} For this case, we simply use the notation dom(f)=X{\dom{f} = X} and ran(f)=Y.{\ran{f} = Y.}

Preimage

Let's suppose we're playing some game consisting of two sets, B{B} and C.{C.} The set B{B} consists of a variety of buttons, and the set C{C} consists of various checks — a check for ten, a check for a hundred, a checking for a thousand ... incrementing by powers of ten all the way up to a billion. Now suppose that every button in B,{B,} if pushed, returns some check in C.{C.}

Anyone playing this game is likely interested in the set of buttons bB{b \in B} where each button returns a check of a particular subset of Y{Y} — perhaps the subset of checks cC{c \subset C} such that c{c} is at least a million. In this case, we're only interested in a function f:BC{f: B' \to C} such that cC{c \in C} is at least a million. But, even more importantly, we're interested in the set B.{B'.} We call B{B'} a preimage of f.{f.}

preimage. Let f{f} be a function from X{X} to Y.{Y.} Then the preimage of a set SY{S \subseteq Y} under f{f} is defined as:

f1[S]={xX:f(x)S}. f^{-1}[S] = \set{x \in X : f(x) \in S}.

Restrictions and Extensions

In the case where f:XX,{f: X \to X,} we call f{f} the identity map. The identity map introduces us to a special kind of relation called the restriction.

restriction. Let f:XY{f: X \to Y} be a function from X{X} to Y,{Y,} and the set A{A} be a subset of X{X} (i.e., AX{A \subset X}). Where xX{x \in X} and yY,{y \in Y,} the function:

f(x)=y   (for  xA) f(x) = y ~~~(\text{for}~~ x \in A)

is called the restriction of f{f} to A{A}. We may denote such a function with:

fA:AX \eval{f}{A}: A \to X

Informally, restrictions are simply a more convenient way of defining functions for a common scenario. Suppose we have the function:

f:BC f: B \to C

We want to define a function g:AC,{g: A \to C,} but AC.{A \subset C.} That is, we want to communicat that there's a relationship between the members of A{A} and the members of C,{C,} that doesn't include the members of B.{B.} The identity map allows us to say that:

g(x)=f(x) g(x) = f(x)

where xA.{x \in A.} The function g(x){g(x)} is called the restriction of f{f} to X,{X,} and the function f(x){f(x)} is called the extension of g{g} to B.{B.}

Compositions

Suppose we had a function f:XY,{f : X \to Y,} and a funtion g:YZ.{g : Y \to Z.} In many applications, we want to have some function h{h} that takes the result y{y} in (x,y)f,{(x,y) \in f,} as the argument y{y} in (y,z)g.{(y,z) \in g.} That is, a function h{h} whose result is some value:

g(f(x)). g(f(x)).

We call the function h{h} the composition of g{g} with f,{f,} and the result g(f(x)){g(f(x))} a composite of g{g} with f.{f.} Simply a put, a composition is a function whose domain consists of the results of another function.

composition. Let A,{A,} B,{B,} and C{C} be sets with f:AB{f: A \to B} and g:BC.{g : B \to C.} Then the composition of g{g} with f,{f,} denoted gf,{g \circ f,} is defined as a function from AC{A \to C} where

(gf)(x)=g(f(x)) (g \circ f)(x) = g(f(x))

for all xA.{x \in A.}

Compositions are relations that appear in everyday life. For example, a recipe is a composition. Each step in a recipe is a function. E.g., cracking an egg takes an argument — an egg — accompanied with a result — an albumen (egg white) usually encasing a vitellus (yolk). Using the result of the previous step to perform another a step is a composition. E.g., whisking the cracked eggs (the result of the previous step) to produce a mixture.

Partial Orders of Functions

Now that we've defined the concepts of restriction and extension, one interesting consequence is examining them as they relate to partial orders. Suppose X,{X,} Y,{Y,} and F{F} are sets, where F{F} is the set of all functions whose domain is included in F{F} and whose range is included in Y.{Y.} Now suppose we have the relation:

fRgdom(f)dom(g)xdom(f)[f(x)=g(x)] f \rel g \iff \dom{f} \subset \dom{g} \land \forall x \in \dom{f}\ix{f(x) = g(x)}

That is, f{f} is a restriction of g{g} (or, equivalently, g{g} is an extension of f{f}). Given that all the functions in F{F} are just subsets of the Cartesian product X×Y,{X \times Y,} it follows that the relation:

fRgfg f \rel g \equiv f \subset g

Surjections

A function f:XY{f: X \to Y} is called surjective if every element of Y{Y} is mapped to at least once.

surjection. Let f{f} be a map from the set X{X} to the set Y.{Y.} If, for each y{y} in Y,{Y,} there exists an xX,{x \in X,} such that:

f(x)=y f(x) = y

then f{f} is a surjection, and we write:

f:XY. f: X \surj Y.

In other words, every element of Y{Y} gets at least one of X.{X.} They can get many of x,{x,} but they must at least have one. For example, this the functions below are surjective functions.

But the functions below are not.

If X{X} are Y{Y} sets, and f{f} is a surjective function mapping elements from X{X} to Y,{Y,} then:

#(X)>=#(Y). \card(X) \gte \card(Y).

It follows that either

  1. X{X} has more members than Y,{Y,} or
  2. X{X} and Y{Y} have the same number of members.

Injections

A function f:XY{f: X \to Y} is called injective if every element of Y{Y} is mapped to at most once.

injection. Let f{f} be a map from the set X{X} to the set Y,{Y,} and xX.{x \in X.} If, for each xx,{x \neq x',}

f(x)(x), f(x) \neq (x'),

then f{f} is an injection, and we write:

f:XY. f: X \inj Y.

That is, every element of Y{Y} gets at most one of X.{X.} They can get none of X,{X,} but if they do get something from X,{X,} they can only get one. For example, these are injective functions:

But these are not:

Another way of thinking about injections: They're functions that map distinct elements of the domain to distinct elements of the codomain.

If X{X} and Y{Y} are sets, and f{f} is an injective function mapping elements from X{X} to Y,{Y,} then:

#(X)<=#(Y) \card(X) \lte \card(Y)

Thus, it follows that:

  1. X{X} has less members than Y,{Y,} or
  2. X{X} and Y{Y} have the same number of members.

Bijections

A function f:XY{f: X \to Y} is called bijective iff it is both surjective and injective.

bijection. Let f{f} be a map from the set X{X} to the set Y.{Y.} If, for each yY,{y \in Y,} there exists a unique xX,{x \in X,} such that:

f(x)=y, f(x) = y,

then f{f} is an bijection, and we write:

f:XY. f: X \bij Y.

For example, these functions only take one appearance:

That is, every element of X{X} maps to one, and only one, element of Y,{Y,} and every element of Y{Y} is mapped to once, and only once. None of these functions are bijective:

From top-left to bottom-right: The first is surjective but not injective, the second is injective but not surjective, and the last two are not functions.

If X{X} and Y{Y} are sets and f{f} is a bijective function mapping elements from X{X} to Y,{Y,} then:

#(X)=#(Y) \card(X) = \card(Y)

That is, X{X} and Y{Y} have the same number of members.

Valued Functions

A function whose codomain is some number set is called a valued function. Such functions are of particular interest in many other areas of mathematics. For example, a function whose codomain is R{\reals} is called a real-valued function, a functions whose codomain is Z{\uint} is called an integer-valued function, and so on. Both real-valued functions and integer-valued functions have some special properties. In the examples that follow, let's suppose the domain and codomain is R.{\reals.}

Addition of Valued Functions

Say we had the functions f(x)=x2{f(x) = x^2} and g(x)=xx2.{g(x) = x - x^2.} We can add these two functions:

f+g      (f+g)(x)=x2f+(xx2)g. f + g~~~\ni~~~(f + g)(x) = \tnote{x^2}{$f$} + \tnote{(x - x^2)}{$g$}.

Here is a more explicit definition:

addition of functions. Let f:AR{f: A \to \reals} and g:AR{g: A \to \reals} with xR.{x \in \reals.} Then f+g:AR{f + g : A \to \reals} is defined for all xR{x \in \reals} where

f+g      f(x)+g(x)=(f+g)(x). f + g~~~\ni~~~f(x) + g(x) = (f + g)(x).

Note that we use the notation {\ni} to denote that (f+g)(x){(f+g)(x)} is a member of the function f+g.{f+g.} We do so to emphasize the fact that f+g{f+g} is a set, and (f+g)(x){(f+g)(x)} is an element of the set. Some authors write f+g=(f+g)(x),{f+g = (f+g)(x),} but this isn't quite correct. Nevertheless, no one ever really writes the notation above. We use it here to make the underlying ideas clearer.

Families

Now that we've seen functions, we introduce another special relation called the family.

family. Let I{I} and X{X} be sets, and f{f} a function defined as follows:

  1. f:IX.{f: I \to X.}
  2. Where iI{i \in I} and xX,{x \in X,} f(x)=(i,x)=xi.{f(x) = (i,x) = x_i.}

We call I{I} the index set, iI{i \in I} an index, X{X} the indexed set, xX{x \in X} a term, and the function f{f} a family.

A particularly special type of family is the sequence. But before we examine sequences, we need a special set called the natural numbers.