thThis section covers:
 Adding/Subtracting/Multiplying/Dividing Functions
 Increasing, Decreasing and Constant Functions
 Extrema: Minimums and Maximums
 Even and Odd Functions
 Compositions of Functions (Composite Functions)
 Decomposition of Functions
 Domains of Composites
 Applications of Compositions
 More Practice
Note: Using composition of functions to determine if two functions are inverses can be found here in the Inverses of Functions section.
We learned what a function is in the Algebraic Functions section, but let’s talk about more advanced types of functions. All these types of functions are found in “real life” computations that go on every day!
Let’s first review what a function is. A function is defined as a relation between two things where there is only one “answer” for every “question”. For example, \(x\) is typically the variable used for the “question” and \(y\) or \(f\left( x \right)\) is the answer. Thus, we can’t have more than one “\(y\)” (dependent variable) for the same “\(x\)” (independent variable).
We evaluate functions by plugging in the value in the parentheses on the lefthand side for every \(x\) (or whatever the variable is) on the righthand side. For example, for function \(f\left( x \right)=4{{x}^{2}}+3x\), if our \(x\) was 2, our \(f\left( x \right)\) would be \(f\left( 2 \right)=4{{\left( 2 \right)}^{2}}+3\left( 2 \right)=16+6=22\). As a more complicated example, \(\displaystyle f\left( {x1} \right)=4{{\left( {x1} \right)}^{2}}+3\left( {x1} \right)=4\left( {{{x}^{2}}2x+1} \right)+3x3=4{{x}^{2}}8x+4+3x3=4{{x}^{2}}5x+1\).
Adding, Subtracting, Multiplying, and Dividing Functions
Functions, like numbers, can actually be added, subtracted, multiplied and even divided. These operations are pretty obvious, but I will give examples anyway. Let’s think of a situation where two functions would be added:
Yesterday you went to your favorite cosmetics store and used your $5 off coupon. Then you went to your favorite shoe store and used your 25% off coupon. What is the function for the total number of dollars you spent yesterday, given you bought items that regularly cost $80 at each store? (Disregard tax).
We have two functions here: one for what you spent at the cosmetic store (given the regular price of the items), and one for what you spent at the shoe store (given the regular price of the items). You might want to put some “fake” numbers in to convince yourself that these are the correct functions.
Total amount spent at cosmetics store, given full price of items: \(\displaystyle f\left( x \right)=x5\)
Total amount spent at shoe store, given full price of items: \(g\left( x \right)\,=\,.75x\)
Let’s get the total amount you spent two ways: first adding the amount you spent separately at each store, and then combining (adding) the functions and getting the total amount you spent at both stores.
We said that you bought items at each store that regularly cost $80. Look how we get the same amount that we spent by first evaluating the functions separately (plugging numbers in) and then adding the amounts, and second by adding the functions, and then evaluating that combined function:
Functions Evaluated Separately 
Functions Added Together 
\(\displaystyle \begin{array}{c}\text{Cosmetics Store:}\\\color{#800000}{{f\left( x \right)=x5}}\\f\left( {80} \right)=805=\$75\end{array}\)
\(\begin{array}{c}\text{Shoe Store:}\\\color{#800000}{{g\left( x \right)=.75x}}\\g\left( {80} \right)=.75\left( {80} \right)=\$60\end{array}\)
\(\displaystyle \begin{array}{c}\text{Total Spent:}\\\$75+\$60=\$135\,\,\,\,\surd \end{array}\) 
\(\displaystyle \begin{array}{l}\text{Cosmetics store:}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\color{#800000}{{f\left( x \right)=x5}}\,\\\text{Shoe store:}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\underline{{\,\,\,\,\color{#800000}{{g\left( x \right)=.75x}}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,}}\,\\\text{Total Spent :}\,\,\,\,\,\,\,f\left( x \right)+g\left( x \right)=x5+.75x\\\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\left( {f+g} \right)\left( x \right)=1.75x5\\\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,(\text{Note weird notation!})\end{array}\)
\(\displaystyle \begin{align}\left( {f+g} \right)\left( {80} \right)&=1.75x5\\&=1.75\left( {80} \right)5\\&=1405=\$135\,\,\,\,\,\,\,\surd \end{align}\) 
Below are the rules on how the adding, subtracting, multiplying and dividing functions work. I know the notation on the left looks really funny (and we saw this in the example above); it just means that the sum/difference/product/quotient of two functions is defined as when you just take the right hand side (what they are defined as) and add/subtract/multiply/divide them together. Makes sense, right?
Let’s use two different functions, both of which are binomials:
Operation  Example
\(f\left( x \right)=x+2\), \(g\left( x \right)=5x4\) 
Adding: \(\left( {f+g} \right)\left( x \right)=f\left( x \right)+g\left( x \right)\) 
\(\displaystyle \begin{array}{l}\color{#800000}{{\left( {f+g} \right)\left( x \right)}}=f\left( x \right)+g\left( x \right)=\left( {x+2} \right)+\left( {5x4} \right)\\\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,=\,6x2\end{array}\) 
Subtracting: \(\left( {fg} \right)\left( x \right)=f\left( x \right)g\left( x \right)\) 
\(\begin{array}{l}\color{#800000}{{\left( {fg} \right)\left( x \right)}}=f\left( x \right)g\left( x \right)=\left( {x+2} \right)\left( {5x4} \right)\\\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,=4x+6\end{array}\) 
Multiplying: \(\left( {f\cdot g} \right)\left( x \right)=f\left( x \right)\cdot g\left( x \right)\) 
\(\begin{array}{l}\color{#800000}{{\left( {f\cdot g} \right)\left( x \right)}}=f\left( x \right)\cdot g\left( x \right)=\left( {x+2} \right)\left( {5x4} \right)\\\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,=\,\,5{{x}^{2}}+6x8\end{array}\) 
Dividing: \(\displaystyle \left( {\frac{f}{g}} \right)\left( x \right)=\frac{{f\left( x \right)}}{{g\left( x \right)}}\) 
\(\displaystyle \color{#800000}{{\frac{{f\left( x \right)}}{{g\left( x \right)}}}}=\frac{{f\left( x \right)}}{{g\left( x \right)}}=\,\,\frac{{x+2}}{{5x4}};\,\,\,\,x\ne \frac{4}{5}\) 
See – not too bad, right? I know we haven’t learned about the quotient of two functions yet; we will talk about that in the Rational Functions section. This particular function that we got from dividing functions can’t be simplified, but we’ll see later that some of them can.
Note that the multiplication operation on functions is not to be confused with the composition of functions, which looks like\(\left( {f\circ g} \right)\left( x \right)\). We will go over this later here.
Increasing, Decreasing and Constant Functions
You might be asked to tell what parts of a function are increasing, decreasing, or constant. Note that we also address this concept in the Graphing and Finding Roots of Polynomials section here and in the Calculus: Curve Sketching section here.
This really isn’t too difficult, but you have to be careful to look where the \(y\) or \(f(x)\) is increasing, decreasing, or remaining constant, but the answer will be in an interval of the \(x\). The answer will always with soft brackets, since the exact point where the function changes direction is neither increasing, decreasing, nor remaining constant.
Let’s look at an example:
Graph  Increasing, Decreasing, and Constant Intervals 
(Look which way the \(y\) is going: up down, or straight across, from left to right)
\(f\left( x \right)\) is increasing: \(\left( {2,3} \right)\) (Notice this is not a point, but an interval of the \(x\)) \(f\left( x \right)\)is decreasing: \(\left( {\infty ,\,0} \right)\cup \left( {3,\infty } \right)\) \(f\left( x \right)\) is constant: \(\left( {0,2} \right)\) (Notice this is not a point, but an interval of the \(x\))
Absolute Maximum: None (since the range goes up to \(\infty \)) Absolute Minimum: None (since the range begins at \(\infty \)) Local Maximum(s): \(\left( {3,2} \right)\text{; }\,\text{or at}\,\,2,\,\text{where }x=3\) (since it locally has a maximum) Local Minimum(s): None (since, even locally, there is no minimum) 
See how we are looking at the \(y\) (up and down) to see where the function is increasing, decreasing, or constant, but write down the \(x\) (back and forth)?
Also, see how the function is either increasing, decreasing, or constant for its whole domain (except for the “turning” points)?
Important note: If a function has a break in it, such as an asymptote or hole in a rational function, it is not increasing, constant, or decreasing at that point. We would have to “jump” over that part of the graph when writing down the \(x\) intervals, like we do with domains and ranges. (The function would be discontinuous at that point). Also, information about polynomials and their end behavior, which is sometimes taught with increasing and decreasing functions, can be found here in the Graphing and Finding Roots of Polynomial Functions section.
Extrema: Relative and Absolute Minimums and Maximums
In the example above, there is a local (relative) maximum at point \((3,2)\) since this is the highest point in the section of the graph where the “hill” is. A local (relative) minimum would similarly be the lowest point in a section of a graph where there is a “valley”. This graph would have no absolute minimums or absolute maximums (the absolute lowest and highest points on the graph), since the range of the graph goes from \(\left( {\infty ,\infty } \right)\).
These minimums and maximums are called the extrema of the functions, and we typically identify them as either a coordinate point, or “minimum/maximum of the \(y\) value, where \(x=\) the \(x\) value”; in the above example, we would say “a maximum of 2, where \(x=3\)”.
Again, think of the absolute extrema as the absolute lowest or highest point in the whole domain of the function, and the relative (local) extrema as the lowest or highest for a part of the graph. Technically, relative extrema must be the minimum or maximum of a point from both sides of \(x\), so they can’t be endpoints; they are just “valleys” or “hills”. Note that not every function has a lowest (minimum) or highest (maximum) point in an interval or even the whole domain (like the function \(y=x\)), so there may not be any extrema.
The endpoints of a function may be the lowest or highest points (thus the absolute, not relative extrema); these are called the endpoint extrema.
Here is a graph that shows some examples of absolute/relative extrema; note also the endpoint extrema points:
We discuss how the extrema of functions are useful in the Curve Sketching of graphs here in the Differential Calculus Curve Sketching section.
Even and Odd Functions
There are actually three different types of functions: even, odd, or neither. Most functions are neither, but you’ll need to know how to identify the even and odd functions, both graphically and algebraically. One reason the engineers out there need to know if functions are even or odd is that they can do fewer computations if they know functions have certain traits.
Even Functions
Even functions are those that are symmetrical about the \(y\)axis, meaning that they are exactly the same to the right of the \(y\)axis as they are to the left. This means if you drew a function on a piece of paper and folded that paper where the \(y\)axis is, the two sides of the function would match exactly. (You will go over all this symmetry stuff in Geometry). I know this sounds really complicated, but this means if \((x,y)\) is a point on the function (graph), then so is \((x,y)\). One of the most “famous” examples of an even function is \(y={{x}^{2}}\).
A function is even, algebraically, if \(f\left( {x} \right)=f\left( x \right)\).
Odd Functions
Odd functions are those that are symmetrical about the origin \((0,0)\), meaning that if \((x,y)\) is a point on the function (graph), then so is \((x,y)\). Think of odd functions as having the “pinwheel” effect (if you’ve heard of a pinwheel); if you put a pin through the origin and rotated the function around halfway, you’d see the same function. (If you turn the function upside down, you’ll have same function!) One of the most “famous” examples of an even function is \(y={{x}^{3}}\) (but a simpler one is \(y=x\)).
A function is odd, algebraically, if \(f\left( {x} \right)=f\left( x \right)\).
“Neither” Functions
Any function that isn’t odd or even, is (you guessed it!) neither!
Here are some examples with some simple functions:
Function  Even, Odd, or Neither? 
\(f\left( x \right)=x\) 
Odd function: \(f\left( {x} \right)=f\left( x \right)\) \(\begin{array}{c}f\left( x \right)=x\\f\left( {x} \right)=x=f\left( x \right)\end{array}\)
Note that, as an example, both \(\displaystyle \left( {4,4} \right)\) and \(\left( {4,4} \right)\) are on the graph (symmetrical to the origin). 
\(y={{x}^{2}}\) 
Even function: \(f\left( {x} \right)=f\left( x \right)\) \(\begin{array}{c}f\left( x \right)={{x}^{2}}\\f\left( {x} \right)={{\left( {x} \right)}^{2}}={{x}^{2}}=f\left( x \right)\end{array}\)
Note that, as an example, both \(\left( {2,4} \right)\) and \(\left( {2,4} \right)\) are on the graph (symmetrical to the \(y\)axis). 
\(y=2x3\) 
Neither: \(\displaystyle \begin{array}{c}f\left( x \right)=2x3\\f\left( {x} \right)=2\left( {x} \right)3=2x3\\f\left( x \right)=\left( {2x3} \right)=2x+3\\f\left( {x} \right)\ne f\left( x \right)\\f\left( {x} \right)\ne f\left( x \right)\end{array}\) 
Here are more examples where we’ll determine the type of function (even, odd, or neither) algebraically. Make sure to be really careful with the signs, especially with the even and odd exponents.
Function  Even, Odd, or Neither? 
\(f\left( x \right)=3{{x}^{2}}+8\) 
\(f\left( {x} \right)=3{{\left( {x} \right)}^{2}}+8=3{{x}^{2}}+8=f\left( x \right)\) Even! 
\(f\left( x \right)={{x}^{5}}4x\) 
\(\begin{array}{c}f\left( {x} \right)={{\left( {x} \right)}^{5}}4(x)={{x}^{5}}+4x\\=({{x}^{5}}4x)=f\left( x \right)\end{array}\) Odd! 
\(f\left( x \right)=2{{x}^{2}}x1\) 
\(\displaystyle \begin{array}{c}f\left( {x} \right)=2{{\left( {x} \right)}^{2}}(x)1=2{{x}^{2}}+x1\\f\left( x \right)=\left( {2{{x}^{2}}x1} \right)=2{{x}^{2}}+x+1\\f\left( {x} \right)\ne f\left( x \right)\ne f\left( x \right)\end{array}\) Neither! 
\(\sin x\)
(Trigonometric function) 
\(\displaystyle f\left( {x} \right)=\sin \left( {x} \right)=\sin x=f\left( x \right)\) Odd! 
\(\cos x\)
(Trigonometric function) 
\(\displaystyle f\left( {x} \right)=\cos \left( {x} \right)=\cos x=f\left( x \right)\) Even! 
HINT: When dealing with polynomials, note that the even functions have all zero or even exponents terms – don’t forget that the exponent of a constant, like 8, is 0, since 8 is the same as \(8{{x}^{0}}\), or \((8)(1)\). Odd functions have all odd exponents terms (note that \(x\) has an exponent of 1). Functions that are neither even nor odd have a combination of even exponents and odd exponents terms. Note that this works on polynomials only; for example, it does not necessarily work with a function that is a quotient of two polynomials (a rational function).
Compositions of Functions (Composite Functions)
Compositions of functions can be confusing and a lot of people freak out with them, but they really aren’t that bad if you learn a few tricks.
Note: Using composition of functions to determine if two functions are inverses can be found here in the Inverses of Functions section.
Composition of functions is just combining 2 or more functions, but evaluating them in a certain order. It’s almost like one is inside the other – you always work with one first, and then the other. That’s all it is!
Let’s start out with an example (shopping, of course!). Let’s say you found two coupons for your favorite clothing store: one that is a 20% discount, and another one that is $10 off. The store allows you to use both of them, in any order. You need to figure out which way is the better deal.
First define the two functions. Make sure you understand how they work with “real” numbers with each discount, for example if you bought $100 worth of clothes (you’d spend $80 with first discount, $90 with second). Of course, if you could only use one of the discounts, the amount you save depends on how much you spend, but you are allowed to use both.
Total amount spent at store with 20% discount, given full price of items: \(\displaystyle f\left( x \right)=.80x=.8x\)
Total amount spent at store with $10 off, given full price of items: \(g\left(x\right)=x10\)
Look at what happens when we apply the discounts in different orders, if we were to buy $100 worth of clothes. For now, look at first two columns only:
Order of Discounts  Using “Math”  Using Composition of Functions 
$10 off first, followed by 20% off  \(\displaystyle \begin{align}g\left( x \right)&=x10\,\,\,\,\\g\left( {100} \right)&=10010=\color{red}{{\$90}}\\\\f\left( x \right)&=\,\,.8x\\\,f\left( {\color{red}{{90}}} \right)&=.8\left( {\color{red}{{90}}} \right)=\$72\end{align}\)  \(\displaystyle \begin{align}f\left( {\color{blue}{{g\left( x \right)}}} \right)&=\,f\circ g\left( x \right)\\\\f\left( {\color{blue}{{x10}}} \right)&=.8\left( {\color{blue}{{x10}}} \right)\\&=.8x8\\f\left( {g\left( {100} \right)} \right)&=.8\left( {100} \right)8=\$72\end{align}\) 
20% off first, followed by $10 off  \(\displaystyle \begin{align}f\left( x \right)&=.8x\\f\left( {100} \right)&=.8\left( {100} \right)=\color{red}{{\$80}}\\\\g\left( x \right)&=x10\\g\left( {\color{red}{{80}}} \right)&=\color{red}{{80}}10=\$70\end{align}\)  \(\displaystyle \begin{align}g\left( {\color{blue}{{f\left( x \right)}}} \right)&=\,g\circ f\left( x \right)\\\\g\left( {\color{blue}{{.8x}}} \right)&=\color{blue}{{.8x}}10\\g\left( {f\left( {100} \right)} \right)&=.8\left( {100} \right)10=\$70\end{align}\) 
Now let’s look at the last column. Composition of functions are either written \(f\left( {g\left( x \right)} \right)\) or \(\left( {f\circ g} \right)\left( x \right)\). The trick with compositions of functions is that we always work from the inside out with \(f\left( {g\left( x \right)} \right)\) or right to left with\(f\circ g\left( x \right)\). You look at what the inside (or rightmost) function first and then that’s the “new \(x\)“ that we use to replace every “\(x\)“ in the outside (or leftmost) function. Another way to look at it is the output of the inner function becomes the input of the outer function.
So, in the example above, if we take the $10 off first and then take 20% off, we have to use the inside function \(g(x)\) (\(x10\)) and put it in the outside function \(f(x)\) as the “new \(x\)”. We have to put this everywhere on the right of the \(f(x)\) function, to replace every \(x\)’s (in this example, we only have one). Don’t worry if you don’t get this at first; it’s a difficult concept! It’d be better to take the 20% off first (which makes sense, since we’re taking the 20% off of a higher number).
Compositions Algebraically
Let’s do more examples of getting compositions of functions algebraically, using the two functions below:
Composition  Math Example: \(f\left( x \right)=x+2\), \(g\left( x \right)=3{{x}^{2}}+4x+1\) 
\(f\left( {g\left( x \right)} \right)\)  \(f\left( {g\left( x \right)} \right)=f\left( {3{{x}^{2}}+4x+1} \right)=\left( {3{{x}^{2}}+4x+1} \right)+2=3{{x}^{2}}+4x+3\) 
\(g\circ f\left( x \right)\)  \(\begin{align}g\circ f\left( x \right)&=g\left( {f\left( x \right)} \right)=g\left( {x+2} \right)=3{{\left( {x+2} \right)}^{2}}+4\left( {x+2} \right)+1\\&=3\left( {{{x}^{2}}+4x+4} \right)+4\left( {x+2} \right)+1\\&=3{{x}^{2}}+12x+12+4x+8+1\\&=3{{x}^{2}}+16x+21\end{align}\) 
\(f\left( {g\left( 3 \right)} \right)\) 
Method 1: Since we already see that \(f\left( {g\left( x \right)} \right)=3{{x}^{2}}+4x+3\), we can just put the 3 in for \(x\): \(f\left( {g\left( 3 \right)} \right)=3{{\left( 3 \right)}^{2}}+4\left( 3 \right)+3=42\). Method 2: Remember that the output of the inner function is the input for the outer function. Work with the inside function first: \(g\left( 3 \right)=3{{\left( 3 \right)}^{2}}+4\left( 3 \right)+1=40\). Now we can use 40 as the input of \(f\left( x \right):\,\,f\left( {40} \right)=40+2=42\). Pretty cool! 
\(f\left( {f\left( x \right)} \right)\)  I know this is sort of weird, you but you can get the composition of functions with the same function – just sort of pretend they are two different functions: \(f\left( {f\left( x \right)} \right)=\,\,f\left( {x+2} \right)=\left( {x+2} \right)+2=x+4\). Weird, huh? 
Find \(x\) where \(g\left( {f\left( x \right)} \right)=5\).  This problem goes “backwards” (outside in), where we need to first find the “\(x\)” (different than the \(x\) in the problem – sorry!) where \(g\left( x \right)=5\). Note that we get two cases:
\(\begin{align}g\left( x \right)&=5\\3{{x}^{2}}+4x+1&=5\\3{{x}^{2}}+4x4&=0\\\left( {3x2} \right)\left( {x+2} \right)&=0\\x&=\frac{2}{3};\,\,\,\,\,x=2\end{align}\) Now, since \(\displaystyle g\left( {\frac{2}{3}} \right)=5\) and \(g\left( {2} \right)=5\), \(\displaystyle f\left( x \right)=\frac{2}{3},2\); we now need to find the \(x\) using \(f\left( x \right)\) (both cases): \(\begin{align}f\left( x \right)&=\frac{2}{3}\\x+2&=\frac{2}{3}\\x&=\frac{2}{3}\frac{6}{3}=\frac{4}{3}\end{align}\) \(\begin{align}f\left( x \right)&=2\\x+2&=2\\x&=4\end{align}\) Therefore, \(\displaystyle x=\frac{4}{3}\) and \(4\). Try it, starting with these values and working inside out; it works! 
Compositions Graphically
Sometimes you’ll be asked to work with compositions of functions graphically, both “forwards” and “backwards”. You can do this without even knowing what the functions are! Let’s first do a “real life” example:
Let’s say you took a very parttime babysitting job (at $12/job) to satisfy your cravings for going to the movies (at $10 per movie). How much money you make for the month depends on how many babysitting jobs you get that month (\(f\left( x \right)\)), and how many movies you go to depends on how much money you have that month (\(g\left( x \right)\)). Do you see how many movies you go to depends on how many babysitting jobs you have that month (\(g\left( {f\left( x \right)} \right)\))? (Remember, we work with inside functions first.)
Let’s show this graphically:
Graph of \(\boldsymbol {f(x)}\)  Graph of \(\boldsymbol {g(x)}\) 
Let’s say we took 5 babysitting jobs last month. That translates into $60 of babysitting money that month (see graph to left). That output of $60 then is used as the input into the graph at the right. The output of the new graph is 6; we could go to 6 movies that month.
To see this algebraically, \(f(x)=12x\) and \(\displaystyle g(x)=\frac{x}{{10}}\), so \(\displaystyle g(f(5))=g(12\times 5)=g(60)=\frac{{60}}{{10}}=6\).
Here are more examples, with more complicated graphs:
Composition Problem  Graphs  
Problem: Find \(f\left( {g\left( 1 \right)} \right)\)
Solution: Start from the inside out. First find the \(y\) for when \(x\) is 1 in \(g\left( x \right)\). This is 8.
Then use 8 as the \(x\) in \(f\left( x \right)\) to get the \(y\). \(f\left( 8 \right)\) is 10. Therefore, \(f\left( {g\left( 1 \right)} \right)=10\). 
\(g\left( x \right)\) 
\(f\left( x \right)\) 
Problem: Find \(x\), where \(f\left( {g\left( x \right)} \right)=3\)
Solution: Since the 3 is the \(y\) of \(f\left( x \right)\), we have to start from the outside here, the \(f\left( x \right)\). Find the \(x\) for when \(f\left( x \right)=3\); this is 1. This becomes the \(g\left( x \right)\).
Now we have to find the \(x\) where \(g\left( x \right)=1\). This is at \(2\) and \(2\). (We can have two answers). 
\(f\left( x \right)\) 
\(g\left( x \right)\) 
I know this can be really confusing, but if you go through it a few times, it gets easier!
Compositions Using Tables
You also may be asked to evaluate composition of functions using tables. You’ll see similar problems here in the Inverses of Functions section. Here are some problems:
Tables for functions \(f\left( x \right)\) and \(g\left( x \right)\)  Problems and Solutions  

a) Find \(f\left( {g\left( 2 \right)} \right)\)
Work inside out (since the \(2\) is on the inside). First, find the “\(y\)“ (\(g\left( x \right)\)) value in the second table when \(x=2\); this is \(9\). This is the “new” \(x\) to get the “\(y\)“ (\(f\left( x \right)\)) in the first table. Thus, \(f\left( {g\left( 2 \right)} \right)=8\). b) Find \(g\left( {g\left( 3 \right)} \right)\) Work inside out. First, find the “\(y\)“ (\(g\left( x \right)\)) value in the second table when \(x=3\); this is \(1\). This is the “new” \(x\) to get the “\(y\)“ (\(g\left( x \right)\)) in this same table. Thus, \(g\left( {g\left( 3 \right)} \right)=5\). c) Find \(x\) if \(g\left( {f\left( x \right)} \right)=1\) Work outside in (since the \(1\) is on the outside). First, find the “\(x\)“ value when \(g\left( x \right)=1\); this is \(3\). This is the “new” \(y\) in the \(f\left( x \right)\) table; now get the corresponding \(x\), which is \(1\). Try it: \(g\left( {f\left( 1 \right)} \right)=1\); it works! d) Find \(x\) if \(f\left( {g\left( x \right)} \right)=3\) Work outside in. First, find the “\(x\)“ value when \(f\left( x \right)=3\); this is \(1\). This is the “new” \(y\) in the \(g\left( x \right)\) table, which doesn’t exist in the table! Thus, the solution is “does not exist”, or DNE. e) Find the domain and range of \(f\left( {g\left( x \right)} \right)\) and \(g\left( {f\left( x \right)} \right)\) The \(x\)values of \(g\left( x \right)\) where \(f\left( {g\left( x \right)} \right)\) exist are 2 (\(f\left( {g\left( 2 \right)} \right)=f\left( 9 \right)=8\)) and 3 (\(f\left( {g\left( 3 \right)} \right)=f\left( {1} \right)=4\)), so the domain is \(\{2,3\}\) and corresponding range is \(\{8,4\}\). The only \(x\)value of \(f\left( x \right)\) where \(g\left( {f\left( x \right)} \right)\) exists is 1 (\(g\left( {f\left( 1 \right)} \right)=g\left( 3 \right)=1\)), so the domain is \(\{1\}\) and corresponding range is \(\{1\}\). 
Decomposition of Functions
Sometimes we have to decompose functions or “pull them apart”. I like to think of this like performing surgery on them – opening them up and seeing what the pieces are!
Note that there may be more than one way to decompose functions, and some functions can’t even really be decomposed! But you should get problems that make it pretty straightforward.
The best way to show this is with an example. Let’s say we have the following functions:
\(f\left( x \right)=x+3\)  \(g\left( x \right)={{x}^{2}}4\)  \(h\left( x \right)=2x\)  \(k\left( x \right)=5x+8\) 
Compose Function
Now, let’s first find \(f\left( {g\left( {h\left( {k\left( x \right)} \right)} \right)} \right)\) or \(f\circ g\circ h\circ k\left( x \right)\) (compose the function). To “build” the function, we need to start from the inside and go outwards. We won’t worry about multiplying out and simplifying for now.
\(k\left( x \right)=\color{red}{{5x+8\,}}\,\,\,\,\,\,\,h\left( x \right)=2\left( {\color{red}{{5x+8}}} \right)=\color{blue}{{10x+16}}\,\,\,\,\,\,\,\,g\left( x \right)={{\left( {\color{blue}{{10x+16}}} \right)}^{2}}4\,\,\,\,\,\,\,\,f\left( x \right)=\color{green}{{\left( {{{{\left( {10x+16} \right)}}^{2}}4} \right)}}+3\)
Decompose Function
Now, let’s say we were given \(d\left( x \right)=\left( {{{{\left( {10x+16} \right)}}^{2}}4} \right)+3\) (in its “unsimplified” form). Let’s go the opposite way, or “decompose” the function: look at the last operation done, and that will be on the outside of the composed function. The last thing we did was add 3 (\(f\left( x \right)\)), before that, we took the square and subtracted 4 (\(g\left( x \right)\)), and even before that, we multiplied by 2 (\(h\left( x \right)\)) the function “\(5x+8\)” (\(k\left( x \right)\)).
When we decompose, the function on the outside (or the left) is the last thing we do. Since we performed the functions above in the following order: \(k\left( x \right)\) first, followed by \(h\left( x \right)\), then \(g\left( x \right)\), and finally \(f\left( x \right)\), we have to write the composition in the opposite order. So, \(\displaystyle d\left( x \right)=\left( {{{{\left( {10x+16} \right)}}^{2}}4} \right)+3=f\left( {g\left( {h\left( {k\left( x \right)} \right)} \right)} \right)\) or \(\displaystyle f\circ g\circ h\circ k\left( x \right)\). Tricky!
Let’s try another one; decompose \(j\left( x \right)={{\left( {5\left( {2x+3} \right)+8} \right)}^{2}}4\). Let’s look at the functions again, since we have to decompose by using them:
\(f\left( x \right)=x+3\)  \(g\left( x \right)={{x}^{2}}4\)  \(h\left( x \right)=2x\)  \(k\left( x \right)=5x+8\) 
The last thing we did was square something and subtract 4 (\(g\left( x \right)\)), before that, we multiplied it by 5 and then added 8 (\(k\left( x \right)\)), before that, we added 3 (\(f\left( x \right)\)), and then before that we multiplied by 2 (\(h\left( x \right)\)). Again, since we work from the inside out, we have to start with the last thing we did and go forward: \(j\left( x \right)={{\left( {5\left( {2x+3} \right)+8} \right)}^{2}}4\,\,\,=\,\,\,g\left( {k\left( {f\left( {h\left( x \right)} \right)} \right)} \right)\) or \(g\circ k\circ f\circ h\left( x \right)\). Work it the other way; it works!
Domains of Composites
Domains of Composites Algebraically
Sometimes in Advanced Algebra or even PreCalculus you’ll be asked to find the domains of compositions of functions, both graphically and algebraically. This isn’t totally intuitive, but if you learn a few rules, it’s really not bad at all. Let’s first review the case where you have to worry about domains; we looked at it here in the Algebraic Functions section:
A domain is restricted if:
 It is randomly indicated that way in the problem. For example, \(f\left( x \right)=3x1,\,\,x\ge 0\).
 There is a variable in the denominator and that denominator could be 0. For example, \(\displaystyle f\left( x \right)=\frac{1}{{x3}}\). (In this case, \(x3\ne 0;\,\,\,\,\,x\ne 3\)).
 There is a variable underneath an even radical sign, and that radicand (underneath the radical sign) could be negative. For example, \(f\left( x \right)=\sqrt{{x+4}}\). (In this case, \(x+4\ge 0;\,\,\,\,\,\,x\ge 4\)).
 (More advanced – see Logarithmic Functions section) If there’s a variable in the argument of a log or ln function; log arguments must be greater than 0. For example, \(f\left( x \right)=\log \left( {8x} \right)\). (In this case, \(8x>0;\,\,\,\,x<8\)).
There are other types of functions, like trigonometric functions, that have domain restrictions, but we won’t address these here.
(Note that if we could have a mixture of the above restrictions, for example, for \(\displaystyle f\left( x \right)=\frac{{\sqrt{x}}}{{x1}}\), \(x\ge 0\) and \(x\ne 1\), so the domain of \(x\) is \(\left[ {0,1} \right)\cup \left( {1,\infty } \right)\).)
The best way to show how to get the domain of a composite is to jump right in and do a problem.
Problem:
Suppose \(f\left( x \right)=3x1,\,\,x\ge 0\) and \(g\left( x \right)=\sqrt{{x2}}\). Find the composition \(g\left( {f\left( x \right)} \right)\) and it’s domain.
Solution:
To get the composition, we put the inner function as the “new \(x\)” in the outer function, so \(\displaystyle g\left( {f\left( x \right)} \right)=g\left( {3x1} \right)=\sqrt{{\left( {3x1} \right)2}}=\sqrt{{3x3}}\). Because of the even root, we have (at a minimum), \(3x3\ge 0;\,\,\,\,\,\,\,\,x\ge 1\).
But we can’t just look at the composite function alone to get the domain of the composition of functions; unfortunately, it’s a little trickier than this. We also need to see what values \(x\) can be for the inside function, since \(x\) goes directly into that function. Since the inside function is \(f\left( x \right)=3x1,\,\,x\ge 0\), we know that \(x\ge 0\) (this was given as a domain restriction in the problem).
Then we have to put these two restrictions together to get the domain of the composite, which means taking the intersection or “and” (both have to work) of \(\displaystyle x\ge 0\) and \(\displaystyle x\ge 1\), which is \(\displaystyle x\ge 1\). (For example, .5 doesn’t work, since it’s not both \(\ge 0\) and \(\ge 1\).) The domain of \(g\left( {f\left( x \right)} \right)\) is \(\left[ {1,\,\,\infty } \right)\).
Remember also that if either the domain of the inner or domain of outer (where you put the inner) is all real numbers (no restrictions), you don’t have to worry about that part of the intersection (see examples below).
Note: Instead of actually getting the composite function like we did above, we can also restrict the inner function to the outer domain directly. So, in the above example, we would have seen that the domain of the outer is \(x\ge 2\) because of the even radical, and then gotten the inner function (the “new \(x\)”) in the outer domain this way: \(3x1\ge 2;\,\,\,\,\,3x\ge 3;\,\,\,\,\,x\ge 1\). Coupled with the restriction of the inner function (\(\displaystyle x\ge 0\)), we still have \(\displaystyle x\ge 1\).
A trick:
I like to just remember the following “trick”: Domain of Composite = The Intersection of {the Domain of the Inner Function} and {Restricting the Inner Function to the Outer Domain}.
Another way to write this is the Domain of the Composite is:
\(\text{D}\,\text{I}\,\text{F }\,\,\cap \text{ }\,\,\text{I}\,\text{F}\to \,\,\text{O}\,\text{D}\)
Let’s do more examples. For the following functions, find the composition and its domain:
Functions  Composition and Domain 
\(\begin{array}{l}f\left( x \right)=5x+1,\,\,x\le 10\\g\left( x \right)={{\left( {x+2} \right)}^{2}},\,\,x\ge 0\end{array}\)
Find \(g\left( {f\left( x \right)} \right)\) and domain of composite. 
\(g\left( {f\left( x \right)} \right)=g\left( {5x+1} \right)={{\left( {\left( {5x+1} \right)+2} \right)}^{2}}={{\left( {5x+3} \right)}^{2}}=25{{x}^{2}}+30x+9\)
\(\text{D}\,\text{I}\,\text{F }\,\,\cap \text{ }\,\,\text{I}\,\text{F}\to \,\,\text{O}\,\text{D}\) (Domain of Inner Intersected with the Inner Function in the Outer Domain)
Domain of Inner Function: \(x\le 10\) Inner Function in Outer Domain: The domain of the outer function is \(x\ge 0\). Thus, \(\displaystyle 5x+1\ge 0,\,\,\text{or }x\ge \frac{1}{5}\). Now, taking the intersection of the two inequalities above, we have \(\displaystyle x\ge \frac{1}{5}\,\,\text{and }x\le \text{10}\). Thus, the domain of \(g\left( {f\left( x \right)} \right)\) is \(\displaystyle \left[ {\frac{1}{5},\,\,10} \right]\). 
\(\displaystyle \begin{align}f\left( x \right)&=\frac{2}{{x1}}\\g\left( x \right)&={{x}^{2}}\end{align}\)
Find \(g\left( {f\left( x \right)} \right)\) and domain of composite. 
\(\displaystyle g\left( {f\left( x \right)} \right)=g\left( {\frac{2}{{x1}}} \right)={{\left( {\frac{2}{{x1}}} \right)}^{2}}=\frac{4}{{{{{\left( {x1} \right)}}^{2}}}}\)
\(\text{D}\,\text{I}\,\text{F }\,\,\cap \text{ }\,\,\text{I}\,\text{F}\to \,\,\text{O}\,\text{D}\) Domain of Inner Function: \(x\ne 1\) Inner Function in Outer Domain: Since the domain of the outer function is all real numbers, we don’t have to worry about this part (there are no restrictions here). Thus, the only restriction is \(x\ne 1\). The domain of \(g\left( {f\left( x \right)} \right)\) is \(\left( {\infty ,1} \right)\cup \left( {1,\infty } \right)\). 
\(\begin{array}{l}f\left( x \right)=\sqrt{{2x8}}\\g\left( x \right)={{x}^{2}}+5\end{array}\)
Find \(f\left( {g\left( x \right)} \right)\) and domain of composite. 
\(f\left( {g\left( x \right)} \right)=f\left( {{{x}^{2}}+5} \right)=\sqrt{{2\left( {{{x}^{2}}+5} \right)8}}=\sqrt{{2{{x}^{2}}+2}}\)
\(\text{D}\,\text{I}\,\text{F }\,\,\cap \text{ }\,\,\text{I}\,\text{F}\to \,\,\text{O}\,\text{D}\) Domain of Inner Function: Since the domain of the inner function is all real numbers, we don’t have to worry about this part (there are no restrictions here). Inner Function in Outer Domain: The domain of the outer function is \(2x8\ge 0,\,\text{or }x\ge 4\). Since our inner function is the “new \(\boldsymbol{x}\) ”, \({{x}^{2}}+5\ge 4,\,\text{or }{{x}^{2}}\ge 1\). This will always happen, so it will be the real numbers. Now, taking the intersection of real numbers and real numbers, we get no domain restrictions, so the domain of the composite is real numbers: \(\mathbb{R}\). 
\(\begin{array}{l}f\left( x \right)=\log \left( {x4} \right)\\g\left( x \right)=\sqrt{{x+7}}\end{array}\)
Find \(f\left( {g\left( x \right)} \right)\) and domain of composite. 
\(f\left( {g\left( x \right)} \right)=f\left( {\sqrt{{x+7}}} \right)=\log \left( {\sqrt{{x+7}}4} \right)\)
\(\text{D}\,\text{I}\,\text{F }\,\,\cap \text{ }\,\,\text{I}\,\text{F}\to \,\,\text{O}\,\text{D}\) (Note that log functions are discussed here in the Logarithmic Functions section.) Domain of Inner Function: What’s underneath an even radical sign most be \(\ge 0\), so the domain of the inner function is \(x+7\ge 0,\,\,\text{or}\,\,x\ge 7\). Inner Function in Outer Domain: The domain of the outer function is \(x4>0,\,\text{or }x>4\), since the argument of a log function has to be \(>0\). Since our inner function is the “new \(x\)”, \(\sqrt{{x+7}}>4,\,\text{or}\,\,x+7>16,\,\,\text{or}\,\,x>9\). Take the intersection of the two inequalities to get \(x>9,\,\text{or}\,\left( {9,\infty } \right)\) as the domain of the composites (both \(x\ge 7\,\text{and}\,x>9\) have to work). 
Let’s do one more that happens to involve a Rational Function, that we will learn about here in the Solving Rational Functions, including Asymptotes section. To get the domain of the following composition, we will have to use a sign chart. We’ve worked with sign charts here in the Quadratic Inequalities section, and they are a useful tool!
Functions  Composition and Domain  
\(\begin{align}f\left( x \right)&=\sqrt{{x6}}\\g\left( x \right)&=\frac{6}{{x+5}}\end{align}\)
Find \(f\left( {g\left( x \right)} \right)\) and domain of composite. 
\(\displaystyle f\left( {g\left( x \right)} \right)=f\left( {\frac{6}{{x+5}}} \right)=\sqrt{{\frac{6}{{x+5}}6}}\,\,\)
\(\text{D}\,\text{I}\,\text{F }\,\,\cap \text{ }\,\,\text{I}\,\text{F}\to \,\,\text{O}\,\text{D}\) Domain of Inner Function: \(x\ne 5\) Inner Function in Outer Domain: The domain of the outer function is \(x\ge 6\), so \(\displaystyle \frac{6}{{x+5}}\ge 6\). Since this is a rational inequality (we don’t know if “\(x+5\)” is positive or negative), we need to use the sign chart method (shown below) that we’ll learn about later when we discuss Rational Functions. The interval we get doing this is \(5<x\le 4\). Now, taking the intersection of the two inequalities above, we have \(x\ne 5\) and \(\left( {5,4} \right]\). The domain of \(f\left( {g\left( x \right)} \right)\) is still \(\left( {5,4} \right]\). 

Sign Chart Method to find the Inner Function in Outer Domain:
In order to solve the rational inequality \(\displaystyle \frac{6}{{x+5}}\ge 6\) using a sign chart, we need to get everything on the left side, and 0 on the other side. Then we want to combine terms using a common denominator. Note that we had to change the sign when we divided by –6 in the nexttolast step: \(\begin{array}{c}\frac{6}{{x+5}}\ge \,\,6\,\,\,\,\,\,\,\frac{6}{{x+5}}6\ge \,\,0\,\,\,\,\,\,\,\,\frac{6}{{x+5}}\frac{{6\left( {x+5} \right)}}{{x+5}}\ge \,\,0\,\,\,\,\,\,\,\,\,\frac{{66x30}}{{x+5}}\ge \,\,0\\\frac{{6\left( {x+4} \right)}}{{x+5}}\ge \,\,0\,\,\,\,\,\,\,\,\frac{{6\left( {x+4} \right)}}{{\left( {6} \right)\left( {x+5} \right)}}\le \,\,\frac{0}{{6}}\,\,\,\,\,\,\,\,\,\frac{{x+4}}{{x+5}}\le \,\,0\end{array}\) We now draw a sign chart. We get the “boundary points” or “critical values” by setting all the factors (in both numerator and denominator) to 0; these are –5, and –4. (We put a closed circle on the –4 boundary point because of the less than and equal to, but we need to put an open circle on the –5 since we can’t have 0 in the denominator.) We then check each interval with random points to see the rational expression is positive or negative. We put signs over each interval and look for the minus sign, indicating it’s negative (because of the \(\le \)). Always try easy numbers, especially 0, if it’s not a critical value! 

The interval is \(5<x\le 4\) or \(\left( {5,4} \right]\). 
Try –6 for the leftmost interval: \(\displaystyle \frac{{6+4}}{{6+5}}=\frac{{2}}{{1}}=\text{positive }(+)\) Try –4.5 for the middle interval: \(\displaystyle \frac{{4.5+4}}{{4.5+5}}=\frac{{.5}}{{.5}}=\text{negative (}\text{)}\) Try 0 for the rightmost interval: \(\displaystyle \frac{{0+4}}{{0+5}}=\frac{4}{5}=\text{positive (}+\text{)}\) 
Domains of Composites Graphically
We can determine the domains of composites graphically too, and this way is actually better to see what’s going on. I call these the XYX method (from the outsidein), since that is the sequence of events (look at X in the outside graph, then use it as a Y on the inside graph, then pick the X from the inside graph).
Here are some examples:
If we knew what these functions were algebraically (we’ll see how later!), we could use the \(\displaystyle \text{D}\,\text{I}\,\text{F }\cap \text{ I}\,\text{F}\,\to \,\text{O}\,\text{D}\) method. I know this is really difficult, but follow these steps and you’ll be able to do any of the problems!
Applications of Compositions
Here are a couple of composites applications you may see in your Algebra class:
Composition Word Problem  Solution 
Increasing Area Problem:
A rock is thrown in a pond, and the radius of the ripple circle increases at a rate of .5 inch per second.
Find an algebraic expression for the area of the ripple in terms of time \(t\), and find the area after 20 seconds. 
For these types of problems, we want to start with the simplest (meaning most direct) function we can find in terms of time \(t\); this would be that the radius of the ripples increase at a rate of .5 inch per second. We can write this as \(r\left( t \right)=.5t\). We also now that the formula for the area of a circle, based on its radius, is \(A\left( r \right)=\pi {{r}^{2}}\).
Since the area is based on the radius which is based on the time, we can put the two functions together, making the inside function the “time” function (remember that we work from the inside out with compositions).
We get \(A\left( {r\left( t \right)} \right)=\pi {{\left( {.5t} \right)}^{2}}=\pi \left( {.25} \right){{t}^{2}}\). When \(t=20\) seconds, we get \(A\left( {r\left( {20} \right)} \right)=\pi \left( {.25} \right){{\left( {20} \right)}^{2}}=100\pi \,\,\text{i}{{\text{n}}^{2}}\). Make sure units match, which they do since we are dealing with a rate of .5 inches per second. 
Shadow Problem:
Amelia is walking away from a 20foothigh street lamp at a rate of 4 ft/sec.
If Amelia is 5’6” tall, how long will she have walked (both in terms of time and distance) when her shadow is 7 feet long?

This is a tough one; actually, you’ll be doing some like this in Calculus. Let’s draw a picture first, and we need to know a little bit about shadows and Geometry. 😉
The main thing to know for this type of problem is that shadows are on the ground, in this case in front of Amelia. The light from the lamp comes down diagonally from the top over Amelia’s head to create the shadow.
The composition part of this problem is that the distance she has already walked is a function of the time she has already walked; remember that \(\text{distance}=\text{rate}\,\times \,\text{time}\). Thus, the distance she has walked is \(4t\). The distance from the bottom of the pole to the end of her shadow is \(\displaystyle S\left( {D\left( t \right)} \right)=D\left( t \right)+7=4t+7\).
From Geometry we know that the two triangles in pink are similar, since they have the same angle measurements; one is just a “multiple” of the other. Set up a proportion, noting that 5’6” is 5.5 feet: \(\displaystyle \frac{{\text{large left side}}}{{\text{small left side}}}=\frac{{\text{large bottom}}}{{\text{small bottom}}}\) or \(\displaystyle \frac{{20}}{{5.5}}=\frac{{4t+7}}{7}\) . Cross multiply to get \(\left( {20} \right)\left( 7 \right)=\left( {5.5} \right)\left( {4t+7} \right)\), and solve to get \(\boldsymbol{t\approx 4.61}\) seconds.
To get the distance Amelia has walked, we have to multiply 4.61 (seconds) by 4 (feet per second) to get about 18.45 feet.

Learn these rules, and practice, practice, practice!
Click on Submit (the arrow to the right of the problem) to solve this problem. You can also type in more problems, or click on the 3 dots in the upper right hand corner to drill down for example problems.
If you click on “Tap to view steps”, you will go to the Mathway site, where you can register for the full version (steps included) of the software. You can even get math worksheets.
You can also go to the Mathway site here, where you can register, or just use the software for free without the detailed solutions. There is even a Mathway App for your mobile device. Enjoy!
On to Inverses of Functions – you are ready!!