eli5 what’s the difference between the domain of a relation and the relation itself?

54 views
0

and is it correct to say that a relation is a subset of a Cartesian product AxB? or am I confusing it with its domain?

In: 1

Relation is a mapping between two sets. Domain is one of the sets. They’re very related, but refer to different constructs.

[deleted]

>is it correct to say that a relation is a subset of a Cartesian product AxB?

Yes. The Cartesian product AxB is the set of all tuples (a,b) where a is an element of A and b is an element of B. A relation is a subset of the Cartesian product; it is the set of all tuples (a,b) out of the Cartesian product for which “a is related to b” holds true (whatever “is related to” means in the specific case).

The domain of a relation is simply the first of the two sets, so in our example above, the domain is A. B is called the codomain. For the relations you encounter most frequently, such as “greater than”, both the domain and the codomain will be the the set of real numbers (R), so those relations are called endorelations of R.

As an example which isn’t an endorelation, consider “occurs in the flag of”. The domain is the set of all colors, the codomain is the set of all countries. The Cartesian product is the set of all possible (color, country) tuples, such as (white, China), (lavender, Brazil) or (red, France). The relation “occurs in the flag of” is a subset of the Cartesian product that contains only those tuples (like (red, France)) where the color actually occurs in the flag.