Is a function a "special kind of relation", or, does it "describe a specific relation"?
My text on discrete mathematics explains:
A relation is a subset of a Cartesian product and a function is a special kind of relation.
But it would make more sense to me if a function described a relation as a subset of the Cartesian product.
My thoughts being:
Given a function, f(x) = y, we can compute a set of (x,y) coordinates within the Cartesian plain. And this set of coordinates would be the relation that is the subset of the Cartesian product.
Am I confused? Could anyone help explain how a function IS a relation?
A function is a specific kind of relation.
The best way to understand this is with the help of an example. So, let us take a couple of sets - set $A$ = {1, 2, 3} and set $B$ = {$a$, $b$, $c$}. Thus the set $A \times B$ will have 9 elements.
We can choose $2^9 = 512$ different subsets of $A \times B$. Each of this subset is a relation between $A$ and $B$. So, $\phi$ is a relation, {$(1, a), (1, c), (2, b)$} is also a relation. $A$ is called the domain and $B$ is called the co-domain.
A function is also a subset of $A \times B$ (hence a relation), but it has constraints. For every element in set $A$, there should be exactly one element in set $B$. More concretely, for every element $x$ in set A, there is exactly one $(x, y)$ in $f$ for some $y \epsilon B$
For example, {$(1, a), (2, b), (3, b)$} is a function, but {$(1, a), (2, b)$} is not because there is no entry of the form (3, *). Also, {$(1, a), (1, b), (3, b), (2, b)$} is also not a function because 1 has two values it is mapping to.