## Finding the inverse of a function

Consider the function $$f(x)=5x+2$$. What does this function do to the input number $$x$$?

First, it multiplies the input number by $$5$$, then it adds $$2$$ to the resulting product.

Now, suppose you were told that $$17$$ was the resulting output number. What would you do to find out what the input number was? First, you would have to subtract $$2$$ then divide by $$5$$ (getting the result $$3$$). That is, you would have to undo the operations that $$f$$ did, and in the reverse order. This "undo" function that subtracts two then divides by five is called the inverse of $$f$$, and is written $$f^{-1}(x)=\dfrac{x-2}{5}$$. It is the function that undoes what $$f$$ does.

So if $$f(x)=5x+2$$, then $$f^{-1}(x)=\dfrac{x-2}{5}$$.

## Not every function has an inverse function

Now consider the function $$g(x)=x^2$$, the squaring function. How would one undo the squaring function?

By taking the square root?

What if the input number is $$-2$$? Then $$g(- 2) = 4$$. But if we take the square root of $$4$$, we get $$2$$, not $$-2$$.

The problem is that there are two input numbers, $$-2$$ and $$+2$$, with the same output number $$4$$. Thus, there is no way to figure out which input number, $$-2$$ or $$+2$$, produced the $$4$$, so there is no way to undo what $$g$$ did.

Remember, a function must always give the same output for any given input. It cannot sometimes give an output of $$2$$ when the input is $$4$$ and other times give an output of $$-2$$ when the input is $$4$$. Thus there is no inverse function for $$g$$.

This dilemma will always occur for functions that transform two or more input numbers into the same output number.

## One-to-one functions

In order to have an inverse, a function must have only one input number corresponding to any given output number.

We already know, from the definition of a function, that there can be only one output number for any given input number. If we add the requirement that there must also be only one input number for any given output number, we get what is called a one-to-one function.

Only one-to-one functions have an inverse function.

## The horizontal line test

Remember the vertical line test? No vertical line intersects the graph of a function more than once.

For one-to-one functions, we have the horizontal line test:

No horizontal line intersects the graph of a one-to-one function more than once.

## Exercise 1.6.1

Sketch the graph of $$y=x^2$$ between $$x = -3$$ and $$x = + 3$$. Draw a horizontal line which intersects the $$y$$-axis at $$y = 4$$. At the two points where the horizontal line intersects the graph, draw vertical lines. Where do these two vertical lines intersect the $$x$$-axis? Each of these two numbers has $$4$$ as its output. Graph paper

See Solution

## Finding the equation of $$f^{-1}(x)$$

Now we will see a method of finding the equation of $$f^{-1}(x)$$ from the equation of $$f(x)$$ which works for some, but not all, one-to-one functions.

In the inverse of a one-to-one function, the role of input and output numbers is reversed, because the output number is put into the inverse function and outputs the original input.

This effect of reversing the roles of input and output can be accomplished algebraically by reversing the $$y$$ and the $$x$$ in the equation of the one-to-one function.

For example, suppose $$f(x)=\dfrac{x+2}{x-3}$$ Replace $$f(x)$$ with $$y$$ to obtain: $$y=\dfrac{x+2}{x-3}$$

Next, reverse the variables, replacing $$x$$ with $$y$$ and $$y$$ with $$x$$to obtain: $$x=\dfrac{y+2}{y-3}$$

This equation describes the relationship between $$x$$ and $$y$$ in the inverse function . It is not, however, the equation of $$f^{-1}(x)$$.

To find the equation of $$f^{-1}(x)$$, we must solve $$x=\dfrac{y+2}{y-3}$$ for y.

## Exercise 1.6.2

Solve $$x=\dfrac{y+2}{y-3}$$ for $$y$$ to find the equation for $$f^{-1}(x)$$.

See Solution

## a restricted domain one-to-one function

Consider the function $$f(x)=(x-1)^2$$ for $$x\le1$$.

We shall see that the requirement that $$x\le1$$ is very important, since, without it, the function would not be one-to-one.

## Exercise 1.6.3

Sketch the graph of $$f(x)=(x-1)^2$$ without the restriction that $$x\le1$$.

Draw the graph a second time with the restriction that $$x\le1$$.

Notice that the first graph fails the horizontal line test, but that the second graph passes the horizontal line test. Graph paper

See Solution

## Finding the inverse when the domain is restricted

Now let us find the equation for $$f^{-1}(x)$$ given that $$x\le1$$.

First, replace $$f(x)$$ with $$y$$: $$y=(x-1)^2$$ for $$x\le1$$

Then reverse the variables: $$x=(y-1)^2$$ for $$y\le1$$

Solving for $$y$$ yields $$y=1\pm\sqrt{x}$$ for $$y\le1$$ which is not a function, since there is more than one solution for $$y$$. But since $$y\le1$$, we know to reject the 'solution' $$y=1+\sqrt{x}$$ and retain the true solution $$y=1-\sqrt{x}$$. Thus $$f^{-1}(x)=1-\sqrt{x}$$.

## Exercise 1.6.4

Find $$f^{-1}(x)$$ given that $$f(x)=9-x^2$$ for $$x\ge3$$.

See Solution

## Finding the graph of $$f^{-1}(x)$$ geometrically

There is a very nice way to use the graph of $$f(x)$$ to see what the graph of $$f^{-1}(x)$$ looks like.

First, draw the graph of $$f(x)$$.

Next sketch the graph of $$y=x$$ as a dotted line.

Then 'reflect' the graph of $$f(x)$$ in the graph $$y=x$$ of as if it were a mirror.

The reflected graph is the graph of $$f^{-1}(x)$$.

The same result can be achieved manually by first drawing the graph of $$f(x)$$ on a blank sheet of paper. Then grasp the paper at the lower left and upper right corners and flip the sheet over. Hold the flipped sheet up to the light with the back of the sheet facing you and you will see that the $$x$$ and $$y$$ axes have switched places and you will be looking at the graph of $$f^{-1}(x)$$.

Geometrically, reversing $$x$$ and $$y$$ in the equation for $$f(x)$$ is equivalent to switching the positions of the $$x$$ and $$y$$ axes by 'flipping' the graph or by reflecting the graph in the line $$y=x$$.

## Exercise 1.6.5

Sketch the graphs of $$f$$ and $$f^{-1}$$and from exercise 1.6.4. Graph paper

See Solution