What is \(x\) if \(x^22=7\)?
What if you also knew that \(x\geq 0\)?
The need for onetoone
Let’s think about this quadratic problem in terms of functions and consider the function \(f(x)=x^22\) where \(x\) can be any real number. The domain of \(f\) is \(\mathbb{R}\) and the range is the interval \([2,\infty)\) or in other words \(f(x)\ge2\).
The function is manytoone, which you can see from the graph of \(y=f(x)\) below. For instance, the inputs \(3\) and \(3\) both give the same output value, namely \(7\).
The inverse function, \(f^{1}(x)\), would be one that ‘undoes’ the effects of \(f(x)\), but what value should we get for \(f^{1}(7)\)? We would want it to provide both values, \(3\) and \(3\), making it a onetomany relation but we do not consider things with more than one output to be functions.
See the resource What relation are you? for more about manytoone and onetomany relations.
Restricting the domain
If we define a new function, \(g(x)\), with the same rule as \(f(x)\) but with its domain restricted to \([0,\infty)\), then this function is onetoone (also known as injective).
How did I know to use the positive rather than the negative square root?
Notice that,

Function \(g\) has the same range as \(f\) so any value that can be obtained as output from \(f\) can also be obtained from \(g\).

The domain of \(g^{1}(x)\) is \([2,\infty)\), which is the range of \(g(x)\).

The range of \(g^{1}(x)\) is \([0,\infty)\), which is the domain of \(g(x)\).
We chose to restrict the domain of \(g\) to \([0,\infty)\), but we could instead have chosen to restrict it to \((\infty,0]\). What would the graph of \(y=g(x)\) then look like? What would its range have been? Would it be invertible?
Another function is defined as \(h(x)=x^22, \ 1\le x\le4\). What is its range and what is its inverse function?
Definitions
When we say that two functions, \(f\) and \(f^{1}\), are inverses we mean that each one “undoes” the action of the other. Applying one and then the other (either way round) will take us back to our starting value.
Algebraically we can say that,

\(f^{1}(f(x))=x\) for all values of \(x\) in the domain of \(f\), and

\(f(f^{1}(y))=y\) for all values of \(y\) in the domain of \(f^{1}\).
In order to achieve this, not only must \(f\) be onetoone on its entire domain, but also the domain of \(f^{1}\) must be the same as the range of \(f\) and viceversa. Below, we shall explore why this is.
There is a concept of a onesided inverse, where one of the above bullet points is true but not the other. However, we are only going to consider cases where they are inverses both ways round.
Matching domains and ranges
Function machines
We can represent the composition of a function and its inverse as a function machine.
In the middle of the first diagram, the output of \(f\) becomes the input of \(f^{1}\), and so the range of \(f\) must match the domain of \(f^{1}\). The second machine shows that the domain of \(f\) must match the range of \(f^{1}\).
Graphs
Another way to think about this is to consider the graph above of the function \(y=g(x)\). Starting at a value of \(x\) in the domain of \(g\) we find \(y\) by tracking vertically from the \(x\)axis to the curve then horizontally to the \(y\)axis.
As \(g^{1}\) is the inverse, the same graph also represents \(x=g^{1}(y)\). Starting at a \(y\) value on the \(y\)axis we track the same path in reverse to find our \(x\) value. As it is the same graph, the range of possible outputs from \(g\) must be the same as the domain of possible inputs to \(g^{1}\) and viceversa.
A diagrammatic approach
We can draw a diagram to represent the function \(f\), as we did in What relation are you?.
The dots on the left represent the domain of \(f\) and as \(f\) is a onetoone function, there is at most one arrow coming into each dot on the right. We have also chosen to make the right hand set be exactly the range of \(f\), so every dot has an arrow coming into it.
What would the diagram for \(f^{1}\) look like, and how does this show that the domain of \(f^{1}\) is the range of \(f\) and vice versa?