I am learning precalculus and my book defines the following:
A function $f$ from a set $A$ to a set $B$ is a rule that assigns to every element $a$ in $A$ one and only one value in $B$.
Well, I am thinking, a rule isn't something that I've seen defined mathematically. So what is a function, really? Is it a subset of $A\times B$ or something?
Indeed, a function is a subset of $A \times B$ with the following very important property: for every $x \in A$, there exist a unique $y \in B$ such that $(x,y) \in A \times B$. Intuitively, this tells you that a function cannot take an element $x$ into several distinct values $y$ - that wouldn't be a function anymore, but somehing called "binary relation" (that you need not worry about).
Nevertheless, for many practical purposes, thinking of a function as a rule, or a correspondence between $x$ values and $y$ values, will suffice. Still, keep the correct definition somewhere in the back of your mind, readily available if necessary.