0

Wikipedia defines a relation as a set of ordered pairs.

An example of this is {(1,1), (2,4), (3,9)}

But how could this set fully define a relation? Can’t the relation have one of many different possible codomains? And wouldn’t each of these relations be different?

Frasch
  • 347
  • What is your definition of a relation? – saulspatz Jun 07 '19 at 01:11
  • 4
    This is a relation between any set that contains $1$, $2$, and $3$, and any set that contains $1$, $2$, and $9$. It tells you that the $1$ in the first set is related to the $1$ in the second; that the $2$ in the first set is related to the $4$ in the second, and that the $3$ in the first set is related to the $9$ in the second. But you don’t speak of relations in the abstract, you speak of relation from one set $X$ to one set $Y$ (just like you don’t generally speak of “functions” without saying what the domain and codomain are, at least by convention). – Arturo Magidin Jun 07 '19 at 01:12

2 Answers2

5

You are right that absent context, this does not fully define a relation, just like saying $f(x)=x^2$ does not really define a function (until I tell you what the domain, and possibly also what the codomain, are).

Basically, given sets $X$ and $Y$, a relation from $X$ to $Y$ is a subset $R$ of $X\times Y$, $R\subseteq X\times Y$; that is, $R$ is a set of ordered pairs with first coordinate in $X$ and second coordinate in $Y$. We think of $R$ as giving the relation that relates the element $a\in X$ to the element $b\in Y$ if and only if the pair $(a,b)$ is an element of $R$.

Just as with functions, to fully describe a relation we need to specify $X$, $Y$, and $R$ (with functions, you want to specify the domain $X$, the codomain $Y$, and the rule for assigning elements of $X$ to elements of $Y$, the “function”). Often because of context we can “get away” with not specifying $X$ and $Y$ explicitly. For example, in Calculus I we agree that our functions will always be defined from a subset of $\mathbb{R}$ to $\mathbb{R}$. We even agree that functions given by formulas are defined from their natural domain to $\mathbb{R}$, so that we can “get away” with just giving the formula $f(x) = x^2$ and we “know” that this is a function from $\mathbb{R}$ to $\mathbb{R}$ without saying the latter.

Similarly, from context or convention we may agree that if we don’t explicitly say what the domain and codomain of the relation are, then we will take them to be some specific set; or we will take them to be “the smallest sets for which the relation $R$ makes sense”, that is, take $X$ to be the set $\{a\mid \text{there is a }b\text{ such that }(a,b)\in R\}$, and take $Y$ to be the set $\{b \mid \text{there is an }a\text{ such that }(a,b)\in R\}$. This usually needs to be agreed on explicitly, though.

Arturo Magidin
  • 398,050
0

When I took axiomatic set theory, relations were defined as sets of ordered pairs, and functions as a special case. The domain of a relation $R$ was defined as $\operatorname{Dmn}(R) = \{x|\exists y((x,y)\in R)\}$ and the range was defined similarly.

In particular, I recall the example $f:\mathbb{N}\to\mathbb{N}$ defined by $f(n)=n^2$ and the function $g:\mathbb{N}\to\mathbb{R}$defined by $g(n)=n^2$ are the same function, because they are the same sets of ordered pairs.

If I'm not mistaken, in category theory, $f$ and $g$ are different morphisms. (I don't know anything about category theory; I tried to read a book about it once, and couldn't get very far in, but I think I recall this same example, differentiating morphisms from functions, near the beginning of the book.)

So, my understanding is that the Wikipedia article is correct. I agree that you can't specify a function by a formula without giving the domain, unless as in calculus, there is some prior agreement. However, I don't believe that the codomain distinguishes functions, either in a formal or an informal sense. Once we know the domain and the formula, the function is completely determined.

saulspatz
  • 53,131
  • 1
    See this answer. Basically, there are two different ways of thinking about functions, each of which has its pluses and minuses. Similarly with relations. – Arturo Magidin Jun 07 '19 at 15:48
  • 1
    @ArturoMagidin I wasn't taking issue with your answer, just trying to give another point of view. I do sometimes wonder which point of view is prevalent nowadays. I learned basic math $50$ years ago, and it seems to me every book I read back then considered a function or relation as just a set of ordered pairs, but this doesn't seem to be the case today. I think this may be an influence from computer science, since in a statically-typed language, the types of the domain and codomain elements have to be specified. – saulspatz Jun 07 '19 at 15:57
  • I wasn't taking issue with your answer. I was providing some commentary to your third paragraph. – Arturo Magidin Jun 07 '19 at 16:49
  • I also think your impression from 50 years ago is mistaken, as is your belief of where the distinction came from. Even 50 years ago the notion of "surjective" was bandied about, but doesn't fit well with the notion of functions as simply sets of ordered pairs. What you are talking about is the difference between axiomatic elementary set theory, and the actual use. Bourbaki is over 50 years old, and it already dealt with functions as ordered triples, keeping into account domains and codomains. (cont) – Arturo Magidin Jun 07 '19 at 16:51
  • (cont) Calculus books 50 years ago already said that two functions were equal if and only if they had the same domain, the same codomain, and the same value at every point in the domain, which does not match the "function is just a set of ordered pairs". – Arturo Magidin Jun 07 '19 at 16:51
  • @ArturoMagidin Well, if that's so, I'm mistaken. I see what you mean about "surjective." That does't gibe with the definition as a set of ordered pairs, I agree. – saulspatz Jun 07 '19 at 17:15