# Phil 735: Functions

I’m going to explain the notion of a function first, and then the notion of a relation (on a separate page) as a generalization of that. Many textbooks instead explain relations first and then equate functions with relations that have special properties. These textbooks usually also equate both functions and relations with certain sets, which below I’ll call the function’s graph.

As I said when talking about ordered pairs, I’m going to downplay such reductions in our discussion.

A function is a mapping from one or more arguments to a “result” or “value” or “output.” If the function is defined only on members of a set `Δ`, we can say it’s (at least) a partial function on the domain `Δ`. If it’s defined on all the members of `Δ`, then it’s a total function on the domain `Δ`. When we say just “function” without qualification, we’re normally talking about total functions.

There’s another use of the term “domain” in the literature we’ll be discussing, when we talk about the “domain” of a quantifier. These uses are related, but they aren’t obviously and straightforwardly derivable from each other.

Some textbooks say that “a function is a procedure or rule assigning to any argument from the domain of the function a unique object which is that function’s value at that argument.” But it can be problematic and confusing if you think of functions as “procedures or rules.” One issue is that what intuitively we’d regard as different procedures can generate the same assignments or mappings. Should we then say we have two functions or just one? Another issue is that some functions can’t be captured by anything that intuitively counts as an algorithm or procedure. So better not to conflate the mathematical notion of function being introduced now with your intuitive understanding of a “procedure or rule.”

The codomain of a function `f` is a set `Γ` such that all of the values of `f` for any arguments are members of `Γ`. (I’ll also say that `f` maps its arguments “into” `Γ`.) This doesn’t exclude the possibility that there are some members of `Γ` that aren’t the value of `f` for any argument. The particular subset of `Γ` whose members all are the value of `f` for some argument I’ll call the range of `f`.

When `f` is function with domain `Δ` and codomain `Γ`, we’ll write that `f: Δ → Γ`. When `d ∈ Δ` is such that `f(d) = c`, for some `c ∈ Γ`, `c` is sometimes called the image of `d` under `f`. But most often, I will tend to say instead that `c` is the “value” of `f` at `d`, or the “result” of `f` for argument `d`.

There is a lot of variation in how the term “range” is used. Some authors use it to mean what I’m calling the function’s codomain. And some authors talk not only about the “image of `d` under `f`,” but also about “the image of `f`” itself, by which they mean what I’m calling `f`’s range.

If `Θ ⊆ Γ` is a subset of `f`’s codomain, then the preimage of `Θ` is the largest subset of `f`’s domain such that `f` maps every member of that set into `Θ`. For example, if `f: ℤ → ℕ` maps each `z` to `z²`, then the preimage of `{4,9}` will be `{-2,2,-3,3}`. I don’t think we’ll need to make use of this notion. I’m only mentioning it here for reference, in case you come across it and wonder what it means.

When `f` takes more than one argument, we’ll say that its domain is a set of tuples, like `Δ₁ ⨯ Δ₂`, and we’ll write that `f: Δ₁ ⨯ Δ₂ → Γ`. This is not the only way to handle multiple arguments, but it is the style of handling them that you’ll find in the literature we’ll be reading.

Finally, the graph of a function `f` with domain `Δ` and codomain `Γ` is the set `{(d,c) | d ∈ Δ and c ∈ Γ and f(d) = c}`. Sometimes I slip and call this the function’s “extension,” but in fact the standard terminology is to call this the function’s “graph” and to reserve the term “extension” for predicates — that is, linguistic expressions like adjectives. (The graph of a unary function `f` may be the same set of pairs as the extension of some dyadic predicate “F”.)

The expression “graph” is used several different ways in formal contexts. The notion we’re employing here is different from the use of “graph” to describe things like subway maps, or the use to describe a 2D picture with horizontal and vertical axes. (Of course there are connections between these different uses, but it’s better not to confuse them.)

Some authors identify functions (and also relations) with their graphs. This raises several issues. One is similar to issues raised by the identifications of `(a,b)` with `{{a},{a,b}}` and of `(a,b,c)` with `(a,(b,c))`. There could be an intelligible argument about whether these objects should be identified, or rather whether they should instead only be thought of as having some intimate (perhaps unique) correspondence.

A second kind of issue is different: this is that some authors, in certain contexts, want to distinguish between functions (and relations) whose codomains differ, even if they have the same graph. (Similar things could be said about the domains, if the functions are partial.) For example, they may want to distinguish the function that maps every `z ∈ ℤ` to `z²` and whose codomain is the set of natural numbers `ℕ`, and the corresponding function whose codomain is the set of all integers `ℤ`, even though none of the members of `ℤ – ℕ` are the value of this function for any argument.

I don’t expect the merits of distinguishing these to be obvious at this point. Like a number of other debates, I’m just flagging this so that you’re aware that there are choices being made, about which arguments can be had. I think we can avoid taking a stand on the question whether there can be distinct functions (or relations) with the same graph. Note, though, that some of the notions we’ll define below (surjective functions and relations, perhaps reflexive relations) will be sensitive to what a function’s codomain is taken to be.

## Injections, Surjections, Bijections

Functions cannot be “one-to-many.” For a single argument (or tuple of arguments), the function must have only a single value. (Or if it’s a partial function, the function must only have a single value if it’s defined for that argument.) Of course, the single value could be a set. So if you found yourself in a situation where you wanted something like a one-`Δ`-to-many-`Γ`s function, you might scratch your itch by instead working with a function whose values are sets of `Γ`s.

Functions can however be “many-to-one.” For instance, consider the height function. Perhaps Sam is taller than me, but Vera and I are the same height. Then the “height-in-centimeters” function would map Sam and me to distinct numbers, but would map me and Vera to the same number. That is, it sometimes maps distinct arguments (me and Vera) to the same value (whatever our common height in centimeters happens to be).

Some functions are not many-to-one. These functions always map distinct arguments to distinct values. For instance, let `Μ` be the set of males who have biological children, and `Ρ` the set of people, and let `f: Μ → Ρ` be the function that maps a member of `Μ` to his firstborn biological child. Assuming no genetic engineering or special fertilization techniques, no two males have the same firstborn child. Functions of this sort, that always map distinct arguments to distinct values, are known as one-to-one. Another term sometimes used for this is that the functions are injective or “an injection.”

Whether a function is one-to-one may depend on what you take its domain to be. For example, if we considered the function “firstborn child” to be defined not on the set of male parents, but on the set of male or female parents, then it would no longer be one-to-one, because some distinct parents have the same firstborn child.

Notice that the range of the “firstborn child” relation is smaller than what I designated as its codomain. Some members of `Ρ` are not anyone’s firstborn child. When this is not the case — when every member of the codomain is the value of some argument to that function — then we say that the function is (not merely into but) onto that codomain. Another term sometimes used for this is that the function is surjective. And another way to think of this is that surjective functions are ones where (what we’re calling) the function’s range exhausts the function’s codomain.

Functions can be one-to-one without being onto, and they can be onto without being one-to-one. But they can also be both. Functions that do have both of these properties are called one-to-one correspondences. Another term used for this is that the functon is bijective or “a bijection.”

The terms “injective” and “surjective” can be applied to partial functions as well as to total functions. Generally, though, the term “bijection” is restricted to total functions.

As we’ll discuss later, when a function is bijective, then its domain and codomain have to have the same size.

Wikipedia has some diagrams of functions having and lacking some of these features.

1. When a function takes a single argument, we call it a “unary” function. When it takes two arguments, “binary.” When it takes three arguments, “ternary.” And so on. The general property is called the function’s arity.

2. A total function that maps `Α` into `Α` is called a unary operation on `Α`. One that maps `Α ⨯ Α` into `Α` is called a binary operation; and so on.

3. When you have a unary operation on `Α` (that is, a function from `Α` into `Α`) that’s a bijection, this is called a permutation. That is, a permutation is any bijective function from a set to itself. You can think of it as a way to shuffle the members of the set around. The members of the set don’t need to be ordered in any way, to be permutable in this sense.

4. One special kind of permutation maps every member of its domain to that very same member. This is known as the identity function on that domain. I’ll use the notation ΙΔ for the identity function on domain `Δ`.

5. If we have a function `f: ℤ → ℕ`, such that `f(z) = z²`, some other ways to specify which particular function `f` is are:

``````f: z ↦ z²

f = λ z. z²``````

## Inverses

Suppose a function `f: Δ → Γ` is a bijection. Then because the function is one-to-one, every value in `Γ` in `f`’s range is such that there is a unique member of `Δ` that `f` maps to it. And because the function is onto `Γ`, every value in `Γ` is in `f`’s range. So we can talk about the inverse of function `f`, written as `f⁻¹: Γ → Δ`, and defined such that:

``∀c ∈ Γ (∀d ∈ Δ (f⁻¹(c) = d iff f(d) = c))``

We’ve just said that all bijections have inverses; in fact, they have unique inverses. (That is, if function `f` is a bijection, `f` has one and only one inverse function.) The converse is also true: any function with an inverse is a bijection.

Any (partial) function `f` will have an inverse that’s at least a partial function iff `f` is injective. `f` only needs to be surjective for the inverse to be a total function.

## Composition

Suppose we have two functions `f: Δ → Γ` and `g: Γ → Ρ`. For example, `f` might be the function that maps me to my height in centimeters and `g` be the function that maps each number `n` to `n²`. Then there is a function with the domain `Δ` and codomain `Ρ` which takes an argument `d ∈ Δ`, first applies `f` to it, and then applies `g` to the result. In our example, this would be the function that maps me to (my height in centimeters)². This function is called the composition of f and g and is usually written as `g ∘ f`. That is:

``(g ∘ f)(d) = g(f(d))``

Where `f: Δ → Γ` is a bijection and `f⁻¹` is its inverse, note that `f⁻¹ ∘ f` will be an identity function on `f`’s domain. (Note that `f` will also be `f⁻¹`’s inverse, but that `f ∘ f⁻¹` could be a different function than `f⁻¹ ∘ f`. Can you explain why?)

If `f`’s codomain is the same set as its domain, then the values of `f` for some argument will also themselves be suitable arguments for `f`. So we can talk about `f ∘ f`. And we can talk about `f ∘ f ∘ f` and so on. Sometimes we use this shorthand notation:

``````...

f³(d) = (f ∘ f ∘ f)(d) = f(f(f(d)))

f²(d) = (f ∘ f)(d) = f(f(d))

f¹(d) = f(d)``````

f⁰(d) = IΔ(d) = d, where ΙΔ is the identity function for `f`’s domain `Δ`

Note that this is very different from a convention you may have learned when doing trigonometry: `sin² x = (sin x)²`, not `sin(sin x)`.