Last time we talked about functions as mappings of points from one set to another set. The function maps from the domain to the codomain, but there may be points in the codomain that are not part of the mapping. The subset of the codomain that includes all the points in the mapping is the range of the function.

A function is one-to-one, or an injection, if every point in the range is mapped to from exactly one point in the domain. In other words, if x and y are points in the domain of the function f, f(x)=f(y) only if x=y. A function is onto, or a surjection, if the range of the function is equal to the codomain of the function. If the function is both one-to-one and onto, it is a bijection.

We can use the function to go from the domain to the range. It would be nice if we could go in the other direction, and nicer if going the other direction is also a function. If the original function is one-to-one, we can have an inverse function that maps from the range of the original function to the domain of the original function. If it's not one-to-one, then the inverse function would have points in its domain that map to multiple points in its range, so it wouldn't be a valid function.

We can also have functions act on sets of points rather than individual points. If a function f has domain X and codomain Y, then any point x∈X maps to a point in Y. If A is a subset of X, then we can find the set of points in Y that all the points in A map to. Instead of saying f(x)=y, where x and y are points in X and Y, we can say that f(A)=B, where A and B are subsets of X and Y.

The nifty thing about this is that the one-to-one and onto concepts apply to functions as sets the same way that they apply to functions of points. A function that maps sets is one-to-one if no subset of the codomain can be mapped to from more than one subset of the domain. If A and B are subsets of the codomain, then f(A)=f(B) only if A=B for one-to-one functions. And a function is onto if every subset of the codomain is the mapping of a subset of the domain.

The convenient part of this is that if a function is one-to-one or onto for points, it is also one-to-one or onto for sets. Also, looking at sets, every function has an inverse function. The inverse mapping can go from a single point to multiple points, but it can't go from a single set to multiple sets.

If A is set in the domain and B=f(A) is a set in the codomain, then B is the image of A. If f^{−1} is the inverse of f, then f^{−1}(B)=A, and A is the preimage of B.