Source: algebrica.org - CC BY-NC 4.0 https://algebrica.org/composite-functions/ Fetched from algebrica.org post 15487; source modified 2025-12-06T17:56:46.
What are composite functions
When we talk about composite functions, we refer to the process of applying one function to the result of another. In other words, given two functions $f(x)$ and $g(x)$, a composite function is formed by evaluating $g$ at the output of $f$. This is denoted by:
This means that we first apply $f$ to the input $x$, and then apply $g$ to the result.

This diagram illustrates the concept of a composite function: the input $x$ from set $A$ is first mapped to $f(x)$ in set $B$, and then $f(x)$ is mapped to $g(f(x))$ in set $C$, resulting in the composition $g \circ f$.
More formally, let two functions $f(x)$ and $g(x)$ be given such that:
- $f \colon A \rightarrow B$
- $g \colon B \rightarrow C$
- $f(A) \subseteq B$
The composite function is defined as follows:
This means that the function $g \circ f$ maps each element $x$ in the domain $A$ to the value $g(f(x))$, provided that the image of $f$ is contained in the domain of $g$.
Example
Consider the following functions:
- $f(x) = 2x + 3$
- $g(x) = x^2$
We wanto to define the composite function $g \circ f = g(f(x))$. Let’s start by evaluating $f(x)$:
Now plug that into $g(x)$:
Therefore, the composite function is:
Composition with the inverse function
If a function $f$ is composed with its inverse $f^{-1}$, the result is the identity function, which maps each element of a set to itself:
This operation is valid only if the function $f$ is invertible, meaning that it is both one-to-one (injective) and onto (surjective) over its domain.
When the composition between two functions is well-defined, that is, when the output of the first function lies within the domain of the second, we can write:
This notation highlights that function composition is not commutative: in general, the order in which functions are composed affects the outcome, and the following holds:
Example
Let’s demonstrate with a simple example that function composition is not a commutative operation, that is, in general, $g \circ f \neq f \circ g$. Consider the two functions:
- $f(x) = e^x$
- $g(x) = x + 1$
Compute $f \circ g$:
Compute $g \circ f$:
We have:
- $(f \circ g)(x) = e^{x + 1} = e \cdot e^x$
- $(g \circ f)(x) = e^x + 1$
These expressions are not equal and this proves that function composition is not commutative.