Processing math: 100%

Functions

Suppose we want to map one set to the other: given an element of set A (the input), return an element of set B (the output).

For example, suppose A={x|x is a user on our computer system} and B={x|x is a valid password}. We might want to know, given a user, what is that user's password: the input is the user (from A) and the output is that user's password (from B).

Let A and B be two sets. A function from A to B is an assignment of exactly one element from B to each element of A. We write f(a)=b if bB is the unique element assigned by the function f to the element aA. If f is a function from A to B, we write f:AB.

It makes sense to model the password example above as a function because each user has exactly one password. Here are two other examples:

Functions can be specified in several ways:

Consider the function f:AB. We call A the domain of f and B the codomain of f. Furthermore, if f(a)=b, then b is the image of a and a is the preimage of b. The set of all images of elements of A is called the range of f. For example:

If S is a subset of the domain, we can also look at its image: the subset of B that consists of the images of the elements in S: f(S)={f(s)|sS}. In the grades example above, g({Tim,Jo,Lee})={A,B}.