Composition of Functions

Functions & Advanced Algebra

Composition of functions combines two functions by applying one function to the output of another, written as (f o g)(x) = f(g(x)).

Formula

(f \circ g)(x) = f(g(x))

Definition

Composing two functions means plugging one function into another. You take the output of the inner function and use it as the input of the outer function.

Example

Let $g(x) = x + 1$ and $f(x) = 2x$. Then $f(g(3))$: first $g(3) = 4$, then $f(4) = 8$. So $(f \circ g)(3) = 8$. The inner function runs first, then the outer.

Key Insight

Think of a two-step machine: the first machine ($g$) processes your input, then hands the result to the second machine ($f$). Order matters: $f(g(x))$ is usually different from $g(f(x))$.

Definition

The composition $(f \circ g)(x) = f(g(x))$ applies $g$ first, then $f$. The domain of $f \circ g$ is all $x$ in the domain of $g$ for which $g(x)$ is in the domain of $f$. Composition is associative but generally not commutative.

Example

$f(x) = x^2$, $g(x) = x + 3$. $(f \circ g)(x) = f(x + 3) = (x + 3)^2 = x^2 + 6x + 9$. $(g \circ f)(x) = g(x^2) = x^2 + 3$. Different results confirm composition is not commutative.

Key Insight

To find the domain of $f \circ g$: start with the domain of $g$, then exclude any $x$ where $g(x)$ is outside the domain of $f$. Always work from the inside out.

Definition

Function composition is the categorical composition of morphisms. Given $f: B \to C$ and $g: A \to B$, the composition $f \circ g: A \to C$ is defined by $(f \circ g)(a) = f(g(a))$. Composition is associative and the identity function is the identity morphism, making functions with composition a category (Set).

Example

In the chain rule of calculus: $d/dx[f(g(x))] = f'(g(x)) \cdot g'(x)$. This is the derivative of a composition, and its proof relies directly on the definition of composition and the limit definition of the derivative.

Key Insight

The chain rule is the infinitesimal version of composition. In abstract algebra, group homomorphisms are composable, and the composition of two homomorphisms is a homomorphism, preserving the algebraic structure.