Composition of Functions
Consider the function $g : \mathbb{R} \to \mathbb{R}$ defined as $g(x) := x^2$ and $f: \mathbb{R} \to \mathbb{R}$ defined as $f(x) := x + 1$. If we wanted to compose $f$ with $g$, we would write $f(g(x)) = (g \circ f) (x) = (x + 1)^2$. We will now formalize the definition of a composite function.
Definition: If $f : A \to B$ and $g : B \to C$ are functions such that $R(f) \subseteq D(g) = B$, then the function $(g \circ f)(x) = g(f(x))$ is a function $(g \circ f) : A \to C$. |
It is important to note that in general, $(g \circ f)(x) ≠ (f \circ g)(x)$. In our example above, recall that $(g \circ f)(x) = (x + 1)^2$. On the other hand $(f \circ g)(x) = x^2 + 1$. Clearly $(x + 1)^2 ≠ x^2 + 1$.
Example 1
If $f : \mathbb{R} \to \mathbb{R}$ is defined by $f(x) := 1 - x^2$ and $g : \mathbb{R} \to \mathbb{R}$ is defined by $g(x) := \sqrt{x}$, determine $(g \circ f)(x)$.
We obtain that $(g \circ f)(x) = \sqrt{1 - x^2}$. Furthermore, we note that $D(g \circ f) = \{ x : -1 ≤ x ≤ 1 \}$ since $(g \circ f)(x)$ cannot take on real values less than x = -1 or greater than x = 1 otherwise the value under the radical is negative.
Example 2
Recall that $(f \circ g)(x)$ does not necessarily equal $(g \circ f)(x)$. Find an example where $(f \circ g)(x) = (g \circ f)(x)$.
Suppose that $f$ and $g$ are defined for all reals such that $f(x) := x$ and $g(x) := x + 1$. Then $(f \circ g)(x) = f(g(x)) = f(x + 1) = x + 1$. Furthermore $(g \circ f)(x) = g(f(x)) = g(x) = x + 1$. In this case, $(f \circ g)(x) = (g \circ f)(x)$.