Defining domains

What is \(x\) if \(x^2-2=7\)?

What if you also knew that \(x\geq 0\)?

If \(x^2-2=7\) then \(x\) could be \(3\) or \(-3\), but by restricting \(x\) to \(x\geq 0\), we ensure there is a single solution to the equation \(x^2-2=7\). (Of course, we could have restricted \(x\) in other ways to ensure that there was a single solution.)

The need for one-to-one

Let’s think about this quadratic problem in terms of functions and consider the function \(f(x)=x^2-2\) 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)\ge-2\).

The function is many-to-one, 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 one-to-many relation but we do not consider things with more than one output to be functions.

\[y=x^2-2 \quad\implies\quad x^2=y+2 \quad\implies\quad x=\pm\sqrt{y+2}\] This seems to imply that \[f^{-1}(x)=\pm\sqrt{x+2}\] but the \(\pm\) indicates one-to-many behaviour, so \(f^{-1}\) is not actually a function.

See the resource What relation are you? for more about many-to-one and one-to-many 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 one-to-one (also known as injective).

graphs showing f of x with domain R and g of x with domain x greater than or equal to zero
This means that \(g\) is invertible and we can write its inverse function as \[g^{-1}(x) = \sqrt{x+2},\quad x\ge-2.\]

How did I know to use the positive rather than the negative square root?

graph showing g-inverse of x

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^2-2, \ 1\le x\le4\). What is its range and what is its inverse function?

This alternative \(g\) has range \([-2,\infty)\), which is the same as before. It is still one-to-one, but now we see that we need to take the negative square root to find the inverse of \(g\), because the domain of \(g\) is \((-\infty,0]\). \[y=g(x)=x^2-2 \quad\implies\quad x^2=y+2 \quad\implies\quad x=-\sqrt{y+2}\] and therefore \[g^{-1}(x)=-\sqrt{x+2}\]

graph of g with domain x less than or equal to zero
For the function \(h\), since it has domain \([1,4]\), we will have to take the positive square root to find its inverse. \[\begin{align*} h(x) &=x^2-2,\quad 1\le x\le4; \quad \text{range: }[-1,14] \\ h^{-1}(x) &=\sqrt{x+2},\quad-1\le x\le14; \quad \text{range: }[1,4] \end{align*}\]

Notice that the domain of \(h^{-1}\) is the range of \(h\) and vice versa.

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 one-to-one on its entire domain, but also the domain of \(f^{-1}\) must be the same as the range of \(f\) and vice-versa. Below, we shall explore why this is.

There is a concept of a one-sided 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.

function machine diagram showing f then f inverse and another the other way round

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 vice-versa.

A diagrammatic approach

We can draw a diagram to represent the function \(f\), as we did in What relation are you?.

Two ovals each containing five dots, each dot in the left oval is joined to to a different dot in the right oval by an arrow

The dots on the left represent the domain of \(f\) and as \(f\) is a one-to-one 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?

The arrows are all reversed to get the inverse function:

The same diagram as above, but with all of the arrows reversed

It is clear from these diagrams that the domain of \(f\), which is the left set, is the range of \(f^{-1}\), while the range of \(f\), which is the right set, is the domain of \(f^{-1}\).