Composing Functions
The algebra of continuous functions lets us combine functions by operations on their values. Another basic way to build a function is to feed the output of one function into another. Continuity behaves well under this construction, but the domains must fit together: every output of the inner function must be an allowed input for the outer function.
The order in the notation is important: \(f\) acts first, and \(g\) acts second. Thus \(g\circ f\) is generally different from \(f\circ g\), and \(f\circ g\) may not even be defined. Continuity of a composition depends on continuity at the values actually involved: at a point \(a\), the relevant outer input is \(f(a)\).
Worked Example: A Polynomial Inside Another Polynomial
Let \(f(x)=x^2-2\) and \(g(t)=3t+1\), both defined on \(\mathbb{R}\). Since \(f(\mathbb{R})\subseteq\mathbb{R}\), the composition is defined on all of \(\mathbb{R}\). Substitution gives
The inner function \(f\) and the outer function \(g\) are polynomials, so each is continuous everywhere by “Continuity of Polynomial Functions.” The composition theorem below therefore gives continuity of \(g\circ f\) on \(\mathbb{R}\); the resulting polynomial formula confirms the same conclusion. At \(x=2\), \(f(2)=2^2-2=2\), and then \(g(2)=3(2)+1=7\). The formula gives \(3(2)^2-5=12-5=7\), as required.
The Pointwise Composition Theorem
To prove continuity at a point, the epsilon-delta choices have to be made in the right order. First, an outer continuity condition specifies how close the input to \(g\) must be to \(f(a)\). Then, continuity of \(f\) ensures that \(x\) close enough to \(a\) makes \(f(x)\) that close to \(f(a)\).
Proof. Let \(\varepsilon>0\). Since \(g\) is continuous at \(f(a)\), there is a \(\rho>0\) such that, for every \(y\in F\),
Since \(f\) is continuous at \(a\), there is a \(\delta>0\) such that, for every \(x\in E\),
Take any \(x\in E\) with \(|x-a|<\delta\). The second implication gives \(|f(x)-f(a)|<\rho\). Also, \(f(x)\in F\), by the domain condition \(f(E)\subseteq F\). We may therefore use the first implication with \(y=f(x)\), obtaining
Since \((g\circ f)(x)=g(f(x))\) and \((g\circ f)(a)=g(f(a))\), this is precisely the epsilon-delta condition for \(g\circ f\) to be continuous at \(a\). \(\square\)
The proof also explains why \(\rho\) and \(\delta\) need not be equal. The outer function determines the required tolerance \(\rho\) for its input; the inner function then determines a possibly different tolerance \(\delta\) for the original input. The conclusion uses both continuity hypotheses at their respective points.
Worked Example: An Absolute Value Applied to a Rational Function
Define \(f(x)=(x-1)/(x+2)\) for \(x\in E=\mathbb{R}\setminus\{-2\}\), and define \(g(t)=|t|\) for \(t\in F=\mathbb{R}\). The range of \(f\) lies in \(F\), so \(g\circ f\) is defined on \(E\). The rational-function continuity result gives continuity of \(f\) at every point of \(E\), and “Continuity of Absolute Value” gives continuity of \(g\) at every real number. Hence \(g\circ f\) is continuous on \(E\). Explicitly,
For example, at \(x=1\), \(f(1)=(1-1)/(1+2)=0/3=0\), so \((g\circ f)(1)=|0|=0\). At \(x=0\), \(f(0)=(0-1)/(0+2)=-1/2\), so \((g\circ f)(0)=|-1/2|=1/2\). The excluded input \(x=-2\) remains excluded: there \(x+2=0\), and the inner function is not defined.
Continuity at the Relevant Outer Input
For continuity of \(g\circ f\) at \(a\), it is not necessary that \(g\) be continuous everywhere on \(F\). The pointwise theorem only asks that \(g\) be continuous at \(f(a)\). Values of \(g\) far from \(f(a)\) cannot affect the epsilon-delta condition at \(a\), because continuity of \(f\) keeps \(f(x)\) close to \(f(a)\) whenever \(x\) is sufficiently close to \(a\).
Worked Example: The Outer Function Need Not Be Continuous Everywhere
Define \(g:\mathbb{R}\to\mathbb{R}\) by \(g(t)=t\) when \(t\ne0\), and \(g(0)=5\). This function is not continuous at \(0\): for \(t\ne0\), \(g(t)=t\), which approaches \(0\) as \(t\) approaches \(0\), but \(g(0)=5\). It is continuous at \(2\), however. Indeed, if \(|t-2|<1\), then \(t>1\), so \(t\ne0\) and \(g(t)=t\); consequently, \(|g(t)-g(2)|=|t-2|\).
Let \(f(x)=x\) on \(\mathbb{R}\) and consider continuity of \(g\circ f\) at \(a=2\). The identity function is continuous at \(2\), and \(g\) is continuous at \(f(2)=2\). The pointwise composition theorem applies, even though \(g\) is not continuous everywhere. More explicitly, if \(\varepsilon>0\), choose \(\delta=\min\{\varepsilon,1\}\). When \(|x-2|<\delta\), we have \(x>1\), so \(g(f(x))=g(x)=x\) and \(g(f(2))=g(2)=2\). Thus
This verifies continuity at \(2\) directly. The discontinuity of \(g\) at \(0\) does not interfere, because \(f(2)=2\), not \(0\).
Composition on Entire Domains
Applying the pointwise theorem separately at every point gives the global version. The domain condition remains essential: a continuous inner function does not define a composition with \(g\) unless all of its values belong to the domain of \(g\).
Proof. Let \(a\in E\). Since \(f\) is continuous on \(E\), it is continuous at \(a\). Since \(f(a)\in F\) and \(g\) is continuous on \(F\), \(g\) is continuous at \(f(a)\). The pointwise composition theorem therefore shows that \(g\circ f\) is continuous at \(a\). This holds for every \(a\in E\), so \(g\circ f\) is continuous on \(E\). If \(E\) is empty, continuity on \(E\) holds vacuously. \(\square\)
Worked Example: A Rational Function Applied to a Square
Let \(f(x)=x^2+1\), and let \(g(t)=1/(t+2)\), defined for \(t\in F=\mathbb{R}\setminus\{-2\}\). Both functions are continuous on their domains. For every real \(x\), \(f(x)=x^2+1\geq1\), so \(f(x)\ne-2\); hence \(f(\mathbb{R})\subseteq F\). The global composition theorem gives continuity on \(\mathbb{R}\) of
The domain check can also be seen directly from the denominator: \(x^2+3\geq3>0\), so the displayed quotient is defined for every real \(x\). At \(x=1\), \(f(1)=2\) and \(g(2)=1/(2+2)=1/4\), which agrees with \(1/(1^2+3)=1/4\).
Uniform Continuity Under Composition
There is a useful stronger conclusion when both functions satisfy uniform continuity. Unlike continuity at a point, uniform continuity uses one input tolerance that works throughout the domain. The tolerances can again be chosen in sequence: first use uniform continuity of the outer function, then use uniform continuity of the inner function to meet the resulting requirement.
Proof. Fix \(\varepsilon>0\). By uniform continuity of \(g\), there is a \(\rho>0\) such that, for all \(u,v\in F\),
By uniform continuity of \(f\), there is a \(\delta>0\) such that, for all \(x,y\in E\),
If \(x,y\in E\) satisfy \(|x-y|<\delta\), then \(f(x),f(y)\in F\) and \(|f(x)-f(y)|<\rho\). Applying the choice of \(\rho\) to \(u=f(x)\) and \(v=f(y)\) gives
The choice of \(\delta\) depends on \(\varepsilon\) but not on \(x\) or \(y\). This is exactly uniform continuity of \(g\circ f\) on \(E\). \(\square\)
The distinction between continuity and uniform continuity should be kept clear. The pointwise composition theorem uses tolerances that may depend on the point \(a\). In the uniform version, the two tolerances are chosen independently of the points being compared. The proof works because each function supplies a uniform tolerance on its entire domain.
What the Composition Theorems Do—and Do Not—Say
Composition is a reliable way to transfer continuity, provided the functions are evaluated in the right order and their domains fit. A common mistake is to check only that \(f\) and \(g\) are individually continuous while overlooking whether \(f(x)\) is an allowed input to \(g\). For example, a function \(g\) defined only on \(\mathbb{R}\setminus\{0\}\) cannot be applied at an input \(x\) for which \(f(x)=0\).
Another mistake is to demand more continuity than the pointwise conclusion needs. To prove continuity at \(a\), it is enough that \(f\) be continuous at \(a\) and \(g\) be continuous at \(f(a)\). Global continuity of both functions gives a convenient global theorem, but it is stronger than necessary for one point. In either form, the nested choice of tolerances is the central technique: control the outer output first, and then make the inner output close enough to use that control.
Check Your Understanding
Use the domain conditions and the composition results to answer the following questions.
- In \(g\circ f\), which function acts first, and what condition ensures the composition is defined on all of \(E\)?
- At a point \(a\), at which input must \(g\) be continuous for the pointwise composition theorem to apply?
- Why does the pointwise proof choose a tolerance for \(g\) before choosing one for \(f\)?
- Can \(g\circ f\) be continuous at \(a\) if \(g\) is discontinuous at a point outside the relevant neighborhood of \(f(a)\)? Explain.
- What additional feature distinguishes the uniform-continuity composition proof from the pointwise continuity proof?