What is the difference between function and relations ? What are the characteristics of function and relations? What are the similarities and contrasts between relations and functions ? Examples will be much appreciated , thanks !
3 Answers
Relation between sets $X$ and $Y$ is a triple $(X,Y,R)$ where $R$ is an arbitrary subset of $X\times Y$.
Example 1. Relation $\le$ between integers is $(\mathbb Z,\mathbb Z, R)$ where $(x,y)\in R$ if $x$ is less than or equal to $y$, e. g. $(2,3)\in R$, $(3,2)\notin R$. This is an example of a total order relation.
Example 2. Biological relation between animals $$\big(\mathrm{animals},~\mathrm{animals},~\{(x,y)\mid x,y\text{ are the same species}\}\big)$$ is an example of equivalence relation.
Function (map) is a relation $(X,Y,R)$ such that for every $x\in X$ there is unique element $(x,y)\in R$.
The keywords are "every" and "unique", this is the difference from general relations. $X$ is called domain, $Y$ is codomain, $\{y\mid (x,y)\in R\}$ is range, $R$ is graph of the function.
Example 3. Function $$f=\left(\mathbb R,\mathbb R,\{(x,y)\in \mathbb R^2 \mid y=x^2\}\right)\,,$$ is a parabola, usually denoted as $$f: \mathbb R\to \mathbb R,~ x\mapsto x^2\,.$$
Example 4. Function $$\big(\mathrm{animals},~\mathrm{species},~\{(x,y)\mid x\text{ belong the species } y\}\big)$$ is in fact the canonical projection of animals by equivalence relation from the example 2.
Use Google or Wikipedia for all unknown words.
In some interpretations, functions are relations with some very specific conditions. Specifically, a relation $R$ is a function is for any $x$ there is exactly one $y$ such that $xRy$.
Take, for instance, the relations on $\Bbb R$. There are a lot of relations. You might be aware of $\leq$, for instance, or the relation $\sim$ defined by $x \sim y$ iff $x-y \in \Bbb Z$.
Some of these relations are functions. For instance, the relation $R$ given by $xRy$ iff $x - y = 1$ is a function. It's usually written as $y = x-1$ or $R(x) = x-1$, but that doesn't change how it works.
'Relation' is one person to other person how to relate but function is transformation so function transform to one object to other object.