How could we ensure the inverse of y=x^2 is a function?

pick a part of the domain where f(x) is one-to-one.

That is, where y is always decreasing or always increasing.