Tutorials › AP Calculus › Reading Composite Functions from Function Notation

Chain Rule and Nested Functions · Tutorial 162 of 999

Reading Composite Functions from Function Notation

Recognize which function acts first and represent composite expressions as clear, ordered layers.

Intermediate 9 min read

What You'll Learn

  • Define a composite function and identify its domain requirements
  • Read f(g(x)) from the inside outward
  • Identify inner and outer functions in trigonometric and algebraic expressions
  • Represent two- and three-layer compositions with nested-function diagrams
  • Distinguish composition from multiplication and from similar-looking expressions

Why the Order of a Composite Function Matters

A function expression can describe more than one operation. In \(f(g(x))\), the input \(x\) is first used to calculate \(g(x)\); that result is then used as the input to \(f\). Reading the expression correctly means identifying this order before trying to evaluate it or reason about it.

This inside-out reading is useful throughout calculus. A complicated-looking expression often becomes easier to understand when it is separated into functions, each with a clear role. A nested-function diagram makes the order visible: it traces the input through the inner function and then through the outer function.

Key idea: In \(f(g(x))\), \(g\) acts first and \(f\) acts second. The inner function is \(g\); the outer function is \(f\).

What Function Composition Means

Suppose \(g\) takes inputs from a set \(X\) to outputs in a set \(Y\), and \(f\) takes inputs from \(Y\) to outputs in a set \(Z\). The output of \(g\) can then be used as an input to \(f\). The resulting function is called the composition of \(f\) with \(g\).

Definition: If \(g:X\to Y\) and \(f:Y\to Z\), their composition is the function \(f\circ g:X\to Z\) defined by \((f\circ g)(x)=f(g(x))\). The function \(g\) is applied first; \(f\) is applied to the result.

The order of the function names in \(f\circ g\) can take a moment to get used to. The rightmost function, \(g\), acts first. The notation \(f(g(x))\) displays the same order: begin with the innermost expression \(x\), evaluate \(g\), and then evaluate \(f\).

For a composition to make sense at a particular input, two requirements must hold. First, \(x\) must be in the domain of \(g\). Second, the value \(g(x)\) must be an allowed input for \(f\). It is not enough for each formula to be familiar; the output of the inner function must fit the domain of the outer function.

A Reliable Way to Read the Notation

To identify the functions in a composite expression, look for the operation that receives the entire inner expression as its input. That operation is the outer function. The expression placed inside it determines the inner function. Then check the order by tracing the input from the innermost part outward.

1
Start with the input.
Find the expression in the deepest, innermost position, usually \(x\).
2
Identify the first function applied.
Determine what operation acts directly on that input. This is the inner function.
3
Move outward one layer at a time.
Each outer operation takes the result of the preceding layer as its input.
4
Check the domain at each stage.
Confirm that each intermediate result is an allowable input for the next function.

A nested-function diagram records those stages in order. Read its arrows from left to right: the input goes into the inner function first, and the final function produces the output.

Worked Example: Evaluating \(f(g(x))\) from the Inside Out

Worked Example: Evaluating \(f(g(2))\)

Let \(g(x)=x^2+3\) and \(f(t)=2t-1\). Identify the inner and outer functions, draw the order, and evaluate \(f(g(2))\).

The expression is \(f(g(2))\). The value \(2\) is inside \(g\), so \(g\) is applied first. The result is then used as the input to \(f\). Thus, \(g\) is inner and \(f\) is outer.

1
Input.
\(2\)
2
Apply \(g\).
\(2\longmapsto g(2)\)
3
Apply \(f\).
\(g(2)\longmapsto f(g(2))\)

First calculate the inner value:

$$ g(2)=2^2+3=4+3=7. $$

Now use that result as the input to \(f\):

$$ f(g(2))=f(7)=2(7)-1=14-1=13. $$

We can check by writing the composition as one expression. Since \(f(t)=2t-1\), replace its input \(t\) with \(g(x)=x^2+3\):

$$ f(g(x))=2(x^2+3)-1. $$

At \(x=2\), this gives \(2(2^2+3)-1=2(4+3)-1=14-1=13\), matching the inside-out calculation. The check confirms that the inner result was used as the outer function’s input.

Reading Trigonometric Expressions as Compositions

Standard function names can also serve as outer functions. In \(\sin(x^2+1)\), the sine function receives the entire expression \(x^2+1\) as its input. The inner function is \(g(x)=x^2+1\); the outer function is \(f(u)=\sin u\). The letter \(u\) is used here to show that the outer function takes a single input, which may be the output of another function.

$$ x \longmapsto \underbrace{x^2+1}_{\text{inner function }g} \longmapsto \underbrace{\sin(x^2+1)}_{\text{outer function }f\text{ applied to }g(x)} $$

In composition notation, the same expression is \((f\circ g)(x)\), where \(g(x)=x^2+1\) and \(f(u)=\sin u\). The notation does not say that sine and \(x^2+1\) are multiplied. It says that the output of \(g\) becomes the input of \(f\).

Worked Example: Identifying the Layers in \(\sin(x^2+1)\)

Identify the inner and outer functions, represent their order, and check the interpretation at \(x=1\).

The whole input to the sine function is \(x^2+1\), so take \(g(x)=x^2+1\) as the inner function and \(f(u)=\sin u\) as the outer function. The composition is \((f\circ g)(x)=f(g(x))=\sin(x^2+1)\).

1
Start with \(x\).
The input is \(x\).
2
Apply \(g\).
Calculate \(g(x)=x^2+1\).
3
Apply \(f\).
Take the sine of the result: \(f(g(x))=\sin(x^2+1)\).

For the check, set \(x=1\). The inner function gives \(g(1)=1^2+1=2\). The outer function then gives \(f(2)=\sin 2\). Therefore \(f(g(1))=\sin 2\), which agrees with substituting directly into the original expression: \(\sin(1^2+1)=\sin 2\).

This example is about the structure and order of the expression. The key is that the entire quantity \(x^2+1\), not just \(x\), is the input to sine.

More Than Two Layers

A composition can contain several nested functions. Identify each layer separately, from the innermost operation to the outermost. Keeping the layers distinct is clearer than trying to treat a long expression as one undivided formula.

Worked Example: Sorting Three Nested Layers

Consider \(e^{\sin(x^2)}\). Identify the three functions and their order, then check the value at \(x=0\).

Start at the inside. First, \(x\) is squared. Next, the sine function acts on that square. Finally, the exponential function with base \(e\) acts on the sine value. Define the functions by \(h(x)=x^2\), \(g(u)=\sin u\), and \(f(v)=e^v\). The full expression is \((f\circ g\circ h)(x)\), meaning \(f(g(h(x)))\).

1
Innermost layer.
\(x\longmapsto h(x)=x^2\)
2
Middle layer.
\(h(x)\longmapsto g(h(x))=\sin(x^2)\)
3
Outermost layer.
\(g(h(x))\longmapsto f(g(h(x)))=e^{\sin(x^2)}\)

Now evaluate each stage at \(x=0\). First, \(h(0)=0^2=0\). Second, \(g(h(0))=\sin(0)=0\). Third, \(f(g(h(0)))=e^0=1\). Thus the original expression at \(x=0\) is \(e^{\sin(0^2)}=e^{\sin 0}=e^0=1\), as the layer-by-layer evaluation shows.

The order is important: \(e^{\sin(x^2)}\) means square, then sine, then exponential. The diagram makes that sequence explicit.

Domain Requirements Are Part of the Reading

Identifying the layers also helps determine where a composition is defined. For a square root to produce a real number, its input must be nonnegative. In a composite expression, this condition applies to the value produced by the inner function.

Worked Example: Reading a Square-Root Composition and Its Domain

Consider \(\sqrt{5-2x}\). Identify the inner and outer functions, state the real domain, and check the value at \(x=1\).

Let \(g(x)=5-2x\) be the inner function and \(f(u)=\sqrt{u}\) be the outer function. The square-root function is defined for real inputs \(u\ge 0\), so the inner output must satisfy \(5-2x\ge 0\).

$$ 5-2x\ge 0 \quad\Longrightarrow\quad -2x\ge -5 \quad\Longrightarrow\quad x\le \frac{5}{2}. $$

The real domain of the composite expression is therefore all real \(x\) with \(x\le 5/2\). To check at \(x=1\), first calculate \(g(1)=5-2(1)=3\). Then apply the outer function: \(f(3)=\sqrt{3}\). Direct substitution gives \(\sqrt{5-2(1)}=\sqrt{3}\), the same result. Also, \(1\le 5/2\), so this input lies in the domain.

Why the Inside-Out Order Is Required

The order is not merely a convenient reading habit; it follows from the definition of composition. Suppose \(g:X\to Y\) and \(f:Y\to Z\). To evaluate \(f(g(x))\), the value \(g(x)\) must exist first. Only then is there a specific value available to put into \(f\). The function \(f\) then returns an element of \(Z\).

$$ x\in X \quad\Longrightarrow\quad g(x)\in Y \quad\Longrightarrow\quad f(g(x))\in Z. $$

This gives a direct justification for reading \(f(g(x))\) from the inside outward. The expression \(g(x)\) is itself the input written inside \(f\). Evaluating the outer function before the inner one would leave its input unspecified. The composition notation \(f\circ g\) records precisely this dependency: \(g\) must produce a value before \(f\) can act on it.

Composition order generally cannot be reversed. The expression \(g(f(x))\) describes a different sequence: apply \(f\) first, then \(g\). It may produce a different function or may not be defined for the same inputs. Thus, \(f\circ g\) and \(g\circ f\) should not be treated as interchangeable.

Common Mistake: Reversing the Functions

A common error is to say that \(f\) acts first in \(f(g(x))\) because its name appears first. That reverses the actual order. Here is a concrete example showing why the reversal changes the result.

Let \(g(x)=x+1\) and \(f(t)=t^2\). The correct inside-out evaluation at \(x=2\) is:

$$ g(2)=2+1=3, \qquad f(g(2))=f(3)=3^2=9. $$

The mistaken reversed order would apply \(f\) to \(2\), then apply \(g\) to that result:

$$ f(2)=2^2=4, \qquad g(f(2))=g(4)=4+1=5. $$

The answers, \(9\) and \(5\), are different. The correction is to begin with the innermost function in the expression as written: in \(f(g(2))\), evaluate \(g(2)\) first, then apply \(f\). The reversed calculation evaluates \(g(f(2))\), which is a different composition.

Do Not Confuse Composition with Similar Expressions

Parentheses and placement matter. Compare \(\sin(x^2+1)\) with \(\sin(x^2)+1\). In the first expression, \(x^2+1\) is the input to sine. In the second, \(x^2\) is the input to sine, and the \(+1\) is applied afterward. They have different layers.

For example, at \(x=0\), the first expression gives \(\sin(0^2+1)=\sin 1\), while the second gives \(\sin(0^2)+1=\sin 0+1=0+1=1\). The placements of the parentheses show which operations are inside the sine function.

Also distinguish composition from multiplication. The notation \(f(g(x))\) means “apply \(g\), then \(f\).” Multiplication of function values is written \(f(x)g(x)\), which means multiply the two outputs at the same input \(x\). These notations describe different operations.

Takeaway: Read function expressions by starting at the innermost input and moving outward. In \(f(g(x))\), \(g\) acts first; in \(\sin(x^2+1)\), the entire expression \(x^2+1\) is the input to sine. A nested-function diagram records this order and helps expose domain requirements.

Check Your Understanding

For each question, identify the functions and follow the order of evaluation carefully.

  1. For \(p(q(x))\), which function is applied first? Which is the outer function?
  2. In \(\cos(3x-4)\), identify an inner function and an outer function, and write the composition using function notation.
  3. Let \(g(x)=x^2-1\) and \(f(u)=u+5\). Evaluate \(f(g(2))\), showing the intermediate value.
  4. Draw or describe the order of the three layers in \(\sqrt{1+\sin x}\), from the innermost operation outward.
  5. Explain why \(f(g(x))\) and \(g(f(x))\) need not have the same value. Give a numerical example.

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon
Clinical Biostats