Identify the layers of a composition
A calculation in two steps
A calculator finds \(y = \sqrt{x^2 + 9}\) in two steps. The figure shows three number lines for \(x\), \(u\) and \(y\), and the orange dot on each line shows the current value.
Drag \(x\). The first box squares \(x\) and adds 9, and its result is \(u\). The second box takes the square root of \(u\), and its result is \(y\).
At \(x = 4\), the first box gives \(u = 4^2 + 9 = 25\), and the second box gives \(y = \sqrt{25} = 5\).
The first box works on the input \(x\). The second box runs last, so its result is the final answer \(y\).
Any two steps
Without numbers, the first box is a function \(g\) and the second box is a function \(f\).
Drag the dot on the first line. The dot on the second line moves to \(u = g(x)\), and the dot on the third line moves to \(y = f(u)\).
The whole calculation is \(y = f(g(x))\), which is a composition: one function applied to the result of another.
Each box is one layer of the calculation, and it works on the result of the box before it. The box that runs last is the outer function, and the box before it is the inner function.
Notation
The inner function \(g\) runs first, and its result is called \(u\).
\[\cy{u} = g(x)\]The outer function \(f\) runs last, on \(u\).
\[y = f(\cy{u})\]In one line, the formula reads from the inside: \(g\) acts on \(x\), and then \(f\) acts on the result.
\[y = f(g(x))\]To find the layers of a formula, ask which operation runs last. That operation is the outer function, and everything it works on is the inner function.
Repeat the question on the inner function to find more layers.
The next skill needs \(g\) to be differentiable at \(x\) and \(f\) to be differentiable at \(u\). In this skill, you only name the layers.
When it fails
Try \(y = x^2 + \sin x\). The last operation is an addition, which combines two separate parts, and each part starts from \(x\) on its own.
The addition box works on two values, \(a\) and \(b\), not on one value \(u\). A sum, a product or a quotient is not a composition at the top level, so you differentiate it with its own rule. Then you look for layers inside each part.
Example 1: one inner function
Name the inner and outer functions of \(y = (5x - 2)^4\). Test them at \(x = 1\).
At \(x = 1\), the first box gives \(5(1) - 2 = 3\), so the dot on the \(u\) line is at 3.
\[u = 5x - 2 = \cy{3}\]The second box raises 3 to the fourth power, so the dot on the \(y\) line is at 81.
\[y = u^4 = 3^4 = \cy{81}\]The fourth power runs last, so it is the outer function, and the first box is the inner function.
\[f(u) = u^4, \qquad g(x) = 5x - 2\]As a check, \(f(g(1)) = f(3) = 81\), which matches the last dot.
Example 2: three layers
Find the layers of \(y = \ln\bigl(1 + (x-4)^2\bigr)\) from the outside in. Test them at \(x = 6\).
At \(x = 6\), the boxes give \(u = 6 - 4 = 2\), then \(w = 1 + 2^2 = 5\), then \(y = \ln 5 \approx 1.609\).
\[u = \cy{2}, \qquad w = \cy{5}, \qquad y = \cy{\ln 5}\]A tempting wrong move: Call the squaring the outer function, because it has the visible exponent 2.
\[f(u) = u^2\]The ringed box squares \(u\) and adds 1, and the natural log still runs after it. This means the last dot is at \(\ln 5\), not at \(2^2 = 4\). The outer function is the box that produces \(y\).
The last box takes the natural log, so the outer function is \(\ln w\).
\[y = \ln w\]The box before it squares \(u\) and adds 1, so \(w = 1 + u^2\). The first box gives the innermost function, \(u = x - 4\).
\[\begin{aligned} y &= \ln w \\ w &= 1 + u^2 \\ u &= x - 4 \end{aligned}\]
Practice
Name the layers of \(y = (e^{3x} + 1)^6\) from the outside in. Give the value of each layer at \(x = 0\).
Run the calculation at x = 0 and read each dot. The box that runs last is the outer function.
Solution
At \(x = 0\), the first box gives \(u = 3(0) = 0\).
\[u = 3x = 0\]The next box gives \(w = e^0 + 1 = 2\).
\[w = e^u + 1 = 2\]The last box gives \(y = 2^6 = 64\). The outer function is \(w^6\), the middle function is \(e^u + 1\), and the inner function is \(3x\).
\[y = w^6 = 64\]
Questions
The figure shows \(y = (4 - x^2)^3\). Its boxes square \(x\), subtract the result from 4, and cube the new result.
Which box is the outer function?
- The box that cubes.
- The box that squares \(x\).
- The box that subtracts from 4.
Answer
The box that cubes.
At \(x = 1\), what number does the dot just before the last box show?
- 3
- 1
- 27
Answer
3
For \(y = \ln(x^2 - 8)\), find \(y\) at \(x = 3\).
- 0
- 1
- \(\ln 9\)
Answer
0
Summary
You find the layers by asking which operation runs last, because that operation is the outer function.
This works because each layer is one function applied to the result of the layer inside it, so the layers read from the outside in.
Name the layers before you differentiate a composition, because the chain rule uses one factor for each layer.
This is one of four skills in topic 3.1 of Which & Why: AP Calculus.