## Section7.3Gist of Composition and Inverses of Functions

### Subsection7.3.1Composition

The composition of functions is all about using the output of one function as the input for another.

The notation we will use for composing two functions is

\begin{equation*} f(g(x)) \end{equation*}

which we read as "$f$ of $g$ of $x$".

Working from the inside-out, this means that the function $g$ is used first to get an output, and then that output is used as the input for the function $f\text{.}$

If we use function composition with a numerical input, we will get a numerical output. However, if we just use $x$ as the input and compose functions, the result will be an expression involving $x\text{,}$ which is a brand new function representing the composition. This new function is called a composite function.

###### Note7.3.2.

Often, the composite function $f(g(x))$ is written as

\begin{equation*} (f \circ g)(x) \end{equation*}

to indicate that $(f \circ g)$ is a new function.

Similarly, the composite functions $g(f(x))$ and $f(f(x))$ would be written as $(g \circ f)(x)$ and $(f \circ f)(x)\text{.}$

Notice something important about the composite formula you found for $g(f(x))$ in Exercise 7.3.3: Using $x$ as the input, you found that $g(f(x)) = 9x^2 + 27x + 20\text{.}$ Evaluating this new formula at the input $x = 5$ gives:

\begin{align*} 9(5)^2 + 27(5) + 20 \amp= 9\cdot25 + 27\cdot5 + 20\\ \amp= 225 + 135 + 20\\ \amp= 380 \end{align*}

This is exactly the same result you got when you evaluated $g(f(5))$ in Exercise 7.3.1.

The formula $g(f(x)) = 9x^2 + 27x + 20$ is really a new, single function that represents the composition $f(g(x))\text{.}$ Once you've found this formula, you could quickly evaluate many numerical compositions, such as $g(f(7))$ or $g(f(-3.6))\text{,}$ without having to think about $g$ and $f$ separately.

Turning two or more functions into one function by composition is really a common idea — think about any complex machine, such as an automobile. Many internal processes depend on each other, and you may think of the following simplifications:

• Applying pressure to the accelerator pedal allows air into sthe fuel system.

• The air in the system is monitored, and fuel is added to the system accordingly.

• Spark plugs ignite the fuel mixture.

• Etc.

Now, few people would look at a car and see it as a composition of its dozens of connected systems and processes. We just simplify this by assigning a single word to refer to this complex composite function: “car”.

If everything is working properly, from the driver's perspective, there is just one input — depressing the accelerator — that sets everything else in motion.

This is true for any composition of functions in mathematics. Even if we have something complicated like:

\begin{equation*} f(g(h(x))) \end{equation*}

There is just one input value, $x\text{,}$ that is needed in order to evaluate the composite function.

The next example uses function composition in the context of a patient taking blood pressure medicine.

Let $C$ represent the concentration, measured in mgkg, of a blood pressure regulating drug in a patient's bloodstream as a function of time $t\text{,}$ measured in hours. As time goes on, the concentration of the drug in the bloodstream decreases as the body metabolizes and/or excretes it.

At the same time, the drug is meant to help lower the patient's blood pressure $P\text{,}$ measured in mm Hg. So, as the drug leaves the patient's bloodstream, the blood pressure increases.

Therefore, $P$ depends on $C\text{,}$ and $C$ depends on $t\text{.}$

There is a function which represents how $C$ depends on $t\text{.}$ We will call this function $f\text{,}$ and write:

\begin{equation*} C = f(t) \end{equation*}

There is another function which represents how $P$ depends on $C\text{.}$ We will call this function $g\text{,}$ and write:

\begin{equation*} P = g(C) \end{equation*}

So, we would first use $f(t)$ to find the concentration $C$ of the drug in the bloodstream, and then use that concentration as the input for the function $g(C)$ in order to find the patient's blood pressure $P\text{.}$

In function notation, this would look like:

\begin{align*} P \amp= g(C)\\ \amp=g(f(t)) \end{align*}

That last expression, $g(f(t))\text{,}$ is a composite function, and it shows that the blood pressure is really a function of $t\text{.}$

Continue Example 7.3.4 in the next exercise, evaluating the composition with a numerical input.

Finally, we conclude Example 7.3.4 by finding the formula for a composite function.

Even outside of a context, knowing how to write a formula for a composite function is an important skill.

Let $f(x) = 3x^2 + 5x$ and $g(x) = 8x - 1\text{.}$

Find and simplify formulas for each composite function.

1. $f(g(x))$

2. $g(f(x))$

3. $g(g(x))$

4. $f(f(x))$

Solution
1. \begin{align*} f(g(x)) \amp= f(8x - 1)\\ \amp= 3(8x - 1)^2 + 5(8x - 1)\\ \amp= 3(8x - 1)(8x - 1) + 40x - 5\\ \amp= 3(64x^2 - 16x + 1) + 40x - 5\\ \amp= 192x^2 - 8x - 2 \end{align*}
2. \begin{align*} g(f(x)) \amp= g(3x^2 + 5x)\\ \amp= 8(3x^2 + 5x) - 1\\ \amp= 24x^2 + 40x - 1 \end{align*}
3. \begin{align*} g(g(x)) \amp= g(8x - 1)\\ \amp= 8(8x - 1) - 1\\ \amp= 64x - 8 - 1\\ \amp= 64x - 9 \end{align*}
4. \begin{align*} f(f(x)) \amp= f(3x^2 + 5x)\\ \amp= 3(3x^2 + 5x)^2 + 5(3x^2 + 5x)\\ \amp= 3(3x^2 + 5x)(3x^2 + 5x) + 15x^2 + 25x\\ \amp= 3(9x^4 + 30x^3 + 25x^2) + 15x^2 + 25x\\ \amp= 27x^4 + 90x^3 + 75x^2 + 15x^2 + 25x\\ \amp= 27x^4 + 90x^3 + 90x^2 + 25x \end{align*}
##### Transformations are Compositions.

In chapter 5, you studied transformations of a function. There, you took a function $f(x)$ and shifted its graph left or right by adding a number to the input of the function. For instance, $f(x – 3)$ represented shifting the graph $y = f(x)$ to the right by $3$ units.

However, this may also be thought of as the composition of two functions: $f(x)$ and $g(x) = x - 3$

As a composition, this transformation occurs by substituting the function $g(x) = x - 3$ into the function $f(x)\text{:}$

\begin{equation*} f(x - 3) = f(g(x)) \end{equation*}

So, we have already been using function composition, though we have waited until now to give it that name.

### Subsection7.3.2Inverses

Two functions are called inverses if they undo each other. If one function has a certain process, then the other function will have the reverse process.

Using function notation, this means the following:

If $f$ and $g$ are inverses, then both of the following will be true:

• $\displaystyle f(g(x)) = x$
• $\displaystyle g(f(x)) = x$

This is because whatever the inside function did with the input $x\text{,}$ the outside function undid that action.

If a function $f$ has an inverse function $f^{-1}\text{,}$ then we say that the function $f$ is invertible (also called one-to-one).

The functions $f(x) = 2^x + 1$ and $g(x) = \log_{2}(x - 1)$ are inverses.

In order to show this, we would use function composition to show that both of the conditions above are true.

\begin{align*} f(g(x)) \amp= f(\log_{2}(x - 1))\\ \amp= 2^{\log_{2}(x - 1)} + 1\\ \amp= (x - 1) + 1\\ \amp= x \end{align*}

This shows that $f(g(x)) = x\text{.}$ Similarly, we have:

\begin{align*} g(f(x)) \amp= g(2^x+1)\\ \amp= \log_{2}\left((2^x+1)-1\right)\\ \amp= \log_{2}\left(2^x\right)\\ \amp= x \end{align*}

This shows that $g(f(x)) = x\text{.}$

##### Notation.

If $h(x)$ is a function, then its inverse is called $h^{-1}\text{.}$ This notation does not mean that $h$ is being raised to a negative exponent — rather, it is just special notation for an inverse function.

We use this special notation either when we want to talk about the inverse of some function, or when we want to find the formula for the inverse.

##### Interpreting the notation.

If $f$ takes an input $a$ and gives an output $b\text{,}$ then its inverse $f^{-1}$ would take $b$ as the input and give the output $a\text{.}$

Since a function and its inverse represent reverse processes, the input and output are similarly reversed.

In the next exercise, practice interpreting the meaning of an inverse function.

The function $V(r)$ represents the volume of a sphere with a radius of $r$ centimeters.

It is true that $V(3.5) \approx 179.59\text{.}$ In context, this means that if the radius is $3.5$ cm, then the volume is approximately $179.59$ cm$^{3}\text{.}$

What does the equation

\begin{equation*} V^{-1}(0.56) \approx 0.51 \end{equation*}

mean in context?

Solution

It means that if the volume is $0.56$ cm$^{3}\text{,}$ then the radius is approximately $0.51$ cm.

##### Graphing the Inverse.

We can describe the inverse of a function $f$ in different ways, depending on what information we need.

For instance, we can certainly take a table of values from $f(x)\text{,}$ switch the inputs and outputs, and we will have a table of values for $f^{-1}(x)\text{:}$

 $x$ $f(x)$ $1$ $12$ $3$ $10$ $4$ $8$ $6$ $1$ $10$ $-4$
 $x$ $f^{-1}(x)$ $12$ $1$ $10$ $3$ $8$ $4$ $1$ $6$ $-4$ $10$

From a graphical standpoint, taking a set of points from the table of $y = f(x)\text{,}$ and switching the $x$- and $y$-coordinates, will give us points on the graph of $y = f^{-1}(x)\text{.}$

If you have the graph of a function $y = f(x)\text{,}$ you can sketch a graph of its inverse $y = f^{-1}(x)$ by selecting points on $y = f(x)$ and reflecting them over the line $y = x\text{.}$ This is actually the effect of switching the $x$- and $y$-coordinates of a point: it reflects the point over the line $y = x\text{.}$

##### Domain and Range Connection.

A function and its inverse trade inputs and outputs. Recall Exercise 1.1.1, where the function used degrees Fahrenheit as the input, and gave degrees Celsius as the output. The inverse for this function would use degrees Celsius as the input and give degrees Fahrenheit as the output.

You probably own a trimmed-down version of this function, as seen below:

This is clearly an invertible function, changing degrees Fahrenheit into degrees Celsius. We choose an input value (degrees Fahrenheit) on one side of the thermometer, and read the corresponding output (degrees Celsius) on the other side.

If we gave this function the name $C = g(F)\text{,}$ then the domain is

\begin{equation*} 32 \leqslant F \leqslant 212 \end{equation*}

and the range is

\begin{equation*} 0 \leqslant C \leqslant 100\text{.} \end{equation*}

Of course, we could also read the thermometer in reverse, using degrees Celsius as the input and degrees Fahrenheit as the output. This would be the inverse function, written as:

\begin{equation*} F = g^{-1}(C) \end{equation*}

Notice that the domain and range have been switched for the inverse function. Now $F = g^{-1}(C)$ has domain

\begin{equation*} 0 \leqslant C \leqslant 100 \end{equation*}

and range:

\begin{equation*} 32 \leqslant F \leqslant 212 \end{equation*}

This observation will be true for all invertible functions:

If $f$ is an invertible function, then:

• The domain of $f$ is the same as the range of $f^{-1}\text{,}$ and

• The range of $f$ is the same as the domain of $f^{-1}\text{.}$

##### The Inverse Formula.

If we have the formula for a function $f(x)\text{,}$ we may want to use the formula for the inverse $f^{-1}(x)\text{.}$

But how can we find the formula?

If you deposit $\500$ into a savings account that earns $3\%$ interest per year, and you make no additional deposits or withdrawals, then your account balance can be found by the function

\begin{equation*} B(t) = 500(1.03)^t \end{equation*}

where $t$ represents the number of years after making the original deposit of $\500\text{,}$ and $B(t)$ represents the balance in the account after $t$ years.

For this function, the input is years and the output is dollars. You would use a number of years, say $12\text{,}$ and $B(12)$ would calculate how many dollars are in the account.

The inverse function $B^{-1}$ would switch these, using dollars for the input and years for the output. Here, you would use an amount of money, say $\925\text{,}$ and $B^{-1}(925)$ would calculate how many years it would take to have that much in the account.

In order to find the value of $B^{-1}(925)\text{,}$ we could solve for $t$ in the equation:

\begin{equation*} 500\cdot1.03^t = 925 \end{equation*}

Solve this equation to find the value of $B^{-1}(925)\text{.}$

Solution

Solving for $t\text{:}$

\begin{align*} 500(1.03)^t \amp= 925\\ 1.03^t \amp= \frac{925}{500}\\ \ln\mathopen{}\left(1.03^t\right)\mathclose{} \amp= \ln\mathopen{}\left(\frac{925}{500}\right)\mathclose{}\\ t\cdot \ln(1.03) \amp= \ln\mathopen{}\left(\frac{925}{500}\right)\mathclose{}\\ t \amp= \frac{\ln\mathopen{}\left(\frac{925}{500}\right)\mathclose{}}{\ln\left(1.03\right)}\\ \amp\approx 20.81 \text{ years} \end{align*}

It would take about $20.81$ years for the account to grow to $\925\text{.}$

If you had to repeatedly answer questions like those in Example 7.3.13, you would find yourself solving the same equation each time.

Instead, you could just find the formula for the inverse function $B^{-1}$ and use it to directly calculate the number of years required.

To do this, use the fact that $B$ and $B^{-1}$ undo each other. In particular:

\begin{equation*} B\mathopen{}\left(B^{-1}(x)\right)\mathclose{} = x \end{equation*}

Here, we treat $B^{-1}(x)$ as the unknown, and solve for it, using the same algebraic steps as we used in Example 7.3.13:

\begin{align*} B\mathopen{}\left(B^{-1}(x)\right)\mathclose{} \amp= x\\ 500(1.03)^{B^{-1}(x)} \amp= x\\ 1.03^{B^{-1}(x)} \amp= \frac{x}{500}\\ \ln\mathopen{}\left(1.03^{B^{-1}(x)}\right)\mathclose{} \amp= \ln\mathopen{}\left(\frac{x}{500}\right)\mathclose{}\\ B^{-1}(x)\cdot \ln (1.03) \amp= \ln\mathopen{}\left(\frac{x}{500}\right)\mathclose{}\\ B^{-1}(x) \amp= \frac{\ln\mathopen{}\left(\frac{x}{500}\right)\mathclose{}}{\ln (1.03)} \end{align*}

Now, use this inverse function to determine how long it would take for there to be $\1200$ in the account.

Solution

The input for the inverse function is dollars, so we just evaluate:

\begin{align*} B^{-1}(1200) \amp= \frac{\ln\mathopen{}\left(\frac{1200}{500}\right)\mathclose{}}{\ln (1.03)}\\ \amp\approx 29.62 \text{ years} \end{align*}

It would take about $29.62$ years for the account to grow to $\1200\text{.}$

For the function $g(x) = \frac{3}{5x+2}\text{,}$ use the technique from the last example to find the formula for the inverse $g^{-1}(x)\text{.}$

Hint

Use the fact that

\begin{equation*} g\mathopen{}\left(g^{-1}(x)\right)\mathclose{}=x \end{equation*}

to solve for $g^{-1}(x)\text{.}$ Expanding this is the first step:

\begin{align*} g\mathopen{}\left(g^{-1}(x)\right)\mathclose{} \amp= x\\ \frac{3}{5g^{-1}(x)+2} \amp= x \end{align*}

Now, solve this equation for $g^{-1}(x)\text{.}$

Solution
\begin{align*} g\mathopen{}\left(g^{-1}(x)\right)\mathclose{} \amp= x\\ \frac{3}{5g^{-1}(x)+2} \amp= x\\ 3 \amp= \left(5g^{-1}(x)+2\right)x\\ \frac{3}{x} \amp= 5g^{-1}(x)+2\\ \frac{\frac{3}{x}-2}{5} \amp= g^{-1}(x) \end{align*}
##### What makes a function invertible.

Remember the defining characteristic of a function:

For each input, there is only one output.

Thinking about the graph, this means that there can be at most one point with any given $x$-coordinate. That is, no two points on the graph of a function can be directly above or below each other.

Now, if an inverse $f^{-1}$ is really a function, then it must also obey this rule. No two points on the graph of $y = f^{-1}(x)$ can sit directly above or below each other.

So if $f^{-1}$ is a function, this has an implication for the original function $f\text{.}$

To see this, remember that the graphs of a function and its inverse are reflections of each other over the line $y = x\text{.}$ If no two points on the graph of an inverse function can sit above or below each other, then reflecting these points over $y = x$ means that no two points on the graph of $f(x)$ can sit directly left or right of each other.

Explore this in the following exercise.

Graphically, we have these two rules:

Vertical Line Test

A vertical line may only intersect the graph of a function at most once. If some vertical line could intersect the graph more than once, then the graph is not a function.

Horizontal Line Test

If a function is invertible, then its graph may only intersect a horizontal line at most once. If a horizontal line could intersect the graph more than once, then the graph is not invertible.

As an example of using the Horizontal Line Test, the function $f(x) = x^2$ does not have an inverse function, since the horizontal line $y = 4$ intersects the graph of $f(x)$ twice, at the points $(2, 4)$ and $(-2, 4)\text{.}$ See Figure 7.3.18.

Conversely, the function $g(x) = x^3$ does have an inverse function, since no horizontal line can intersect the graph more than once. See Figure 7.3.19.

##### Restricting the Domain.

You may object to the notion that $f(x) = x^2$ is non-invertible, because surely the function $g(x) = \sqrt{x}$ performs the opposite action.

However, this is only true because we define $\sqrt{x}$ so that it never gives negative outputs. [Check this on your calculator!]

For example, we have two inputs which give the same output for the function $f(x)=x^2\text{:}$

\begin{gather*} f(5) = 5^2 = 25\\ f(-5) = (-5)^2 = 25 \end{gather*}

Since an inverse function would reverse the input and the output, it would need to somehow use $25$ as the input, and then output both $5$ and $-5\text{.}$

But because $g(x) = \sqrt{x}$ is a function, it can only give the single output $5\text{.}$

Therefore, when we use $g(x)=\sqrt{x}$ as the inverse for $f(x)=x^2\text{,}$ we have decided to use only part of the domain of $f$ so that its inverse, $g\text{,}$ is really a function. This is called restricting the domain.

We restrict the domain of a function in order to make it invertible. We choose an interval for the input, so that the output never has repeated values — this ensures that the inverse will pass the vertical line test.

### Subsection7.3.3Conclusion

Test your understanding of this chapter with the following exercises.

Student Learning Outcome: Define composite functions and combinations of functions and apply and interpret these in appropriate situations.

Student Learning Outcome: Evaluate, apply, and interpret function notation, including the notation for inverse functions and composition of functions.

Student Learning Outcome: Demonstrate the inverse relationship between an exponential function and a logarithmic function (with the same base).

### Exercises7.3.4Exercises

###### 1.

Evaluating Composite Functions

###### 7.

Formula of a Composite Function

###### 13.

Graph of a Composite Function

###### 15.

Evaluating Inverse Functions

###### 19.

Formula of an Inverse Function

###### 28.

Graph of an Inverse Function

###### 34.

Restricting the Domain

Written Homework

###### 42.

At a company, the human resources department keeps information about their employees in table form. If an office specialist enters the name of an employee, a function $f$ will output that employee's ID Number. If they enter an employee's ID Number, then various functions can be used:

• Function $W$ will output that employee's current hourly wage (in dollars).

• Function $D$ will output that employee's date of hire.

• Function $N$ will output that employee's name.

1. Write a composition to find employee Nallely Garcia's date of hire.

2. Write a composition to find employee David Smith's hourly wage.

3. What is $f(N(1435))\text{?}$ Explain how you know.

4. Which of the functions ($f\text{,}$ $W\text{,}$ $D$ and $N$) are invertible? Explain your choices, using examples if possible.