There are differnet definition from what a function is.
The most precisely definition of a function is that a function is a relation from a set of inputs to a set of possible outputs where each input is related to exactly one output.
For example:
Let define the following function: y= 3x + 2
The graph for the function y=3x + 2 would be as follow:
As you can clearly see above, for example the number 1 in X would correspond to the number 5 in y.