What is a mathematical relation?
It’s a mathematical symbol you can place between two numbers/variables to create a logical statement (or an open sentence). The importance of "relation" is its capability to turn a statement to be either true or false.
Symbols we’ve seen so far: /, =, . If we place them between two numbers we get a Boolean thing. If instead of numbers we’re dealing with sets we place a relation symbol,
Don’t compare apples and oranges?
In most of our elementary mathematical experiences, we've been accustomed to relation where either side is of the same type. This is not always the case.
Think about the symbol for a moment. We use this to create a relation between a number on the left side and a set on the left side. Consider the following example,
The “element of” relation is a relation from one set (e.g. A) to another set (e.g. B).

"element of" relation
This diagram is a good visualization of the relation of each element in set A to the elements in set B. Note however, that this diagram only works for finite sets. Another thing is that by drawing the sets separately, we are assuming that they are not only different but also disjoint.
Divisibility sets
The diagram for the divisibility relation on the set of all divisors of 6 is given below,

“divides” relation
Purist perspective
For some mathematicians, it is inappropriate to represent the same set in two different places in a Venn diagram. The diagram should like this, (where self-reference is possible):

digraph
This is known as a directed graph (a.k.a. digraph) of the relation. (The important property of sets depicted in this diagram is the idea of closure.)
When we discuss sets, we describe it best by listing all the elements. Now, our main goal is how to best describe relation.
For relations, what we know is that it takes a pair, one on the left and one on the right and in the middle is the relational symbol. It should also be evident that order is important, for example, 2 < 3 is true while 3 < 2 is false.
The relation is intimately tied up to a set of ordered pairs that make it true, and to proceed to abstract relations it is necessary to define sets of ordered pairs.
Cartesian Product
Cartesian product is defined to be the set of all ordered pairs (a,b) where a is an element of set A and b is an element of set B. We denote a Cartesian product with the symbol
Something to note: if x appears between numbers that operation is a multiplication, but if it is between sets you’re doing something different – forming the Cartesian product.
Cartesian Plane
The familiar x-y plane is called the Cartesian plane, after its first creator, Rene Descartes coordinatizing the plane. The Cartesian plane was responsible for bridging a relationship between geometry and algebra. Rene Descartes’ name is also immortalized in the definition of the Cartesian product of sets where the plane is nothing more than the product,
In the abstract, we can define a relation as any subset of an appropriate Cartesian product. (Abstract relation will be denoted by ‘R’) The abstract relation from set A to a set B is just some subset .
On the other hand, a relation on a set S is defined by a subset of .
In symbols, our abstract relation is defined as:
In order to say that particular pair (a,b) of things make the relation true we have to write:
Examples
Suppose A is the set while B is the set
and we define a relation from A to B by
For the element, , we can write it as
.
We then denote a negation by a slash on the symbol. For instance, for the pair which is not in the set, we write:
Inverse Relation
We will get around to defining functions as relations that have a certain nice property. The operations you are used to in functions also apply to relations. When one function “undoes” what another function “does” we say that it is its inverses.
Example:
(Doubling)
(Halving)
The inverse of relation is written as , and it consists of the reversals of the pairs in the abstract relation.
In other form, we have:
Functional Composition
Suppose R is a relation from A to B and S is a relation from B to C then the composite is defined as,
The value “b” is said to be the intermediate result, which serves to connect “a” to “c”. Note the arrangement, this is the composition of R first, then S, but it is written as - watch out for this!
Composition of relations must be read from right to left.
Example:
Given A as set of , B is
and
. The relation R goes from A to B, while S goes from B to C, and consists of the following set of pairs,
The diagram is given as follows:

"functional composition"
Disclaimer: this is a summary of section 6.1 from the book A Gentle Introduction to the Art of Mathematics: by Joe Fields, the content apart from rephrasing is identical, most of the equations are screenshots of the book and the same examples are treated.
Well I think I have never seen a digraph before (perhaps in school but I don't really remember it).
The most complicate of the things explained in here I think is the "Functional Composition" , I have to re read it a few times so I could understand it properly hehe.
Thank you for reading!