A binary relation R from A to B is said to be a function if for every element a in A, there is a unique element b in B so that (a, b) is in R. For a function R from A to B, instead of writing (a, b) ? R, we also use the notation R(a) = b, where b is called the image of a. the set A is called the domain of the function R, and the set B is called the range of the function R. The notion of a function is but a formalization of the notion associating or assigning an element in the range to each of the elements in the domain. For example, let A be a set of houses and B be a set of colours. Then a function from A to B is an assignment of colours for painting the house. Following the convention of representing a binary relation in tabular form that was introduced earlier, we can represent the function, where the left column contains all the elements in the domain and the right column contains their corresponding images.
A function from A to B is said to be an onto function if every element of B is the image of one or more elements of A. A function from A to B is said to be a one-to-one function if no two elements of A have the same image. A function from A to B is said to be one-to-one onto function if it is both onto and a one-to-one function. Let A be a set of workers and B_{1}, B_{2} and B_{3} be sets of jobs. An onto function from A to B_{1}, is an assignment of the workers to the jobs so that every job has at least one worker assigned to it; a one-to-one function from A to B2 is an assignment such that no two workers will have the same job; and a one-to-one onto function from A to B_{3} is an assignment such that every job has a worker assigned to it, and no two workers are assigned to the same job.
In the literature, an onto function is also called a surjection, a one-to-one function is also called an injection, and a one-to-one function is also called a bijection.
A well-known proof technique in mathematics is the so-called pigeonhole principle, also known as the shoe box argument or Dirichlet drawer principle. In an informal way the pigeonhole principle says that if there are “many” pigeons and “a few” pigeonholes, then there must be some pigeonhole occupied by two or more pigeons, and then there must be some pigeonhole occupied by two or more pigeons. Formally, let D and R be finite sets. If |D| > |R|, then for any function ƒ from D to R, there exist d_{1}, d_{2} ? D such that ƒ(d_{1}) = ƒ(d_{2}). Some trivial applications of the pigeonhole principle are: Among 13 people, there are at 2 of them who were born in the same month. Here the 13 people are the pigeons and the 12 months are the pigeonholes. Also, if 11 shoes are selected from 10 pairs of shoes there must be a pair of matched shoes among the selection. Here the 11 shoes are the pigeons and 10 pairs are the pigeonholes. The pigeonhole principle can be stated in slightly more general form: For any function ƒ from D to R, there exist i elementsd_{1}, d_{2}, … d_{i} in D, i = |D|/|R|, such that ƒ(d_{1}) = ƒ(d_{2}) = ƒ(d_{i})