Skip to main content

MATH 308 — Lec 17 — Composition & Inverses

Math 308 · November 6, 2026

Lecture 17 — Composition and Inverse Functions
MATH 308  Bridge to Advanced Mathematics  Chartrand §10.4–10.5

Goals for today. By the end of this lecture you should be able to:

  • form the composition g∘fg \circ fg∘f of two functions and evaluate it correctly;

  • prove that injectivity and surjectivity are inherited by compositions — and see how much of the converse holds;

  • state what it means for a function to be invertible, and build the inverse when it exists;

  • prove the central theorem of the chapter: a function is invertible if and only if it is bijective.

Composition of functions (§10.4)

Recall from Lecture 16 that a function f ⁣:A→Bf\colon A \to Bf:A→B assigns to each a∈Aa \in Aa∈A exactly one element f(a)∈Bf(a) \in Bf(a)∈B. If a second function starts where fff lands, we can run them in series.

Definition 1. Let f ⁣:A→Bf\colon A \to Bf:A→B and g ⁣:B→Cg\colon B \to Cg:B→C. Their composition is the function g∘f ⁣:A→Cg \circ f \colon A \to Cg∘f:A→C defined by

(g∘f)(x)=g(f(x))for every x∈A.(g \circ f)(x) = g\bigl(f(x)\bigr) \qquad \text{for every } x \in A.(g∘f)(x)=g(f(x))for every x∈A.

Read g∘fg \circ fg∘f as “ggg after fff”: apply fff first, then ggg. For g∘fg \circ fg∘f to make sense, the codomain of fff must be the domain of ggg.

The composition g f follows the blue arrow, then the red one. Here (g f)(a3)=g(b2)=c2.

The composition g∘fg \circ fg∘f follows the blue arrow, then the red one. Here (g∘f)(a3)=g(b2)=c2(g\circ f)(a_3)=g(b_2)=c_2(g∘f)(a3​)=g(b2​)=c2​.

Example 1. Let f,g ⁣:R→Rf,g\colon \mathbb{R}\to \mathbb{R}f,g:R→R be f(x)=x+1f(x) = x+1f(x)=x+1 and g(x)=x2g(x) = x^2g(x)=x2. Then

(g∘f)(x)=g(x+1)=(x+1)2,(f∘g)(x)=f(x2)=x2+1.(g \circ f)(x) = g(x+1) = (x+1)^2, \qquad (f \circ g)(x) = f(x^2) = x^2 + 1.(g∘f)(x)=g(x+1)=(x+1)2,(f∘g)(x)=f(x2)=x2+1.

Since (g∘f)(1)=4(g\circ f)(1) = 4(g∘f)(1)=4 but (f∘g)(1)=2(f\circ g)(1) = 2(f∘g)(1)=2, we see g∘f≠f∘gg \circ f \ne f \circ gg∘f=f∘g: composition is not commutative. (It is associative — see the Remark below.)

Proposition 1 (Composition preserves the two properties). Let f ⁣:A→Bf\colon A \to Bf:A→B and g ⁣:B→Cg\colon B \to Cg:B→C.

  1. If fff and ggg are both injective, then g∘fg \circ fg∘f is injective.

  2. If fff and ggg are both surjective, then g∘fg \circ fg∘f is surjective.

Proof. (i) Suppose (g∘f)(x)=(g∘f)(y)(g \circ f)(x) = (g \circ f)(y)(g∘f)(x)=(g∘f)(y) for some x,y∈Ax,y \in Ax,y∈A; that is, g(f(x))=g(f(y))g(f(x)) = g(f(y))g(f(x))=g(f(y)). Since ggg is injective, f(x)=f(y)f(x) = f(y)f(x)=f(y). Since fff is injective, x=yx = yx=y. Hence g∘fg \circ fg∘f is injective.

(ii) Let c∈Cc \in Cc∈C. Since ggg is surjective, there is b∈Bb \in Bb∈B with g(b)=cg(b) = cg(b)=c. Since fff is surjective, there is a∈Aa \in Aa∈A with f(a)=bf(a) = bf(a)=b. Then (g∘f)(a)=g(f(a))=g(b)=c(g \circ f)(a) = g(f(a)) = g(b) = c(g∘f)(a)=g(f(a))=g(b)=c. Hence g∘fg \circ fg∘f is surjective. ◻

Corollary 2. If fff and ggg are bijective, then g∘fg \circ fg∘f is bijective.

Proof. Apply both parts of Proposition 1: g∘fg\circ fg∘f is injective and surjective, hence bijective. ◻

Remark 1. The converse is only half true, and knowing which half is a useful diagnostic. If g∘fg \circ fg∘f is injective, then fff must be injective (the “inner” map); if g∘fg \circ fg∘f is surjective, then ggg must be surjective (the “outer” map). But the other factor can misbehave. For instance, with f ⁣:{1}→{1,2}f\colon \{1\} \to \{1,2\}f:{1}→{1,2}, f(1)=1f(1)=1f(1)=1, and g ⁣:{1,2}→{1}g\colon\{1,2\}\to\{1\}g:{1,2}→{1} the constant map, g∘fg \circ fg∘f is a bijection {1}→{1}\{1\}\to\{1\}{1}→{1} even though fff is not surjective and ggg is not injective. Composition also associates: (h∘g)∘f=h∘(g∘f)(h \circ g)\circ f = h \circ (g \circ f)(h∘g)∘f=h∘(g∘f), since both send x↦h(g(f(x)))x \mapsto h(g(f(x)))x↦h(g(f(x))).

The identity, and inverse functions (§10.5)

Definition 2. The identity function on a set AAA is idA ⁣:A→A\mathrm{id}_A\colon A \to AidA​:A→A given by idA(a)=a\mathrm{id}_A(a) = aidA​(a)=a for all a∈Aa \in Aa∈A. It is the “do-nothing” map: idB∘f=f\mathrm{id}_B \circ f = fidB​∘f=f and f∘idA=ff \circ \mathrm{id}_A = ff∘idA​=f for every f ⁣:A→Bf\colon A \to Bf:A→B.

Definition 3. A function f ⁣:A→Bf\colon A \to Bf:A→B is invertible if there is a function g ⁣:B→Ag\colon B \to Ag:B→A with

g∘f=idAandf∘g=idB.g \circ f = \mathrm{id}_A \qquad\text{and}\qquad f \circ g = \mathrm{id}_B .g∘f=idA​andf∘g=idB​.

Such a ggg is called an inverse of fff. Both equations are required: ggg must undo fff and fff must undo ggg.

Example 2. Let f ⁣:R→Rf\colon \mathbb{R}\to \mathbb{R}f:R→R, f(x)=2x+3f(x) = 2x + 3f(x)=2x+3. Guess g(x)=x−32g(x) = \tfrac{x-3}{2}g(x)=2x−3​. Check both directions:

g(f(x))=(2x+3)−32=x,f(g(x))=2⋅x−32+3=x.g(f(x)) = \frac{(2x+3)-3}{2} = x, \qquad f(g(x)) = 2\cdot\frac{x-3}{2} + 3 = x.g(f(x))=2(2x+3)−3​=x,f(g(x))=2⋅2x−3​+3=x.

So fff is invertible with inverse ggg. By contrast f ⁣:R→Rf\colon \mathbb{R}\to \mathbb{R}f:R→R, f(x)=x2f(x)=x^2f(x)=x2, is not invertible: it is neither injective (f(−1)=f(1)f(-1)=f(1)f(−1)=f(1)) nor surjective (nothing maps to −1-1−1). Restricting to f ⁣:[0,∞)→[0,∞)f\colon [0,\infty) \to [0,\infty)f:[0,∞)→[0,∞) repairs both defects, and then g(x)=xg(x) = \sqrt{x}g(x)=x​ is a genuine inverse.

An inverse simply reverses every arrow. On the graph in R2\mathbb{R}^2R2, this is the reflection across the line y=xy = xy=x.

f(x)=2x+3 and its inverse f^(-1)(x)=x-32 are mirror images across y=x.

f(x)=2x+3f(x)=2x+3f(x)=2x+3 and its inverse f−1(x)=x−32f^{-1}(x)=\tfrac{x-3}{2}f−1(x)=2x−3​ are mirror images across y=xy=xy=x.

Proposition 3 (The inverse is unique). If f ⁣:A→Bf\colon A \to Bf:A→B has an inverse, that inverse is unique. We may therefore write it f−1f^{-1}f−1.

Proof. Suppose ggg and hhh are both inverses of fff. Using g∘f=idAg \circ f = \mathrm{id}_Ag∘f=idA​, associativity, and f∘h=idBf \circ h = \mathrm{id}_Bf∘h=idB​,

g=g∘idB=g∘(f∘h)=(g∘f)∘h=idA∘h=h.■g = g \circ \mathrm{id}_B = g \circ (f \circ h) = (g \circ f) \circ h = \mathrm{id}_A \circ h = h. \qquad\blacksquareg=g∘idB​=g∘(f∘h)=(g∘f)∘h=idA​∘h=h.■

Invertible === bijective (§10.5)

Everything above points at one theorem, and it is the reason bijections matter so much (Lecture 16, Lecture 18).

Theorem 4. A function f ⁣:A→Bf\colon A \to Bf:A→B is invertible if and only if it is bijective.

Proof. (⇒\Rightarrow⇒) Suppose fff is invertible, with inverse g ⁣:B→Ag\colon B \to Ag:B→A. Injective: if f(a1)=f(a2)f(a_1) = f(a_2)f(a1​)=f(a2​), apply ggg to both sides: g(f(a1))=g(f(a2))g(f(a_1)) = g(f(a_2))g(f(a1​))=g(f(a2​)), i.e. a1=a2a_1 = a_2a1​=a2​ since g∘f=idAg \circ f = \mathrm{id}_Ag∘f=idA​. Surjective: let b∈Bb \in Bb∈B. Then f(g(b))=(f∘g)(b)=bf\bigl(g(b)\bigr) = (f \circ g)(b) = bf(g(b))=(f∘g)(b)=b, so g(b)∈Ag(b) \in Ag(b)∈A is a preimage of bbb. Thus fff is bijective.

(⇐\Leftarrow⇐) Suppose fff is bijective. We build an inverse. Fix b∈Bb \in Bb∈B. Because fff is surjective there exists a∈Aa \in Aa∈A with f(a)=bf(a) = bf(a)=b; because fff is injective this aaa is the only such element. So the rule

g(b)=the unique a∈A with f(a)=bg(b) = \text{the unique } a \in A \text{ with } f(a) = bg(b)=the unique a∈A with f(a)=b

defines a genuine function g ⁣:B→Ag\colon B \to Ag:B→A. Now check both composites. For a∈Aa \in Aa∈A, put b=f(a)b = f(a)b=f(a); then g(b)g(b)g(b) is the unique preimage of bbb, which is aaa, so g(f(a))=ag(f(a)) = ag(f(a))=a — that is, g∘f=idAg \circ f = \mathrm{id}_Ag∘f=idA​. For b∈Bb \in Bb∈B, by definition f(g(b))=bf(g(b)) = bf(g(b))=b, so f∘g=idBf \circ g = \mathrm{id}_Bf∘g=idB​. Hence ggg is an inverse of fff, and fff is invertible. ◻

Corollary 5 (Socks and shoes). *If f ⁣:A→Bf\colon A\to Bf:A→B and g ⁣:B→Cg\colon B\to Cg:B→C are bijective, then g∘fg \circ fg∘f is bijective and

(g∘f)−1=f−1∘g−1.(g \circ f)^{-1} = f^{-1} \circ g^{-1}.(g∘f)−1=f−1∘g−1.

Proof. g∘fg\circ fg∘f is bijective, hence invertible by Theorem 4. Compute, using associativity and Proposition 3:

(f−1∘g−1)∘(g∘f)=f−1∘(g−1∘g)∘f=f−1∘idB∘f=f−1∘f=idA,(f^{-1}\circ g^{-1})\circ(g \circ f) = f^{-1}\circ(g^{-1}\circ g)\circ f = f^{-1}\circ \mathrm{id}_B \circ f = f^{-1}\circ f = \mathrm{id}_A,(f−1∘g−1)∘(g∘f)=f−1∘(g−1∘g)∘f=f−1∘idB​∘f=f−1∘f=idA​,

and symmetrically (g∘f)∘(f−1∘g−1)=idC(g\circ f)\circ(f^{-1}\circ g^{-1}) = \mathrm{id}_C(g∘f)∘(f−1∘g−1)=idC​. So f−1∘g−1f^{-1}\circ g^{-1}f−1∘g−1 is the inverse of g∘fg\circ fg∘f. The order flips — last on, first off, like taking off shoes before socks. ◻

Homework problems

  1. Let f(x)=3x−1f(x) = 3x - 1f(x)=3x−1 and g(x)=x2+1g(x) = x^2 + 1g(x)=x2+1 on R\mathbb{R}R. Compute (g∘f)(x)(g \circ f)(x)(g∘f)(x) and (f∘g)(x)(f \circ g)(x)(f∘g)(x), and evaluate each at x=2x = 2x=2.

  2. Prove directly from the definitions: if g∘fg \circ fg∘f is injective, then fff is injective. (Do not assume ggg is injective.)

  3. Find the inverse of f ⁣:R→Rf\colon \mathbb{R}\to \mathbb{R}f:R→R, f(x)=x2−4f(x) = \tfrac{x}{2} - 4f(x)=2x​−4, and verify both g∘f=idRg\circ f=\mathrm{id}_\mathbb{R}g∘f=idR​ and f∘g=idRf\circ g=\mathrm{id}_\mathbb{R}f∘g=idR​.

  4. Give a function f ⁣:Z→Zf\colon \mathbb{Z}\to \mathbb{Z}f:Z→Z that is injective but not surjective, and explain why it fails to be invertible.

  5. Let A={1,2,3}A = \{1,2,3\}A={1,2,3}. Write a bijection f ⁣:A→Af\colon A \to Af:A→A with f≠idAf \ne \mathrm{id}_Af=idA​, then compute f−1f^{-1}f−1 and f∘ff \circ ff∘f. Is f∘f=idAf \circ f = \mathrm{id}_Af∘f=idA​?

  6. Using Corollary 5, if f(x)=x+5f(x)=x+5f(x)=x+5 and g(x)=2xg(x)=2xg(x)=2x on R\mathbb{R}R, find (g∘f)−1(g\circ f)^{-1}(g∘f)−1 two ways: directly, and as f−1∘g−1f^{-1}\circ g^{-1}f−1∘g−1.

Suggested textbook exercises (Chartrand §10.4–10.5): 10.30, 10.34, 10.38, 10.42, 10.46, 10.52.

← Back to Math 308