Q:

Relationship between functions and relations

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. 

A:

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,3)\}$.
$\{(1,3),(2,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$.

