# Finding inverse of a function

Before I saw that the way of finding a function's inverse from purple maths

1. from equation eg. $y=\frac{1}{x}$
2. solve for x eg $x=\frac{1}{y}$
3. switch x & y eg. $y=\frac{1}{x}\textrm{ then }f^{-1}=\frac{1}{y}$

For the question:

Find the inverse for $f: (-3,0]\rightarrow R, f(x)=25-x^2$

I did:

$f(f^{-1}(x))=x$

$25-(f^{-1}(x))^2=x$

$(f^{-1}(x))^2 = 25-x$

$f^{-1} = \pm\sqrt{25-x}$

Answer is $f^{-1}: (16,25] \rightarrow (-3,0], f^{-1}(x)=-\sqrt{25-y}$

I suppose $y$ should be $x$?

Firstly is my method/working correct at all?

Secondly, why reject the positive part? Is it because the original range is negative only? What if it includes positive too? eg $(-3,1)$ (not necessarily this function)

Third, for such questions, I will need to state the domain of values that give the original range? eg. $f^{-1}: (16,25] \rightarrow (-3,0]$

• "I suppose y should be x?" - yes. Since your original function's domain is negative, and the (principal) square root is positive, you need to negate the square root function you got. Sep 3 '11 at 13:54
• @Srivatsan Narayanan, haha thanks, but I think I need since I'm asking a question Sep 3 '11 at 14:05
• jiewmeng, and since not many people who ask questions here show their work, we encourage that sort of behavior by upvoting the question. :) Sep 3 '11 at 14:09
• @J.M. oh great, thanks! Sep 3 '11 at 14:24

It is good to keep the relevant definitions at the back of our mind. The inverse of a function $f : A \to B$ is the function $f^{-1} : B \to A$ such that $$f^{-1}(f(a)) = a \text{ for all a \in A}, \tag{1}$$ and $$f(f^{-1}(b)) = b \text{ for all b \in B}. \tag{2}$$

Such an $f^{-1}$ need not always exist; when it does, we say that $f$ is invertible. A fairly standard theorem here is that $f$ is invertible if and only if it is a bijection; that is, if and only if it is surjective (onto) and injective (one-to-one).

So the first thing to check when you want to compute the inverse is whether the function is indeed a bijection. In your case, the function $f$ is defined as $f: (-3, 0] \to R$ by $f(x) = 25-x^2$. What $R$ is not clearly given, but I will make a reasonable assumption shortly. Following our dictum, before computing the inverse, let's check if the function is a bijection:

• It is indeed injective: this is clear if you plot the parabola $y = 25-x^2$ and restrict attention to $x \in (-3, 0]$, but we will give an algebraic proof. Suppose $x_1, x_2 \in (-3, 0]$ are such that $f(x_1) = f(x_2)$. Then we get $25 - x_1^2 = 25 - x_2^2$. Then either $x_1 = x_2$ or $x_1 = -x_2$. But since both $x_1, x_2$ are nonnegative, we cannot have $x_1 = -x_2$, unless $x_1 = x_2 = 0$. So, in both cases, $x_1 = x_2$ holds.

• What about surjectivity? This is where $R$ comes in. If $R = \mathbb R$, then the function is clearly not surjective, since $26$ is clearly not in the image of $f$. However, we can make this surjective by defining $R$ to be the range of $f$: $$R := f((-3, 0]) = \{ f(x) \,:\, x \in (-3, 0] \} .$$

We can check that $R = (16, 25]$ in this example. (In fact, the OP has implicitly done this already.)

Now, let's calculate the inverse $g : (16, 25] \to (-3,0]$. (I am using the symbol $g$ for the inverse for extra clarity.) Using the condition $(2)$ (as the OP does), we get: $$25 - g(b)^2 = b.$$ Solving for $g(b)$, we get that either $g(b) = + \sqrt{25 - b}$ or $g(b) = -\sqrt{25-b}$.

But we still must figure out the sign. Taking the positive sign gives a result that is nonnegative. However, as the OP notices, the range of $g$, which is the same as the domain of $f$, consists only of negative numbers and zero; so the positive sign gives an answer that is outside the range. So we can discard the positive root. We are thus left with: $$g(b) = - \sqrt{25 - b}.$$ Since the $b$ in the above equation is a dummy variable, we can replace it by $x$ or $y$ or any other variable as well.

What if $f$ was defined on the domain $(-3,1)$? In this case, we can mimick the the above calculation, but we run into an issue because we cannot discard the positive sign anymore for some values of $b$.

What went wrong? Only that we forgot to check that $f$ is a bijection before attempting to find the inverse. Going back and doing this, we find that this function is not injective (e.g., $f(1/2) = 25 - (1/2)^2 = f(-1/2)$) and hence, indeed, an inverse does not exist.

Your final question. Yes. This was answered somewhere in the middle of my elaborate explanation.

The bottomline of all this is that computing inverses is not just "solve for $x$ in terms of $y$ and switch $x$ & $y$". This is a convenient short-cut, but one also needs to pay some attention to the domain and range. Many people ignore this latter aspect to save time (or may be because they do not know better), but I recommend that you at least do the necessary checks in your head.