A function f: R2 → R is said to be independent

A function f: R2 → R is said to be independent of the second variable if for each x € R we have f (x, y1) = f (x, y2) for all y1, y2. €R Show that f is independent of the second variable if and only if there is a function f: R→R such that f(x, y) = g(x). What is f1 (a, b) in terms of g1?