Explanation of why functions must be one-to-one functions to have an inverse?

think about it. If

f(1) = 2
and f(2) = 2

how can you pick an inverse g(2)?