Hi, if I have a piecewise function such as:

f(x) = (x-1)^2 if x>1

or tan(x) if -π/2 < x < 0

If I want want to find the inverse, do I simply calculate the inverse for each of piecewise operations ?

eg. (x-1)^2 has the inverse y = 1 +- sqrt(x)

and tan(x) has the inverse tan^-1(x)

is it is straightforward as that or I am missing something ?

thanks for any help.