f is not a function.
a function f is the same thing as a subset Gf of X×Y with the following property:
for all x∈X, there is a unique y∈Y such that (x,y)∈Gf and we set y = f(x).
To say that there is a unique y∈Y says that f(x) is uniquely determined by x, and to say that for every x∈X there exists an (x,y)∈Gf says that in fact f(x) is defined for all x∈X.
This is the so-called vertical line test: for each x∈X, we have the subset x×YofX×Y. (In case X=Y=R, such subsets are exactly the vertical lines.)
Then G is the graph of a function f if and only if, for every x∈X, ({x} × Y ) ∩ G consists of exactly one point, necessarily of the form (x,y) for some y∈Y .
The unique such y is then f(x).