Composite Functions: A Step-by-Step Journey
What is a Function? The Basic Machine
Before we combine functions, let's recall what a single function is. A function is a special rule that takes an input (usually called $x$) and assigns to it exactly one output. You can think of it as a machine: you drop a number in the top, the machine does its work, and a new number pops out the bottom.
For example, consider the function $f$ defined by the rule $f(x) = x + 3$. This "add 3" machine does the same thing to any input: If you put in $5$, you get out $8$: $f(5) = 5 + 3 = 8$. If you put in $-2$, you get out $1$: $f(-2) = -2 + 3 = 1$.
The Idea of Chaining Machines Together
Now, imagine you have two machines lined up so the output of the first one automatically becomes the input of the second one. This assembly line is a composite function.
Let's use two simple functions: $f(x) = x + 3$ (the "add 3" machine). $g(x) = x \times 2$ or $2x$ (the "multiply by 2" machine).
If we connect them so $f$ happens first and then $g$, the combined machine works like this:
- Start with an input $x$.
- Apply $f$: calculate $f(x) = x + 3$. Call this result $A$.
- Immediately apply $g$ to the result $A$: calculate $g(A) = 2 \times A$.
The overall process is: $x \rightarrow (x+3) \rightarrow 2(x+3)$.
This new, combined function is written as $(g \circ f)(x)$. Notice the order: $g \circ f$ means "$f$ first, then $g$". So, $(g \circ f)(x) = g(f(x)) = 2(x+3)$.
Order Matters: A Critical Distinction
In our daily lives, order matters. Putting on socks and then shoes is very different from putting on shoes and then socks! The same is true for functions. Composition is generally not commutative: $(g \circ f)(x)$ is usually not the same as $(f \circ g)(x)$.
Let's test this with our functions $f(x)=x+3$ and $g(x)=2x$.
| Comparing $(g \circ f)(x)$ and $(f \circ g)(x)$ | ||
|---|---|---|
| Composite | Step-by-Step | Final Formula |
| $(g \circ f)(x)$ f first, then g | 1. Start with $x$. 2. Apply $f$: $f(x)=x+3$. 3. Apply $g$ to the result: $g(x+3)=2(x+3)$. | $2x + 6$ |
| $(f \circ g)(x)$ g first, then f | 1. Start with $x$. 2. Apply $g$: $g(x)=2x$. 3. Apply $f$ to the result: $f(2x)=2x+3$. | $2x + 3$ |
As you can see, $2x+6$ is not the same as $2x+3$ (they differ by 3). The order in which you apply the functions changes the final outcome.
Evaluating Composite Functions with Numbers
Sometimes you need to find the numerical output of a composite function for a specific input. Let's use new functions: $m(x)=x^2$ and $n(x)=x-4$.
Example 1: Find $(m \circ n)(5)$. This means $m(n(5))$.
- First, apply $n$ to $5$: $n(5) = 5 - 4 = 1$.
- Then, apply $m$ to that result: $m(1) = 1^2 = 1$.
So, $(m \circ n)(5) = 1$.
Example 2: Find $(n \circ m)(2)$. This means $n(m(2))$.
- First, apply $m$ to $2$: $m(2) = 2^2 = 4$.
- Then, apply $n$ to that result: $n(4) = 4 - 4 = 0$.
So, $(n \circ m)(2) = 0$. Again, notice $(m \circ n)(5) \neq (n \circ m)(2)$.
Finding the Formula of a Composite Function
Often, we want a single formula for the new composite function. Let's find a general formula for $(p \circ q)(x)$ if $p(x) = \sqrt{x}$ and $q(x) = x + 1$.
By definition, $(p \circ q)(x) = p(q(x))$.
- Write down the rule for $p$: $p(\text{input}) = \sqrt{\text{input}}$.
- The input to $p$ will be $q(x)$, which is $x+1$.
- Substitute $q(x)$ into the rule for $p$: $p(q(x)) = \sqrt{x+1}$.
Therefore, $(p \circ q)(x) = \sqrt{x+1}$. This new function has its own domain[1] (we can only put in numbers $x$ such that $x+1 \ge 0$, so $x \ge -1$).
Composite Functions in the Real World: A Temperature Story
Composite functions are not just abstract math—they model real, multi-step processes. Imagine you are on a trip to the United States from Europe. You see a weather forecast in degrees Fahrenheit (°F), but you think in degrees Celsius (°C). Furthermore, you want to know if you should wear a coat based on a simple rule.
We can model this with two functions:
- Function $C$: Converts Fahrenheit to Celsius. The formula is $C(f) = \frac{5}{9}(f - 32)$, where $f$ is the temperature in °F.
- Function $J$: Judges the temperature in Celsius. It outputs a advice: $J(c) = \begin{cases} \text{"Coat"} & \text{if } c < 15 \\ \text{"Jacket"} & \text{if } 15 \le c < 20 \\ \text{"No Coat"} & \text{if } c \ge 20 \end{cases}$, where $c$ is the temperature in °C.
If the forecast says 50°F, you naturally perform a composite function evaluation in your head:
- First, apply $C$: $C(50) = \frac{5}{9}(50-32) = \frac{5}{9} \times 18 = 10$°C.
- Then, apply $J$ to that result: $J(10) = \text{"Coat"}$ (since $10 < 15$).
The composite function $(J \circ C)(f)$ directly gives clothing advice from a Fahrenheit input. $(J \circ C)(50) = \text{"Coat"}$.
This chaining of processes—conversion then judgment—is exactly what composite functions represent.
Important Questions
Q1: Can you compose more than two functions?
Absolutely! You can chain three or more functions. For functions $a(x)$, $b(x)$, and $c(x)$, the triple composite $ (a \circ b \circ c)(x) $ means $a(b(c(x)))$. You start with $x$, apply $c$, then apply $b$ to that result, and finally apply $a$ to the last result. The process just keeps going from the inside out.
Q2: Does $(f \circ g)(x)$ always equal $(g \circ f)(x)$?
No, as we saw in the examples, order usually matters. Function composition is not commutative. $(f \circ g)(x) = (g \circ f)(x)$ is a special case that happens only for certain function pairs (like $f(x)=x+5$ and $g(x)=x-5$). You should always assume the order changes the result unless proven otherwise.
Q3: What is the domain of a composite function?
The domain[1] of $(g \circ f)(x)$ is the set of all $x$ in the domain of $f$ such that $f(x)$ is in the domain of $g$. You must check two things: 1) Can you compute $f(x)$? 2) Having computed $f(x)$, can you then plug that value into $g$? For example, if $f(x)=\sqrt{x}$ and $g(x)=1/x$, then for $(g \circ f)(x)=1/\sqrt{x}$, the domain is $x > 0$ (you cannot take the square root of a negative number, and you cannot divide by zero, so $\sqrt{x}$ cannot be $0$, meaning $x$ cannot be $0$ either).
Footnote
[1] Domain: The set of all possible input values ($x$-values) for which a function is defined. For example, the domain of $f(x)=1/x$ is all real numbers except $x=0$.
