Relationship between functions and relations

7.7k Views Asked by At

In Discrete math I remember learning that "a function is a relation that is both 1 to 1 and onto."

Every time I try to look this up I can't find this definition of "function", all I can find is that "a function that is 1 to 1 and onto is a bijective function".

Have I misremembered this, or does it vary between different math subjects, or contexts or something?

Is there at least a difference between a relation and a function? What properties must a relation have to qualify as a function? Are functions a subclass of "relations" at all? Because I know that I have not misremembered learning that a function is a special kind of relation.

3

There are 3 best solutions below

2
On BEST ANSWER

The usual (set-theoretic) definition is that a function $A\to B$ is a subset of $A\times B$ such that for every $a\in A$ there is exactly one $b\in B$ such that $(a,b)$ is in the function.

In contrast, a relation between $A$ and $B$ is just an arbitrary subset of $A\times B$.

So, for example, is $A=\{1,2\}$ and $B=\{3,4\}$, then the following are relations between $A$ and $B$:

  1. $\{(1,3)\}$.
  2. $\{(1,3),(2,3)\}$.
  3. $\{(1,3),(2,3),(2,4)\}$.

but only the middle of these is a function $A\to B$. The first one is lacking an image of $2$; the last one has too many images of $2$.

3
On

This is the definition I usually go by (It is from the Munkres Topology book):

First, what is a rule of assignment?

A rule of assignment is a subset $r$ of the cartesian product $C\times D$ of two sets, having the property that each element of $C$ appears as the first coordinate of at most one ordered pair belonging to $r$.

Now define the image and domain sets of $r$ as:

$$ domain\; r = \{c | \exists d \in D \;s.t \;(c,d) \in r\}$$ $$ image\; r = \{d | \exists c \in C \;s.t \;(c,d) \in r\}$$

Now what is a function?

A function $f$ is a rule of assignment $r$ together with a set $B$ which contains the image set of $r$ ($B$ is called the range of $f$).

What is a relation?

A relation on a set $A$ is a subset of the cartesian product $A\times A$.

So as you can see a a function is a special kind of relation such that every element in the domain of the function appears only once in the relation.

2
On

Yes, functions are a special case of (binary) relations. That is, all functions are relations, but not all relations are functions. A relation $R$ is just a subset $R \subseteq X \times Y$, and an element of $R$ is a pair $(x,y)$ where $x \in X$ and $y \in Y$.

This is also true for functions, but functions must in addition satisfy the condition that for each $x \in X$, there exists a unique $y \in Y$ such that $(x,y) \in R$. In the language of functions, $X$ here is the domain of the function and $Y$ is the codomain. The restriction that we place on functions is that there can not be two different values that can be obtained by taking $f(x)$, in other words, the function must be well-defined.

As a small example, consider the case where $(2,3) \in R$ and $(2,4) \in R$. This is perfectly reasonable for a relation, and this could for example be part of the relation $\leq \subseteq \mathbb{N} \times \mathbb{N}$, and would then mean that it is both the case that $2 \leq 3$ and $2 \leq 4$. But this relation is not a function, because for $2 \in X$, there are two values $y$ in $Y$ such that $(2,y) \in R$.