The problem is:

"Suppose that A is a nonempty set and R is an equivalence relation on A. Show that there is a function f with A as its domain such that (x,y) are elements of R if and only if f(x)=f(y)"

I don't understand how to connect a relation with a function

thank you