How is a relation defined? I've read multiple ways of defining relations and was wondering what is generally accepted. One of these ways is as follows.
$xRy=C\iff C\subseteq A\times B$
and the cartesian product is defined as
$A\times B=D\iff (\forall x)(\forall y)((x,y)\in D\iff x\in A \land y\in B)$
Is this definition generally accepted or is there a more formal definition?
 A: In set theory, relations are sets; thus "to be a relation" is a property of sets.
We define the pair $(x,y)$, for example with Kuratowski's definition, and then we define the cartesian product of two sets $A$ and $B$ : 

$A \times B = \{ (x,y) \mid x \in A \text { and } y \in B \}$.

Finally, we define when a set is a (binary) relation :

$\text {Rel}(A) \text { iff } \forall x \ [x \in A \to \exists y \exists z (x=(y,z))]$.

The symbol $xRy$ is an abbreviation for $(x,y) \in R$.

Due to the fact that $A \times B$ is the set of all pairs $(x,y)$ with $x \in A$ and $y \in B$, we have that :

for every $C$, if $C \subseteq A \times B$, then $\text {Rel}(C)$.

A: The simplest of all definitions I have seen is : " A relation is a set of ordered pairs". 
Any set such that all its elements are ordered pairs is a relation. 
In case the set is empty, the definition still holds vacuously, so the Empty set is a relation. 
In what you wrote, C was supposed to be a set. A set is not a sentence. But xRy is a sentence ( or an " open sentence"). So writing : 
xRy = C 
cannot mean anything, for a set cannot be the same object as a sentence. 
What you could say is : A set C is a relation from A to B  defined by the sentence xRy iff 
(1) C is a subset of  " A cross B" 
(2) any ordered pair (x,y) belongs to C <--> the sentence x R y is true. 

(I) In traditional aristotelian philosophy, the term " relation " was one of the 10 " categories", that is, it was a kind of predicate. The specificity of relational statements was not recognized: they were treated as ordinary Subject-Verb-Predicate statements. 
So, the sentence " Socrates is Plato's master" was analyzed as : " being Plato's master" is a predicate ( an attribute) belonging to the subject " Socrates". 
(II) This approach revealed unsatisfying, due to the fact that it does not allow to show the validity of reasonings involving relational statements. 
(1) Line A is parallel to B 
(2) Line B is parallel to C 
(3) Therefore? 
If you treat " parallel to A " as a whole predicate and "parallel to C" as a whole predicate, you get, a reasoning of the form 
(1) a is X
(2) b is Y 
and you cannot conclude anything. 
(III) So relations could not be treated as ordinary predicates. It was realized that they had to be considered as 2-place predicates. For example the true ( deep) structure of " A is parallel to B " is not " A is parallel-to-B" but 
Parallel [( A, B) ]
in words: the ordered pair (A,B) satisfies ( makes true) the predicate " Parallel". 
So " parallel" is in fact : __  Parallel __
And in general , a relation R is : ____ R  ____ 
(IV) Following Frege, one can say that  _R _ is an "open sentence". For any pair (x,y) this open sentence takes a truth value ( true or false). In this way you can produce a fonction ( a truth function) taking as inputs ordered pairs ( x,y) and giving back truth values as outputs. 
This leads to the " propositional function " definition of " relation" ( See Lipschutz, Schaum's outline of Set Theory, Chapter 6,  at Archive.org)
" A relation R consists of the following : 
(1) a set A 
(2) a set B
(3) an open sentence P (x,y) in which P(a,b) is either true or false for any ordered pair (a,b) belonging to the cartesian product A cross B. "
(V) The preceding approach was still intensional, it involved concepts ( " intensions" in traditional philosophy) , for the "open sentence" involved in the definition of the relation could be identified only by its meaning, its sense.From the preceding point of view the relation " lady x is the wife of mister y " and the relation " lady x has as husband mister y " are not the same relation, because their open sentences do not involve the same concepts. 
If mathematics wants to avoid this problem, it has  to define its objects in a purely extensional way. They want to say that the two preceding relations are one and the same ( in spite of their purely " conceptual" difference). The only way to do this was to say that a relation R is nothing else than the set of all ordered pairs that are " selected" by its defining open sentence ( that is, nothing else than the " solution set" of this open sentence). 
A motivation for this is geven below by Lipschutz 

A: If the question is " is this set a relation?" you do not need the " subset" part of the definiiton. The definition you will use is : " a set is a relation iff it is a set of ordered pairs" 
If the question is " is this set a relation from A to B?" you will need the " subset" part of the definition. 
The definition you will use is : a set S is a relation from A to B iff
(1) it is a set of ordered pairs
(2) all these ordered pairs belong to the cartesian product A cross B, 
which means , in brief, that S is a subset of the cartesian product A cross B. 

Sometimes , instead of writing 
set S = { x | x is a natural number and x is divisible by 2}
some authors write : S is the set such that 
x belongs to S <--> x is a natural number and x is divisible by 2. 
The same thing can be done for relations. 
Instead of saying that 
R = { (x,y) belonging to A cross B  | x = 3 y }
one can perfectly say that R is the set such that 
(x,y) belongs to R <--> (x,y) belongs to A crosss B and x = 3y 
