Binary Relations
A binary relation is a mathematical object that maps elements from one set, called the domain, to another set, called the codomain.
Now, let's look at the definition of a function:
Functions are mappings that assign elements from one set (domain) to another (codomain).
The distinction is that in a function, every element should only map to at most one element, so, for example, an element
So, a function is a special case of a binary relation.
A function that maps elements in domain
If a function is a partial function, some elements in the domain can be undefined (some elements in the domain don't have an arrow coming out). For example,
On the other hand, if every element in the domain is defined, it is called a total function.
Function composition is as simple as taking the value of one function, and passing it to another one:
A binary relation
The notation is similar to functions:
If the domain and codomain are the same set
When a pair
The image of a set
For example, look at this diagram:
Range is the actual elements with arrows coming in. In this example, while
So, the range is not always equal to codomain — it can be equal to, or smaller than the codomain.
The set of points with an arrow coming in from
We can write it in logical notation as such:
So, the formula above says that
This part itself
The inverse of a relation
This formula holds true:
An arrow coming from
Now, there are some terms that we are going to take a look at:
-
total relation: there is at least one arrow out of every domain element. (in a relation from
to , every element in set has to have an arrow going out) is total iff . - If a relation is both total and a function, that means there is exactly one arrow coming out of every domain element.
-
surjective relation: there is at least one arrow into every codomain element (the range is the entire codomain).
is surjective iff - Example of a non-injective surjective function:
-
injective relation: there is at most one arrow into every codomain element.
- Example of an injective non-surjective function:
-
bijective relation: there is exactly one arrow out in every domain element, and exactly one arrow in every codomain element (one-to-one correspondence).
- Example of a bijection (injective surjective function):
Here is a nice way to keep these in mind: think of totality, surjection, function, and injection as superheroes who are responsible for inspecting the arrows from one set to another.
Totality is concerned with the domain, surjection is concerned with the codomain. Both of them want at least one arrow.
Function is concerned with the domain, injection is concerned with the codomain. Both of them want at most one arrow.
Bijection always wants one-to-one correspondence.
is a function iff is an injection.
is a surjection iff is total.
is an injection iff is a function.
is a bijection iff is a bijection.