I'm wondering how the domain affects the inverse function.

Taking the example:

The inverse is

Why is the inverse restricted to 0 while the other was restricted to -3? I see it on a graph and I understand that it must be because the function stops being a 1 on 1 at x=0 but I'm wondering how we figure that out with functions that are more complex such as a sinus function or something?