# SP18:Lecture 5 Functions

($1)$2 | $3 ($4) | $5 ($6)

We finished our list of proof techniques, adding implication () and existentials (). We then defined functions and discussed some examples.

# Functions

Definition: Function
If and are sets, then a function from to (written ) is an unambiguous rule giving, for every input , an output . is called the domain of ; is called the codomain.

When giving a function, you must indicate the domain, the codomain, and an unambiguous rule giving an output for every input.

The output of a function is unambiguous if there is only one output for any input. It is especially important to check this when the input of the function can be written in different ways. For example, given by , , and is not unambiguous, because so it is not clear if or .

## Specifying functions

When giving a function, you must indicate the domain, the codomain, and an unambiguous rule giving an output for every input. There are many, many ways to do this, as long as the output is clear. We gave a few examples during lecture:

### direct specification

We can define the output of the function directly:

let be given by . The domain and codomain of are both ; the image is .

### drawings

We can draw a function:

The domain of is , and the codomain of is .

We might also write this as is given by , , and .

### tables

Another way to draw a function is with a table:

x
a 1
b 1
c 1

This almost describes a function; the domain is clearly (because if there were any other domain elements, would not be a function); and the rule is clear. However, the codomain is not clear: is it ? Or ? Or , or ? When describing a function with a table, the codomain should be specified somewhere.

### function description

A function need not have an algorithm for constructing the output; a description of the output is also fine. For example, let give, on input , the closing Dow-Jones Industrial average on day .

## Function examples

You can write a function in many different ways; the important thing is that the domain is clear, the codomain is clear, and the output is clear (and unambiguous).

#### direct specifications

We can define the output of the function directly:

let be given by . The domain and codomain of are both ; the image is .

#### drawings

We can draw a function:

The domain of is , and the codomain of is .

#### tables

Another way to draw a function is with a table:

x
a 1
b 1
c 1

This almost describes a function; the domain is clearly (because if there were any other domain elements, would not be a function); and the rule is clear. However, the codomain is not clear: is it ? Or ? Or , or ? When describing a function with a table, the codomain should be specified somewhere.