Composition of Continuous Functions

Suppose you know that f(x)=sin⁡(x)f(x) = \sin(x) is continuous. Suppose you also know g(x)=x2+1g(x) = x^2 + 1 is continuous. What can you say about h(x)=sin⁡(x2+1)h(x) = \sin(x^2+1)? This function is built by feeding the output of gg into ff. The question is not idle. Almost every function encountered in calculus — 1−x2\sqrt{1-x^2}, e−x2e^{-x^2}, log⁡(cos⁡x)\log(\cos x) — is a chain of simpler continuous pieces linked by composition. If continuity did not survive this linking operation, the entire calculus of elementary functions would collapse. None of these examples are continuous "from scratch." This article proves the fundamental permanence property that makes such reasoning legitimate. The composition of continuous functions is continuous. This holds at every point where the composition is defined and each piece is continuous. The result complements the Algebra of Continuous Functions, which handles sums, products, and quotients. Composition is the remaining basic way to combine functions. It behaves differently in a way that deserves careful attention. Continuity of gg at a point aa, and continuity of ff at g(a)g(a) (not at aa), is exactly what is needed. The proof is a clean two-line argument once the ε\varepsilon-δ\delta definition is unwound. But the bookkeeping of which point each function must be continuous at is where students most often go wrong. We give the direct ε\varepsilon-δ\delta proof. We restate it via the Sequential Characterization of Continuity for comparison. We also pin down exactly how the hypotheses must be quantified. By the end you will be able to state the composition theorem precisely. You will be able to prove it two independent ways. You will recognize the one common way the hypotheses get misapplied. You will also see how this single lemma underwrites the continuity of every elementary function you will meet. This foreshadows Continuity of Polynomials, Rational, and Elementary Functions.

Key takeaways
  • If gg is continuous at aa and ff is continuous at g(a)g(a), then f∘gf\circ g is continuous at aa.
  • The hypothesis is about ff's continuity at the image point g(a)g(a), not at aa itself.
  • The proof is a direct two-step ε\varepsilon-δ\delta chase: control ff near g(a)g(a) first, then control gg near aa.
  • An equivalent proof uses the sequential characterization: xn→a⇒g(xn)→g(a)⇒f(g(xn))→f(g(a))x_n \to a \Rightarrow g(x_n)\to g(a) \Rightarrow f(g(x_n)) \to f(g(a)).
  • If gg is continuous only at aa (not nearby) and ff is not continuous at g(a)g(a), composition can fail — both hypotheses are load-bearing.
  • Key idea: continuity composes because "close inputs give close outputs" is transitive across two maps, provided the second map's continuity is anchored at the first map's output.

Where this lives today

The composition theorem is the quiet engine behind nearly every continuity argument in calculus and beyond. In elementary calculus, it is what justifies calling sin⁡(x2)\sin(x^2), ecos⁡xe^{\cos x}, or ln⁡(1+x2)\ln(1+x^2) continuous without re-deriving continuity from scratch each time — each is a finite chain of compositions of functions already known to be continuous, foreshadowing the systematic treatment in Continuity of Polynomials, Rational, and Elementary Functions. In real analysis more broadly, the theorem generalizes verbatim to continuous maps between metric spaces and topological spaces (the proof is identical with ∣x−a∣|x-a| replaced by a metric d(x,a)d(x,a), or with preimages of open sets), making it a cornerstone of point-set topology: the composition of continuous maps between topological spaces is continuous, which is what makes "the category of topological spaces and continuous maps" a coherent category in the first place. In differential calculus, composing continuity lemmas at the right basepoints is the model for the chain rule, where derivative composition again requires the inner function's value to land where the outer function's derivative hypothesis is checked. In dynamical systems, iterating a continuous map g,g∘g,g∘g∘g,…g, g\circ g, g\circ g\circ g, \dots relies on this theorem to guarantee that iterates of continuous maps remain continuous, underlying the study of fixed points and orbits. In numerical analysis and engineering, composed continuous transfer functions (filters, coordinate changes, normalization layers) inherit stability guarantees from this same principle — a small perturbation at the input cannot suddenly blow up through a chain of continuous stages. In probability and statistics, continuous transformations of continuous random variables (e.g. Y=f(X)Y = f(X) for continuous ff and a random variable XX with continuous distribution structure) rely on composition results to preserve regularity properties through changes of variables.

Ask the tutor: Can you show me how this composition theorem is used, step by step, to prove that tan⁡(x)\tan(x) is continuous wherever cos⁡(x)≠0\cos(x) \ne 0?

DefinitionComposition of functions and the continuity hypothesis

Let A,B⊆RA, B \subseteq \mathbb{R}, let g:A→Rg : A \to \mathbb{R} satisfy g(A)⊆Bg(A) \subseteq B, and let f:B→Rf : B \to \mathbb{R}. The composition f∘g:A→Rf \circ g : A \to \mathbb{R} is defined by

(f∘g)(x)=f(g(x)),x∈A.(f\circ g)(x) = f\big(g(x)\big), \qquad x \in A.

Recall (from the Sequential Characterization of Continuity and the ε\varepsilon-δ\delta definition) that a function φ:D→R\varphi: D \to \mathbb{R} is continuous at a point c∈Dc \in D if for every ε>0\varepsilon > 0 there exists δ>0\delta > 0 such that

x∈D, ∣x−c∣<δ   ⟹   ∣φ(x)−φ(c)∣<ε.x \in D, \ |x - c| < \delta \ \implies\ |\varphi(x) - \varphi(c)| < \varepsilon.

The composition theorem below requires: gg continuous at the point a∈Aa\in A, and ff continuous at the point g(a)∈Bg(a) \in B — two different basepoints for two different functions.

Intuition

Think of gg and ff as two machines wired in series. The first machine, gg, takes an input xx near aa and produces an output g(x)g(x) near g(a)g(a) — that is exactly what continuity of gg at aa guarantees. The second machine, ff, takes that output and, because it is continuous at g(a)g(a), produces f(g(x))f(g(x)) close to f(g(a))f(g(a)) whenever its input g(x)g(x) is close enough to g(a)g(a). The subtlety is the phrase "close enough": ff's tolerance for how close its input must be to g(a)g(a) is some η>0\eta > 0 determined by ff and by whatever error bound ε\varepsilon we were originally handed. It is gg's job, using its own continuity at aa, to guarantee that a sufficiently small perturbation δ\delta of xx around aa forces g(x)g(x) to land within that η\eta-window around g(a)g(a). The chain of implications runs backward from the desired output error to the required input error, which is why composition proofs read most naturally "outside in."

Figure
Two-stage tolerance chase: ε\varepsilon at the output determines η\eta at the middle, which determines δ\delta at the input
a a-δ a+δ domain of g g continuous at a g(a) g(a)-η g(a)+η domain of f f continuous at g(a) f(g(a)) -ε +ε

Theorem and proof

TheoremContinuity of Compositions

Let A,B⊆RA, B \subseteq \mathbb{R}, let a∈Aa \in A, and suppose g:A→Rg: A \to \mathbb{R} satisfies g(A)⊆Bg(A) \subseteq B. Suppose: 1. gg is continuous at aa, and 2. f:B→Rf: B \to \mathbb{R} is continuous at the point g(a)∈Bg(a) \in B. Then the composition f∘g:A→Rf \circ g : A \to \mathbb{R} is continuous at aa. Consequently, if gg is continuous on all of AA and ff is continuous on all of B⊇g(A)B \supseteq g(A), then f∘gf\circ g is continuous on all of AA.

Proof

We prove the pointwise statement directly from the ε\varepsilon-δ\delta definition of continuity; this is the natural and standard technique for this result, and it does not presuppose the theorem being proved.

Step 1 (Fix the target tolerance). Let ε>0\varepsilon > 0 be given. We must produce δ>0\delta > 0 such that

x∈A,∣x−a∣<δ   ⟹   ∣(f∘g)(x)−(f∘g)(a)∣<ε.x \in A, \quad |x - a| < \delta \ \implies\ |(f\circ g)(x) - (f\circ g)(a)| < \varepsilon.

Step 2 (Use continuity of ff at g(a)g(a) to get an intermediate tolerance η\eta). Since ff is continuous at g(a)∈Bg(a) \in B, applying the definition of continuity to ff with this same ε>0\varepsilon > 0 yields some η>0\eta > 0 such that

y∈B,∣y−g(a)∣<η   ⟹   ∣f(y)−f(g(a))∣<ε.(∗)y \in B, \quad |y - g(a)| < \eta \ \implies\ |f(y) - f(g(a))| < \varepsilon. \tag{$\ast$}

This η\eta depends only on ff, on the point g(a)g(a), and on ε\varepsilon; it does not yet involve gg or xx.

Step 3 (Use continuity of gg at aa, with target tolerance η\eta, to get δ\delta). Since η>0\eta > 0 and gg is continuous at a∈Aa \in A, applying the definition of continuity to gg — with η\eta in the role of the "epsilon" for gg — yields some δ>0\delta > 0 such that

x∈A,∣x−a∣<δ   ⟹   ∣g(x)−g(a)∣<η.(∗∗)x \in A, \quad |x - a| < \delta \ \implies\ |g(x) - g(a)| < \eta. \tag{$\ast\ast$}

Step 4 (Chain the two implications). Let x∈Ax \in A with ∣x−a∣<δ|x - a| < \delta. By (∗∗)(\ast\ast), ∣g(x)−g(a)∣<η|g(x) - g(a)| < \eta. Since g(A)⊆Bg(A) \subseteq B, the point y:=g(x)y := g(x) lies in BB, and it satisfies ∣y−g(a)∣<η|y - g(a)| < \eta with g(a)∈Bg(a) \in B as well. Thus the hypothesis of (∗)(\ast) is met with y=g(x)y = g(x), and we conclude

∣f(g(x))−f(g(a))∣<ε,|f(g(x)) - f(g(a))| < \varepsilon,

that is,

∣(f∘g)(x)−(f∘g)(a)∣<ε.|(f\circ g)(x) - (f\circ g)(a)| < \varepsilon.

We have exhibited, for every ε>0\varepsilon>0, a δ>0\delta>0 (constructed in Steps 2–3) with the required property. Hence f∘gf\circ g is continuous at aa. ■\blacksquare

The "on all of AA" consequence. If gg is continuous at every point of AA and ff is continuous at every point of BB, then for each a∈Aa \in A hypothesis (1) holds at that aa, and hypothesis (2) holds because g(a)∈Bg(a) \in B and ff is continuous there. The pointwise result just proved applies at every a∈Aa \in A, so f∘gf \circ g is continuous on all of AA. ■\blacksquare

∎
LemmaSequential reformulation

Under the same hypotheses as the theorem, if (xn)(x_n) is any sequence in AA with xn→ax_n \to a, then (f∘g)(xn)→(f∘g)(a)(f\circ g)(x_n) \to (f\circ g)(a).

Proof

This is an independent second proof, using the Sequential Characterization of Continuity rather than ε\varepsilon-δ\delta directly; it is logically equivalent to (but not derived from) the proof above, since the sequential characterization is itself proved from the ε\varepsilon-δ\delta definition. Let (xn)n=1∞(x_n)_{n=1}^\infty be a sequence in AA with xn→ax_n \to a. Since gg is continuous at aa, the sequential characterization of continuity gives

g(xn)→g(a).g(x_n) \to g(a).

Now (g(xn))n=1∞(g(x_n))_{n=1}^\infty is a sequence in BB (because g(A)⊆Bg(A)\subseteq B) converging to g(a)∈Bg(a) \in B. Since ff is continuous at g(a)g(a), applying the sequential characterization again (this time to ff, with the sequence yn:=g(xn)→g(a)y_n := g(x_n) \to g(a)) gives

f(g(xn))→f(g(a)),f(g(x_n)) \to f(g(a)),

i.e. (f∘g)(xn)→(f∘g)(a)(f\circ g)(x_n) \to (f\circ g)(a). Since (xn)(x_n) was an arbitrary sequence in AA converging to aa, the sequential characterization of continuity (applied to f∘gf\circ g at aa) gives that f∘gf \circ g is continuous at aa. ■\blacksquare

∎
CorollaryComposition preserves uniform structure is NOT claimed

The theorem asserts pointwise continuity of f∘gf \circ g at aa from pointwise data at aa and g(a)g(a) only. No claim is made here about uniform continuity of f∘gf\circ g from uniform continuity of ff and gg separately; that is a related but distinct statement requiring its own hypotheses and proof, and is not addressed by this theorem.

Worked examples

Example 1: A genuinely asymmetric chain, verified by hand. Let

g(x)=1x2+1,f(y)=4−3y,h=f∘g,g(x) = \frac{1}{x^2+1}, \qquad f(y) = \sqrt{4 - 3y}, \qquad h = f \circ g,

so h(x)=4−3x2+1h(x) = \sqrt{4 - \dfrac{3}{x^2+1}}. Take the basepoint a=2a = 2. Set up the pieces. We have A=RA = \mathbb{R} (domain of gg). Since 0<g(x)≤10 < g(x) \le 1 for all real xx (as x2+1≥1x^2+1\ge 1), the range of gg lies in (0,1]⊂B:=(−∞,4/3](0,1] \subset B := (-\infty, 4/3], which is exactly the domain of ff (we need 4−3y≥04-3y \ge 0, i.e. y≤4/3y \le 4/3). So the composition is well-defined on all of R\mathbb{R}. Check hypothesis (1): gg continuous at a=2a=2. By the Algebra of Continuous Functions, x↦x2+1x \mapsto x^2+1 is continuous everywhere (product and sum of continuous functions) and is never 00, so its reciprocal g(x)=1/(x2+1)g(x) = 1/(x^2+1) is continuous everywhere, in particular at a=2a=2. Numerically, g(2)=1/5g(2) = 1/5. Check hypothesis (2): ff continuous at g(2)=1/5g(2) = 1/5. Write f=⋅∘ℓf = \sqrt{\cdot}\circ \ell where ℓ(y)=4−3y\ell(y) = 4-3y is continuous everywhere (polynomial), and u↦uu \mapsto \sqrt{u} is continuous on [0,∞)[0,\infty) — a standard fact provable directly from ε\varepsilon-δ\delta (and itself an instance of continuity of elementary functions). At y=1/5y = 1/5: ℓ(1/5)=4−3/5=17/5>0\ell(1/5) = 4 - 3/5 = 17/5 > 0, so u\sqrt{u} is continuous at u=17/5u = 17/5. By this very composition theorem applied one level down, ff is continuous at y=1/5y=1/5. Apply the theorem. Since gg is continuous at 22 and ff is continuous at g(2)=1/5g(2) = 1/5, the theorem gives that h=f∘gh = f\circ g is continuous at 22. Numerical sanity check. h(2)=4−3/5=17/5=3.4≈1.8439h(2) = \sqrt{4 - 3/5} = \sqrt{17/5} = \sqrt{3.4} \approx 1.8439. Perturb slightly: at x=2.1x = 2.1, g(2.1)=1/(2.12+1)=1/5.41≈0.18484g(2.1) = 1/(2.1^2+1) = 1/5.41 \approx 0.18484, and h(2.1)=4−3(0.18484)=4−0.55452=3.44548≈1.8562h(2.1) = \sqrt{4 - 3(0.18484)} = \sqrt{4 - 0.55452} = \sqrt{3.44548} \approx 1.8562. The output moved by about 0.01230.0123 while the input moved by 0.10.1 — consistent with continuity (small input change, small output change), and consistent with the chain: gg moved by ≈0.01516\approx 0.01516, well inside any small η\eta, and ff's local behavior near 17/517/5 (derivative −3/(217/5)≈−0.813-3/(2\sqrt{17/5}) \approx -0.813) amplifies that by a bounded factor.

Example 2: A case where a piece is discontinuous at the wrong point, but composition still works because the theorem's exact hypothesis is met. Let

g(x)=x2,f(y)={1y≠15y=1,a=−1.g(x) = x^2, \qquad f(y) = \begin{cases} 1 & y \ne 1 \\ 5 & y = 1\end{cases}, \qquad a = -1.

Here ff is discontinuous at y=1y=1 (jump from the constant value 11 nearby to 55 at the point) but we are evaluating at a=−1a = -1, so g(a)=1g(a) = 1. Let's see what the theorem does and does not say. Check hypothesis (1): g(x)=x2g(x)=x^2 is continuous at a=−1a=-1 (polynomial). Fine. Check hypothesis (2): We need ff continuous at g(a)=1g(a) = 1. But ff is discontinuous at 11! So hypothesis (2) fails, and the theorem simply does not apply here — it makes no claim about f∘gf\circ g at a=−1a=-1. Indeed, let's check directly: (f∘g)(−1)=f(1)=5(f\circ g)(-1) = f(1) = 5. But for xx near −1-1, x≠−1x \ne -1, g(x)=x2g(x) = x^2 is near 11 but generally ≠1\ne 1 (e.g. x=−1.01⇒g(x)=1.0201≠1x = -1.01 \Rightarrow g(x) = 1.0201 \ne 1), so f(g(x))=1≠5f(g(x)) = 1 \ne 5. Thus (f∘g)(x)→1≠5=(f∘g)(−1)(f\circ g)(x) \to 1 \ne 5 = (f\circ g)(-1) as x→−1x \to -1: f∘gf \circ g is discontinuous at −1-1, exactly because hypothesis (2) failed. This is not a counterexample to the theorem — it illustrates that the hypothesis is necessary and that checking it at the correct point g(a)g(a), not at aa, is the crux of applying the theorem correctly. Now contrast with a=0a = 0: g(0)=0≠1g(0) = 0 \ne 1, so hypothesis (2) becomes "ff continuous at 00" — and indeed ff is continuous at 00 (it equals the constant 11 on a whole neighborhood of 00, since f(y)=1f(y)=1 for all y≠1y\ne 1). So the theorem applies at a=0a=0 and correctly predicts f∘gf\circ g continuous at 00; direct check: (f∘g)(x)=f(x2)=1(f\circ g)(x) = f(x^2) = 1 for all xx with x2≠1x^2 \ne 1, i.e. for all xx near 00 other than x=±1x=\pm1, and (f∘g)(0)=f(0)=1(f\circ g)(0) = f(0) = 1, matching.

CounterexampleWhy continuity of ff must hold at g(a)g(a), not merely "somewhere" or "at aa"

The theorem requires ff continuous at the specific point g(a)g(a). If we instead only assume ff is continuous at aa itself (a category error when g(a)≠ag(a) \ne a, but a natural point of confusion) or continuous merely at some point, composition can fail badly. Take again

g(x)=x2,f(y)={0y≤01y>0,a=0.g(x) = x^2, \qquad f(y) = \begin{cases} 0 & y \le 0 \\ 1 & y > 0 \end{cases}, \qquad a = 0.

Here gg is continuous everywhere, in particular at a=0a = 0, and g(0)=0g(0) = 0. Is ff continuous at g(0)=0g(0) = 0? No: ff has a jump at 00 (value 00 at y=0y=0, but f(y)=1f(y) = 1 for all y>0y>0 arbitrarily close to 00). So hypothesis (2) fails at the required point g(a)=0g(a)=0, even though one might carelessly note "ff is continuous at plenty of other points, e.g. at y=1y=1" — irrelevant, since 1≠g(a)1 \ne g(a). Consequence: (f∘g)(x)=f(x2)(f\circ g)(x) = f(x^2). For x≠0x \ne 0, x2>0x^2 > 0, so f(x2)=1f(x^2) = 1. But (f∘g)(0)=f(0)=0(f\circ g)(0) = f(0) = 0. So

lim⁡x→0(f∘g)(x)=1≠0=(f∘g)(0),\lim_{x\to 0} (f\circ g)(x) = 1 \ne 0 = (f\circ g)(0),

and f∘gf \circ g is discontinuous at 00, despite gg being continuous everywhere and ff being continuous at many points — just not at the one point that matters, g(0)=0g(0)=0. This shows the hypothesis "ff continuous at g(a)g(a)" cannot be weakened to "ff continuous at aa" or "ff continuous somewhere nearby aa"; it is continuity at the exact image point g(a)g(a) that the proof's Step 2 uses, and dropping this precision breaks the conclusion.

Scope, edge cases & common traps

SituationWhat the theorem saysCommon error
gg continuous at aa, ff continuous at g(a)g(a)f∘gf\circ g continuous at aa— (correct application)
gg continuous at aa, ff continuous at aa but not at g(a)g(a) (and g(a)≠ag(a)\ne a)theorem does not apply; conclusion can failChecking ff's continuity at the wrong point, aa instead of g(a)g(a)
gg continuous on all of AA, ff continuous on all of B⊇g(A)B \supseteq g(A)f∘gf\circ g continuous on all of AAForgetting to check g(A)⊆Bg(A) \subseteq B, i.e. that the composition is even well-defined
f,gf, g both continuous everywhere except one shared "bad" point that composition might avoid or hitMust check pointwise at g(a)g(a) for the specific aa in questionAssuming "mostly continuous" pieces compose to something "mostly continuous" without verifying the image point
gg discontinuous at aa but ff constant near g(a)g(a)Theorem's hypotheses fail (need gg continuous at aa); conclusion may still happen to hold by coincidence, but is not guaranteed by this theoremCiting the theorem when one hypothesis silently fails

The mathematician behind it

Origins · 1 minAugustin-Louis Cauchy and how this was discovered
AC
Augustin-Louis Cauchy
1789–1857 · Early 19th-century Paris, foundational period of rigorous analysis

Cauchy was among the first to insist on a workable, rigorous definition of continuity and limit, in his Cours d'analyse (1821), replacing informal appeals to "infinitely small quantities" with inequality-based reasoning that is the direct ancestor of the modern ε\varepsilon-δ\delta formulation later sharpened by Weierstrass. The basic permanence properties of continuous functions — that sums, products, and compositions of continuous functions remain continuous — were established in this era as part of the broader project of putting calculus on a logically secure footing, replacing Euler-style formal manipulation of infinite series and "continuous" functions understood loosely as those given by a single analytic expression.

History
- 1821 — Cauchy's Cours d'analyse gives an early rigorous treatment of limits and continuity and establishes closure properties for combinations of continuous functions.
- 1837 — Bolzano's work (published posthumously, though composed earlier) on continuous functions and the intermediate value property circulates and deepens the rigorous foundation.
- 1861 — Weierstrass, lecturing in Berlin, formalizes the modern ε\varepsilon-δ\delta definition of continuity and limit, making arguments like the composition proof fully explicit and quantifier-precise.
- 1872 — Weierstrass exhibits a continuous, nowhere-differentiable function, sharpening the era's understanding of exactly what continuity does and does not guarantee, and reinforcing the need for careful compositional reasoning.
- 1900s — The composition theorem becomes a standard early lemma in analysis textbooks (Rudin, and later Abbott), used immediately to establish continuity of polynomials, rational functions, and elementary transcendental functions built from simpler continuous pieces.
Do I need ff and gg to be continuous at the same point?

No — and this is the single most important subtlety. You need gg continuous at the input point aa, and ff continuous at the output point g(a)g(a), which is generally a different real number from aa. For instance if g(x)=x+5g(x) = x+5 and a=2a = 2, you need ff continuous at g(2)=7g(2) = 7, not at 22. Conflating these two basepoints is the most common way students misapply this theorem. Always compute g(a)g(a) first, then check ff's continuity there.

Does the theorem require ff and gg to be continuous on their entire domains, or just at one point?

The core theorem is stated pointwise: continuity of gg at aa and of ff at g(a)g(a) suffice to conclude continuity of f∘gf\circ g at aa. Nothing is assumed about behavior at other points. The "globalized" corollary — f∘gf\circ g continuous on all of AA — follows immediately by applying the pointwise result at every a∈Aa \in A, provided gg is continuous throughout AA and ff is continuous throughout g(A)g(A) (or a superset BB of it).

What if g(a)g(a) is not in the domain of ff?

Then f∘gf\circ g is not even defined at aa, and the question of its continuity there does not arise. The standing assumption g(A)⊆Bg(A) \subseteq B (domain of ff) in the definition of composition guarantees f(g(x))f(g(x)) makes sense for every x∈Ax \in A; checking this containment is a prerequisite bookkeeping step before continuity is even a meaningful question.

Is the converse true: if f∘gf \circ g is continuous at aa, must ff and gg individually be continuous at aa and g(a)g(a) respectively?

No, and this converse is false in general — it is not claimed by the theorem. A simple illustration: let g(x)=0g(x) = 0 for all xx (continuous) but let ff be wildly discontinuous everywhere except at y=0y=0, where it happens to be continuous. Then f∘gf \circ g is the constant function f(0)f(0), which is continuous, even though ff itself is discontinuous almost everywhere — but note ff is continuous at the one point that matters, g(a)=0g(a) = 0, so this does not violate the theorem; it just shows the composition's continuity can survive even when ff misbehaves off the relevant point. In fact one can construct examples where f∘gf\circ g is continuous at aa while gg itself is discontinuous at aa, by having gg's discontinuity be "invisible" to ff (e.g. ff constant). So the converse direction is genuinely false and is not asserted here.

Why does the proof go "outside-in" — choosing η\eta for ff before δ\delta for gg?

Because the quantity we ultimately want to bound, ∣f(g(x))−f(g(a))∣<ε|f(g(x)) - f(g(a))| < \varepsilon, is controlled by ff's continuity, which tells us how close g(x)g(x) needs to be to g(a)g(a) (within some η\eta) to guarantee that output bound. Only after we know this required closeness η\eta can we ask gg's continuity (at aa) to produce a δ\delta guaranteeing inputs within δ\delta of aa land within η\eta of g(a)g(a). The dependency is ε→η→δ\varepsilon \to \eta \to \delta, which is why the tolerance for the outer function must be fixed before the tolerance for the inner one.

Does this theorem work the same way for one-sided continuity or continuity on an interval endpoint?

Yes, with the natural adaptation. If aa is a left endpoint of AA and gg is right-continuous at aa (using one-sided limits/δ\delta-neighborhoods restricted to AA), and ff is continuous (or appropriately one-sided continuous) at g(a)g(a), the identical proof goes through verbatim, since the ε\varepsilon-δ\delta argument never used two-sidedness — only that xx ranges over AA near aa. This is exactly how continuity of composed functions is verified at endpoints of domains such as [0,1][0,1].

How does this relate to the chain rule for derivatives?

The chain rule is a differentiable refinement of the same compositional idea: it requires gg differentiable at aa and ff differentiable at g(a)g(a) (matching basepoints, exactly as here) to conclude f∘gf\circ g differentiable at aa with derivative f′(g(a))g′(a)f'(g(a))g'(a). Since differentiability at a point implies continuity there, the chain rule's hypotheses are strictly stronger, and its conclusion (differentiability) is strictly stronger than mere continuity — but the "match the basepoints correctly" structure of the argument is identical to the composition-of-continuity theorem proved here.

Before this